[chora] Fwd: Searching in chora
Chuck Hagenbuch
chuck at horde.org
Thu Apr 3 16:23:28 PST 2003
----- Forwarded message from CDeRuiter at Ovid.com -----
Date: Thu, 3 Apr 2003 14:27:29 -0700
From: Chris DeRuiter <CDeRuiter at Ovid.com>
Reply-To: Chris DeRuiter <CDeRuiter at Ovid.com>
Subject: Searching in chora
To: "'chuck at horde.org'" <chuck at horde.org>
Chuck,
I've made a small change to your code for chora and with this I'm able to
have our people searching for files within the
Cvs repository.
It basically is one small hack in the cvs.php and a renamed cvs.php called
search_cvs.php
With this I'm including the code.
OK I know I'm not a programmer but for a scripter, I would say it works!!
CVS.PHP
59 /* This is where our HACK could come */
60 ?>
61 <table>
62 <form method="post" action="/horde/chora/search_vcs.php">
63 <tr class = item1><td>File Name</td><td>
64 <input type="text" name="fname"></td>
65 <td>File Name Contains</td><td>
66 <input type="text" name="fuzzy"></td><td>
67 <input type="submit" value="Submit Search" >
68 </td></tr></form>
69 </table>
70 <?php
search_cvs.php
The substr 26 strips away the first part of the path to my vcs repository
and of course -2 strips the vcs extension.
<?php
define('CHORA_BASE', dirname(__FILE__));
require_once CHORA_BASE . '/lib/base.php';
require_once HORDE_BASE . '/config/mime_mapping.php';
require_once HORDE_BASE . '/config/mime_drivers.php';
require_once HORDE_BASE . '/lib/MIME/Magic.php';
require_once HORDE_BASE . '/lib/MIME/Viewer.php';
require_once CHORA_BASE . '/config/mime_drivers.php';
if (@is_dir($fullname)) {
/* checkError() is the error trapping function. */
checkError($dir = $CVS->queryDir($where));
$atticFlags = $acts['sa'] ? CVSLIB_ATTIC_SHOW : CVSLIB_ATTIC_HIDE;
checkError($dir->browseDir(CVSLIB_LOG_QUICK, $atticFlags));
$dir->applySort($acts['sbt'], $acts['ord']);
checkError($dirList =& $dir->queryDirList());
checkError($fileList = $dir->queryFileList($atticFlags));
/* Decide what title to display */
if ($where == '') {
$title = $conf['options']['introTitle'];
} else {
$title = sprintf(_("CVS Directory of /%s"),
Text::htmlallspaces($where));
}
if ($acts['sa']) {
$extraLink='<a href="' . Chora::url('cvs', $where, array('sa' => 0))
. '">' . _("Hide Deleted Files") .
'</a>';
} else {
$extraLink='<a href="' . Chora::url('cvs', $where, array('sa' => 1))
. '">' . _("Show Deleted Files") .
'</a>';
}
$js_onLoad = null;
require CHORA_TEMPLATES . '/common-header.inc';
require CHORA_BASE . '/menu.php';
require CHORA_TEMPLATES . '/headerbar.inc';
$dirrow = 0;
$fnamesrch = $HTTP_POST_VARS["fname"];
//$fuzzysrch = $HTTP_POST_VARS["fuzzy"];
if ( $fnamesrch ){
exec("find /repository/fs001/vc-data -name $fnamesrch,v
-print", $TempFile);
$itemnr = "item0";
print "<table>";
print "<tr class =smallheader>";
print "<td align=left><h4>Searching on</h4></td><td><h5>
$fnamesrch</h5>";
print "</td></tr>";
foreach ($TempFile as $currFile) {
$currFile = substr($currFile,26,-2);
//print "<tr class = $itemnr><td colspan = 2><a
href=\"https://doubt.ovid.com/horde/chor
a/cvs.php/$currFile?login=1\">";
print "<tr class = $itemnr><td colspan = 2><a
href=\"https://doubt.ovid.com/horde/chora/
cvs.php/$currFile\">";
print "$currFile";
print "</a>";
print "</td></tr>";
if ( "$itemnr" == "item0" ){
$itemnr = "item1";
} else {
$itemnr = "item0";
}
}
}
print "</table>";
$fuzzysrch = $HTTP_POST_VARS["fuzzy"];
if ( $fuzzysrch ){
exec("find /repository/fs001/vc-data -name *$fuzzysrch*,v
-print", $TempFile2);
$itemnr = "item0";
print "<table>";
print "<tr class =smallheader>";
print "<td align=left><h4>Searching on</h4></td><td><h5>
$fuzzysrch</h5>";
print "</td></tr>";
foreach ($TempFile2 as $currFile2) {
$currFile2 = substr($currFile2,26,-2);
//print "<tr class = $itemnr><td colspan = 2><a
href=\"https://doubt.ovid.com/horde/chor
a/cvs.php/$currFile2?login=1\">";
print "<tr class = $itemnr><td colspan = 2><a
href=\"https://doubt.ovid.com/horde/chora/
cvs.php/$currFile2\">";
print "$currFile2";
print "</a>";
print "</td></tr>";
if ( "$itemnr" == "item0" ){
$itemnr = "item1";
} else {
$itemnr = "item0";
}
}
}
print "</table>";
}
-------------------------------
Chris de Ruiter
Build manager / PVCS Manager
9350 South 150 East
Ste. 200
Sandy, Utah 84070
Phn. Home : +801 963-5036
Phn. Work : +801 304-3224
Fax. : +801 304-3001
Email : chris_deruiter at ovid.com <mailto:chris_deruiter at ovid.com>
: http://www.ovid.com <http://www.ovid.com>
Yoda >> "You MUST UNLEARN what you have learned"
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to which they are addressed.
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system. If you are not the intended recipient you are
notified that disclosing, copying, forwarding or otherwise distributing or
taking any action in reliance on the contents of this information is
strictly prohibited.
----- End forwarded message -----
-chuck
--
Charles Hagenbuch, <chuck at horde.org>
"... It is not more light we need, but more warmth! We die of cold, not of
darkness. It is not the night that kills, but the frost." - Miguel de
Unamuno
More information about the chora
mailing list