专注前端,专注网页设计制作 - (承接网页制作/模板制作/设计) QQ:755150799 织梦模板 | 网页特效 | 网站模板 | 建站教程 | TOP排行榜 | Tag标签 | 联系我们
当前位置: 网站首页 > 建站教程 > dedeCMS教程 > >

织梦dedecms后台文章百度收录排名开发教程

时间:2014-03-05来源:学技巧网站制作 作者:学技巧 阅读: 次 【 点评一下


1. 先把 :inc_baidu.php 放入后台根目录的的 inc 文件夹内,

2. 再把ext_baidu.php放入后台根目录

3. 然后修改后台根目录下的templets模版 文件夹 的content_list.htm :

代码如下:

<a href="javascript:getBaiduRanking(0)" class="coolbg"> 百度排名 </a>
   <a href="javascript:getBaiduShoulu(0)" class="coolbg"> 百度收录 </a>
<a href="javascript:getBaiduZhonghe(0)" class="coolbg"> 百度综合 </a>
4. 最后修改后台根目录下的js文件夹 的list.js :

代码如下:
//百度排名
function getBaiduRanking(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
location="ext_baidu.php?aid="+aid+"&dopost=BaiduRanking&qstr="+qstr;
}
//百度收录
function getBaiduShoulu(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
location="ext_baidu.php?aid="+aid+"&dopost=BaiduShoulu&qstr="+qstr;
}
//百度收录排名 综合查询
function getBaiduZhonghe(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
location="ext_baidu.php?aid="+aid+"&dopost=BaiduZhonghe&qstr="+qstr;
}



inc_baidu.php完整代码


<?php

require_once(dirname(__FILE__).'/../config.php');
require_once(DEDEADMIN.'/inc/inc_batchup.php');
require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
require_once(DEDEINC.'/typelink.class.php');
require_once(DEDEINC.'/arc.archives.class.php');


//得到标题
function getTitle($aid)
{
//利用传递ID,得到网址
$aid = $aid;
$aid = preg_replace("#[^0-9]#", '', $aid);
   $Archives=new Archives();
   //获取表信息
$arcQuery = "SELECT title FROM  `xjq_archives`  WHERE id='$aid' ";
       $arcRow =$Archives->dsql->GetOne($arcQuery);
$title=$arcRow[title];
return  $title;
}

//得到网址
function getUrl($aid){
//利用传递ID,得到网址
$aid = $aid;
$aid = preg_replace("#[^0-9]#", '', $aid);
   $Archives=new Archives();
   //获取主表信息
   $query = "SELECT arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon,
             tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
          FROM `xjq_arctiny` arc
          LEFT JOIN `xjq_arctype` tp ON tp.id=arc.typeid
          LEFT JOIN `xjq_channeltype` ch ON ch.id=tp.channeltype
          WHERE arc.id='$aid' ";
   $trow = $Archives->dsql->GetOne($query);
   $trow['maintable'] = ( trim($trow['maintable'])=='' ? 'xjq_archives' : trim($trow['maintable']) );
   if($trow['issystem'] != -1)
   {
       $arcQuery = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
                  FROM `{$trow['maintable']}` arc LEFT JOIN `xjq_arctype` tp on arc.typeid=tp.id
                  LEFT JOIN `xjq_channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
       $arcRow =$Archives->dsql->GetOne($arcQuery);
       if($arcRow['ismake']==-1 || $arcRow['corank']!=0 || $arcRow['arcrank']!=0 || ($arcRow['typeid']==0 && $arcRow['channel']!=-1) || $arcRow['money']>0)
       {
           $weburl='{$cfg_phpurl}/view.php?aid='.$aid;
         return $weburl;
       }
   }
   else
   {
       $arcRow['id'] = $aid;
       $arcRow['typeid'] = $trow['typeid'];
       $arcRow['senddate'] = $trow['senddate'];
       $arcRow['title'] = '';
       $arcRow['ismake'] = 1;
       $arcRow['arcrank'] = $trow['corank'];
       $arcRow['namerule'] = $trow['namerule'];
       $arcRow['typedir'] = $trow['typedir'];
       $arcRow['money'] = 0;
       $arcRow['filename'] = '';
       $arcRow['moresite'] = $trow['moresite'];
       $arcRow['siteurl'] = $trow['siteurl'];
       $arcRow['sitepath'] = $trow['sitepath'];
   }
   $arcurl  = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],$arcRow['ismake'],$arcRow['arcrank'],
   $arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']);
   $arcfile = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],
   $arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename']);
   if(preg_match("#^http:#", $arcfile))
   {
       $arcfile = preg_replace("#^http:\/\/([^\/]*)\/#i", '/', $arcfile);
   }
   $truefile = GetTruePath().$arcfile;
   if(!file_exists($truefile))
   {
       MakeArt($aid,TRUE);
   }
     $weburl=$arcurl;
 return $weburl;
}
/*//检查排名
function getBaiduRanking($aid)
{
//利用传递ID,得到网址
$aid = $aid;
$aid = preg_replace("#[^0-9]#", '', $aid);
   $Archives=new Archives();
   //获取主表信息
   $query = "SELECT arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon,
             tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
          FROM `xjq_arctiny` arc
          LEFT JOIN `xjq_arctype` tp ON tp.id=arc.typeid
          LEFT JOIN `xjq_channeltype` ch ON ch.id=tp.channeltype
          WHERE arc.id='$aid' ";
   $trow = $Archives->dsql->GetOne($query);
   $trow['maintable'] = ( trim($trow['maintable'])=='' ? 'xjq_archives' : trim($trow['maintable']) );
   if($trow['issystem'] != -1)
   {
       $arcQuery = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
                  FROM `{$trow['maintable']}` arc LEFT JOIN `xjq_arctype` tp on arc.typeid=tp.id
                  LEFT JOIN `xjq_channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
       $arcRow =$Archives->dsql->GetOne($arcQuery);
       if($arcRow['ismake']==-1 || $arcRow['corank']!=0 || $arcRow['arcrank']!=0 || ($arcRow['typeid']==0 && $arcRow['channel']!=-1) || $arcRow['money']>0)
       {
           $webname='{$cfg_phpurl}/view.php?aid='.$aid;
         //  exit();
       }
   }
   else
   {
       $arcRow['id'] = $aid;
       $arcRow['typeid'] = $trow['typeid'];
       $arcRow['senddate'] = $trow['senddate'];
       $arcRow['title'] = '';
       $arcRow['ismake'] = 1;
       $arcRow['arcrank'] = $trow['corank'];
       $arcRow['namerule'] = $trow['namerule'];
       $arcRow['typedir'] = $trow['typedir'];
       $arcRow['money'] = 0;
       $arcRow['filename'] = '';
       $arcRow['moresite'] = $trow['moresite'];
       $arcRow['siteurl'] = $trow['siteurl'];
       $arcRow['sitepath'] = $trow['sitepath'];
   }
   $arcurl  = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],$arcRow['ismake'],$arcRow['arcrank'],
   $arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']);
   $arcfile = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],
   $arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename']);
   if(preg_match("#^http:#", $arcfile))
   {
       $arcfile = preg_replace("#^http:\/\/([^\/]*)\/#i", '/', $arcfile);
   }
   $truefile = GetTruePath().$arcfile;
   if(!file_exists($truefile))
   {
       MakeArt($aid,TRUE);
   }
     $weburl=$arcurl;

$keyword=getTitle($aid);
$baiduurl = 'http://www.baidu.com/s?rn=100&wd='.$keyword;
$pagecode = RemoveUselessCode(file_get_contents($baiduurl));
//$pagecode = RemoveUselessCode($pagecode);
$seolist = getSeoList($pagecode);
$ranking = getNumber($seolist,$weburl);
return $ranking;
}*/
/*
//检查收录
function getBaiduShoulu($aid)
{
//利用传递ID,得到网址
$aid = $aid;
$aid = preg_replace("#[^0-9]#", '', $aid);
   $Archives=new Archives();
   //获取主表信息
   $query = "SELECT arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon,
             tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
          FROM `xjq_arctiny` arc
          LEFT JOIN `xjq_arctype` tp ON tp.id=arc.typeid
          LEFT JOIN `xjq_channeltype` ch ON ch.id=tp.channeltype
          WHERE arc.id='$aid' ";
   $trow = $Archives->dsql->GetOne($query);
   $trow['maintable'] = ( trim($trow['maintable'])=='' ? 'xjq_archives' : trim($trow['maintable']) );
   if($trow['issystem'] != -1)
   {
       $arcQuery = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
                  FROM `{$trow['maintable']}` arc LEFT JOIN `xjq_arctype` tp on arc.typeid=tp.id
                  LEFT JOIN `xjq_channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
       $arcRow =$Archives->dsql->GetOne($arcQuery);
       if($arcRow['ismake']==-1 || $arcRow['corank']!=0 || $arcRow['arcrank']!=0 || ($arcRow['typeid']==0 && $arcRow['channel']!=-1) || $arcRow['money']>0)
       {
           $weburl='{$cfg_phpurl}/view.php?aid='.$aid;
         //  exit();
       }
   }
   else
   {
       $arcRow['id'] = $aid;
       $arcRow['typeid'] = $trow['typeid'];
       $arcRow['senddate'] = $trow['senddate'];
       $arcRow['title'] = '';
       $arcRow['ismake'] = 1;
       $arcRow['arcrank'] = $trow['corank'];
       $arcRow['namerule'] = $trow['namerule'];
       $arcRow['typedir'] = $trow['typedir'];
       $arcRow['money'] = 0;
       $arcRow['filename'] = '';
       $arcRow['moresite'] = $trow['moresite'];
       $arcRow['siteurl'] = $trow['siteurl'];
       $arcRow['sitepath'] = $trow['sitepath'];
   }
   $arcurl  = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],$arcRow['ismake'],$arcRow['arcrank'],
   $arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']);
   $arcfile = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],
   $arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename']);
   if(preg_match("#^http:#", $arcfile))
   {
       $arcfile = preg_replace("#^http:\/\/([^\/]*)\/#i", '/', $arcfile);
   }
   $truefile = GetTruePath().$arcfile;
   if(!file_exists($truefile))
   {
       MakeArt($aid,TRUE);
   }
     $weburl=$arcurl;
  // exit();
//return $weburl;

   $baiduurl2 = 'http://www.baidu.com/s?wd='.$weburl;
//$baiduurl2 = 'http://www.baidu.com/s?wd=site%3A'.$weburl;
$pagecode2 = RemoveUselessCode(file_get_contents($baiduurl2));
$pagecode = RemoveUselessCode($pagecode);
$seolist2 = getSeoList($pagecode2);
$Shoulu = getShoulu($seolist2,$weburl);
return $Shoulu;
}*/
//检查排名
function getBaiduRanking($aid)
{
$aid = $aid;
$keyword=getTitle($aid);
$weburl=getUrl($aid);

$baiduurl = 'http://www.baidu.com/s?rn=100&wd='.$keyword;
$pagecode = RemoveUselessCode(file_get_contents($baiduurl));
//$pagecode = RemoveUselessCode($pagecode);
$seolist = getSeoList($pagecode);
$ranking = getNumber($seolist,$weburl);
return $ranking;
}
//检查收录
function getBaiduShoulu($aid)
{
$aid = $aid;
$weburl=getUrl($aid);

$baiduurl2 = 'http://www.baidu.com/s?wd='.$weburl;
//$baiduurl2 = 'http://www.baidu.com/s?wd=site%3A'.$webname;
$pagecode2 = RemoveUselessCode(file_get_contents($baiduurl2));
$pagecode = RemoveUselessCode($pagecode);
$seolist2 = getSeoList($pagecode2);
$Shoulu = getShoulu($seolist2,$weburl);
return $Shoulu;
}
/*
* 去除不必要代码 减少总字符数 增加处理速度
* @return string
*/
function RemoveUselessCode($string)
{
$string = preg_replace("/<style.*>.*<\/style>/isU", '', $string);//样式
$string = preg_replace("/<script.*>.*<\/script>/isU", '', $string);//JS
$string = preg_replace("/<div id=\"out\">.*<\/form><\/div>/isU", '', $string);//上导航
$string = preg_replace("/<div id=\"rs\">.*<\/body>/isU", '', $string);//相关搜索
$string = preg_replace("/http\:\/\/\w{1,4}\.baidu\.com\/.*\"/isU", '"', $string);//百度连接
$string = preg_replace("/<font color=#CC0000>(.*)<\/font>/isU", '\\1', $string);//文字颜色
$string = preg_replace("/<em>(.*)<\/em>/isU", '\\1', $string);//em标签
$string = preg_replace("/style=\".*\"/isU", '', $string);//分样式
$string = preg_replace("/onmousedown=\".*\"/isU", '', $string);//动作代码
//$string = preg_replace('/\s/isU', '', $string);
return $string;
}


/*
* 获得自然排名信息列表
* @return array
*/
function getSeoList($string)
{
//列表正则
$Preg='/<table cellpadding=\"0\" cellspacing=\"0\".*id=\"\d{1,3}\".*>.*<\/table>/isU';
//标题正则
//$titlePreg='/<h3 class=\"t\"><a.*>(.*)<\/a><\/h3>/isU';
$titlePreg='/<td class=\"{0,1}f\"{0,1}.*>.*<a.* href=\"(.*)\".*>(.*)<\/a>/isU';
//描述正则
$descriptionPreg='/<font size=\"{0,1}-1\"{0,1}>(.*)<br/isU';
//URL正则
$urlPreg='/<span class=\"g\">(.*)<\/span>/isU';
//人工干预
$urlspecial='/<font color=\"{0,1}#008000\"{0,1}>(.*)<\/font>/isU';

preg_match_all($Preg,$string,$listinfo);
//print_r($listinfo);
if($listinfo == "")
{
return "-";
}
else
{
$i=0;
$list=array();
foreach($listinfo[0] as $listOne)
{
preg_match($titlePreg,$listOne,$title);
preg_match($descriptionPreg,$listOne,$description);
$description[1] = preg_replace('/<.*>(.*)<\/>/isU', '\\1', $description[1]);
$list[$i]["title"]=$title[2];
$list[$i]["description"]=$description[1];
$list[$i]["url"]=$title[1];
$i++;
}
return $list;
}
}


/*
* 获得排名
* @return string
*/
function getNumber(array $list,$weburl)
{
$number = 0;
foreach($list as $i=>$one)
{
if(stripos($one["url"],$weburl,0) !== false)
{
$number = $i+1;
return $number;
break;
}
}
return $number;
}

/*
* 判断是否收录
* @return string
*/
function getShoulu(array $list,$weburl)
{
$shoulu = '否';
foreach($list as $i=>$one)
{
if(stripos($one["url"],$weburl,0) !== false)
{
$shoulu = '是';
return $shoulu;
break;
}
}
return $shoulu;
}

?>

ext_baidu.php完整代码

<?php
require_once(dirname(__FILE__).'/config.php');
require_once(DEDEADMIN.'/inc/inc_baidu.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>百度收录排名by : w2kan.com</title>
</head>

<body>

<?php
$dopost=$_GET['dopost'];
$aid=$_GET['aid'];
$qstr=$_GET['qstr'];
if(empty($dopost))
{
   ShowMsg('对不起,你没指定运行参数!','-1');
   exit();
}
$aid = isset($aid) ? preg_replace("#[^0-9]#", '', $aid) : '';

/*--------------------------
//文档百度排名
function getBaiduRanking(){ }
---------------------------*/
if($dopost=='BaiduRanking')
{
?>

<table width="500" border="1" align="center" cellpadding="1" cellspacing="1">
 <tr bgcolor="#CCFFFF">
   <td>ID</td>
   <td>标题</td>
   <td>百度排名</td>

 </tr>

<?php
  if( !empty($aid) && empty($qstr) ) $qstr = $aid;

   if($qstr=='')
   {
       ShowMsg("参数无效!","recycling.php");
       exit();
   }
   $qstrs = explode("`", $qstr);
   foreach($qstrs as $aid)
   {
echo '<tr><td>'.$aid.'</td>';
       echo '<td>'.getTitle($aid).'</td>';
       echo '<td>'.getBaiduRanking($aid).'</td></tr>';
   }



}

else if($dopost=='BaiduShoulu')
{
?>

<table width="500" border="1" align="center" cellpadding="1" cellspacing="1">
<tr bgcolor="#CCFFFF">
   <td>ID</td>
   <td>标题</td>
   <td>百度收录</td>
 </tr>

<?php
if( !empty($aid) && empty($qstr) ) $qstr = $aid;

   if($qstr=='')
   {
       ShowMsg("参数无效!","recycling.php");
       exit();
   }
   $qstrs = explode("`", $qstr);
   foreach($qstrs as $aid)
   {
echo '<tr><td>'.$aid.'</td>';
       echo '<td>'.getTitle($aid).'</td>';
       echo '<td>'.getBaiduShoulu($aid).'</td></tr>';
   }



}else if($dopost=='BaiduZhonghe')

{
?>
<table width="500" border="1" align="center" cellpadding="1" cellspacing="1">
 <tr bgcolor="#CCFFFF">
   <td>ID</td>
   <td>标题</td>
   <td>百度排名</td>
   <td>百度收录</td>
 </tr>

<?php
if( !empty($aid) && empty($qstr) ) $qstr = $aid;

   if($qstr=='')
   {
       ShowMsg("参数无效!","recycling.php");
       exit();
   }
   $qstrs = explode("`", $qstr);
   foreach($qstrs as $aid)
   {
echo '<tr><td>'.$aid.'</td>';
       echo '<td>'.getTitle($aid).'</td>';
       echo '<td>'.getBaiduRanking($aid).'</td>';
       echo '<td>'.getBaiduShoulu($aid).'</td></tr>';
   }



}
?>
</table>
<br/>
<br/>

<table width="500" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
   <td><a href="content_list.php">返回列表</a></td>
   <td>QQ:793664261

   by@ w2kan.com</td>
 </tr>
</table>

</body>
</html>

list.js 完整代码

<!--
if(moz) {
extendEventObject();
extendElementModel();
emulateAttachEvent();
}
function viewArc(aid){
if(aid==0) aid = getOneItem();
window.open("archives_do.php?aid="+aid+"&dopost=viewArchives");
}
function kwArc(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
location="archives_do.php?aid="+aid+"&dopost=makekw&qstr="+qstr;
}
function editArc(aid){
if(aid==0) aid = getOneItem();
location="archives_do.php?aid="+aid+"&dopost=editArchives";
}
function updateArc(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
location="archives_do.php?aid="+aid+"&dopost=makeArchives&qstr="+qstr;
}
function checkArc(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
location="archives_do.php?aid="+aid+"&dopost=checkArchives&qstr="+qstr;
}
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');
}
function adArc(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
location="archives_do.php?aid="+aid+"&dopost=commendArchives&qstr="+qstr;
}

function cAtts(jname, e, obj)
{
var qstr=getCheckboxItem();
   var screeheight = document.body.clientHeight + 20;
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
LoadQuickDiv(e, 'archives_do.php?dopost=attsDlg&qstr='+qstr+'&dojob='+jname+'&rnd='+Math.random(), 'attsDlg', '450px', '160px');
ChangeFullDiv('show', screeheight);
}

function delArc(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
location="archives_do.php?qstr="+qstr+"&aid="+aid+"&dopost=delArchives";
}

function QuickEdit(aid, e, obj)
{
LoadQuickDiv(e, 'archives_do.php?dopost=quickEdit&aid='+aid+'&rnd='+Math.random(), 'quickEdit', '450px', '300px');
ChangeFullDiv('show');
}
//百度排名
function getBaiduRanking(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
location="ext_baidu.php?aid="+aid+"&dopost=BaiduRanking&qstr="+qstr;
}
//百度收录
function getBaiduShoulu(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
location="ext_baidu.php?aid="+aid+"&dopost=BaiduShoulu&qstr="+qstr;
}
//百度收录排名 综合查询
function getBaiduZhonghe(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
if(qstr=='')
{
alert('必须选择一个或多个文档!');
return;
}
location="ext_baidu.php?aid="+aid+"&dopost=BaiduZhonghe&qstr="+qstr;
}
//上下文菜单
function ShowMenu(evt,obj,aid,atitle)
{
 var popupoptions
 popupoptions = [
   new ContextItem("浏览文档",function(){ viewArc(aid); }),
new ContextItem("编辑属性",function(){ QuickEdit(aid, evt, obj); }),
   new ContextItem("编辑文档",function(){ editArc(aid); }),
   new ContextSeperator(),
   new ContextItem("更新HTML",function(){ updateArc(aid); }),
   new ContextItem("审核文档",function(){ checkArc(aid); }),
   new ContextItem("推荐文档",function(){ adArc(aid); }),
   new ContextItem("删除文档",function(){ delArc(aid); }),
   new ContextSeperator(),
   new ContextItem("复制(<u>C</u>)",function(){ copyToClipboard(atitle); }),
   new ContextItem("重载页面",function(){ location.reload(); }),
   new ContextSeperator(),
   new ContextItem("全部选择",function(){ selAll(); }),
   new ContextItem("取消选择",function(){ noSelAll(); }),
   new ContextSeperator(),
   new ContextItem("关闭菜单",function(){})
 ]
 ContextMenu.display(evt,popupoptions);
 //location="catalog_main.php";
}
//获得选中文件的文件名
function getCheckboxItem()
{
var allSel="";
if(document.form2.arcID.value) return document.form2.arcID.value;
for(i=0;i<document.form2.arcID.length;i++)
{
if(document.form2.arcID[i].checked)
{
if(allSel=="")
allSel=document.form2.arcID[i].value;
else
allSel=allSel+"`"+document.form2.arcID[i].value;
}
}
return allSel;
}

//获得选中其中一个的id
function getOneItem()
{
var allSel="";
if(document.form2.arcID.value) return document.form2.arcID.value;
for(i=0;i<document.form2.arcID.length;i++)
{
if(document.form2.arcID[i].checked)
{
allSel = document.form2.arcID[i].value;
break;
}
}
return allSel;
}

function selAll()
{
for(i=0;i<document.form2.arcID.length;i++)
{
if(!document.form2.arcID[i].checked)
{
document.form2.arcID[i].checked=true;
}
}
}
function noSelAll()
{
for(i=0;i<document.form2.arcID.length;i++)
{
if(document.form2.arcID[i].checked)
{
document.form2.arcID[i].checked=false;
}
}
}
-->

分享到:
  • 用微信  “扫一扫”

    将文章分享到朋友圈。

    关注公众号:xue-jiqiao

本文版权归原作者所有,转载请注明原文来源出处,学技巧网站制作感谢您的支持!