1
|
|
|
<?php |
2
|
1 |
|
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
3
|
|
|
|
4
|
|
|
/********************************************************************************* |
5
|
|
|
* SugarCRM Community Edition is a customer relationship management program developed by |
6
|
|
|
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
7
|
|
|
|
8
|
|
|
* SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
9
|
|
|
* Copyright (C) 2011 - 2014 Salesagility Ltd. |
10
|
|
|
* |
11
|
|
|
* This program is free software; you can redistribute it and/or modify it under |
12
|
|
|
* the terms of the GNU Affero General Public License version 3 as published by the |
13
|
|
|
* Free Software Foundation with the addition of the following permission added |
14
|
|
|
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
15
|
|
|
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
16
|
|
|
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
17
|
|
|
* |
18
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT |
19
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
20
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
21
|
|
|
* details. |
22
|
|
|
* |
23
|
|
|
* You should have received a copy of the GNU Affero General Public License along with |
24
|
|
|
* this program; if not, see http://www.gnu.org/licenses or write to the Free |
25
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
26
|
|
|
* 02110-1301 USA. |
27
|
|
|
* |
28
|
|
|
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
29
|
|
|
* SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
30
|
|
|
* |
31
|
|
|
* The interactive user interfaces in modified source and object code versions |
32
|
|
|
* of this program must display Appropriate Legal Notices, as required under |
33
|
|
|
* Section 5 of the GNU Affero General Public License version 3. |
34
|
|
|
* |
35
|
|
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
36
|
|
|
* these Appropriate Legal Notices must retain the display of the "Powered by |
37
|
|
|
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
38
|
|
|
* reasonably feasible for technical reasons, the Appropriate Legal Notices must |
39
|
|
|
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
40
|
|
|
********************************************************************************/ |
41
|
|
|
|
42
|
|
|
|
43
|
1 |
|
$js_loaded = false; |
44
|
1 |
|
require_once("include/templates/Template.php"); |
45
|
|
|
|
46
|
|
|
class TemplateGroupChooser extends Template { |
47
|
|
|
var $args; |
48
|
|
|
var $js_loaded = false; |
49
|
|
|
var $display_hide_tabs = true; |
50
|
|
|
var $display_third_tabs = false; |
51
|
|
|
|
52
|
2 |
|
function __construct() { |
53
|
2 |
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
57
|
|
|
*/ |
58
|
|
|
function TemplateGroupChooser(){ |
59
|
|
|
$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
60
|
|
|
if(isset($GLOBALS['log'])) { |
61
|
|
|
$GLOBALS['log']->deprecated($deprecatedMessage); |
62
|
|
|
} |
63
|
|
|
else { |
64
|
|
|
trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
65
|
|
|
} |
66
|
|
|
self::__construct(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
|
70
|
2 |
|
function display() { |
71
|
2 |
|
global $app_strings, $mod_strings, $js_loaded; |
72
|
|
|
|
73
|
2 |
|
$left_size = (empty($this->args['left_size']) ? '10' : $this->args['left_size']); |
74
|
2 |
|
$right_size = (empty($this->args['right_size']) ? '10' : $this->args['right_size']); |
75
|
2 |
|
$third_size = (empty($this->args['third_size']) ? '10' : $this->args['third_size']); |
76
|
2 |
|
$max_left = (empty($this->args['max_left']) ? '' : $this->args['max_left']); |
77
|
2 |
|
$alt_tip_up = $app_strings['LBL_ALT_MOVE_COLUMN_UP']; |
78
|
2 |
|
$alt_tip_down = $app_strings['LBL_ALT_MOVE_COLUMN_DOWN']; |
79
|
2 |
|
$alt_tip_left = $app_strings['LBL_ALT_MOVE_COLUMN_LEFT']; |
80
|
2 |
|
$alt_tip_right = $app_strings['LBL_ALT_MOVE_COLUMN_RIGHT']; |
81
|
|
|
|
82
|
2 |
|
$str = ''; |
83
|
2 |
|
if($js_loaded == false) { |
84
|
|
|
// $this->template_groups_chooser_js(); |
85
|
2 |
|
$js_loaded = true; |
86
|
|
|
} |
87
|
2 |
|
if(!isset($this->args['display'])) { |
88
|
2 |
|
$table_style = ""; |
89
|
|
|
} |
90
|
|
|
else { |
91
|
|
|
$table_style = "display: ".$this->args['display']; |
92
|
|
|
} |
93
|
|
|
|
94
|
2 |
|
$str .= "<div id=\"{$this->args['id']}\" style=\"{$table_style}\">"; |
95
|
2 |
|
if(!empty($this->args['title'])) $str .= "<h4>{$this->args['title']}</h4>"; |
96
|
|
|
$str .= <<<EOQ |
97
|
|
|
<table cellpadding="0" cellspacing="0" border="0"> |
98
|
|
|
|
99
|
|
|
<tr> |
100
|
|
|
<td> </td> |
101
|
2 |
|
<td scope="row" id="chooser_{$this->args['left_name']}_text" align="center"><nobr>{$this->args['left_label']}</nobr></td> |
102
|
|
|
EOQ; |
103
|
|
|
|
104
|
2 |
|
if($this->display_hide_tabs == true) { |
|
|
|
|
105
|
|
|
$str .= <<<EOQ |
106
|
|
|
<td> </td> |
107
|
2 |
|
<td scope="row" id="chooser_{$this->args['right_name']}" align="center"><nobr>{$this->args['right_label']}</nobr></td> |
108
|
|
|
EOQ; |
109
|
|
|
} |
110
|
|
|
|
111
|
2 |
|
if($this->display_third_tabs == true) { |
|
|
|
|
112
|
|
|
$str .= <<<EOQ |
113
|
|
|
<td> </td> |
114
|
|
|
<td> </td> |
115
|
|
|
<td scope="row" id="chooser_{$this->args['third_name']}" align="center"><nobr>{$this->args['third_label']}</nobr></td> |
116
|
|
|
EOQ; |
117
|
|
|
} |
118
|
|
|
|
119
|
2 |
|
$str .= '<td> </td></tr><tr><td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">'; |
120
|
2 |
|
if(!isset($this->args['disable'])) { |
121
|
2 |
|
$str .= "<a id='chooser_{$this->args['left_name']}_up_arrow' onclick=\"return SUGAR.tabChooser.up('{$this->args['left_name']}','{$this->args['left_name']}','{$this->args['right_name']}');\">" . SugarThemeRegistry::current()->getImage('uparrow_big','border="0" style="margin-bottom: 1px;"',null,null,'.gif',$alt_tip_up) . "</a><br> |
122
|
2 |
|
<a id='chooser_{$this->args['right_name']}_down_arrow' onclick=\"return SUGAR.tabChooser.down('{$this->args['left_name']}','{$this->args['left_name']}','{$this->args['right_name']}');\">" . SugarThemeRegistry::current()->getImage('downarrow_big','border="0" style="margin-top: 1px;"',null,null,'.gif',$alt_tip_down) . "</a>"; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
$str .= <<<EOQ |
126
|
|
|
</td> |
127
|
|
|
<td align="center"> |
128
|
|
|
<table border="0" cellspacing=0 cellpadding="0" align="center"> |
129
|
|
|
<tr> |
130
|
2 |
|
<td id="{$this->args['left_name']}_td" align="center"> |
131
|
2 |
|
<select id="{$this->args['left_name']}" name="{$this->args['left_name']}[]" size= |
132
|
|
|
EOQ; |
133
|
2 |
|
$str .= '"' . (empty($this->args['left_size']) ? '10' : $this->args['left_size']) . '" multiple="multiple" ' . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">'; |
134
|
|
|
|
135
|
2 |
|
foreach($this->args['values_array'][0] as $key=>$value) { |
136
|
1 |
|
$str .= "<option value='{$key}'>{$value}</option>"; |
137
|
|
|
} |
138
|
|
|
$str .= "</select></td> |
139
|
|
|
</tr> |
140
|
|
|
</table> |
141
|
2 |
|
</td>"; |
142
|
2 |
|
if ($this->display_hide_tabs == true) { |
|
|
|
|
143
|
2 |
|
$str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">'; |
144
|
2 |
|
if(!isset($this->args['disable'])) { |
145
|
2 |
|
$str .= "<a id='chooser_{$this->args['left_name']}_left_arrow' onclick=\"return SUGAR.tabChooser.right_to_left('{$this->args['left_name']}','{$this->args['right_name']}', '{$left_size}', '{$right_size}', '{$max_left}');\">" . SugarThemeRegistry::current()->getImage('leftarrow_big','border="0" style="margin-right: 1px;"',null,null,'.gif',$alt_tip_left) . "</a><a id='chooser_{$this->args['left_name']}_left_to_right' onclick=\"return SUGAR.tabChooser.left_to_right('{$this->args['left_name']}','{$this->args['right_name']}', '{$left_size}', '{$right_size}');\">" . SugarThemeRegistry::current()->getImage('rightarrow_big','border="0" style="margin-left: 1px;"',null,null,'.gif',$alt_tip_right) . "</a>"; |
146
|
|
|
} |
147
|
|
|
$str .= "</td> |
148
|
2 |
|
<td id=\"{$this->args['right_name']}_td\" align=\"center\"> |
149
|
2 |
|
<select id=\"{$this->args['right_name']}\" name=\"{$this->args['right_name']}[]\" size=\"" . (empty($this->args['right_size']) ? '10' : $this->args['right_size']) . "\" multiple=\"multiple\" " . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">'; |
150
|
2 |
|
foreach($this->args['values_array'][1] as $key=>$value) { |
151
|
1 |
|
$str .= "<option value=\"{$key}\">{$value}</option>"; |
152
|
|
|
} |
153
|
|
|
$str .= "</select></td><td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">" |
154
|
2 |
|
. "<script>var object_refs = new Object();object_refs['{$this->args['right_name']}'] = document.getElementById('{$this->args['right_name']}');</script>"; |
155
|
|
|
} |
156
|
|
|
|
157
|
2 |
|
if ($this->display_third_tabs == true) { |
|
|
|
|
158
|
|
|
$str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">'; |
159
|
|
|
if(!isset($this->args['disable'])) { |
160
|
|
|
$str .= "<a id='chooser_{$this->args['right_name']}_right_arrow' onclick=\"return SUGAR.tabChooser.right_to_left('{$this->args['right_name']}','{$this->args['third_name']}', '{$right_size}', '{$third_size}');\">" . SugarThemeRegistry::current()->getImage('leftarrow_big','border="0" style="margin-right: 1px;"',null,null,'.gif',$alt_tip_left) . "</a><a id='chooser_{$this->args['right_name']}_left_to_right' onclick=\"return SUGAR.tabChooser.left_to_right('{$this->args['right_name']}','{$this->args['third_name']}', '{$right_size}', '{$third_size}');\">" . SugarThemeRegistry::current()->getImage('rightarrow_big','border="0" style="margin-left: 1px;"',null,null,'.gif',$alt_tip_right) . "</a>"; |
161
|
|
|
} |
162
|
|
|
$str .= "</td> |
163
|
|
|
<td id=\"{$this->args['third_name']}_td\" align=\"center\"> |
164
|
|
|
<select id=\"{$this->args['third_name']}\" name=\"{$this->args['third_name']}[]\" size=\"" . (empty($this->args['third_size']) ? '10' : $this->args['third_size']) . "\" multiple=\"multiple\" " . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">'; |
165
|
|
|
foreach($this->args['values_array'][2] as $key=>$value) { |
166
|
|
|
$str .= "<option value=\"{$key}\">{$value}</option>"; |
167
|
|
|
} |
168
|
|
|
$str .= "</select> |
169
|
|
|
<script> |
170
|
|
|
object_refs['{$this->args['third_name']}'] = document.getElementById('{$this->args['third_name']}'); |
171
|
|
|
</script> |
172
|
|
|
<td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\"> |
173
|
|
|
</td>"; |
174
|
|
|
} |
175
|
|
|
$str .= "<script> |
176
|
2 |
|
object_refs['{$this->args['left_name']}'] = document.getElementById('{$this->args['left_name']}'); |
177
|
|
|
</script></tr> |
178
|
2 |
|
</table></div>"; |
179
|
|
|
|
180
|
|
|
|
181
|
2 |
|
return $str; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
|
185
|
|
|
|
186
|
|
|
/* |
187
|
|
|
* All Moved to sugar_3.js in class tabChooser; |
188
|
|
|
* Please follow style that Dashlet configuration is done. |
189
|
|
|
*/ |
190
|
|
|
function template_groups_chooser_js() { |
191
|
|
|
//return '<script>var object_refs = new Object();</script>'; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
?> |
197
|
|
|
|
When comparing two booleans, it is generally considered safer to use the strict comparison operator.