Browse Source

增加关联内容字段类型

tags/6.0.0
tianya 3 years ago
parent
commit
1c518ba299
33 changed files with 623 additions and 96 deletions
  1. +13
    -0
      src/dede/album_add.php
  2. +13
    -0
      src/dede/album_edit.php
  3. +13
    -0
      src/dede/archives_add.php
  4. +13
    -0
      src/dede/archives_edit.php
  5. +11
    -0
      src/dede/article_add.php
  6. +12
    -0
      src/dede/article_edit.php
  7. +2
    -1
      src/dede/content_list.php
  8. +2
    -1
      src/dede/inc/fieldtype.txt
  9. +6
    -0
      src/dede/inc/inc_admin_channel.php
  10. +6
    -0
      src/dede/inc/inc_archives_all.php
  11. +1
    -1
      src/dede/inc/inc_menu.php
  12. +6
    -0
      src/dede/js/list.js
  13. +13
    -1
      src/dede/mychannel_field_add.php
  14. +11
    -0
      src/dede/mychannel_field_edit.php
  15. +13
    -0
      src/dede/soft_add.php
  16. +13
    -0
      src/dede/soft_edit.php
  17. +13
    -0
      src/dede/spec_add.php
  18. +13
    -0
      src/dede/spec_edit.php
  19. +4
    -4
      src/dede/templets/content_i_list.htm
  20. +4
    -4
      src/dede/templets/content_s_list.htm
  21. +4
    -4
      src/dede/templets/content_select_list.htm
  22. +36
    -4
      src/dede/templets/content_sg_list.htm
  23. +15
    -12
      src/dede/templets/diy_add.htm
  24. +4
    -4
      src/dede/templets/diy_edit.htm
  25. +40
    -23
      src/dede/templets/freelist_add.htm
  26. +25
    -21
      src/dede/templets/freelist_edit.htm
  27. +1
    -1
      src/dede/templets/makehtml_taglist.htm
  28. +51
    -4
      src/dede/templets/mychannel_field_add.htm
  29. +46
    -1
      src/dede/templets/mychannel_field_edit.htm
  30. +1
    -1
      src/dede/templets/tags_main.htm
  31. +42
    -3
      src/include/customfields.func.php
  32. +170
    -0
      src/include/taglib/relation.lib.php
  33. +6
    -6
      src/include/typeunit.class.admin.php

+ 13
- 0
src/dede/album_add.php View File

@@ -386,6 +386,19 @@ else if($dopost=='save')
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "
  请选择你的后续操作:


+ 13
- 0
src/dede/album_edit.php View File

@@ -433,6 +433,19 @@ else if($dopost=='save')
$arcUrl = $cfg_phpurl."/view.php?aid=$id";
}
ClearMyAddon($id, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg =
"   请选择你的后续操作:


+ 13
- 0
src/dede/archives_add.php View File

@@ -233,6 +233,19 @@ color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywo
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "   请选择你的后续操作:
<a href='archives_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>继续发布文档</a>


+ 13
- 0
src/dede/archives_edit.php View File

@@ -242,6 +242,19 @@ else if($dopost=='save')
$artUrl = $cfg_phpurl."/view.php?aid=$id";
}
ClearMyAddon($id, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "
  请选择你的后续操作:


+ 11
- 0
src/dede/article_add.php View File

@@ -285,6 +285,17 @@ else if($dopost=='save')
}
ClearMyAddon($arcID, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "   请选择你的后续操作:


+ 12
- 0
src/dede/article_edit.php View File

@@ -258,6 +258,18 @@ else if($dopost=='save')
$artUrl = $cfg_phpurl."/view.php?aid=$id";
}
ClearMyAddon($id, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "


+ 2
- 1
src/dede/content_list.php View File

@@ -21,6 +21,7 @@ $mid = isset($mid) ? intval($mid) : 0;
if(!isset($keyword)) $keyword = '';
if(!isset($flag)) $flag = '';
if(!isset($f)) $f = '';
if(!isset($arcrank)) $arcrank = '';
if(!isset($dopost)) $dopost = '';
@@ -132,7 +133,7 @@ if(empty($channelid)
}
if($channelid < -1 )
{
header("location:content_sg_list.php?cid=$cid&channelid=$channelid&keyword=$keyword");
header("location:content_sg_list.php?f=$f&cid=$cid&channelid=$channelid&keyword=$keyword");
exit();
}


+ 2
- 1
src/dede/inc/fieldtype.txt View File

@@ -13,4 +13,5 @@ addon,附件类型
select,使用select下拉框
radio,使用radio选项卡
checkbox,checkbox多选框
stepselect,联动类型
stepselect,联动类型
relation,关联内容

+ 6
- 0
src/dede/inc/inc_admin_channel.php View File

@@ -60,6 +60,12 @@ function GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen)
$fields[0] = " `$fieldname` varchar(100) NOT NULL default '';";
$fields[1] = "varchar(100)";
}
else if($dtype=="relation") {
if(empty($dfvalue)) $dfvalue = '';
$fields[0] = " `$fieldname` TEXT NOT NULL default '$dfvalue';";
$fields[1] = "TEXT";
}
else if($dtype=="textchar")
{
if(empty($dfvalue)) $dfvalue = '';


+ 6
- 0
src/dede/inc/inc_archives_all.php View File

@@ -131,6 +131,12 @@ function GetFormItem($ctag)
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else if ($ctag->GetAtt("type")=="relation") {
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:100%;height:80'></textarea>\r\n";
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
return $formitem;
}
else
{
if($ctag->GetAtt('default')!="") $dfvalue = $ctag->GetAtt('default');


+ 1
- 1
src/dede/inc/inc_menu.php View File

@@ -145,7 +145,7 @@ $adminMenu1
<m:item name='更新RSS文件' link='makehtml_rss.php' rank='sys_MakeHtml' target='main' />
<m:item name='获取JS文件' link='makehtml_js.php' rank='sys_MakeHtml' target='main' />
<m:item name='更新专题HTML' link='makehtml_spec.php' rank='sys_MakeHtml' target='main' />
<m:item name='更新TAG HTML' link='makehtml_taglist.php' rank='sys_MakeHtml' target='main' />
<m:item name='更新Tag HTML' link='makehtml_taglist.php' rank='sys_MakeHtml' target='main' />
</m:top>
<m:top item='6_' name='会员管理' display='none' rank='member_List,member_Type'>


+ 6
- 0
src/dede/js/list.js View File

@@ -132,6 +132,9 @@ function getOneItem()
function selAll()
{
if (typeof document.form2.arcID.length === "undefined") {
document.form2.arcID.checked = true;
}
for(i=0;i<document.form2.arcID.length;i++)
{
if(!document.form2.arcID[i].checked)
@@ -142,6 +145,9 @@ function selAll()
}
function noSelAll()
{
if (typeof document.form2.arcID.length === "undefined") {
document.form2.arcID.checked = false;
}
for(i=0;i<document.form2.arcID.length;i++)
{
if(document.form2.arcID[i].checked)


+ 13
- 1
src/dede/mychannel_field_add.php View File

@@ -5,6 +5,7 @@
* @version $Id: mychannel_field_add.php 1 15:07 2010年7月20日Z tianya $
* @package DedeCMS.Administrator
* @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
@@ -25,6 +26,7 @@ if($action=='save')
$dfvalue = trim($vdefault);
$isnull = ($isnull==1 ? "true" : "false");
$mxlen = $maxlength;
if(preg_match("#^(select|radio|checkbox)$#i", $dtype))
{
@@ -55,9 +57,10 @@ if($action=='save')
//检测被修改的字段类型
$fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen);
$ntabsql = $fieldinfos[0];
$buideType = $fieldinfos[1];
$rs = $dsql->ExecuteNoneQuery(" ALTER TABLE `$trueTable` ADD $ntabsql ");
$rs = $dsql->ExecuteNoneQuery("ALTER TABLE `$trueTable` ADD $ntabsql ");
if(!$rs)
{
$gerr = $dsql->GetError();
@@ -155,4 +158,13 @@ foreach($fields as $k=>$v)
$f .= ($f=='' ? $k : ' '.$k);
}
// 获取频道模型
$dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id");
$dsql->Execute();
while($row=$dsql->GetObject())
{
$channelArray[$row->id]['typename'] = $row->typename;
$channelArray[$row->id]['nid'] = $row->nid;
}
require_once(DEDEADMIN."/templets/mychannel_field_add.htm");

+ 11
- 0
src/dede/mychannel_field_edit.php View File

@@ -5,6 +5,7 @@
* @version $Id: mychannel_field_edit.php 1 15:22 2010年7月20日Z tianya $
* @package DedeCMS.Administrator
* @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
@@ -37,6 +38,16 @@ foreach($ds as $d)
$dds = explode(',', trim($d));
$fieldtypes[$dds[0]] = $dds[1];
}
// 获取频道模型
$dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id");
$dsql->Execute();
while($crow=$dsql->GetObject())
{
$channelArray[$crow->id]['typename'] = $crow->typename;
$channelArray[$crow->id]['nid'] = $crow->nid;
}
//保存更改
/*--------------------
function _SAVE()


+ 13
- 0
src/dede/soft_add.php View File

@@ -296,6 +296,19 @@ else if($dopost=='save')
$arcUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "
  请选择你的后续操作:


+ 13
- 0
src/dede/soft_edit.php View File

@@ -320,6 +320,19 @@ else if($dopost=='save')
$arcUrl = $cfg_phpurl."/view.php?aid=$id";
}
ClearMyAddon($id, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "
  请选择你的后续操作:


+ 13
- 0
src/dede/spec_add.php View File

@@ -228,6 +228,19 @@ else if($dopost=='save')
$artUrl = $cfg_phpurl."/view.php?aid=$arcID";
}
ClearMyAddon($arcID, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "
  请选择你的后续操作:


+ 13
- 0
src/dede/spec_edit.php View File

@@ -272,6 +272,19 @@ else if($dopost=='save')
$artUrl = $cfg_phpurl."/view.php?aid=$id";
}
ClearMyAddon($id, $title);
// 自动更新关联内容
if (is_array($automake)) {
foreach ($automake as $key => $value) {
if (isset(${$key}) && !empty(${$key})) {
$ids = explode(",", ${$key});
foreach ($ids as $id) {
MakeArt($id,true,true,$isremote);
}
}
}
}
//返回成功信息
$msg = "  请选择你的后续操作:
<a href='spec_add.php?cid=$typeid' class='btn btn-secondary btn-sm'>发布新专题</a>


+ 4
- 4
src/dede/templets/content_i_list.htm View File

@@ -133,14 +133,14 @@
<td background='images/wbg.gif' align='center'>
<table border='0' cellpadding='0' cellspacing='0' height="32">
<tr>
<td width='90' align='center'>请选择类目:</td>
<td width='160' align='center'>请选择类目:</td>
<td width='160'>
<select name='cid' style='width:150'>
<option value='0'>选择分类...</option>
{dede:global.optionarr/}
</select>
</td>
<td width='70' background='images/wbg.gif'>
<td width='100' background='images/wbg.gif'>
关键字:
</td>
<td width='160'>
@@ -156,8 +156,8 @@
<option value='lastpost'>最后评论</option>
</select>
</td>
<td>
<button type="submit" class="btn btn-secondary">搜索</button>
<td width='100'>
<button type="submit" class="btn btn-secondary btn-sm">搜索</button>
</td>
</tr>
</table>


+ 4
- 4
src/dede/templets/content_s_list.htm View File

@@ -193,21 +193,21 @@
<table width='98%' align="center" border='0' class="mb-3" cellpadding='1' cellspacing='1' class="table-borderless" background="images/wbg.gif">
<tr>
<td width='90' align='center'>请选择类目:</td>
<td width='160' align='center'>请选择类目:</td>
<td width='160'>
<select name='cid' style='width:150'>
<option value='0'>选择分类...</option>
<?php echo $optionarr?>
</select>
</td>
<td width='70'>
<td width='100'>
关键字:
</td>
<td width='160'>
<input type='text' name='keyword' value='<?php echo $keyword?>' style='width:150'>
</td>
<td>
<button type="submit" class="btn btn-secondary">搜索</button>
<td width='100'>
<button type="submit" class="btn btn-secondary btn-sm">搜索</button>
</td>
</tr>


+ 4
- 4
src/dede/templets/content_select_list.htm View File

@@ -109,21 +109,21 @@
<td>
<table width='600' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='90' align='center'>请选择类目:</td>
<td width='160' align='center'>请选择类目:</td>
<td width='160'>
<select name='cid' style='width:150px'>
<option value='0'>选择分类...</option>
<?php echo $optionarr?>
</select>
</td>
<td width='70'>
<td width='100'>
关键字:
</td>
<td width='160'>
<input type='text' name='keyword' value='<?php echo $keyword?>' style='width:150'>
</td>
<td>
<button type="submit" class="btn btn-secondary">搜索</button>
<td width='100'>
<button type="submit" class="btn btn-secondary btn-sm">搜索</button>
</td>
</tr>
</table>


+ 36
- 4
src/dede/templets/content_sg_list.htm View File

@@ -105,6 +105,20 @@
return allSel;
}
function getCheckboxItem2() {
var allSel = "";
if (document.form2.arcID.value) return document.form2.arcID.value;
for (i = 0; i < document.form2.arcID.length; i++) {
if (document.form2.arcID[i].checked) {
if (allSel == "")
allSel = document.form2.arcID[i].value;
else
allSel = allSel + "," + document.form2.arcID[i].value;
}
}
return allSel;
}
//获得选中其中一个的id
function getOneItem() {
var allSel = "";
@@ -125,6 +139,7 @@
}
}
}
function noSelAll() {
for (i = 0; i < document.form2.arcID.length; i++) {
if (document.form2.arcID[i].checked) {
@@ -132,6 +147,16 @@
}
}
}
function ReturnValue() {
if (window.opener.document.<?php echo $f ?>.value == "") {
window.opener.document.<?php echo $f ?>.value = getCheckboxItem2();
} else {
window.opener.document.<?php echo $f ?>.value += "," + getCheckboxItem2();
}
window.opener = null;
window.close();
}
</script>
</head>
@@ -227,6 +252,13 @@
onClick="moveArc(event,this,<?php echo (empty($channelid) ? 0 : $channelid); ?>)"
class="coolbg">&nbsp;移动&nbsp;</a>
<a class="btn btn-secondary btn-sm" href="javascript:delArc(0)" class="coolbg">&nbsp;删除&nbsp;</a>
<?php
if(!empty($f)) {
?>
<a href="javascript:ReturnValue()" class="btn btn-secondary btn-sm">把选定值加到列表</a>
<?php
}
?>
</td>
</tr>
</form>
@@ -249,22 +281,22 @@
<td>
<table width='600' border='0' cellpadding='0' cellspacing='0' class="table-borderless">
<tr>
<td width='90' align='center'>请选择类目:</td>
<td width='160' align='center'>请选择类目:</td>
<td width='160'>
<select name='cid' style='width:150'>
<option value='0'>选择分类...</option>
{dede:global.optionarr/}
</select>
</td>
<td width='70'>
<td width='100'>
关键字:
</td>
<td width='160'>
<input type='text' name='keyword' value='{dede:global.keyword/}'
style='width:150'>
</td>
<td>
<button type="submit" class="btn btn-secondary">搜索</button>
<td width='100'>
<button type="submit" class="btn btn-secondary btn-sm">搜索</button>
</td>
</tr>
</table>


+ 15
- 12
src/dede/templets/diy_add.htm View File

@@ -5,14 +5,17 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>新增频道</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" />
<script language="javascript" src="../static/js/jquery.js"></script>
<script src="../static/js/bootstrap.bundle.js"></script>
<script language="javascript" src="js/main.js"></script>
<script language="javascript" src="js/diy.js"></script>
<script language="javascript">
function checkSubmit() {
if (document.form1.name.value == '') {
alert("自定义表单名称不能为空!");
ShowMsg("自定义表单名称不能为空!");
return false;
}
return true;
@@ -37,7 +40,7 @@
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle"
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable table-bordered mt-3"
style="background:#CFCFCF;">
<form name="form1" action="diy_add.php?action=add" method="post" onSubmit="return checkSubmit();">
<tr bgcolor="#CFCFCF">
@@ -48,7 +51,7 @@
<tr>
<td width="160" height="28" align="left" bgcolor="#FFFFFF">
diyid:<br />
<span class="STYLE2" id='help1'>  数字,创建后不可更改,并具有唯一性。推荐使用默认值</span>
<span class="STYLE2" id='help1'>数字,创建后不可更改,并具有唯一性。推荐使用默认值</span>
</td>
<td bgcolor="#FFFFFF">
<input name="diyid" type="text" id="diyid" size="10" value="<?php echo $newdiyid?>" class='pubinputs'
@@ -60,7 +63,7 @@
<tr>
<td height="28" align="left" bgcolor="#FFFFFF">
自定义表单名称:<br />
<span class="STYLE2" id="help3">  自定义表单的中文名称,在后台管理,前台发布等均使用此名字。</span>
<span class="STYLE2" id="help3">自定义表单的中文名称,在后台管理,前台发布等均使用此名字。</span>
</td>
<td bgcolor="#FFFFFF">
<input name="name" type="text" id="name" style="width:180px" value="自定义表单<?php echo $newdiyid;?>"
@@ -71,7 +74,7 @@
</tr>
<tr>
<td height="28" align="left" bgcolor="#FFFFFF">数据表:<br />
<span class="STYLE2" id="help5">  必须由英文、数字、下划线组成,用于保存自定义表单数据,不能和已有表名重复,创建后不可修改表名。</span></td>
<span class="STYLE2" id="help5">必须由英文、数字、下划线组成,用于保存自定义表单数据,不能和已有表名重复,创建后不可修改表名。</span></td>
<td bgcolor="#FFFFFF">
<input name="table" type="text" id="table" style="width:180px"
value="<?php echo $cfg_dbprefix; ?>diyform<?php echo $newdiyid; ?>" class='pubinputs' />
@@ -101,22 +104,22 @@
<tr>
<td height="28" align="left" bgcolor="#FFFFFF">前台列表和内容页公开?:</td>
<td bgcolor="#FFFFFF">
<label><input name="public" type="radio" value="2" class='np' />完全公开</label>
<label><input name="public" type="radio" value="1" class='np' checked='1' />公开审核过的</label>
<label><input name="public" type="radio" value="0" class='np' />不公开</label>
<label><input name="public" type="radio" value="2" class='np' /> 完全公开</label>
<label><input name="public" type="radio" value="1" class='np' checked='1' /> 公开审核过的</label>
<label><input name="public" type="radio" value="0" class='np' /> 不公开</label>
</td>
</tr>
<tr bgcolor="#F9FCEF">
<td height="28" colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-borderless">
<tr>
<td width="26%" height="45">&nbsp;</td>
<td width="15%">
<input type="submit" name="button" id="button" value="确定" class="np coolbg" />
<button type="submit" name="button" id="button" class='btn btn-secondary'>确定</button>
</td>
<td width="59%">
<input name="按钮" type="button" class="np coolbg" id="button2" onClick="location='mychannel_main.php';"
value="返回" />
<button type="button" class='btn btn-secondary' id="button2" onclick="location='diy_main.php';"
>返回</button>
</td>
</tr>
</table>


+ 4
- 4
src/dede/templets/diy_edit.htm View File

@@ -62,7 +62,7 @@
</tr>
<tr>
<td width="170" height="28" align="left" bgcolor="#FFFFFF">自定义表单 diyid:<br />
<span class="STYLE2" id='help1'>  数字,创建后不可更改,并具有唯一性。</span> </td>
<span class="STYLE2" id='help1'>数字,创建后不可更改,并具有唯一性。</span> </td>
<td bgcolor="#FFFFFF">
<?php echo $diyid;?>
* <img src="images/help.gif" alt="帮助" width="16" height="16" border="0" style="cursor:hand"
@@ -70,7 +70,7 @@
</tr>
<tr>
<td height="28" align="left" bgcolor="#F9FCEF">自定义表单名称:<br />
<span class="STYLE2" id="help3">  自定义表单的中文名称,在后台管理,前台发布等均使用此名字。</span></td>
<span class="STYLE2" id="help3">自定义表单的中文名称,在后台管理,前台发布等均使用此名字。</span></td>
<td bgcolor="#F9FCEF">
<input name="name" type="text" id="name" value="<?php echo $row['name']?>" style="width:180px"
class='alltxt' />
@@ -80,7 +80,7 @@
</tr>
<tr>
<td height="28" align="left" bgcolor="#FFFFFF">数据表:<br />
<span class="STYLE2" id="help5">  自定义表单数据表创建后不可修改表名</span></td>
<span class="STYLE2" id="help5">自定义表单数据表创建后不可修改表名</span></td>
<td bgcolor="#FFFFFF">
<input name="table" type="text" id="table" style="width:180px" value="<?php echo $row['table']; ?>"
class='alltxt' disabled='1' />
@@ -202,7 +202,7 @@ foreach($dtp->CTags as $ctag)
</td>
<td width="59%">
<button type="button" class='btn btn-secondary' id="button2" onclick="location='diy_main.php';"
value="">返回</button>
>返回</button>
</td>
</tr>
</table>


+ 40
- 23
src/dede/templets/freelist_add.htm View File

@@ -5,8 +5,11 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>新增自由列表</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">
<script language="javascript" src="../static/js/jquery.js"></script>
<script src="../static/js/bootstrap.bundle.js"></script>
<script src="js/main.js" language="javascript"></script>
<script language="JavaScript">
function ChangeListStyle() {
@@ -39,17 +42,23 @@
}
function CheckSubmit() {
if (document.form1.title.value == "") {
alert("自由列表标题标题不能为空!");
ShowMsg("自由列表标题标题不能为空!");
document.form1.title.focus();
return false;
}
return true;
}
</script>
<link rel="stylesheet" type="text/css" href="css/codemirror.css">
<script type="text/javascript" src="js/codemirror.js"></script>
<script type="text/javascript" src="js/mode/xml/xml.js"></script>
<script type="text/javascript" src="js/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="js/mode/css/css.js"></script>
<script type="text/javascript" src="js/mode/htmlmixed/htmlmixed.js"></script>
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<div class="bodytitle">
<div class="bodytitle mt-3">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;">频道管理</div>
</div>
@@ -85,23 +94,23 @@
<p class="intro"> [field:description/]...</p>
</li>
</div>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle"
style="border:1px solid #CFCFCF;border-bottom:none;">
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center"
style="border:1px solid #CFCFCF;border-bottom:none;" class="table-borderless">
<tr>
<td align="left" bgcolor="#EDF9D5" background="images/tbg.gif" style="padding-left:10px;">
<td align="left" bgcolor="#EDF9D5" background="images/tbg.gif" style="padding-left:10px;" class="py-3">
<a href="freelist_main.php"><strong><u>自自由列表管理</u></strong></a>
<strong> &gt;&gt; 增加一个列表:</strong>
</td>
<td align="right" bgcolor="#EDF9D5" background="images/tbg.gif"></td>
</tr>
</table>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle"
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable table-bordered"
style="background:#CFCFCF;">
<form action="freelist_add.php" method="post" name="form1" onSubmit="return CheckSubmit();">
<input type="hidden" name="dopost" value="save">
<tr>
<td height="265" valign="top" bgcolor="#FFFFFF">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" class="table-borderless">
<tr>
<td height="56">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
@@ -124,8 +133,8 @@
<td height="28" align="left">目录默认页名称:</td>
<td align="left"> <input name="defaultpage" type="text" id="defaultpage" style="width:35%"
value="index.html">
<input name="nodefault" type="checkbox" id="nodefault" value="1">
不使用目录默认主页 </td>
<label><input name="nodefault" type="checkbox" id="nodefault" value="1">
不使用目录默认主页</label> </td>
</tr>
<tr>
<td height="28" align="left">命名规则:</td>
@@ -136,8 +145,8 @@
<td height="30" align="left">列表模板:</td>
<td align="left"><input name="templet" type="text" id="templet" style="width:300px"
value="{style}/list_free.htm">
<input type="button" name="set4" value="浏览..." style="width:60px"
onClick="SelectTemplets('form1.templet');" class="inputbut" /></td>
<button type="button" name="set4" style="width:60px"
onClick="SelectTemplets('form1.templet');" class="btn btn-secondary btn-sm">浏览...</button></td>
</tr>
<tr>
<td height="30" align="left">最大列出页数:</td>
@@ -245,12 +254,12 @@
</tr>
<tr>
<td height="28" align="left"> 高级筛选:
<input name="types[]" type="checkbox" id="type1" value="image">
带缩略图
<input name="types[]" type="checkbox" id="type2" value="commend">
推荐
<input name="types[]" type="checkbox" id="type3" value="spec">
专题 关键字:
<label><input name="types[]" type="checkbox" id="type1" value="image">
带缩略图</label>
<label><input name="types[]" type="checkbox" id="type2" value="commend">
推荐</label>
<label><input name="types[]" type="checkbox" id="type3" value="spec">
专题</label> 关键字:
<input name="keywordarc" type="text" id="keywordarc">
(&quot;,&quot;逗号分开)</td>
</tr>
@@ -266,10 +275,10 @@
<option value="postnum">评论总数</option>
</select>
 
<input name="order" type="radio" value="desc" checked>
由高到低
<input type="radio" name="order" value="asc">
由低到高</td>
<label><input name="order" type="radio" value="desc" checked>
由高到低</label>
<label><input type="radio" name="order" value="asc">
由低到高</label></td>
</tr>
<tr>
<td height="28" align="left">循环内的单行记录样式(InnerText):[<a href='javascript:ShowHide("innervar");'><img
@@ -292,8 +301,9 @@
</td>
</tr>
<tr>
<td height="50" align="left"> &nbsp; <input name="Submit2" type="submit" id="Submit2" value="保存一个列表"
class="coolbg" />
<td height="50" align="left"> &nbsp;
<button name="Submit2" type="submit" id="Submit2"
class="btn btn-secondary">保存一个列表</button>
</td>
</tr>
</table>
@@ -305,6 +315,13 @@
</tr>
</table>
</center>
<script type="text/javascript">
var editor = CodeMirror.fromTextArea(document.getElementById('myinnertext'), {
lineNumbers: true,
lineWrapping: true,
mode: 'text/html'
});
</script>
</body>
</html>

+ 25
- 21
src/dede/templets/freelist_edit.htm View File

@@ -5,8 +5,11 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>更改自由列表</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">
<script language="javascript" src="../static/js/jquery.js"></script>
<script src="../static/js/bootstrap.bundle.js"></script>
<script src="js/main.js" language="javascript"></script>
<script language="JavaScript">
function ChangeListStyle() {
@@ -39,7 +42,7 @@
}
function CheckSubmit() {
if (document.form1.title.value == "") {
alert("自由列表标题标题不能为空!");
ShowMsg("自由列表标题标题不能为空!");
document.form1.title.focus();
return false;
}
@@ -55,22 +58,22 @@
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<div class="bodytitle">
<div class="bodytitle mt-3">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;">频道管理</div>
</div>
<center>
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle"
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable table-bordered"
style="background:#CFCFCF;">
<form action="freelist_edit.php" method="post" name="form1" onSubmit="return CheckSubmit();">
<input type="hidden" name="dopost" value="save">
<input type="hidden" name="aid" value="<?php echo $row['aid']?>">
<tr>
<td height="28" bgcolor="#EDF9D5" background="images/tbg.gif">
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<table width="98%" border="0" cellpadding="0" cellspacing="0" class="table-borderless">
<tr>
<td width="35%" height="18" align="left" style="padding-left:10px;">
<a href="freelist_main.php"><strong><u>自自由列表管理</u></strong></a>
<a href="freelist_main.php"><strong><u>自自由列表管理</u></strong></a>
<strong> &gt;&gt; 更改自由列表:</strong>
</td>
<td width="65%" align="right"></td>
@@ -80,7 +83,7 @@
</tr>
<tr>
<td height="265" valign="top" bgcolor="#FFFFFF">
<table width="99%" border="0" align="right" cellpadding="0" cellspacing="1">
<table width="99%" border="0" align="right" cellpadding="0" cellspacing="1" class="table-borderless">
<tr>
<td height="56">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
@@ -104,9 +107,9 @@
<td height="28" align="left">目录默认页名称:</td>
<td align="left"><input name="defaultpage" type="text" id="defaultpage" style="width:35%"
value="<?php echo $row['defaultpage']?>">
<input name="nodefault" type="checkbox" id="nodefault" value="1"
<label><input name="nodefault" type="checkbox" id="nodefault" value="1"
<?php if($row['nodefault']==1) echo " checked"; ?>>
不使用目录默认主页
不使用目录默认主页</label>
</td>
</tr>
<tr>
@@ -118,8 +121,8 @@
<td height="35" align="left">列表模板:</td>
<td align="left"><input name="templet" type="text" id="templet" style="width:300px"
value="<?php echo $row['templet']?>">
<input type="button" name="set4" value="浏览..." style="width:60px"
onClick="SelectTemplets('form1.templet');" class="inputbut" /></td>
<button type="button" name="set4" style="width:60px"
onClick="SelectTemplets('form1.templet');" class="btn btn-secondary btn-sm">浏览...</button></td>
</tr>
<tr>
<td height="30" align="left">最大列出页数:</td>
@@ -233,15 +236,15 @@
if($setype=='') $setype = 'X';
?>
高级筛选:
<input name="types[]" type="checkbox" id="type1" value="image"
<label><input name="types[]" type="checkbox" id="type1" value="image"
<?php if(preg_match("#image#i",$setype)) echo ' checked';?>>
带缩略图
<input name="types[]" type="checkbox" id="type2" value="commend"
带缩略图</label>
<label><input name="types[]" type="checkbox" id="type2" value="commend"
<?php if(preg_match("#commend#i", $setype)) echo ' checked';?>>
推荐
<input name="types[]" type="checkbox" id="type3" value="spec" class="inputbut"
推荐</label>
<label><input name="types[]" type="checkbox" id="type3" value="spec" class="inputbut"
<?php if(preg_match("#spec#i", $setype)) echo ' checked';?>>
专题 关键字:
专题</label> 关键字:
<input name="keywordarc" type="text" id="keywordarc" value="<?php echo $ctag->GetAtt('keyword')?>">
(&quot;,&quot;逗号分开)
</td>
@@ -272,12 +275,12 @@
<option value="postnum">评论总数</option>
</select>
 
<input name="order" type="radio" value="desc"
<label><input name="order" type="radio" value="desc"
<?php if($ctag->GetAtt('orderway')=='desc') echo " checked";?>>
由高到低
<input type="radio" name="order" value="asc"
由高到低</label>
<label><input type="radio" name="order" value="asc"
<?php if($ctag->GetAtt('orderway')=='asc') echo " checked";?>>
由低到高</td>
由低到高</label></td>
</tr>
<tr>
<td height="28" align="left">循环内的单行记录样式(InnerText):[<img src="images/help.gif" width="16" height="16"><a
@@ -300,7 +303,8 @@
</tr>
<tr>
<td height="50" align="left"> &nbsp;
<input name="Submit2" type="submit" id="Submit2" value="保存一个列表" class="coolbg" />
<button name="Submit2" type="submit" id="Submit2"
class="btn btn-secondary">保存一个列表</button>
</td>
</tr>
</table>


+ 1
- 1
src/dede/templets/makehtml_taglist.htm View File

@@ -2,7 +2,7 @@

<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>更新TAG HTML</title>
<title>更新Tag HTML</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">


+ 51
- 4
src/dede/templets/mychannel_field_add.htm View File

@@ -30,7 +30,8 @@ function GetFields()
var sisnull = (isnull==0 ? "false" : "true");
var autofield = (theform.autofield[0].checked ? theform.autofield[0].value : theform.autofield[1].value);
var islist = (theform.islist.checked ? 1 : 0);
var notsend = (theform.notsend.checked ? 1 : 0);
var notsend = (theform.notsend.checked ? 1 : 0);
var automake = theform.relation_automake.checked ? 1 : 0;
if(itemname=="")
{
@@ -58,16 +59,33 @@ function GetFields()
return false;
}
if(spage=="no") spage = "";
if(spage=="no") spage = "";
relstr = "";
if (dtype==="relation") {
relstr = " automake=\""+automake+"\" channel=\""+$("#channeltype").val()+"\"";
}
revalue = "<field:"+fieldname+" itemname=\""+itemname+"\" autofield=\""+autofield+"\" notsend=\""+notsend+"\" type=\""+dtype+"\"";
revalue += " isnull=\""+sisnull+"\" islist=\""+islist+"\" default=\""+vdefault+"\" ";
revalue += relstr + " isnull=\""+sisnull+"\" islist=\""+islist+"\" default=\""+vdefault+"\" ";
revalue += " maxlength=\""+maxlength+"\" page=\""+spage+"\">\r\n"+vinnertext+"</field:"+fieldname+">\r\n";
document.form1.fieldstring.value = revalue;
return true;
}
$(document).ready(function () {
$("#dataType input").click(function(ele){
if ($(ele.currentTarget).val() === "relation") {
$("#_relation").show();
} else {
$("#_relation").hide();
}
})
});
</script>
<style type="text/css">
td{ padding:2px; padding-left:6px; line-height:150%; }
@@ -162,7 +180,7 @@ class="table maintable table-bordered mt-3">
<td bgcolor="#FFFFFF">
<strong>数据类型:</strong>
</td>
<td bgcolor="#FFFFFF">
<td bgcolor="#FFFFFF" id="dataType">
<div class='nw'><label><input type='radio' class='np' name='dtype' id='dtype1' value="text" checked='1'> 单行文本(varchar) </label></div>
<div class='nw'><label><input type='radio' class='np' name='dtype' id='dtype2' value="textchar"> 单行文本(char) </label></div>
<div class='nw'><label><input type='radio' class='np' name='dtype' id='dtype3' value="multitext"> 多行文本 </label></div>
@@ -182,8 +200,37 @@ class="table maintable table-bordered mt-3">
<div class='nw'><label><input type='radio' class='np' name='dtype' id='dtype14' value="radio"> 使用radio选项卡 </label></div>
<div class='nw'><label><input type='radio' class='np' name='dtype' id='dtype15' value="checkbox"> Checkbox多选框 </label></div>
<div class='nw'><label><input type='radio' class='np' name='dtype' id='dtype16' value="stepselect"> 联动类型 </label></div>
<br class='cls' />
<div class='nw'><label><input type='radio' class='np' name='dtype' id='dtype16' value="relation"> 关联内容 </label></div>
</td>
</tr>
<tr id="_relation" style="display: none;">
<td bgcolor="#FFFFFF"><strong>内容模型:</strong><br>
<span class="STYLE2">
选择关联内容对应的内容模型
</span>
</td>
<td bgcolor="#FFFFFF">
<select name="channeltype" id="channeltype" style="width:200px">
<?php
$channelid = 1;
foreach($channelArray as $k=>$arr)
{
if($k==$channelid) {
$nid = $arr['nid'];
echo " <option value='{$k}' selected>{$arr['typename']}|{$arr['nid']}</option>\r\n";
}
else
{
echo " <option value='{$k}'>{$arr['typename']}|{$arr['nid']}</option>\r\n";
}
}
?>
</select>
<label><input name="relation_automake" type="checkbox" class="np" id="relation_automake" value="1">
发布时候自动更新关联内容HTML</label>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><strong>默认值:</strong><br>
<span class="STYLE2">


+ 46
- 1
src/dede/templets/mychannel_field_edit.htm View File

@@ -40,14 +40,30 @@
if (spage == "no") spage = "";
relstr = "";
if (dtype==="relation") {
relstr = " automake=\""+automake+"\" channel=\""+$("#channeltype").val()+"\"";
}
revalue = "<field:" + fieldname + " itemname=\"" + itemname + "\" autofield=\"" + autofield + "\" notsend=\"" + notsend + "\" type=\"" + dtype + "\"";
revalue += " isnull=\"" + sisnull + "\" islist=\"" + islist + "\" default=\"" + vdefault + "\" ";
revalue += relstr + " isnull=\"" + sisnull + "\" islist=\"" + islist + "\" default=\"" + vdefault + "\" ";
revalue += " maxlength=\"" + maxlength + "\" page=\"" + spage + "\">\r\n" + vinnertext + "</field:" + fieldname + ">\r\n";
document.form1.fieldstring.value = revalue;
return true;
}
$(document).ready(function () {
$("#type").change(function (ele) {
if ($(ele.currentTarget).val() === "relation") {
$("#_relation").show();
} else {
$("#_relation").hide();
}
})
});
</script>
<style type="text/css">
td {
@@ -175,11 +191,40 @@
<option value="radio">使用radio选项卡</option>
<option value="checkbox">Checkbox多选框</option>
<option value="stepselect">联动类型</option>
<option value="relation">关联内容</option>
<?php
}
?>
</select> </td>
</tr>
<tr id="_relation" <?php echo $dtype=="relation"? '' : 'style="display: none;"';?>>
<td bgcolor="#FFFFFF"><strong>内容模型:</strong><br>
<span class="STYLE2">
选择关联内容对应的内容模型
</span>
</td>
<td bgcolor="#FFFFFF">
<select name="channeltype" id="channeltype" style="width:200px">
<?php
$channelid = $ctag->GetAtt('channel') == "" ? 1 : $ctag->GetAtt('channel');
foreach($channelArray as $k=>$arr)
{
if($k==$channelid) {
$nid = $arr['nid'];
echo " <option value='{$k}' selected>{$arr['typename']}|{$arr['nid']}</option>\r\n";
}
else
{
echo " <option value='{$k}'>{$arr['typename']}|{$arr['nid']}</option>\r\n";
}
}
?>
</select>
<label><input name="relation_automake" type="checkbox" class="np" id="relation_automake" value="1" <?php echo $ctag->GetAtt('automake')==1? "checked" : "";?>>
发布时候自动更新关联内容HTML</label>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><strong>内容是否需要分页符:</strong><br />
<span class="STYLE2">如果内容需要分页符,不论何种内容,都可以用#P#副标题#e#作为分页符号实现内容分页,但一个模型里仅允许一个这样的字段!</span></td>


+ 1
- 1
src/dede/templets/tags_main.htm View File

@@ -64,7 +64,7 @@
搜索:
<input type='text' name='tag' size='10' value="<?php echo $tag;?>">
<button type='submit' name='sb' class="btn btn-secondary btn-sm">确定</button>
&nbsp; <a href="makehtml_taglist.php" name='sb' class="btn btn-secondary btn-sm">更新TAG HTML</a>
&nbsp; <a href="makehtml_taglist.php" name='sb' class="btn btn-secondary btn-sm">更新Tag HTML</a>
</td>
</form>


+ 42
- 3
src/include/customfields.func.php View File

@@ -18,7 +18,6 @@
*/
function GetFormItem($ctag, $admintype='admin')
{
global $dsql;
$fieldname = $ctag->GetName();
$fieldType = $ctag->GetAtt('type');
$formitem = $formitem = GetSysTemplets("custom_fields_{$admintype}.htm");
@@ -161,11 +160,32 @@ function GetFormItem($ctag, $admintype='admin')
{
$dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : '0');
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:100px' class='intxt' value='$dfvalue' /> (填写数值)\r\n";
} else if($fieldType=='relation') {
$dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : '');
$channel = ($ctag->GetAtt('channel') == "")? "1" : $ctag->GetAtt('channel');
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:90%;height:80px'>$dfvalue</textarea><br>
<button type='button' class='btn btn-secondary btn-sm mt-2 mb-2' onclick='SelectArcList(\"form1.$fieldname\", $channel);'>选择关联内容</button>\r\n";
if ($ctag->GetAtt('automake') == 1) {
$innertext .= "<input type='hidden' name='automake[$fieldname]' value=1>";
}
$innertext .= <<<EOT
<script>
if(typeof SelectArcList === "undefined") {
function SelectArcList(fname,cid) {
var posLeft = 10;
var posTop = 10;
window.open("content_select_list.php?f=" + fname+"&channelid="+cid, "selArcList", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=500,left=" + posLeft + ", top=" + posTop);
}
}
</script>
EOT;
}
else
{
$dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : '');
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:250px' class='intxt' value='$dfvalue' />\r\n";
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:250px' class='intxt' value='$dfvalue' />
\r\n";
}
$formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem);
$formitem = str_replace("~form~",$innertext,$formitem);
@@ -370,7 +390,7 @@ function GetFieldValue($dvalue, $dtype, $aid=0, $job='add', $addvar='', $adminty
*/
function GetFormItemValue($ctag, $fvalue, $admintype='admin', $fieldname='')
{
global $cfg_basedir,$dsql;
global $cfg_basedir;
$fieldname = $ctag->GetName();
$formitem = $formitem = GetSysTemplets("custom_fields_{$admintype}.htm");
$innertext = trim($ctag->GetInnerText());
@@ -540,6 +560,25 @@ function GetFormItemValue($ctag, $fvalue, $admintype='admin', $fieldname='')
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:100px' class='intxt' value='$fvalue' /> (填写数值)\r\n";
}
else if($ftype=="relation") {
$channel = ($ctag->GetAtt('channel') == "")? "1" : $ctag->GetAtt('channel');
$innertext = "<textarea name='$fieldname' id='$fieldname' style='width:90%;height:80px'>$fvalue</textarea><br>
<button type='button' class='btn btn-secondary btn-sm mt-2 mb-2' onclick='SelectArcList(\"form1.$fieldname\", $channel);'>选择关联内容</button>\r\n";
if ($ctag->GetAtt('automake') == 1) {
$innertext .= "<input type='hidden' name='automake[$fieldname]' value=1>";
}
$innertext .= <<<EOT
<script>
if(typeof SelectArcList === "undefined") {
function SelectArcList(fname,cid) {
var posLeft = 10;
var posTop = 10;
window.open("content_select_list.php?f=" + fname+"&channelid="+cid, "selArcList", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=500,left=" + posLeft + ", top=" + posTop);
}
}
</script>
EOT;
}
else
{
$innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:250px' class='intxt' value='$fvalue' />\r\n";


+ 170
- 0
src/include/taglib/relation.lib.php View File

@@ -0,0 +1,170 @@
<?php if(!defined('DEDEINC')) exit('Request Error!');
/**
* 关联内容标签
*
* @version $Id: relation.lib.php 1 9:29 2020年9月23日 tianya $
* @package DedeCMS.Taglib
* @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
* @copyright Copyright (c) 2020, DedeBIZ.COM
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
// 关联内容
function lib_relation(&$ctag,&$refObj)
{
global $dsql;

//属性处理
$attlist="row|12,titlelen|28,infolen|150,name|default,orderby|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);

if (get_class($refObj) != "Archives") {
return "暂无相关内容";
}

if (empty($refObj->Fields[$name])) {
return "暂无相关内容";
}

if (!isset($refObj->ChannelUnit->ChannelFields[$name])) {
return "暂无相关内容";
}
if(empty($tablewidth)) $tablewidth = 100;
if(empty($col)) $col = 1;
$colWidth = ceil(100/$col);
$tablewidth = $tablewidth."%";
$colWidth = $colWidth."%";
$ids = array();
$channelid = $refObj->ChannelUnit->ChannelFields[$name]["channel"];

$odb = "";
if ($channelid > 0) {
$odb = " ORDER BY arc.sortrank DESC";
} else {
$odb = " ORDER BY arc.senddate DESC";
}
if ($orderby=="click") {
$odb = " ORDER BY arc.click DESC";
}

if ($channelid > 0) {
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,
tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
where arc.arcrank>-1 AND arc.id IN (".$refObj->Fields[$name].") $odb";
} else {
$gquery = "SELECT addtable,listfields FROM `#@__channeltype` WHERE id='$channelid' ";
$grow = $dsql->GetOne($gquery);
$maintable = trim($grow['addtable']);
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,
tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
FROM `{$maintable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
where arc.arcrank>-1 AND arc.aid IN (".$refObj->Fields[$name].") $odb";
}

$innertext = trim( $ctag->GetInnerText() );
if($innertext=='') $innertext = GetSysTemplets('part_arclist.htm');

$dsql->SetQuery($query);
$dsql->Execute('al');
$artlist = '';
if($col > 1) {
$artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
}
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace('field', '[', ']');
$dtp2->LoadString($innertext);
$GLOBALS['autoindex'] = 0;
$line = $row;
for($i=0; $i < $line; $i++)
{
if($col>1) $artlist .= "<tr>\r\n";
for($j=0; $j < $col; $j++)
{
if($col>1) $artlist .= " <td width='$colWidth'>\r\n";
if($row = $dsql->GetArray("al"))
{
if ($channelid > 0) {
$row['id'] = $row['id'];
} else {
$row['id'] = $row['aid'];
}
$ids[] = $row['id'];
$row['description'] = isset($row['description'])? $row['description'] : "";
$row['filename'] = isset($row['filename'])? $row['filename'] : "";
$row['money'] = isset($row['money'])? $row['money'] : 0;
$row['ismake'] = isset($row['ismake'])? $row['ismake'] : 0;
//处理一些特殊字段
$row['info'] = $row['infos'] = cn_substr($row['description'],$infolen);

if($row['corank'] > 0 && $row['arcrank']==0)
{
$row['arcrank'] = $row['corank'];
}

$row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);

$row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],
$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']);

if($row['litpic'] == '-' || $row['litpic'] == '')
{
$row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif';
}
if(!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y')
{
$row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic'];
}
$row['picname'] = $row['litpic'];
$row['pubdate'] = isset($row['pubdate'])? $row['pubdate'] : $row['senddate'];
$row['stime'] = GetDateMK($row['pubdate']);
$row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
$row['image'] = "<img src='".$row['picname']."' border='0' alt='".preg_replace("#['><]#","",$row['title'])."'>";
$row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>";
$row['fulltitle'] = $row['title'];
$row['title'] = cn_substr($row['title'], $titlelen);
if(isset($row['color']) && $row['color']!='') $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>";
if(preg_match('#b#', $row['flag'])) $row['title'] = "<strong>".$row['title']."</strong>";
$row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>";
$row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
$row['memberurl'] = $GLOBALS['cfg_memberurl'];
$row['templeturl'] = $GLOBALS['cfg_templeturl'];
if(is_array($dtp2->CTags))
{
foreach($dtp2->CTags as $k=>$ctag)
{
if($ctag->GetName()=='array') {
$dtp2->Assign($k,$row);
}
else {
if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]);
else $dtp2->Assign($k,'');
}
}
$GLOBALS['autoindex']++;
}

$artlist .= $dtp2->GetResult()."\r\n";
}
//if hasRow
else
{
$artlist .= '';
}
if($col>1) $artlist .= " </td>\r\n";
}
//Loop Col
if($col>1) $i += $col - 1;
if($col>1) $artlist .= " </tr>\r\n";
}
//loop line
if($col>1) $artlist .= " </table>\r\n";
$dsql->FreeResult("al");
return $artlist;
}

+ 6
- 6
src/include/typeunit.class.admin.php View File

@@ -150,7 +150,7 @@ class TypeUnit
echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' class='btn btn-secondary btn-sm' title='移动'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' class='btn btn-secondary btn-sm' title='删除'><i class='fa fa-trash' aria-hidden='true'></i></a>";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:25px;height:20px'></td></tr></table></td></tr>\r\n";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
}
//带封面的频道
else if($ispart==1)
@@ -165,7 +165,7 @@ class TypeUnit
echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' class='btn btn-secondary btn-sm' title='移动'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' class='btn btn-secondary btn-sm' title='删除'><i class='fa fa-trash' aria-hidden='true'></i></a>";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:25px;height:20px'></td></tr></table></td></tr>\r\n";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
}
//独立页面
else if($ispart==2)
@@ -178,7 +178,7 @@ class TypeUnit
echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' class='btn btn-secondary btn-sm' title='移动'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' class='btn btn-secondary btn-sm' title='删除'><i class='fa fa-trash' aria-hidden='true'></i></a>";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:25px;height:20px'></td></tr></table></td></tr>\r\n";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
}
echo " <tr><td colspan='2' id='suns".$id."'>";
$lastid = GetCookie('lastCid');
@@ -252,7 +252,7 @@ class TypeUnit
echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' title='移动' class='btn btn-secondary btn-sm'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' title='删除' class='btn btn-secondary btn-sm'><i class='fa fa-trash' aria-hidden='true'></i></a>";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:25px;height:20px'></td></tr></table></td></tr>\r\n";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
}
//封面频道
@@ -268,7 +268,7 @@ class TypeUnit
echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' title='移动' class='btn btn-secondary btn-sm'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' title='删除' class='btn btn-secondary btn-sm'><i class='fa fa-trash' aria-hidden='true'></i></a>";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:25px;height:20px'></td></tr></table></td></tr>\r\n";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
}
//独立页面
@@ -283,7 +283,7 @@ class TypeUnit
echo " <a href='catalog_edit.php?id={$id}' class='btn btn-secondary btn-sm' title='更改'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a>";
echo " <a href='catalog_do.php?dopost=moveCatalog&typeid={$id}' title='移动' class='btn btn-secondary btn-sm'><i class='fa fa-share-square' aria-hidden='true'></i></a>";
echo " <a href='catalog_del.php?id={$id}&typeoldname=".urlencode($typeName)."' title='删除' class='btn btn-secondary btn-sm'><i class='fa fa-trash' aria-hidden='true'></i></a>";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:25px;height:20px'></td></tr></table></td></tr>\r\n";
echo "&nbsp; <input type='text' name='sortrank{$id}' value='{$rank}' style='width:35px;height:20px'></td></tr></table></td></tr>\r\n";
}
echo " <tr><td id='suns".$id."' style='display:none'><table width='100%' border='0' cellspacing='0' cellpadding='0'>";
$this->LogicListAllSunType($id,$step." ");


Loading…
Cancel
Save