]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Administration/SupportPortal.php
Release 6.1.4
[Github/sugarcrm.git] / modules / Administration / SupportPortal.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4  * SugarCRM is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38
39
40
41
42
43
44 global $mod_strings;
45 global $app_list_strings;
46 global $app_strings;
47 global $theme;
48 global $current_user;
49 global $currentModule;
50
51 switch ($_REQUEST['view']) {
52         case "support_portal":
53                 if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
54                 $GLOBALS['log']->info("Administration SupportPortal");
55
56                 $iframe_url = add_http("www.sugarcrm.com/network/redirect.php?tmpl=network");
57         $mod_title = $mod_strings['LBL_SUPPORT_TITLE'];
58
59         echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_title, true);
60         
61         $sugar_smarty = new Sugar_Smarty();
62         $sugar_smarty->assign('iframeURL', $iframe_url);
63         echo $sugar_smarty->fetch('modules/Administration/SupportPortal.tpl');
64
65                 break;
66         default:
67
68                 $send_version = isset($_REQUEST['version']) ? $_REQUEST['version'] : "";
69                 $send_edition = isset($_REQUEST['edition']) ? $_REQUEST['edition'] : "";
70                 $send_lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "";
71                 $send_module = isset($_REQUEST['help_module']) ? $_REQUEST['help_module'] : "";
72                 $send_action = isset($_REQUEST['help_action']) ? $_REQUEST['help_action'] : "";
73                 $send_key = isset($_REQUEST['key']) ? $_REQUEST['key'] : "";
74                 $send_anchor = '';
75                 // awu: Fixes the ProjectTasks pluralization issue -- must fix in later versions.
76                 if ($send_module == 'ProjectTasks')
77                         $send_module = 'ProjectTask';
78         if ($send_module == 'ProductCatalog')
79                 $send_module = 'ProductTemplates';
80         if ($send_module == 'TargetLists')
81                 $send_module = 'ProspectLists';
82         if ($send_module == 'Targets')
83                 $send_module = 'Prospects';                            
84                 $helpPath = 'modules/'.$send_module.'/language/'.$send_lang.'.help.'.$send_action.'.html';
85
86                 $sugar_smarty = new Sugar_Smarty();
87
88                 //if the language is english then be sure to skip this check, otherwise go to the support
89                 //portal if the file is not found.
90                 if ($send_lang != 'en_us' && file_exists($helpPath))
91                 {
92                         $sugar_smarty->assign('helpFileExists', TRUE);
93                         $sugar_smarty->assign('helpPath', $helpPath);
94                         $sugar_smarty->assign('helpBar', getHelpBar($send_module));
95                         $sugar_smarty->assign('bookmarkScript', bookmarkJS());
96                         $sugar_smarty->assign('title', $mod_strings['LBL_SUGARCRM_HELP'] . " - " . $send_module);
97                         $sugar_smarty->assign('styleSheet', SugarThemeRegistry::current()->getCSS());
98                         $sugar_smarty->assign('table', getTable());
99                         $sugar_smarty->assign('endtable', endTable());
100                         $sugar_smarty->assign('charset', $app_strings['LBL_CHARSET']);
101                         echo $sugar_smarty->fetch('modules/Administration/SupportPortal.tpl');                  
102                         
103                 } else {
104                         if(empty($send_module)){
105                                 $send_module = 'toc';
106                         }
107                         
108                         $dev_status = 'GA';
109                         //If there is an alphabetic portion between the decimal prefix and integer suffix, then use the
110                         //value there as the dev_status value
111                         $dev_status = getVersionStatus($GLOBALS['sugar_version']);
112                         $send_version = getMajorMinorVersion($GLOBALS['sugar_version']);
113                         $editionMap = array('ENT' => 'Enterprise', 'PRO' => 'Professional', 'CE' => 'Community_Edition');
114                         if(!empty($editionMap[$send_edition])){
115                                 $send_edition = $editionMap[$send_edition];
116                         }
117                         
118                         //map certain modules
119                         $sendModuleMap = array(
120                                                                 'administration' => array(
121                                                                                                         array('name' => 'Administration', 'action' => 'supportportal', 'anchor' => '1910574'),
122                                                                                                         array('name' => 'Administration', 'action' => 'updater', 'anchor' => '1910574'),
123                                                                                                         array('name' => 'Administration', 'action' => 'licensesettings', 'anchor' => '1910574'),
124                                                                                                         array('name' => 'Administration', 'action' => 'diagnostic', 'anchor' => '1111949'),
125                                                                                                         array('name' => 'Administration', 'action' => 'listviewofflineclient', 'anchor' => '1111949'),
126                                                                                                         array('name' => 'Administration', 'action' => 'enablewirelessmodules', 'anchor' => '1111949'),
127                                                                                                         array('name' => 'Administration', 'action' => 'backups', 'anchor' => '1111949'),
128                                                                                                         array('name' => 'Administration', 'action' => 'upgrade', 'anchor' => '1111949'),
129                                                                                                         array('name' => 'Administration', 'action' => 'locale', 'anchor' => '1111949'),
130                                                                                                         array('name' => 'Administration', 'action' => 'themesettings', 'anchor' => '1111949'),
131                                                                                                         array('name' => 'Administration', 'action' => 'passwordmanager', 'anchor' => '1446494'),
132                                                                                                         array('name' => 'Administration', 'action' => 'upgradewizard', 'anchor' => '1168410'),
133                                                                                                         array('name' => 'Administration', 'action' => 'configuretabs', 'anchor' => '1168410'),
134                                                                                                         array('name' => 'Administration', 'action' => 'configuresubpanels', 'anchor' => '1168410'),
135                                                                                                         array('name' => 'Administration', 'action' => 'wizard', 'anchor' => '1168410'),
136                                                                                                 ),
137                                                                 'calls' => array(array('name' => 'Activities')), 
138                                                                 'tasks' => array(array('name' => 'Activities')), 
139                                                                 'meetings' => array(array('name' => 'Activities')), 
140                                                                 'notes' => array(array('name' => 'Activities')),
141                                                                 'calendar' => array(array('name' => 'Activities')),
142                                                                 'configurator' => array(array('name' => 'Administration', 'anchor' => '1878359')),
143                                                                 'upgradewizard' => array(array('name' => 'Administration', 'anchor' => '1878359')),
144                                                                 'schedulers' => array(array('name' => 'Administration', 'anchor' => '1878359')),
145                                                                 'sugarfeed' => array(array('name' => 'Administration', 'anchor' => '1878359')),
146                                                                 'connectors' => array(array('name' => 'Administration', 'anchor' => '1878359')),
147                                                                 'trackers' => array(array('name' => 'Administration', 'anchor' => '1878359')),
148                                                                 'currencies' => array(array('name' => 'Administration', 'anchor' => '1878359')),
149                                                                 'aclroles' => array(array('name' => 'Administration', 'anchor' => '1916499')),
150                                                                 'roles' => array(array('name' => 'Administration', 'anchor' => '1916499')),
151                                                                 'teams' => array(array('name' => 'Administration', 'anchor' => '1916499')),
152                                                                 'users' => array(array('name' => 'Administration', 'anchor' => '1916499'), array('name' => 'Administration', 'action' => 'detailview', 'anchor' => '1916518')),
153                                                                 'modulebuilder' => array(array('name' => 'Administration', 'anchor' => '1168410')),
154                                                                 'studio' => array(array('name' => 'Administration', 'anchor' => '1168410')),
155                                                                 'workflow' => array(array('name' => 'Administration', 'anchor' => '1168410')),
156                                                                 'producttemplates' => array(array('name' => 'Administration', 'anchor' => '1957376')),
157                                                                 'productcategories' => array(array('name' => 'Administration', 'anchor' => '1957376')),
158                                                                 'producttypes' => array(array('name' => 'Administration', 'anchor' => '1957376')),
159                                                                 'manufacturers' => array(array('name' => 'Administration', 'anchor' => '1957376')),
160                                                                 'shippers' => array(array('name' => 'Administration', 'anchor' => '1957376')),
161                                                                 'taxrates' => array(array('name' => 'Administration', 'anchor' => '1957376')),
162                                                                 'releases' => array(array('name' => 'Administration', 'anchor' => '1868932')),
163                                                                 'timeperiods' => array(array('name' => 'Administration', 'anchor' => '1957639')),
164                                                                 'contracttypes' => array(array('name' => 'Administration', 'anchor' => '1957677')),
165                                                                 'contracttype' => array(array('name' => 'Administration', 'anchor' => '1957677')),
166                                                                 'emailman' => array(array('name' => 'Administration', 'anchor' => '1445484')),
167                                                                 'inboundemail' => array(array('name' => 'Administration', 'anchor' => '1445484')),
168                                                                 'emailtemplates' => array(array('name' => 'Emails')),
169                                                                 'prospects' => array(array('name' => 'Campaigns')),
170                                                                 'prospectlists' => array(array('name' => 'Campaigns')),
171                                                                 'reportmaker' => array(array('name' => 'Reports')),
172                                                                 'customqueries' => array(array('name' => 'Reports')),
173                                                                 'quotas' => array(array('name' => 'Forecasts')),
174                                                                 'projecttask' => array(array('name' => 'Projects')),
175                                                                 'project' => array(array('name' => 'Projects'), array('name' => 'Dashboard', 'action' => 'dashboard'), ),
176                                                                 'projecttemplate' => array(array('name' => 'Projects')),
177                                                                 'datasets' => array(array('name' => 'Reports')),
178                                                                 'dataformat' => array(array('name' => 'Reports')),
179                                                                 'employees' => array(array('name' => 'Administration', 'anchor' => '1957677')),
180                                                                 'kbdocuments' => array(array('name' => 'Administration', 'action' => 'kbadminview', 'anchor' => '1957677')),
181                                                          );
182                                                          
183                         if(!empty($sendModuleMap[strtolower($send_module)])){
184                                 $mappings = $sendModuleMap[strtolower($send_module)];
185                                 
186                                 foreach($mappings as $map){
187                                         if(!empty($map['action'])){
188                                                 if($map['action'] == strtolower($send_action)){
189                                                         $send_module = $map['name'];
190                                                         if(!empty($map['anchor'])){
191                                                                 $send_anchor = $map['anchor'];
192                                                         }
193                                                 }
194                                         }else{
195                                                 $send_module = $map['name'];
196                                                 if(!empty($map['anchor'])){
197                                                                 $send_anchor = $map['anchor'];
198                                                 }
199                                         }
200                                 }
201                                 //$send_module = $sendModuleMap[strtolower($send_module)];
202                         }
203                         $sendUrl = "http://www.sugarcrm.com/crm/product_doc.php?edition={$send_edition}&version={$send_version}&lang={$send_lang}&module={$send_module}&help_action={$send_action}&status={$dev_status}&key={$send_key}&anchor={$send_anchor}";
204                         if(!empty($send_anchor)){
205                                 $sendUrl .= "&anchor=".$send_anchor;
206                         }
207                         $iframe_url = $sendUrl;
208                         
209                         header("Location: {$iframe_url}");
210                         
211                         //$sugar_smarty->assign('helpFileExists', FALSE);
212                         //$sugar_smarty->assign('iframeURL', $iframe_url);
213                 }
214                 break;
215 }
216
217
218 function getHelpBar($moduleName)
219 {
220         global $mod_strings;
221
222         $helpBar = "<table width='100%'><tr><td align='right'>" .
223                         "<a href='javascript:window.print()'>" . $mod_strings['LBL_HELP_PRINT'] . "</a> - " .
224                         "<a href='mailto:?subject=" . $mod_strings['LBL_SUGARCRM_HELP'] . "&body=" . rawurlencode(getCurrentURL()) . "'>" . $mod_strings['LBL_HELP_EMAIL'] . "</a> - " .
225                         "<a href='#' onmousedown=\"createBookmarkLink('" . $mod_strings['LBL_SUGARCRM_HELP'] . " - " . $moduleName . "', '" . getCurrentURL() . "'" .")\">" . $mod_strings['LBL_HELP_BOOKMARK'] . "</a>" .
226                         "</td></tr></table>";
227
228         return $helpBar;
229 }
230
231 function getTable()
232 {
233         $table = "<table class='tabForm'><tr><td>";
234
235         return $table;
236 }
237
238 function endTable()
239 {
240         $endtable = "</td></tr></table>";
241
242         return $endtable;
243 }
244
245 function bookmarkJS() {
246
247 $script =
248 <<<EOQ
249 <script type="text/javascript" language="JavaScript">
250 <!-- Begin
251 function createBookmarkLink(title, url){
252         if (document.all)
253                 window.external.AddFavorite(url, title);
254         else if (window.sidebar)
255                 window.sidebar.addPanel(title, url, "")
256 }
257 //  End -->
258 </script>
259 EOQ;
260
261 return $script;
262 }
263
264 ?>