File: online_helpPlugin.class.php

package info (click to toggle)
fusionforge 5.3.2%2B20141104-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 60,472 kB
  • sloc: php: 271,846; sql: 36,817; python: 14,575; perl: 6,406; sh: 5,980; xml: 4,294; pascal: 1,411; makefile: 911; cpp: 52; awk: 27
file content (95 lines) | stat: -rw-r--r-- 3,215 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php

/**
 * online_helpPlugin Class
 *
 * Copyright 2008 Alain Peyrat <aljeux@free.fr>
 * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
 *
 * This file is part of FusionForge.
 *
 * FusionForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * FusionForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Description:
 *
 * This plugin adds a contextual online doc to GForge by adding a link 'Get Help'
 * on top of the page (near the login/logout links).
 * Documentation is based on the docbook manual converted in chunked HTML.
 */

class online_helpPlugin extends Plugin {

	function __construct() {
		$this->Plugin() ;
		$this->name = "online_help" ;
		$this->text = "online_help!" ; // To show in the tabs, use...
		$this->hooks[] = "headermenu"; // to show up in the admin page fro group
	}

	function headermenu($params) {
		$guide = util_make_uri('/plugins/online_help/');

		$user_guide = array(
			'user' => 'ug_user.html',
			'login' => 'ug_getting_started_login.html',
			'trove' => 'ug_sitewide_trove.html',
			'snippet' => 'ug_sitewide_snippet.html',
			'people' => 'ug_sitewide_project_help.html',
			'home' => 'ug_project.html',
			'admin' => 'ug_project_project_admin.html',
			'activity' => 'ug_project_activity.html',
			'forums' => 'ug_project_forums.html',
			'tracker' => 'ug_project_tracker.html',
			'mail' => 'ug_project_mailing_lists.html',
			'pm' => 'ug_project_task_manager.html',
			'docman' => 'ug_project_docman.html',
			'surveys' => 'ug_project_surveys.html',
			'news' => 'ug_project_news.html',
			'scm' => 'ug_project_subversion.html',
			'frs' => 'ug_project_file_releases.html',
			'wiki' => 'ug_project_wiki.html',
		);

		$uri = getStringFromServer('REQUEST_URI');

		if (strstr($uri,'softwaremap')) {
			$guide .= $user_guide['trove'];
		} elseif (strstr($uri,'/my/')) {
			$guide .= $user_guide['user'];
		} elseif (strstr($uri,'/account/login.php')) {
			$guide .= $user_guide['login'];
		} elseif (strstr($uri,'/account/')) {
			$guide .= $user_guide['user'];
		} elseif (strstr($uri,'/snippet/')) {
			$guide .= $user_guide['snippet'];
		} elseif (strstr($uri,'/people/')) {
			$guide .= $user_guide['people'];
		} elseif (isset($params['toptab']) && isset($user_guide[ $params['toptab'] ])) {
			$guide .= $user_guide[ $params['toptab'] ];
		} else {
			$guide .= 'index.html';
		}

		$guide = '<a href="javascript:help_window(\''.$guide.'\')">'._('Get Help').'</a>';

		$template = isset($params['template']) ?  $params['template'] : ' | {menu}';
		echo str_replace('{menu}', $guide, $template);
	}
}

// Local Variables:
// mode: php
// c-file-style: "bsd"
// End: