给织梦添加复制文档的功能
I..打开templets下的content_list.htm
找到这I.行:
更多精彩就在: 51免费论文网|www.jxszl.com
$channelid)?0:$channelid);?>)"class="coolbg">移动
在这I.行的下方添加:
II.打开dede/js/list.js
找到moveArc这个函数
functionmoveArc(e,obj,cid){
varqstr=getCheckboxItem();
if(qstr==)
{
alert(必须选择I.个或多个文档!);
return;
}
LoadQuickDiv(e,archives_do.php?dopost=moveArchives&qstr=+qstr+&channelid=+cid+&rnd=+Math.random(),moveArchives,IVV0px,I.VIII0px);
ChangeFullDiv(show);
}
然后在下方添加copyArc这个函数
functioncopyArc(e,obj,cid){
varqstr=getCheckboxItem();
if(qstr==)
{
alert(必须选择I.个或多个文档!);
return;
}
LoadQuickDiv(e,archives_do.php?dopost=copyArchives&qstr=+qstr+&channelid=+cid+&rnd=+Math.random(),copyArchives,IVV0px,I.VIII0px);
ChangeFullDiv(show);
}
III.打开dede/archives_do.php找到
elseif($dopost==moveArchives)
{
这句代码然后在这个大括弧结尾处也就是在IVIIIIII行左右添加如下代码:
/*-----------------------------
functioncopyArchives(){}
------------------------------*/
elseif($dopost==copyArchives)
{
CheckPurview(sys_ArcBatch);
if(empty($totype))
{
require_once(DEDEINC./typelink.class.php);
if(!empty($aid)&&empty($qstr))$qstr=$aid;
AjaxHead();
$channelid=empty($channelid)?0:$channelid;
$tl=newTypeLink($aid);
$typeOptions=$tl->GetOptionArray(0,$admin_catalogs,$channelid);
$typeOptions="
$typeOptions
";
//输出AJAX可移动窗体
$divname=copyArchives;
echo"
echo"
echo"
echo"
echo"
echo"
echo"
echo"
?>
复制到的目标栏目必须和选定的文档频道类型I.致,否则程序会自动勿略不符合的文档.
//AJAX窗体结束
}
else
{
$totype=preg_replace("#[^0-IX]#",,$totype);
$typeInfos=$dsql->GetOne("SELECTtp.channeltype,tp.ispart,tp.channeltype,ch.maintable,ch.addtable,ch.issystemFROM`me_arctype`tpLEFTJOIN`me_channeltype`chonch.id=tp.channeltypeWHEREtp.id=$totype");
$idtype="id";
if(!is_array($typeInfos))
{
ShowMsg(参数错误!,-I.);
exit();
}
if($typeInfos[ispart]!=0)
{
ShowMsg(文档保存的栏目必须为最终列表栏目!,-I.);
exit();
}
if(empty($typeInfos[addtable]))
{
$typeInfos[maintable]=me_archives;
}
//增加单表模型判断
if($typeInfos[issystem]==-I.)
{
$typeInfos[maintable]=$typeInfos[addtable];
$idtype="aid";
}
$arcids=preg_replace("#[^0-IX,]#",,preg_replace("#`#",,,$qstr));
$arc=;
$j=0;
$okids=array();
$dsql->SetQuery("SELECT{$idtype},typeidFROM`{$typeInfos[maintable]}`WHERE{$idtype}in($arcids)ANDchannel={$typeInfos[channeltype]}");
$dsql->Execute();
while($row=$dsql->GetArray())
{
if($row[typeid]!=$totype)
{
$dsql->ExecuteNoneQuery("insertintome_arctiny(typeid,typeidII,arcrank,channel,senddate,sortrank,mid)selecttypeid,typeidII,arcrank,channel,senddate,sortrank,midfromme_arctinywhereid={$row[$idtype]}");
$xid=$dsql->GetLastID();
$dsql->ExecuteNoneQuery("insertinto`{$typeInfos[maintable]}`(id,typeid,typeidII,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,keywords,lastpost,scores,goodpost,badpost,voteid,notpost,description,filename,dutyadmin,tackid,mtype,weight)selectcasewhenid>0then$xidelseend,casewhentypeid>0then$totypeelseend,typeidII,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,keywords,lastpost,scores,goodpost,badpost,voteid,notpost,description,filename,dutyadmin,tackid,mtype,weightfrom`{$typeInfos[maintable]}`WHEREid={$row[$idtype]}");
$dsql->ExecuteNoneQuery("insertinto`{$typeInfos[addtable]}`(aid,typeid,body,redirecturl,templet,userip,bigpic)selectcasewhenaid>0then$xidelseend,$totype,body,redirecturl,templet,userip,bigpicfrom`{$typeInfos[addtable]}`WHEREaid={$row[$idtype]}");
$okids[]=$row[$idtype];
$j++;
}
}
//更新HTML
foreach($okidsas$aid)
{
$arc=newArchives($aid);
$arc->MakeHtml();
}
ShowMsg("成功复制$j个文档!",$ENV_GOBACK_URL);
exit();
}
}
原文链接:http://www.jxszl.com/biancheng/dedecms/76644.html