From 73efd665cc1ae97f3802f741af8bd3c888a43648 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 23 May 2014 18:08:32 +0000 Subject: [PATCH] Added the code search result view --- codepot/src/codepot/views/code_search.php | 191 ++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 codepot/src/codepot/views/code_search.php diff --git a/codepot/src/codepot/views/code_search.php b/codepot/src/codepot/views/code_search.php new file mode 100644 index 00000000..efd869db --- /dev/null +++ b/codepot/src/codepot/views/code_search.php @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + +<?=htmlspecialchars($project->name)?> + + + + +
+ + + +load->view ('taskbar'); ?> + + + +load->view ( + 'projectbar', + array ( + 'banner' => NULL, + + 'page' => array ( + 'type' => 'project', + 'id' => 'code', + 'project' => $project, + ), + + 'ctxmenuitems' => array () + ) +); +?> + + + +
+ +
+converter->AsciiToHex('.') . $revreq; + } + + // print the main anchor for the root folder. + // let the anchor text be the project name. + print anchor ( + "code/file/{$project->id}{$revreqroot}", + htmlspecialchars($project->name)); + + // explode non-root folder parts to anchors + $exps = explode ('/', $headpath); + $expsize = count($exps); + $par = ''; + for ($i = 1; $i < $expsize; $i++) + { + print '/'; + $par .= '/' . $exps[$i]; + $xpar = $this->converter->AsciiToHex ($par); + print anchor ( + "code/file/{$project->id}/{$xpar}{$revreq}", + htmlspecialchars($exps[$i])); + } + + if ($headpath != $file['fullpath']) + { + print ' - '; + print htmlspecialchars ($file['fullpath']); + } +?> +
+ + +
+ id}/", 'id="code_search_search_form"')?> + + + lang->line('Search'), 'id="code_search_search_submit"')?> + | + lang->line('Revision')?>: + + +
+ +
+ +subversion->getFile ($project->id, $fullpath, $revision); + if ($file2 !== FALSE) + { + if ($file2['type'] == 'file') + { + $lines = explode ("\n", $file2['content']); + //$matchkeys = preg_grep ("/{$pattern}/i", $lines, 0); + $matchlines = preg_grep ("/{$pattern}/", $lines, 0); + if (count($matchlines) > 0) + { + $hexpath = $controller->converter->AsciiToHex($fullpath); + if ($revision <= 0) + { + $revreq = ''; + $revreqroot = ''; + } + else + { + $revreq = "/{$file2['rev']}"; + $revreqroot = '/' . $controller->converter->AsciiToHex ('.') . $revreq; + } + + print '
  • '; + print anchor ( + "code/file/{$project->id}/{$hexpath}{$revreq}", + htmlspecialchars($fullpath)); + + print '
    ';
    +						foreach ($matchlines as $linenum => $line)
    +						{
    +							printf ('% 6d: ', $linenum);
    +							print htmlspecialchars($line);
    +							print "\n";
    +						}
    +						print '
    '; + + print '
  • '; + } + } + else + { + search_and_show ($controller, $project, $file2, $revision, $pattern); + } + } + } + } +} + +$file = $this->subversion->getFile ($project->id, $file['fullpath'], $revision); +search_and_show ($this, $project, $file, $revision, $pattern); +?> + +
    + +
    + + + + +load->view ('footer'); ?> + + + +
    + + + + +