如果想要把一个栏目的所有文档复制到另一个栏目中如果没有好的办法就只能一个一个的重新建立,为了避免这种浪费时间的事,我们就在后台写一个批量复制的功能。下面是实现功能的具体步骤
修改文件dede/templets/content_batch_up.htm
修改头部脚本函数ShowHideMove()
function ShowHideMove()
{
var selBox = document.getElementByIdx_x('moveradio');
var selBox2 = document.getElementByIdx_x('copyradio');//edited by adan;090508
var obj = document.getElementByIdx_x('moveField');
if(selBox.checked||selBox2.checked) obj.style.display = "block";//edited by adan;090508
else obj.style.display = "none";
}
添加复制栏目按钮
查找
<input name="action" type="radio" class="np" value="move" id="moveradio" onClick="ShowHideMove()" />
移动文档
后面添加
<input name="action" type="radio" class="np" value="copy" id="copyradio" onClick="ShowHideMove()" /><!--added by adan;090508-->
复制栏目文档
修改文件dede/content_batch_action.
php 首先删除文件最后的两段代码
//删除空标题内容
else if($action=='delnulltitle')
{
$dsql->SetQuery("Select id From dede_archives where trim(title)='' ");
$dsql->Execute('x');
$tdd = 0;
while($row = $dsql->GetObject('x'))
{
if(DelArc($row->id))
{
$tdd++;
}
}
ShowMsg("成功删除 $tdd 条记录!","
JAVAscript:;");
exit();
}
//修正缩略图错误
else if($action=='modddpic')
{
$dsql->ExecuteNoneQuery("Update dede_archives set litpic='' where trim(litpic)='litpic' ");
ShowMsg("成功修正缩略图错误!","
JavaScript:;");
exit();
}
上面2段代码,官方人员竟然把上面2段代码搞重复了,先汗一个!
然后在最后添加下面代码
//start 添加复制栏目文章功能 added by adan;090508
else if($action=='copy')
{
if(empty($typeid))
{
ShowMsg('该操作必须指定栏目!','javascript:;');
exit();
}
$typeold = $dsql->GetOne("Select * From `dede_arctype` where id='$typeid'; ");
$typenew = $dsql->GetOne("Select * From `dede_arctype` where id='$newtypeid'; ");
if(!is_array($typenew))
{
$dsql->Close();
ShowMsg("无法检测复制到的新栏目的信息,不能完成操作!","javascript:;");
exit();
}
if($typenew['ispart']!=0)
{
$dsql->Close();
ShowMsg("你不能把数据复制到非最终列表的栏目!","javascript:;");
exit();
}
if($typenew['channeltype']!=$typeold['channeltype'])
{
$dsql->Close();
ShowMsg("不能把数据复制到内容类型不同的栏目!","javascript:;");
exit();
}
$gwhere .= " And channel='".$typenew['channeltype']."' And title like '%$key
word%'";
$ch = $dsql->GetOne("Select addtable From `dede_channeltype` where id={$typenew['channeltype']} ");
$addtable = $ch['addtable'];
$dsql->SetQuery("Select * From `dede_archives` where typeid='$typeid'");
$dsql->Execute('c');
$tdd = 0;
while($row = $dsql->GetObject('c'))
{
$senddate = time();
$sortrank = AddDay($senddate,0);//第二个参数是排序值,参考article_add.php
$ID = $row->id;
$typeid = $newtypeid;//$newtypeid
声明:本站部分内容及图片来自互联网,转载是出于传递更多信息之目的,内容观点仅代表作者本人,不构成投资建议。投资者据此操作,风险自担。如有任何标注错误或版权侵犯请与我们联系,我们将及时更正、删除。