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 $app_strings, $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_up = $app_strings['LBL_ALT_MOVE_COLUMN_UP'];
60 $alt_tip_down = $app_strings['LBL_ALT_MOVE_COLUMN_DOWN'];
61 $alt_tip_left = $app_strings['LBL_ALT_MOVE_COLUMN_LEFT'];
62 $alt_tip_right = $app_strings['LBL_ALT_MOVE_COLUMN_RIGHT'];
65 if($js_loaded == false) {
66 // $this->template_groups_chooser_js();
69 if(!isset($this->args['display'])) {
73 $table_style = "display: ".$this->args['display'];
76 $str .= "<div id=\"{$this->args['id']}\" style=\"{$table_style}\">";
77 if(!empty($this->args['title'])) $str .= "<h4>{$this->args['title']}</h4>";
79 <table cellpadding="0" cellspacing="0" border="0">
83 <td scope="row" id="chooser_{$this->args['left_name']}_text" align="center"><nobr>{$this->args['left_label']}</nobr></td>
86 if($this->display_hide_tabs == true) {
89 <td scope="row" id="chooser_{$this->args['right_name']}" align="center"><nobr>{$this->args['right_label']}</nobr></td>
93 if($this->display_third_tabs == true) {
97 <td scope="row" id="chooser_{$this->args['third_name']}" align="center"><nobr>{$this->args['third_label']}</nobr></td>
101 $str .= '<td> </td></tr><tr><td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
102 if(!isset($this->args['disable'])) {
103 $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>
104 <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>";
110 <table border="0" cellspacing=0 cellpadding="0" align="center">
112 <td id="{$this->args['left_name']}_td" align="center">
113 <select id="{$this->args['left_name']}" name="{$this->args['left_name']}[]" size=
115 $str .= '"' . (empty($this->args['left_size']) ? '10' : $this->args['left_size']) . '" multiple="multiple" ' . (isset($this->args['disable']) ? "DISABLED" : '') . 'style="width: 150px;">';
117 foreach($this->args['values_array'][0] as $key=>$value) {
118 $str .= "<option value='{$key}'>{$value}</option>";
120 $str .= "</select></td>
124 if ($this->display_hide_tabs == true) {
125 $str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
126 if(!isset($this->args['disable'])) {
127 $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>";
130 <td id=\"{$this->args['right_name']}_td\" align=\"center\">
131 <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;">';
132 foreach($this->args['values_array'][1] as $key=>$value) {
133 $str .= "<option value=\"{$key}\">{$value}</option>";
135 $str .= "</select></td><td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">"
136 . "<script>var object_refs = new Object();object_refs['{$this->args['right_name']}'] = document.getElementById('{$this->args['right_name']}');</script>";
139 if ($this->display_third_tabs == true) {
140 $str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
141 if(!isset($this->args['disable'])) {
142 $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>";
145 <td id=\"{$this->args['third_name']}_td\" align=\"center\">
146 <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;">';
147 foreach($this->args['values_array'][2] as $key=>$value) {
148 $str .= "<option value=\"{$key}\">{$value}</option>";
152 object_refs['{$this->args['third_name']}'] = document.getElementById('{$this->args['third_name']}');
154 <td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">
158 object_refs['{$this->args['left_name']}'] = document.getElementById('{$this->args['left_name']}');
169 * All Moved to sugar_3.js in class tabChooser;
170 * Please follow style that Dashlet configuration is done.
172 function template_groups_chooser_js() {
173 //return '<script>var object_refs = new Object();</script>';