From 2f791fd0505560c75372ef912f25b4b43f3da358 Mon Sep 17 00:00:00 2001 From: haneul Date: Mon, 23 Mar 2009 09:01:28 +0000 Subject: [PATCH] #17873741 : added code highlighting for issuetracker git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5934 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/issuetracker/issuetracker.view.php | 39 ++++++++++++++++++- .../xe_issuetracker/source_file_view.html | 4 +- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/modules/issuetracker/issuetracker.view.php b/modules/issuetracker/issuetracker.view.php index def1f9385..72a5bc778 100644 --- a/modules/issuetracker/issuetracker.view.php +++ b/modules/issuetracker/issuetracker.view.php @@ -241,7 +241,44 @@ } } - if(!$file_type) $file_type = "code"; + if(!$file_type) + { + $file_type = "code"; + $extToLang = array( + "h" => "Cpp", + "cpp" => "Cpp", + "csharp" => "CSharp", + "css" => "Css", + "html" => "Xml", + "sql" => "Sql", + "java" => "Java", + "py" => "Python", + "rb" => "Ruby", + "js" => "JScript", + "c" => "Cpp", + "vb" => "Vb", + "xml" => "Xml", + "php" => "Php" + ); + + $file_ext = strtolower($file_ext); + if($extToLang[$file_ext]) + { + $file_ext = $extToLang[$file_ext]; + } + if(file_exists("./common/js/plugins/code_highlighter/script/shBrush".$file_ext.".js")) + { + Context::loadJavascriptPlugin("code_highlighter"); + Context::addJsFile('./common/js/plugins/code_highlighter/script/shBrush'.$file_ext.'.js', false); + $js_code = << + SyntaxHighlighter.config.clipboardSwf = './modules/editor/components/code_highlighter/script/clipboard.swf'; + SyntaxHighlighter.all(); + +dpScript; + Context::addHtmlFooter($js_code); + } + } Context::set('file_type', $file_type); $this->setTemplateFile('source_file_view'); diff --git a/modules/issuetracker/skins/xe_issuetracker/source_file_view.html b/modules/issuetracker/skins/xe_issuetracker/source_file_view.html index 3c1109088..8169ca614 100644 --- a/modules/issuetracker/skins/xe_issuetracker/source_file_view.html +++ b/modules/issuetracker/skins/xe_issuetracker/source_file_view.html @@ -14,8 +14,8 @@
  • [compare with previous]
  • - -
    +
    +
     
     {htmlspecialchars($content->content)}