]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/templates/TemplateGroupChooser.php
Release 6.4.0
[Github/sugarcrm.git] / include / templates / TemplateGroupChooser.php
1 <?php
2 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-2011 SugarCRM Inc.
7  * 
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.
14  * 
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
18  * details.
19  * 
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
23  * 02110-1301 USA.
24  * 
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.
27  * 
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.
31  * 
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  ********************************************************************************/
38
39
40 $js_loaded = false;
41 require_once("include/templates/Template.php");
42
43 class TemplateGroupChooser extends Template {
44     var $args;
45     var $js_loaded = false;
46     var $display_hide_tabs = true;
47     var $display_third_tabs = false;
48
49     function TemplateGroupChooser() {
50     }
51
52     function display() {
53         global $app_strings, $mod_strings, $js_loaded;
54         
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'];
63         
64         $str = '';
65         if($js_loaded == false) {
66 //            $this->template_groups_chooser_js();
67             $js_loaded = true;
68         }
69         if(!isset($this->args['display'])) {
70             $table_style = "";
71         }
72         else {
73             $table_style = "display: ".$this->args['display'];
74         }
75
76         $str .= "<div id=\"{$this->args['id']}\" style=\"{$table_style}\">";
77         if(!empty($this->args['title'])) $str .= "<h4>{$this->args['title']}</h4>";
78         $str .= <<<EOQ
79         <table cellpadding="0" cellspacing="0" border="0">
80         
81         <tr>
82             <td>&nbsp;</td>
83             <td scope="row" id="chooser_{$this->args['left_name']}_text" align="center"><nobr>{$this->args['left_label']}</nobr></td>
84 EOQ;
85
86         if($this->display_hide_tabs == true) {
87            $str .= <<<EOQ
88             <td>&nbsp;</td>
89             <td scope="row" id="chooser_{$this->args['right_name']}" align="center"><nobr>{$this->args['right_label']}</nobr></td>
90 EOQ;
91         }
92         
93         if($this->display_third_tabs == true) {
94            $str .= <<<EOQ
95             <td>&nbsp;</td>
96                 <td>&nbsp;</td>
97                 <td scope="row" id="chooser_{$this->args['third_name']}" align="center"><nobr>{$this->args['third_label']}</nobr></td>
98 EOQ;
99         }
100         
101         $str .= '<td>&nbsp;</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>";
105         }
106         
107         $str .= <<<EOQ
108                 </td>    
109                 <td align="center">
110                     <table border="0" cellspacing=0 cellpadding="0" align="center">
111                         <tr>
112                             <td id="{$this->args['left_name']}_td" align="center">
113                             <select id="{$this->args['left_name']}" name="{$this->args['left_name']}[]" size=
114 EOQ;
115         $str .=  '"' . (empty($this->args['left_size']) ? '10' : $this->args['left_size']) . '" multiple="multiple" ' . (isset($this->args['disable']) ?  "DISABLED" : '') . 'style="width: 150px;">';
116
117         foreach($this->args['values_array'][0] as $key=>$value) {
118             $str .= "<option value='{$key}'>{$value}</option>";
119         }
120         $str .= "</select></td>
121             </tr>
122             </table>
123             </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>";
128             }
129             $str .= "</td>
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>";
134             }
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>";
137          }
138          
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>";
143             }
144             $str .= "</td>
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>";
149             }
150             $str .= "</select>
151                 <script>
152                     object_refs['{$this->args['third_name']}'] = document.getElementById('{$this->args['third_name']}');
153                 </script>
154                 <td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">
155                 </td>";
156          }
157          $str .= "<script>
158                 object_refs['{$this->args['left_name']}'] = document.getElementById('{$this->args['left_name']}');
159                 </script></tr>
160             </table></div>";
161
162                 
163         return $str;
164 }
165
166
167
168     /*
169      * All Moved to sugar_3.js in class tabChooser;
170      * Please follow style that Dashlet configuration is done.
171      */ 
172     function template_groups_chooser_js() {
173         //return '<script>var object_refs = new Object();</script>';
174     }
175
176 }
177
178 ?>