1 |
27b71dd0
|
f.revilla
|
<?php
|
2 |
|
|
// $Id$
|
3 |
|
|
|
4 |
|
|
/**
|
5 |
|
|
* @file
|
6 |
|
|
* Adds helpful messages for website administrators
|
7 |
|
|
* and provides documentation in /admin/help
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
//html paths for differents documentation sections:
|
11 |
6fcc13bc
|
f.revilla
|
define('HELP_OVERVIEW', drupal_get_path('module', 'cdm_dataportal') . '/help/overview.html');
|
12 |
|
|
/*
|
13 |
27b71dd0
|
f.revilla
|
define('HELP_SETTINGS_GENERAL', './sites/all/modules/cdm_dataportal/help/settings_general.html');
|
14 |
|
|
define('HELP_SETTINGS_GEO', './sites/all/modules/cdm_dataportal/help/settings_geo.html');
|
15 |
|
|
define('HELP_SETTINGS_LAYOUT', './sites/all/modules/cdm_dataportal/help/settings_layout.html');
|
16 |
6fcc13bc
|
f.revilla
|
define('HELP_SETTINGS_CACHE', drupal_get_path('module', 'cdm_dataportal') . '/help/settings_cache.html');
|
17 |
|
|
*/
|
18 |
27b71dd0
|
f.revilla
|
|
19 |
|
|
function cdm_dataportal_menu_help ($may_cache, &$items) {
|
20 |
|
|
|
21 |
|
|
if (!$may_cache) {
|
22 |
|
|
|
23 |
|
|
$items[] = array(
|
24 |
|
|
'path' => 'admin/help/cdm_dataportal_general',
|
25 |
|
|
'title' => t('general'),
|
26 |
|
|
'callback' => 'cdm_dataportal_file_get_content',
|
27 |
|
|
'callback arguments' => array(HELP_SETTINGS_GENERAL),
|
28 |
|
|
'access' => true,
|
29 |
|
|
'type' => MENU_LOCAL_TASK,
|
30 |
|
|
);
|
31 |
|
|
|
32 |
|
|
$items[] = array(
|
33 |
|
|
'path' => 'admin/help/cdm_dataportal_geo',
|
34 |
|
|
'title' => t('geo'),
|
35 |
|
|
'callback' => 'cdm_dataportal_file_get_content',
|
36 |
|
|
'callback arguments' => array(HELP_SETTINGS_GEO),
|
37 |
|
|
'access' => true,
|
38 |
|
|
'type' => MENU_LOCAL_TASK,
|
39 |
|
|
);
|
40 |
|
|
|
41 |
|
|
$items[] = array(
|
42 |
|
|
'path' => 'admin/help/cdm_dataportal_layout',
|
43 |
|
|
'title' => t('layout'),
|
44 |
|
|
'callback' => 'cdm_dataportal_file_get_content',
|
45 |
|
|
'callback arguments' => array(HELP_SETTINGS_LAYOUT),
|
46 |
|
|
'access' => true,
|
47 |
|
|
'type' => MENU_LOCAL_TASK,
|
48 |
|
|
);
|
49 |
|
|
|
50 |
|
|
$items[] = array(
|
51 |
|
|
'path' => 'admin/help/cdm_dataportal_cache',
|
52 |
|
|
'title' => t('cache'),
|
53 |
|
|
'callback' => 'cdm_dataportal_file_get_content',
|
54 |
|
|
'callback arguments' => array(HELP_SETTINGS_CACHE),
|
55 |
|
|
'access' => true,
|
56 |
|
|
'type' => MENU_LOCAL_TASK,
|
57 |
|
|
);
|
58 |
|
|
}
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
/**
|
62 |
|
|
* Implementation of hook_help().
|
63 |
|
|
*/
|
64 |
|
|
function cdm_dataportal_help($path) {
|
65 |
|
|
//result to return
|
66 |
|
|
$res = '';
|
67 |
|
|
|
68 |
|
|
switch ($path) {
|
69 |
|
|
|
70 |
|
|
case 'admin/help#cdm_dataportal':
|
71 |
|
|
//$popup = (module_exists('advanced_help')) ? theme('advanced_help_topic', 'cdm_help', 'website-overview') : '';
|
72 |
|
|
//var_dump($popup);
|
73 |
|
|
$content = cdm_dataportal_file_get_content(HELP_OVERVIEW);
|
74 |
|
|
$res = $content;
|
75 |
|
|
break;
|
76 |
|
|
|
77 |
|
|
default:
|
78 |
|
|
$path_aux = str_replace('/' , '_' , $path);
|
79 |
|
|
$res = theme('cdm_dataportal_' . $path_aux);
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
return $res;
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
function cdm_dataportal_file_get_content ($path) {
|
86 |
|
|
|
87 |
|
|
//modyfing the html file to get the drupal paths
|
88 |
|
|
$content = file_get_contents($path);
|
89 |
|
|
$content_result = str_replace("{MODULE_PATH}", file_directory_path(), $content);
|
90 |
7d42f736
|
f.revilla
|
|
91 |
21c45b2d
|
f.revilla
|
/* XXXXX change made because of problems with SVN!!! XXXXX
|
92 |
27b71dd0
|
f.revilla
|
//converting from html to apt for maven documentation
|
93 |
|
|
$apt_content = $content_result;
|
94 |
|
|
//general modifications
|
95 |
|
|
$apt_content = str_replace('<p>', '', $apt_content);
|
96 |
|
|
$apt_content = str_replace('</p>', '', $apt_content);
|
97 |
|
|
$apt_content = str_replace('<b>', '<<', $apt_content);
|
98 |
|
|
$apt_content = str_replace('</b>', '>>', $apt_content);
|
99 |
|
|
$apt_content = str_replace('<i>', '<', $apt_content);
|
100 |
|
|
$apt_content = str_replace('</i>', '>', $apt_content);
|
101 |
|
|
$apt_content = str_replace('<h4>', '', $apt_content);
|
102 |
|
|
$apt_content = str_replace('</h4>', '', $apt_content);
|
103 |
|
|
$apt_content = str_replace('<h3>', '', $apt_content);
|
104 |
|
|
$apt_content = str_replace('</h3>', '', $apt_content);
|
105 |
|
|
$apt_content = str_replace('<ul>', '', $apt_content);
|
106 |
|
|
$apt_content = str_replace('</ul>', '', $apt_content);
|
107 |
|
|
$apt_content = str_replace('&', '&', $apt_content);
|
108 |
|
|
$apt_content = str_replace('<li>', '*', $apt_content);
|
109 |
|
|
$apt_content = str_replace('</li>', '', $apt_content);
|
110 |
|
|
//special modifications
|
111 |
|
|
$apt_content = str_replace('<a target="_blank" href="./?q=admin/build/modules">Administer->Site buildin->Modules</a>',
|
112 |
|
|
'<Administer-\>Site building-\>Modules>',
|
113 |
|
|
$apt_content);
|
114 |
|
|
$apt_content = str_replace('<a target="_blank" href="./?q=admin/build/themes">Administer->Site buildin->Themes</a>',
|
115 |
|
|
'<Administer-\>Site building-\>Themes>',
|
116 |
|
|
$apt_content);
|
117 |
|
|
$apt_content = str_replace('<a target="_blank" href="./?q=admin/settings/cdm_dataportal">Administer->Site Configuration->CDM Dataportal</a>',
|
118 |
|
|
'<Administer-\>Site Configuration-\>CDM Dataportal>',
|
119 |
|
|
$apt_content);
|
120 |
|
|
$apt_content = str_replace('<a target="_blank" href="./?q=admin/settings/cdm_dataportal/general" title="General">here</a>',
|
121 |
|
|
'<Administer-\>Site Configuration-\>CDM Dataportal>',
|
122 |
|
|
$apt_content);
|
123 |
|
|
$apt_content = str_replace('<a target="_blank" href="./?q=admin/settings/cdm_dataportal/geo" title="General">Geo & Map settings</a>',
|
124 |
|
|
'<Administer-\>Site Configuration-\>CDM Dataportal-\>geo & Map>',
|
125 |
|
|
$apt_content);
|
126 |
|
|
$apt_content = str_replace('<a target="_blank" href="./?q=admin/settings/cdm_dataportal/layout/search">Search Layout Settings</a>',
|
127 |
|
|
'<Administer-\>Site Configuration-\>CDM Dataportal-\>Layout-\>Search>',
|
128 |
|
|
$apt_content);
|
129 |
|
|
$apt_content = str_replace('<a target="_blank" href="./?q=admin/settings/cdm_dataportal/layout/media">Media Layout Settings</a>',
|
130 |
|
|
'<Administer-\>Site Configuration-\>CDM Dataportal-\>Layout-\>Media>',
|
131 |
|
|
$apt_content);
|
132 |
7d42f736
|
f.revilla
|
//
|
133 |
|
|
// $apt_content = str_replace('<a target="_blank" href="./?q=admin/settings/cdm_dataportal/layout/media">Media Layout Settings</a>',
|
134 |
|
|
// '<Administer-\>Site Configuration-\>CDM Dataportal-\>Layout-\>Media>',
|
135 |
|
|
// $apt_content);
|
136 |
|
|
//
|
137 |
2d24e311
|
f.revilla
|
|
138 |
27b71dd0
|
f.revilla
|
//regular expressions
|
139 |
|
|
$apt_content = preg_replace('/<!--.*-->/', '', $apt_content);
|
140 |
|
|
$apt_content = preg_replace('/\<a target="(.*)" href="(.*)" title="(.*)"\>(.*)\<\/a\>/', '{{{$2}$4}}', $apt_content);
|
141 |
6fcc13bc
|
f.revilla
|
|
142 |
27b71dd0
|
f.revilla
|
$apt_file = str_replace('html', 'apt', $path);
|
143 |
|
|
$fd = fopen($apt_file, 'w');
|
144 |
|
|
fwrite($fd, $apt_content);
|
145 |
|
|
fclose($fd);
|
146 |
7d42f736
|
f.revilla
|
*/
|
147 |
27b71dd0
|
f.revilla
|
return $content_result;
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
function theme_cdm_dataportal_admin_settings_cdm_dataportal_general () {
|
151 |
|
|
$res = t('<p>Help text for this page</p>');
|
152 |
|
|
return $res;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
function theme_cdm_dataportal_admin_settings_cdm_dataportal_geo () {
|
156 |
|
|
$res = t('<p>Help text for this page</p>');
|
157 |
|
|
return $res;
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
function theme_cdm_dataportal_admin_settings_cdm_dataportal_layout () {
|
161 |
|
|
$res = t('<p>Help text for this page</p>');
|
162 |
|
|
return $res;
|
163 |
|
|
}
|
164 |
|
|
|
165 |
|
|
function theme_cdm_dataportal_admin_settings_cdm_dataportal_cache () {
|
166 |
|
|
$res = t('<p>Help text for this page</p>');
|
167 |
|
|
return $res;
|
168 |
|
|
}
|