Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
1、把下面复制存成SearchIndex.php跟index.php放同一目录 |
最后编辑, 05-10-21 11:53 回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
2、把下面复制存成SearchResult.php跟index.php放同一目录 |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
3、把下面复制存成SearchIndex.tpl放Template目录下 {$CssStyle} {$BugConfig.Title} /* Create the text arrays and value arrays used to create the select */ var StatusText = new Array({$StatusText}); var StatusValue = new Array({$StatusValue}); var SeverityText = new Array({$SeverityText}); var SeverityValue = new Array({$SeverityValue}); var TypeText = new Array({$TypeText}); var TypeValue = new Array({$TypeValue}); var OSText = new Array({$OSText}); var OSValue = new Array({$OSValue}); var ResolutionText = new Array({$ResolutionText}); var ResolutionValue = new Array({$ResolutionValue}); var UserText = new Array({$UserText}); var UserValue = new Array({$UserValue}); var DefaultFieldsText = new Array({$DefaultFieldsText}); var DefaultFieldsValue = new Array({$DefaultFieldsValue}); {literal} /** * Control the display of Query table and CustomSet table. * * @author leeyupeng */ function setCustomSetTable() { if(document.getElementById("QueryTable").style.display == "none") { document.getElementById("QueryTable").style.display = ""; document.getElementById("CustomSetTable").style.display = "none"; } else { document.getElementById("QueryTable").style.display = "none"; document.getElementById("CustomSetTable").style.display = ""; } } /** * Set to the default fields to show in QueryBug.php. * * @author leeyupeng */ function setDefaultFields(ItemList) { for(var x=ItemList.length-1; x>=0; x--) { var opt = ItemList.options[x]; ItemList.options[x] = null; } for(var x=0; x {foreach from=$QueryFieldList2 key=FieldNO item=Field} {if $FieldNO == "0"}{$TplConfig.QueryBugForm.QueryGroup2}{else}{$AndOrList2.$FieldNO}{/if} {$Field} {$OperatorList2.$FieldNO} {$ValueList2.$FieldNO} {/foreach} {foreach from=$SelectQueryFieldList item=SelectQueryField} {$SelectQueryField} {/foreach} {$BugConfig.RnDTeam} |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
4、把下面复制存成SearchResult.tpl放Template目录下 {$CssStyle} {$BugConfig.Title} {$TplConfig.SearchResult.SearchTitle} {if ($RecordTotal==0)}{$TplConfig.SearchResult.NoResult}{else}{$TplConfig.SearchResult.Total}{$RecordTotal}{$TplConfig.SearchResult.Record}{$TplConfig.SearchResult.Div}{$PageTotal}{$TplConfig.SearchResult.Page}{/if} {foreach from=$SearchResultlist key=BugID item=BugInfo} {$TplConfig.QueryBug.BugID}:{$BugInfo.BugID} {$BugInfo.FullInfo} {$TplConfig.QueryBug.BugTitle}:{$BugInfo.BugTitle} {$TplConfig.SearchResult.UserName}{$BugInfo.UserName} {$BugInfo.ActionDate} {/foreach} {if ($RecordTotal0)}{$RecordPage}{/if} {$BugConfig.RnDTeam} |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
5、把下面两个函数贴到FunctionsMain.inc.php文件的后面 function SearchBugFullText($QueryCondition,$KeyWordList) { global $BugConfig; global $MyDB; $BugUserList = bugGetUserList(); $SQL = " SELECT buginfo.BugID , buginfo.BugTitle, bughistory.UserName , bughistory.FullInfo , bughistory.ActionDate"; $SQL .=" FROM buginfo,bughistory"; $SQL .= $QueryCondition; //where #echo $SQL; $ResultID = $MyDB->query($SQL); if($ResultID) { while($BugInfo = $ResultID->fetchRow()) { // Set the short title. $BugInfo["FullInfo"] = sysSubStr($BugInfo["FullInfo"],300,true); $BugInfo["FullInfo"] = KeyWordHeightLight($BugInfo["FullInfo"],$KeyWordList); $BugInfo["FullInfo"] = nl2br($BugInfo["FullInfo"]); $BugInfo["BugTitle"] = sysSubStr($BugInfo["BugTitle"],20,true); $BugInfo["UserName"] = !empty($BugUserList[$BugInfo["UserName"]])? $BugUserList[$BugInfo["UserName"]] :$BugInfo["UserName"]; $SearchResultList[] = $BugInfo; } } return $SearchResultList; } function KeyWordHeightLight($text,$KeywordList,$color="#FF0000")//$color="#FFFF00" { $HeightLightText=$text; if (is_array($KeywordList) AND ($text"") AND (!empty($text))) { foreach ($KeywordList AS $KeyWord) { $HeightLightKeyWord ="".$KeyWord.""; //$HeightLightKeyWord ="".$KeyWord.""; $HeightLightText =str_replace($KeyWord,$HeightLightKeyWord,$HeightLightText); } } return $HeightLightText; } |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
6、把下面两个函数加到语言文件中(chinese.php和english.php) /* Setting of SearchIndex.php. */ $TplConfig["SearchIndex"]["Intro"] ="维护记录搜索引擎"; $TplConfig["SearchIndex"]["SearchBtn"] ="搜索"; /* Setting of SearchResult.php. */ $TplConfig["SearchResult"]["NoResult"] ="对不起,根据您指定的条件在数据库中找不到数据。返回"; $TplConfig["SearchResult"]["SearchTitle"] ="搜索结果:(返回上一页)"; $TplConfig["SearchResult"]["UserName"] ="信息填写人:"; $TplConfig["SearchResult"]["Total"] ="找到相关处理记录约:"; $TplConfig["SearchResult"]["Record"] ="条,"; $TplConfig["SearchResult"]["Div"] ="分"; $TplConfig["SearchResult"]["Page"] ="页显示"; |
最后编辑, 05-10-21 11:59 回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
7、把下面函数贴到Page.class.php文件中。或把 SearchResult.php中的$TPL->assign("RecordPage",$MyPage->show1());改成$TPL->assign("RecordPage",$MyPage->show());也可以 /** * 显示查询结果的分页链接。 * * @return string 返回导航条文字。 * @param int $SectionMax 分页条区间长度。默认值为15,必须为奇数。 * @param string $Align 对其方式,默认为居中对齐。left|center|right * @param booble $JsOut 是否以JS脚本的形式输出。 */ function Show1($SectionMax = 15,$Align="center",$JsOut = false) { //定义样式表信息,通过JS脚本的形式输出,增加这个类文件的独立性。 $StyleString = _PageTotal;$I>=1;$I--) { $PageIdList[$Y] = $I; $Y ++; } //如果页码总数为零,则直接退出。 if($this->_RecTotal == 0) { $LinkString = $TableBegin."Sorry, no record yet\n"; $LinkString .= $TableEnd; return $LinkString; } //链接文字条开始。 $LinkString = $TableBegin; /** * 显示记录总数。 */ #$LinkString .= "Record:$this->_RecTotal"; /** * 生成第一页的链接。(对应正常分页的最后一页。) */ //如果是最后一页,只显示文字,不生成链接。 if($this->_PageID == $this->_PageTotal) { $LinkString .= $this->createTD($FirstPage,"BoldText"); } else { $LinkString .= $this->createTD($this->Link($FirstPage,$this->_URL."PageID=".$this->_PageTotal)); } /** * 判断前一页的链接。 */ //如果是最后一页,则只显示文字,不生成链接。 if($this->_PageID == $this->_PageTotal) { $LinkString .= $this->createTD($PrePage,"BoldText"); } else { $LinkString .= $this->createTD($this->Link($PrePage,$this->_URL."PageID=".($this->_PageID + 1))); } /** * 生成中间页码的链接。 */ //最后一页的情况,实际上是从最后一页开始倒数15。 if($this->_PageID == $this->_PageTotal) { for($I = $this->_PageTotal;$I > ($this->_PageTotal - $SectionMax) and $I > 0;$I --) { if($I != $this->_PageTotal) { $LinkString .= $this->createTD($this->Link($PageIdList[$I],$this->_URL."PageID=".$I)); } else { $LinkString .= $this->createTD($PageIdList[$I],"BoldText"); } } } //第一页的情况,实际是从第一页正数$SectionMax。 elseif($this->_PageID == 1) { if($this->_PageTotal < $SectionMax) { $PageStart = $this->_PageTotal; } else { $PageStart = $SectionMax; } for($I = $PageStart ; $I >= 1; $I --) { if($I != 1) { $LinkString .= $this->createTD($this->Link($PageIdList[$I],$this->_URL."PageID=".$I)); } else { $LinkString .= $this->createTD($PageIdList[$I],"BoldText"); } } } //中间页码的情况。 else { $PageStart = $this->_PageID + ($SectionMax - 1) /2; if($PageStart > $this->_PageTotal) { $PageStart = $this->_PageTotal; } $PageEnd = $this->_PageID - ($SectionMax - 1) /2; if($PageEnd != $PageStart - $SectionMax) { $PageEnd = $PageStart - $SectionMax + 1; } if($PageEnd < 1) { $PageEnd = 1; } if($PageStart != $PageEnd + $SectionMax) { $PageStart = $PageEnd + $SectionMax - 1; } if($PageStart > $this->_PageTotal) { $PageStart = $this->_PageTotal; } for($I = $PageStart;$I >= $PageEnd;$I --) { if($I != $this->_PageID) { $LinkString .= $this->createTD($this->Link($PageIdList[$I],$this->_URL."PageID=".$I)); } else { $LinkString .= $this->createTD($PageIdList[$I],"BoldText"); } } } /** * 生成下一页的链接。 */ //如果是第一页,则只显示文字,不生成链接。 if($this->_PageID == 1) { $LinkString .= $this->createTD($NextPage,"BoldText"); } else { $LinkString .= $this->createTD($this->Link($NextPage,$this->_URL."PageID=".($this->_PageID - 1))); } /** * 生成最后一页的链接。 */ if($this->_PageID == 1) { $LinkString .= $this->createTD($EndPage,"BoldText"); } else { $LinkString .= $this->createTD($this->Link($EndPage,$this->_URL."PageID=1")); } /** * 显示页面总数。 */ #$LinkString .= "Page:$this->_PageTotal"; $LinkString .= $TableEnd; //判断输出方式。 if($JsOut) { //将LinkString用换行符分开,然后做循环,用document.write括起来。输出为JS脚本的形式。 $LinkString = explode("\n",$LinkString); for($I = 0; $I < count($LinkString);$I ++) { if(!empty($LinkString[$I])) { $LinkString[$I] = 'document.write("'.$LinkString[$I].'")'.";\n"; } } $LinkString = join('',$LinkString); return $StyleString."\n".$LinkString.""; } else { return $StyleString.$LinkString; } } |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
8、访问SearchIndex.php文件试试? |
回帖 |
aleung 访问次数 : 101 注册日期 : 05-05-03 16:11 上次访问 : 09-10-29 21:05 |
这个论坛不提供上传附件功能? :( |
回帖 |
cuteser 访问次数 : 242 注册日期 : 07-07-06 22:46 上次访问 : 09-10-29 21:05 |
在BugFree1.1中按上述的操作,访问SearchIndex.php后,在最下面的EDITBOX控件输入待搜索的关键字,然后点击其右侧的按钮,出现以下提示: 提示Fatal error: Call to undefined function: getrecordtotal() in D:\AMP\WWW\Bugfree\SearchResult.php on line 167 |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
你的page.class.php没有 function GetRecordTotal() { return $this->_RecTotal; } 这段代码? |
回帖 |
cuteser 访问次数 : 242 注册日期 : 07-07-06 22:46 上次访问 : 09-10-29 21:05 |
[quote=Mr.Lee]你的page.class.php没有 function GetRecordTotal() { return $this->_RecTotal; } 这段代码?[/quote] 没有,俺这里这个文件是2005/9/1的,加上上面代码后,出现以下错误提示: Fatal error: Call to undefined function: getpagetotal1() in D:\AMP\WWW\Bugfree\SearchResult.php on line 175 俺可是用侬提供的2007/4/19那个安装版安装的。 |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
这绝对是我的疏忽,下面是整个文件,缺啥补啥吧,哈哈... [code] |
回帖 |
cuteser 访问次数 : 242 注册日期 : 07-07-06 22:46 上次访问 : 09-10-29 21:05 |
ok了。 能把“bug描述”里有 待搜索的关键字的bug记录给列出来。不错。 如果“bug标题”里有 带搜索的关键字,俺也想把这些记录列出来,在何处加代码呢?那还没仔细看您的代码:( |
回帖 |
Mr.Lee 访问次数 : 241 注册日期 : 05-10-06 10:46 上次访问 : 09-10-29 21:05 |
查 bug标题 你用自带的那个功能就足够了 如果你想查 bug标题和bug描述的内容一起搜索,我觉得没有多少必要,标题基本是对描述的概述,因此标题有的内容,描述都会有的。 代码在SearchResult.php里面 |
回帖 |