Allow displaying a website url for a project
Allow displaying a website url for a project

--- a/config/projects.conf.php.example
+++ b/config/projects.conf.php.example
@@ -93,6 +93,8 @@
  *	     Compatibility mode relies more on the git executable for loading
  *	     data, at the expense of performance.  Use if you are having
  *	     trouble loading data for this project.
+ *
+ * 'website': the website url for the project.
  */
 //$git_projects_settings['php/gitphp.git'] = array(
 //	'category' => 'PHP',
@@ -102,7 +104,8 @@
 //	'pushurl' => '',
 //	'bugpattern' => '/#([0-9]+)/',
 //	'bugurl' => 'http://mantis.xiphux.com/view.php?id=${1}',
-//	'compat' => false
+//	'compat' => false,
+//	'website' => 'http://xiphux.com/programming/gitphp/'
 //);
 //$git_projects_settings['gentoo.git'] = array(
 //	'description' => 'Gentoo portage overlay',

--- a/css/gitphpskin.css
+++ b/css/gitphpskin.css
@@ -117,6 +117,16 @@
 	float: left; 
 	color: #555555;
 	font-style: italic; 
+}
+
+div.page_footer_text a {
+	color: #555555;
+	font-style: italic;
+	text-decoration: none;
+}
+
+div.page_footer_text a:hover {
+	text-decoration: underline;
 }
 
 

--- a/include/git/Project.class.php
+++ b/include/git/Project.class.php
@@ -219,6 +219,15 @@
 /*}}}2*/
 
 	/**
+	 * website
+	 *
+	 * Stores the website url internally
+	 *
+	 * @access protected
+	 */
+	protected $website = null;
+
+	/**
 	 * commitCache
 	 *
 	 * Caches fetched commit objects in case of
@@ -724,6 +733,36 @@
 	public function SetBugPattern($bPat)
 	{
 		$this->bugPattern = $bPat;
+	}
+
+/*}}}2*/
+
+/* website accessors {{{2*/
+
+	/**
+	 * GetWebsite
+	 *
+	 * Gets the website for this repository, if specified
+	 *
+	 * @access public
+	 * @return string website
+	 */
+	public function GetWebsite()
+	{
+		return $this->website;
+	}
+
+	/**
+	 * SetWebsite
+	 *
+	 * Sets the website for this repository
+	 *
+	 * @access public
+	 * @param string $site website
+	 */
+	public function SetWebsite($site)
+	{
+		$this->website = $site;
 	}
 
 /*}}}2*/

--- a/include/git/ProjectListBase.class.php
+++ b/include/git/ProjectListBase.class.php
@@ -298,6 +298,9 @@
 		if (isset($projData['compat'])) {
 			$projectObj->SetCompat($projData['compat']);
 		}
+		if (isset($projData['website']) && is_string($projData['website'])) {
+			$projectObj->SetWebsite($projData['website']);
+		}
 	}
 
 	/**

--- a/templates/footer.tpl
+++ b/templates/footer.tpl
@@ -7,7 +7,13 @@
  *}
     <div class="page_footer">
       {if $project}
-        <div class="page_footer_text">{$project->GetDescription()}</div>
+        <div class="page_footer_text">
+	{if $project->GetWebsite()}
+	<a href="{$project->GetWebsite()}">{$project->GetDescription()}</a>
+	{else}
+	{$project->GetDescription()}
+	{/if}
+	</div>
         <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" class="rss_logo">{t}RSS{/t}</a>
         <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" class="rss_logo">{t}Atom{/t}</a>
       {else}

--- a/templates/project.tpl
+++ b/templates/project.tpl
@@ -26,6 +26,9 @@
    {/if}
    {if $project->GetPushUrl()}
      <tr><td>{t}push url{/t}</td><td><a href="{$project->GetPushUrl()}">{$project->GetPushUrl()}</a></td></tr>
+   {/if}
+   {if $project->GetWebsite()}
+     <tr><td>{t}website{/t}</td><td><a href="{$project->GetWebsite()}">{$project->GetWebsite()}</a></td></tr>
    {/if}
  </table>
 

comments