DEDE 在後臺新增欄目文件的批量複製功能
修改檔案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
'%$keyword%'";
$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