|
1
|
|
|
<?php |
|
2
|
|
|
/********************************************************************************* |
|
3
|
|
|
* SugarCRM Community Edition is a customer relationship management program developed by |
|
4
|
|
|
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
|
5
|
|
|
|
|
6
|
|
|
* SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
|
7
|
|
|
* Copyright (C) 2011 - 2014 Salesagility Ltd. |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software; you can redistribute it and/or modify it under |
|
10
|
|
|
* the terms of the GNU Affero General Public License version 3 as published by the |
|
11
|
|
|
* Free Software Foundation with the addition of the following permission added |
|
12
|
|
|
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
|
13
|
|
|
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
|
14
|
|
|
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
|
15
|
|
|
* |
|
16
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
17
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
18
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
|
19
|
|
|
* details. |
|
20
|
|
|
* |
|
21
|
|
|
* You should have received a copy of the GNU Affero General Public License along with |
|
22
|
|
|
* this program; if not, see http://www.gnu.org/licenses or write to the Free |
|
23
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
24
|
|
|
* 02110-1301 USA. |
|
25
|
|
|
* |
|
26
|
|
|
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
|
27
|
|
|
* SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
|
28
|
|
|
* |
|
29
|
|
|
* The interactive user interfaces in modified source and object code versions |
|
30
|
|
|
* of this program must display Appropriate Legal Notices, as required under |
|
31
|
|
|
* Section 5 of the GNU Affero General Public License version 3. |
|
32
|
|
|
* |
|
33
|
|
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
|
34
|
|
|
* these Appropriate Legal Notices must retain the display of the "Powered by |
|
35
|
|
|
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
|
36
|
|
|
* reasonably feasible for technical reasons, the Appropriate Legal Notices must |
|
37
|
|
|
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
|
38
|
|
|
********************************************************************************/ |
|
39
|
|
|
|
|
40
|
1 |
|
require_once('include/TemplateHandler/TemplateHandler.php'); |
|
41
|
1 |
|
require_once('include/EditView/EditView2.php'); |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* DetailView - display single record |
|
45
|
|
|
* New implementation |
|
46
|
|
|
* @api |
|
47
|
|
|
*/ |
|
48
|
|
|
class DetailView2 extends EditView |
|
|
|
|
|
|
49
|
|
|
{ |
|
50
|
|
|
var $view = 'DetailView'; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* DetailView constructor |
|
54
|
|
|
* This is the DetailView constructor responsible for processing the new |
|
55
|
|
|
* Meta-Data framework |
|
56
|
|
|
* |
|
57
|
|
|
* @param $module String value of module this detail view is for |
|
58
|
|
|
* @param $focus An empty sugarbean object of module |
|
59
|
|
|
* @param $id The record id to retrieve and populate data for |
|
60
|
|
|
* @param $metadataFile String value of file location to use in overriding default metadata file |
|
61
|
|
|
* @param tpl String value of file location to use in overriding default Smarty template |
|
62
|
|
|
*/ |
|
63
|
|
|
|
|
64
|
3 |
|
function setup( |
|
65
|
|
|
$module, |
|
66
|
|
|
$focus = null, |
|
67
|
|
|
$metadataFile = null, |
|
68
|
|
|
$tpl = 'include/DetailView/DetailView.tpl', |
|
69
|
|
|
$createFocus = true |
|
70
|
|
|
) |
|
71
|
|
|
{ |
|
72
|
3 |
|
global $sugar_config; |
|
73
|
|
|
|
|
74
|
3 |
|
$this->th = new TemplateHandler(); |
|
75
|
3 |
|
$this->th->ss = $this->ss; |
|
76
|
|
|
|
|
77
|
|
|
//Check if inline editing is enabled for detail view. |
|
78
|
3 |
|
if(!isset($sugar_config['enable_line_editing_detail']) || $sugar_config['enable_line_editing_detail']){ |
|
79
|
3 |
|
$this->ss->assign('inline_edit', true); |
|
80
|
|
|
} |
|
81
|
3 |
|
$this->focus = $focus; |
|
82
|
3 |
|
$this->tpl = $tpl; |
|
83
|
3 |
|
$this->module = $module; |
|
84
|
3 |
|
$this->metadataFile = $metadataFile; |
|
85
|
3 |
|
if(isset($GLOBALS['sugar_config']['disable_vcr'])) { |
|
86
|
|
|
$this->showVCRControl = !$GLOBALS['sugar_config']['disable_vcr']; |
|
87
|
|
|
} |
|
88
|
3 |
|
if(!empty($this->metadataFile) && file_exists($this->metadataFile)){ |
|
89
|
2 |
|
require($this->metadataFile); |
|
90
|
|
|
}else { |
|
91
|
|
|
//If file doesn't exist we create a best guess |
|
92
|
1 |
|
if(!file_exists("modules/$this->module/metadata/detailviewdefs.php") && |
|
93
|
1 |
|
file_exists("modules/$this->module/DetailView.html")) { |
|
94
|
|
|
global $dictionary; |
|
95
|
|
|
$htmlFile = "modules/" . $this->module . "/DetailView.html"; |
|
96
|
|
|
$parser = new DetailViewMetaParser(); |
|
97
|
|
|
if(!file_exists('modules/'.$this->module.'/metadata')) { |
|
98
|
|
|
sugar_mkdir('modules/'.$this->module.'/metadata'); |
|
99
|
|
|
} |
|
100
|
|
|
$fp = sugar_fopen('modules/'.$this->module.'/metadata/detailviewdefs.php', 'w'); |
|
101
|
|
|
fwrite($fp, $parser->parse($htmlFile, $dictionary[$focus->object_name]['fields'], $this->module)); |
|
102
|
|
|
fclose($fp); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
//Flag an error... we couldn't create the best guess meta-data file |
|
106
|
1 |
|
if(!file_exists("modules/$this->module/metadata/detailviewdefs.php")) { |
|
107
|
|
|
global $app_strings; |
|
108
|
|
|
$error = str_replace("[file]", "modules/$this->module/metadata/detailviewdefs.php", $app_strings['ERR_CANNOT_CREATE_METADATA_FILE']); |
|
109
|
|
|
$GLOBALS['log']->fatal($error); |
|
110
|
|
|
echo $error; |
|
111
|
|
|
die(); |
|
112
|
|
|
} |
|
113
|
1 |
|
require("modules/$this->module/metadata/detailviewdefs.php"); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
3 |
|
$this->defs = $viewdefs[$this->module][$this->view]; |
|
117
|
3 |
|
} |
|
118
|
|
|
|
|
119
|
|
|
} |
|
120
|
|
|
?> |
|
121
|
|
|
|
This class, trait or interface has been deprecated.