魔扣论坛

魔扣源码论坛业务
查看: 448|回复: 2

[织梦教程] 给织梦添加复制文档的功能

[复制链接]
  • TA的每日心情
    慵懒
    13 分钟前
  • 签到天数: 2957 天

    [LV.Master]开坛老将

    7万

    主题

    227

    回帖

    27万

    积分

    管理员

    Rank: 30Rank: 30Rank: 30Rank: 30Rank: 30Rank: 30Rank: 30Rank: 30

    魔扣币
    745759
    贡献
    157915
    威望
    32799

    最佳新人活跃会员热心会员推广达人宣传达人突出贡献优秀版主荣誉管理论坛元老

    发表于 2020-6-18 01:54:29 | 显示全部楼层 |阅读模式
    魔扣币兑换比例:【 50以下 : ¥1 = 10 魔扣币 】丨【 50 - 100 :¥1 = 20 魔扣币】丨【 100以上:¥1 = 30 魔扣币 】

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    给织梦添加复制文档的功能步骤如下:

    一、打开templets下的content_list.htm

        找到 这一行:

    <a href="javascript:;" class="coolbg">&nbsp;移动&nbsp;</a>

    在这一行的下方添加:

       <a href="javascript:;" class="coolbg">&nbsp;复制&nbsp;</a>

    二、打开dede/js/list.js

    找到moveArc这个函数

    function moveArc(e, obj, cid){
        var qstr=getCheckboxItem();
        if(qstr=='')
        {
            alert('必须选择一个或多个文档!');
            return;
        }
        LoadQuickDiv(e, 'archives_do.php?dopost=moveArchives&qstr='+qstr+'&channelid='+cid+'&rnd='+Math.random(), 'moveArchives', '450px', '180px');
        ChangeFullDiv('show');
    }

    然后在下方添加copyArc这个函数

    function copyArc(e, obj, cid){
        var qstr=getCheckboxItem();
        if(qstr=='')
        {
            alert('必须选择一个或多个文档!');
            return;
        }
        LoadQuickDiv(e, 'archives_do.php?dopost=copyArchives&qstr='+qstr+'&channelid='+cid+'&rnd='+Math.random(), 'copyArchives', '450px', '180px');
        ChangeFullDiv('show');
    }

    三、打开 dede/archives_do.php找到

    else if($dopost=='moveArchives')
    {

    这句代码 然后在这个大括弧结尾处 也就是在433行左右添加如下代码:

    /*-----------------------------
    function copyArchives(){ }
    ------------------------------*/

    else if($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 = new TypeLink($aid);
            $typeOptions = $tl->GetOptionArray(0, $admin_catalogs, $channelid);
            $typeOptions = "<select name='totype' style='width:90%'>

    <option value='0'>请选择复制到的位置...</option>\r\n
            $typeOptions
            </select>";

            //输出AJAX可移动窗体
            $divname = 'copyArchives';
            echo "<div class='title' onmousemove=\"DropMoveHand('{$divname}', 225);\" onmousedown=\"DropStartHand();\" onmouseup=\"DropStopHand();\">\r\n";
            echo "    <div class='titLeft'>复制文档</div>\r\n";
            echo "    <div class='titRight'><img src='images/ico-close.gif' style='cursor:pointer;' onclick='HideObj(\"{$divname}\");ChangeFullDiv(\"hide\");' alt='关闭' title='关闭' /></div>\r\n";
            echo "</div>\r\n";
            echo "<form name='quickeditform' action='archives_do.php' method='post'>\r\n";
            echo "<input type='hidden' name='dopost' value='{$dopost}' />\r\n";
            echo "<input type='hidden' name='qstr' value='{$qstr}' />\r\n";
            echo "<table width='100%' style='margin-top:6px;z-index:9000;'>\r\n";
    ?>
    <tr height='28'>
        <td width="80" class='bline'>&nbsp;目标栏目:</td>
        <td class='bline'>
        <?php echo $typeOptions; ?>
        </td>
    </tr>
    <tr height='32'>
        <td width="80" class='bline'>&nbsp;文档ID:</td>
        <td class='bline'>
            <input type='text' name='tmpids' value="<?php echo $qstr; ?>" style='width:310px;overflow:hidden;' />
            <br />
            复制到的目标栏目必须和选定的文档频道类型一致,否则程序会自动勿略不符合的文档。
        </td>
    </tr>
    <tr height='32'>
        <td colspan='2' align='center' style='padding-top:12px'>
            <input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" class="np" border="0" style="cursor:pointer" />
            &nbsp;&nbsp;
            <img src="images/button_back.gif" width="60" height="22" border="0" onclick='HideObj("<?php echo $divname; ?>");ChangeFullDiv("hide");' style="cursor:pointer" />
        </td>
    </td>
    </tr>
    </table>
    </form>
    <?php
        //AJAX窗体结束
        }
        else
        {
            $totype = preg_replace("#[^0-9]#", '', $totype);
            $typeInfos = $dsql->GetOne("SELECT tp.channeltype,tp.ispart,tp.channeltype,ch.maintable,ch.addtable,ch.issystem FROM `me_arctype` tp LEFT JOIN `me_channeltype` ch on ch.id=tp.channeltype WHERE tp.id='$totype' ");
            $idtype = "id";
            if(!is_array($typeInfos))
            {
                ShowMsg('参数错误!','-1');
                exit();
            }
            if($typeInfos['ispart']!=0)
            {
                ShowMsg('文档保存的栏目必须为最终列表栏目!','-1');
                exit();
            }
            if(empty($typeInfos['addtable']))

    {
                $typeInfos['maintable'] = 'me_archives';
            }
            //增加单表模型判断
            if($typeInfos['issystem'] == -1)
            {
                $typeInfos['maintable'] = $typeInfos['addtable'];
                $idtype = "aid";
            }
            $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
            $arc = '';
            $j = 0;
            $okids = array();
            $dsql->SetQuery("SELECT {$idtype},typeid FROM `{$typeInfos['maintable']}` WHERE {$idtype} in($arcids) AND channel='{$typeInfos['channeltype']}' ");
            $dsql->Execute();
            while($row = $dsql->GetArray())
            {
                if($row['typeid']!=$totype)
                {
    $dsql->ExecuteNoneQuery("insert into me_arctiny (typeid,typeid2,arcrank,channel,senddate,sortrank,mid) select typeid,typeid2,arcrank,channel,senddate,sortrank,mid from me_arctiny where id='{$row[$idtype]}'");
    $xid = $dsql->GetLastID();  
                    $dsql->ExecuteNoneQuery("insert into `{$typeInfos['maintable']}`(id,typeid,typeid2,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) select case when id>'0' then '$xid'  else '' end, case when typeid>'0' then '$totype'  else '' end,typeid2,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 from `{$typeInfos['maintable']}` WHERE id='{$row[$idtype]}' ");
                    $dsql->ExecuteNoneQuery("insert into `{$typeInfos['addtable']}`(aid,typeid,body,redirecturl,templet,userip,bigpic) select case when aid>'0' then '$xid'  else '' end,$totype,body,redirecturl,templet,userip,bigpic from `{$typeInfos['addtable']}` WHERE aid='{$row[$idtype]}' ");
                    $okids[] = $row[$idtype];
                    $j++;
                }
            }
            //更新HTML
            foreach($okids as $aid)
            {
                $arc = new Archives($aid);
                $arc->MakeHtml();
            }
            ShowMsg("成功复制 $j 个文档!", $ENV_GOBACK_URL);
            exit();
        }
    }

    会员购买:>> 点击购买 << | 魔扣币购买:>> 点击购买 <<
    承接业务:服务器代维丨网站托管丨SEO
    联系客服:微信:morko-net | QQ:1367681973

    该用户从未签到

    2

    主题

    253

    回帖

    508

    积分

    高级魔扣

    Rank: 4

    魔扣币
    253
    贡献
    253
    威望
    0
    发表于 2020-6-18 10:57:35 | 显示全部楼层
    真正的朋友,无所谓远近,无所谓性别,也许朋友近在咫尺,也许朋友远在天涯。只要缘相知,心相惜,魔扣源码论坛上的朋友彼此拥有一份美好,彼此关照,这份相知,相助,相契,就是人间最温暖,最惬意,最畅快,最美好的意境,就是人间最真挚的感动!

    该用户从未签到

    6

    主题

    240

    回帖

    486

    积分

    中级魔扣

    Rank: 3Rank: 3

    魔扣币
    240
    贡献
    240
    威望
    0
    发表于 2020-8-29 11:38:53 来自手机 | 显示全部楼层
    谢谢!一定是苍天的美意,你我才相会在网易,一定是神灵的知遇,你我才结下了友谊,一定是命运的安排,你我才充满了情意,一定是缘分的奇迹,你我才成为了知己,人生能够拥有友谊,那是生命最美收益,无论你我置身何处,快乐会永随我与你,魔扣源码论坛愿我的祝福能够带给你幸福快乐。
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    • 联系我们
    • 新浪微博 :
    • 在线客服 :魔扣科技 
    • 源码QQ群 :魔扣源码论坛官方总群
    • 联系邮箱 :charlin#morko.net
    • 微信扫一扫
    快速回复 返回顶部 返回列表