2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
4 /*********************************************************************************
5 * SugarCRM Community Edition is a customer relationship management program developed by
6 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Affero General Public License version 3 as published by the
10 * Free Software Foundation with the addition of the following permission added
11 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
12 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
13 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
20 * You should have received a copy of the GNU Affero General Public License along with
21 * this program; if not, see http://www.gnu.org/licenses or write to the Free
22 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
26 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
28 * The interactive user interfaces in modified source and object code versions
29 * of this program must display Appropriate Legal Notices, as required under
30 * Section 5 of the GNU Affero General Public License version 3.
32 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
33 * these Appropriate Legal Notices must retain the display of the "Powered by
34 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
35 * technical reasons, the Appropriate Legal Notices must display the words
36 * "Powered by SugarCRM".
37 ********************************************************************************/
41 require_once("include/templates/Template.php");
43 class TemplateGroupChooser extends Template {
45 var $js_loaded = false;
46 var $display_hide_tabs = true;
47 var $display_third_tabs = false;
49 function TemplateGroupChooser() {
53 global $mod_strings, $js_loaded;
55 $left_size = (empty($this->args['left_size']) ? '10' : $this->args['left_size']);
56 $right_size = (empty($this->args['right_size']) ? '10' : $this->args['right_size']);
57 $third_size = (empty($this->args['third_size']) ? '10' : $this->args['third_size']);
58 $max_left = (empty($this->args['max_left']) ? '' : $this->args['max_left']);
59 $alt_tip = (empty($this->args['alt_tip']) ? '' : $this->args['alt_tip']);
62 if($js_loaded == false) {
63 // $this->template_groups_chooser_js();
66 if(!isset($this->args['display'])) {
70 $table_style = "display: ".$this->args['display'];
73 $str .= "<div id=\"{$this->args['id']}\" style=\"{$table_style}\">";
74 if(!empty($this->args['title'])) $str .= "<h4>{$this->args['title']}</h4>";
76 <table cellpadding="0" cellspacing="0" border="0">
80 <td scope="row" id="chooser_{$this->args['left_name']}_text" align="center"><nobr>{$this->args['left_label']}</nobr></td>
83 if($this->display_hide_tabs == true) {
86 <td scope="row" id="chooser_{$this->args['right_name']}" align="center"><nobr>{$this->args['right_label']}</nobr></td>
90 if($this->display_third_tabs == true) {
94 <td scope="row" id="chooser_{$this->args['third_name']}" align="center"><nobr>{$this->args['third_label']}</nobr></td>
98 $str .= '<td> </td></tr><tr><td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
99 if(!isset($this->args['disable'])) {
100 $str .= "<a 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;" alt="'.$alt_tip.'"') . "</a><br>
101 <a 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;" alt="'.$alt_tip.'"') . "</a>";
107 <table border="0" cellspacing=0 cellpadding="0" align="center">
109 <td id="{$this->args['left_name']}_td" align="center">
110 <select id="{$this->args['left_name']}" name="{$this->args['left_name']}[]" size=
112 $str .= '"' . (empty($this->args['left_size']) ? '10' : $this->args['left_size']) . '" multiple="multiple" ' . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">';
114 foreach($this->args['values_array'][0] as $key=>$value) {
115 $str .= "<option value='{$key}'>{$value}</option>";
117 $str .= "</select></td>
121 if ($this->display_hide_tabs == true) {
122 $str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
123 if(!isset($this->args['disable'])) {
124 $str .= "<a 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;" alt="'.$alt_tip.'"') . "</a><a 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;" alt="'.$alt_tip.'"') . "</a>";
127 <td id=\"{$this->args['right_name']}_td\" align=\"center\">
128 <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;">';
129 foreach($this->args['values_array'][1] as $key=>$value) {
130 $str .= "<option value=\"{$key}\">{$value}</option>";
132 $str .= "</select></td><td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">"
133 . "<script>var object_refs = new Object();object_refs['{$this->args['right_name']}'] = document.getElementById('{$this->args['right_name']}');</script>";
136 if ($this->display_third_tabs == true) {
137 $str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
138 if(!isset($this->args['disable'])) {
139 $str .= "<a 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;" alt="'.$alt_tip.'"') . "</a><a 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;" alt="'.$alt_tip.'"') . "</a>";
142 <td id=\"{$this->args['third_name']}_td\" align=\"center\">
143 <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;">';
144 foreach($this->args['values_array'][2] as $key=>$value) {
145 $str .= "<option value=\"{$key}\">{$value}</option>";
149 object_refs['{$this->args['third_name']}'] = document.getElementById('{$this->args['third_name']}');
151 <td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">
155 object_refs['{$this->args['left_name']}'] = document.getElementById('{$this->args['left_name']}');
166 * All Moved to sugar_3.js in class tabChooser;
167 * Please follow style that Dashlet configuration is done.
169 function template_groups_chooser_js() {
170 //return '<script>var object_refs = new Object();</script>';