phpcms2008同时发布到其他栏目

 

 

 

 

 修改页面,

增加【同时发布到其他栏目】。注意:此功能只能实现发布数据到其他栏目,如果其他栏目存在此条信息,并不会修改内容。而是增加一条新的内容。原来的信息保留。

 

 

关联的文件:

phpcms\data\cache_model\content_form.class.php

 

 

function catid($field, $value, $fieldinfo)

 

$publishCats = '';

              if(defined('IN_ADMIN') && $action=='add') $publishCats = "<a href='' class=\"jqModal\" οnclick=\"$('.jqmWindow').show();\"/> [同时发布到其他栏目]</a>";

              return $data.' '.$publishCats;

改为

$publishCats = '';

              if(defined('IN_ADMIN') && ($action=='add'||$action=='edit')) $publishCats = "<a href='' class=\"jqModal\" οnclick=\"$('.jqmWindow').show();\"/> [同时发布到其他栏目]</a>";

              return $data.' '.$publishCats;

 

 

 

 

 

phpcms\admin\content.inc.php

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


将edit修改为:

 case 'edit':

 

              if($dosubmit)

              {

                     $info['status'] = ($status == 2 || $status == 3) ? $status : 99;

                     $c->edit($contentid, $info);

 

                     $array2 = array($info['catid']);

                     $cat_selected = array_diff($cat_selected, $array2); //过滤相同栏目。当前栏目不在添加信息                  

                     if($cat_selected!=NULL&&count($cat_selected)>0){

                            $contentid = $c->add($info,$cat_selected);

                     }

                     showmessage('修改成功!', $forward);

              }

              else

              {

                     require CACHE_MODEL_PATH.'content_form.class.php';

                     $content_form = new content_form($modelid);

                     $forminfos = $content_form->get($data);

                    

                     require_once 'tree.class.php';

            foreach($CATEGORY as $cid=>$c)

            {

                            if($c['module'] != $mod || $c['type'] > 0) continue;

                            $checkbox = $c['child'] ? '' : '<input type="checkbox" name="cat_selected[]" value="'.$cid.'">';

                            $cats[$cid] = array('id'=>$cid, 'parentid'=>$c['parentid'], 'name'=>$c['catname'], 'checkbox'=>$checkbox);

            }

                     $str = "<tr><td style='height:22px;padding:0 0 0 10px;'>\$spacer\$name</td><td>\$checkbox</td></tr>";

                     $tree = new tree($cats);

                     $categorys = $tree->get_tree(0, $str);

 

 

                     include admin_tpl('content_edit');

              }

              break;

 

 

 

//修正了修改信息的栏目修改信息后重复出现一个相同信息的问题

 

 

    case 'edit':

 

              if($dosubmit)

              {

                     $info['status'] = ($status == 2 || $status == 3) ? $status : 99;

                     if($cat_selected!=NULL&&count($cat_selected)>0){

                            $c->delete($contentid); //修正了相同栏目重复出现一个相同信息

                            $array2 = array($info['catid']);

                            $cat_selected = array_diff($cat_selected, $array2); //过滤相同栏目。当前栏目不在添加信息                  

                            $contentid = $c->add($info,$cat_selected);

                     }else{

                            $c->edit($contentid, $info);

                     }

                     //var_dump($contentid);var_dump($old_catid);var_dump($cat_selected);

                     showmessage('修改成功!', $forward);

              }

              else

              {

                     require CACHE_MODEL_PATH.'content_form.class.php';

                     $content_form = new content_form($modelid);

                     $forminfos = $content_form->get($data);                 

                     require_once 'tree.class.php';

            foreach($CATEGORY as $cid=>$c)

            {

                            if($c['module'] != $mod || $c['type'] > 0) continue;

                            $checkbox = $c['child'] ? '' : '<input type="checkbox" name="cat_selected[]" value="'.$cid.'">';

                            $cats[$cid] = array('id'=>$cid, 'parentid'=>$c['parentid'], 'name'=>$c['catname'], 'checkbox'=>$checkbox);

            }

                     $str = "<tr><td style='height:22px;padding:0 0 0 10px;'>\$spacer\$name</td><td>\$checkbox</td></tr>";

                     $tree = new tree($cats);

                     $categorys = $tree->get_tree(0, $str);

                     include admin_tpl('content_edit');

              }

              break;

 

修正了栏目选择窗口不显示当前栏目

 

    case 'edit':

 

              if($dosubmit)

              {

                     $info['status'] = ($status == 2 || $status == 3) ? $status : 99;

                     if($cat_selected!=NULL&&count($cat_selected)>0){

                            $c->delete($contentid); //修正了相同栏目重复出现一个相同信息

                            $array2 = array($info['catid']);

                            $cat_selected = array_diff($cat_selected, $array2); //过滤相同栏目。当前栏目不在添加信息                  

                            $contentid = $c->add($info,$cat_selected);

                     }else{

                            $c->edit($contentid, $info);

                     }

                     //var_dump($contentid);var_dump($old_catid);var_dump($cat_selected);

                     showmessage('修改成功!', $forward);

              }

              else

              {

                     require CACHE_MODEL_PATH.'content_form.class.php';

                     $content_form = new content_form($modelid);

                     $forminfos = $content_form->get($data);                 

                     require_once 'tree.class.php';

            foreach($CATEGORY as $cid=>$c)

            {

                            if($cid!=$catid){//当前栏目不显示,add模块也可以采用这种方式

                            if($c['module'] != $mod || $c['type'] > 0) continue;

                            $checkbox = $c['child'] ? '' : '<input type="checkbox" name="cat_selected[]" value="'.$cid.'">';

                            $cats[$cid] = array('id'=>$cid, 'parentid'=>$c['parentid'], 'name'=>$c['catname'], 'checkbox'=>$checkbox);

                            }

            }

                     $str = "<tr><td style='height:22px;padding:0 0 0 10px;'>\$spacer\$name</td><td>\$checkbox</td></tr>";

                     $tree = new tree($cats);

                     $categorys = $tree->get_tree(0, $str);

                     include admin_tpl('content_edit');

              }

              break;

 

 

 

 

phpcms\admin\templates\content_edit.tpl.php

 

 

 

 

添加js

<script type="text/javascript" src="images/js/form.js"></script>

<script type="text/javascript" src="images/js/jqModal.js"></script>

<script type="text/javascript" src="images/js/jqDnR.js"></script>

 

 

 

 

</table>

</div>

 

<div class="jqmWindow">

<h5 class="title" style="cursor:move"><a href="#" class="jqmClose"><img src="images/close.gif" alt="" height="16px" width="16px" /></a>同时发布到其他栏目</h5>

<div id="protocol" style="height:300px;overflow:auto;">

<table cellpadding="0" cellspacing="1" class="table_list">

<caption>请选择栏目</caption>

<?=$categorys?>

<tr>

  <td></td><td><input type="button" value="确定" id="ok" onClick="$('.jqmWindow').hide();" style="width:60px"></td>

</tr>

</table>

</div>

</div>

 

</form>

<script LANGUAGE="javascript">

<!--

function preview_content()

{

       myform.action = "preview.php";

       myform.target = "_blank";

       myform.submit();

       myform.action = "?mod=<?=$mod?>&file=<?=$file?>&action=<?=$action?>&catid=<?=$catid?>&modelid=<?=$modelid?>";

       myform.target="_self";

}

$().ready(function() {

         $('form').checkForm(1);  

       $('.jqmWindow').jqm({overlay: 0      }).jqDrag('.title');

       });

//-->

</script>

</body>

</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值