Benjamin Renard commited on 2012-10-09 16:46:05
Showing 2 changed files, with 83 additions and 0 deletions.
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+<?php |
|
2 |
+/** |
|
3 |
+ * Project infos plugin for ViewGit. |
|
4 |
+ * |
|
5 |
+ * This add project infos on summary page. |
|
6 |
+ * |
|
7 |
+ * @author Benjamin Renard <brenard@easter-eggs.com> |
|
8 |
+ */ |
|
9 |
+class ProjectInfosPlugin extends VGPlugin |
|
10 |
+{ |
|
11 |
+ function __construct() { |
|
12 |
+ $this->register_hook('summary'); |
|
13 |
+ } |
|
14 |
+ |
|
15 |
+ function hook_summary() { |
|
16 |
+ global $page; |
|
17 |
+ $page['project_infos']=get_project_info($page['project']); |
|
18 |
+ if (isset($conf['projects'][$project]['url'])) { |
|
19 |
+ if (is_array($conf['projects'][$project]['url'])) { |
|
20 |
+ $page['project_infos']['url']=array($conf['projects'][$project]['url']); |
|
21 |
+ } |
|
22 |
+ else { |
|
23 |
+ $page['project_infos']['url']=$conf['projects'][$project]['url']; |
|
24 |
+ } |
|
25 |
+ } |
|
26 |
+ $this->display_plugin_template('summary', FALSE); |
|
27 |
+ } |
|
28 |
+ |
|
29 |
+ function hook($type) { |
|
30 |
+ global $conf; |
|
31 |
+ |
|
32 |
+ if ($type == 'summary') { |
|
33 |
+ $this -> hook_summary(); |
|
34 |
+ } |
|
35 |
+ } |
|
36 |
+} |
... | ... |
@@ -0,0 +1,47 @@ |
1 |
+<?php |
|
2 |
+global $page; |
|
3 |
+?> |
|
4 |
+<style> |
|
5 |
+dl.projectinfos { |
|
6 |
+ margin: 0; |
|
7 |
+ padding: 0; |
|
8 |
+} |
|
9 |
+ |
|
10 |
+dl.projectinfos dt { |
|
11 |
+ position: relative; |
|
12 |
+ width: 7em; |
|
13 |
+ left: 0.2em; |
|
14 |
+ font-weight: bold; |
|
15 |
+} |
|
16 |
+ |
|
17 |
+dl.projectinfos dd { |
|
18 |
+ margin-left: 7em; |
|
19 |
+ margin-top: -1.3em; |
|
20 |
+ padding: 0; |
|
21 |
+} |
|
22 |
+ |
|
23 |
+dl.projectinfos ul { |
|
24 |
+ list-style-type: none; |
|
25 |
+ margin: 0; |
|
26 |
+ padding: 0; |
|
27 |
+} |
|
28 |
+</style> |
|
29 |
+<h2>Project informations</h2> |
|
30 |
+<dl class='projectinfos'> |
|
31 |
+<dt>Description</dt> |
|
32 |
+<dd><?php echo $page['project_infos']['description']; ?></dd> |
|
33 |
+ |
|
34 |
+<dt>Last Change</dt> |
|
35 |
+<dd><?php echo $page['project_infos']['head_datetime']; ?></dd> |
|
36 |
+ |
|
37 |
+<?php |
|
38 |
+if (isset($page['project_infos']['url'])) { |
|
39 |
+ echo "<dt>URL</dt> |
|
40 |
+ <dd><ul>"; |
|
41 |
+ foreach ($page['project_infos']['url'] as $url) { |
|
42 |
+ echo "<li>$url</li>"; |
|
43 |
+ } |
|
44 |
+ echo "</ul></dd>"; |
|
45 |
+} |
|
46 |
+?> |
|
47 |
+</dl> |
|
0 | 48 |