<?
$str = $_SESSION["Sstring"];
echo `<script language=javascript>`,$crlf;
echo `function GetSrchStr()`,$crlf;
echo `{`,$crlf;
echo `	lsstr=prompt("Enter the string to search","`,$str,`");`,$crlf;
echo `  if (lsstr=="") {lsstr="NULL";}`,$crlf;
echo `	window.document.Help.action="Help.php?iprm=`,$iPrm,`&iprm2=`,$iPrm2,`&tabRoot=`,$tabRoot,`&lsstr="+lsstr ;`,$crlf;
echo `	window.document.Help.submit(true);`;
echo `}`,$crlf;
echo `function PopTab(itm)`,$crlf;
echo `{`,$crlf;
echo `  return popitup("Help.php?iprm="+itm,50,100,600,"800,resizable=1,scrollbars=yes,location=no,toolbar=no,status=no,menubar=yes");`,$crlf;
echo `}`,$crlf;
echo `function PopIss(itm)`,$crlf;
echo `{`,$crlf;
echo `  return popitup("IssueEdit.php?id="+itm,50,100,600,"800,resizable=1,scrollbars=yes,location=no,toolbar=no,status=no,menubar=yes");`,$crlf;
echo `}`,$crlf;
echo `</script>`;

if ("$str"==``) echo `<body onload="javascript:GetSrchStr();">`,$crlf;
else
  {
//echo "<br>Role=$userRole<br>";
    $NOSORT=1;
    echo `<center><font size=4>Search Results for <i><font color=red>`,$str,`</font></i></font>`,$crlf;
    $lnkT="concat(`<a href=".$dq."javascript:PopTab(`,TabID,`);".$dq.">`,TabName,`</a>`)";
    $lnkI="concat(`<a href=".$dq."javascript:PopIss(`,IssueID,`);".$dq.">`,IssueID,`</a>`)";
    ShowQueryResult("select `Tab` as Type, $lnkT as Item, Title as Description from Tabs where ProjectId in (`$ProjectId`,0) and isDeleted=0 and (AuthorizedRoles=`` or instr(AuthorizedRoles,`$userRole;`)>0) and (instr(Description,`$str`)>0 or instr(Tabs.Title,`$str`)>0 or instr(Tabs.TabName,`$str`)>0) union select `Issue` as Type, $lnkI as Item, IssueTitle as Description from IssueTracker_IssuesView where ProjectId in (`$ProjectId`,0) and (instr(IssueTitle,`$str`)>0 or instr(AssignedDisplayName,`$str`)>0 or instr(OwnerDisplayName,`$str`)>0 or instr(CreatorDisplayName,`$str`)>0) order by Description");
    $_SESSION["Sstring"]=``;
    echo `</center>`;
  }
?>