From 46e7d021fda7ec1470b11409b7ce3818227dc26f Mon Sep 17 00:00:00 2001 From: Heikki Hokkanen Date: Sun, 20 Nov 2011 12:09:39 +0200 Subject: [PATCH] Allow projects to have an external www link. Shown on index page, as well as header on every page. --- default.css | 12 ++++++++++++ doc/TODO | 1 - inc/example-localconfig.php | 1 + inc/functions.php | 5 +++++ templates/header.php | 4 ++++ templates/index.php | 7 ++++++- 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/default.css b/default.css index cf7c9d7..8380f31 100644 --- a/default.css +++ b/default.css @@ -15,6 +15,18 @@ a { color: #c00; } +a.external { + text-decoration: none; +} + +a.external:before { + content: ' ['; +} + +a.external:after { + content: '] '; +} + a.tree_link { padding-top: 16px; height: 0px; diff --git a/doc/TODO b/doc/TODO index 7a75e2b..eb96e5a 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,4 +1,3 @@ -- web/homepage link for every project - php.ini passthrough check (archive etc won't work if it's disabled) - annotate/blame view - git annotate -l -t diff --git a/inc/example-localconfig.php b/inc/example-localconfig.php index 76df131..9dcf14b 100644 --- a/inc/example-localconfig.php +++ b/inc/example-localconfig.php @@ -9,6 +9,7 @@ $conf['projects'] = array( 'bar' => array( 'repo' => '/home/user/projects/foo/.git', 'description' => 'Optional overridden description, otherwise it is taken from .git/description' + 'www' => 'http://www.google.com', # optional ), ); diff --git a/inc/functions.php b/inc/functions.php index 40a670f..f9f6833 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -573,6 +573,11 @@ function run_git_passthru($project, $command) return $result; } +function tpl_extlink($link) +{ + echo ""; +} + /** * Makes sure the given project is valid. If it's not, this function will * die(). diff --git a/templates/header.php b/templates/header.php index 4d5024f..dccf056 100644 --- a/templates/header.php +++ b/templates/header.php @@ -33,6 +33,10 @@ if (isset($page['notices'])) { 'summary', 'p' => $page['project'])) ."\">$page[project]"; + $projconf = $conf['projects'][$page['project']]; + if ($projconf['www']) { + tpl_extlink($projconf['www']); + } } if (isset($page['subtitle'])) { echo " : $page[subtitle]"; diff --git a/templates/index.php b/templates/index.php index 55b3344..a6d2b06 100644 --- a/templates/index.php +++ b/templates/index.php @@ -14,7 +14,12 @@ foreach ($page['projects'] as $p) { $tr_class = $tr_class=="odd" ? "even" : "odd"; echo "\n"; - echo "\t 'summary', 'p' => $p['name'])) ."\">$p[name]\n"; + echo "\t 'summary', 'p' => $p['name'])) ."\">$p[name]"; + if ($p['www']) { + //echo ""; + tpl_extlink($p['www']); + } + echo "\n"; echo "\t". htmlentities_wrapper($p['description']) ."\n"; echo "\t". htmlentities_wrapper($p['message']) ."\n"; echo "\t". htmlentities_wrapper($p['head_datetime']) ."\n"; -- 2.11.4.GIT