]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Connectors/tpls/display_properties.tpl
Release 6.1.4
[Github/sugarcrm.git] / modules / Connectors / tpls / display_properties.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
5  * 
6  * This program is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  * 
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
16  * details.
17  * 
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  * 
23  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25  * 
26  * The interactive user interfaces in modified source and object code versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  * 
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the "Powered by
32  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33  * technical reasons, the Appropriate Legal Notices must display the words
34  * "Powered by SugarCRM".
35  ********************************************************************************/
36
37 *}
38 <table id="{$source_id}" class="sources_table" border="0" cellspacing="1" cellpadding="1">
39 <tr>
40 <td width="33%">
41 <span><b>{$mod.LBL_ENABLED}</b></span>
42 </td>
43 <td width="33%">
44 <span><b>{$mod.LBL_DISABLED}</b></span>
45 </td>
46 <td width="33%">&nbsp;</td>
47 </tr>
48 <tr>
49 <td>
50 <div id="{$source_id}:enabled_div" class="enabled_module_workarea">
51 <ul id="{$source_id}:enabled_ul" class="module_draglist">
52 {foreach from=$enabled_modules item=module}
53 <li id="{$source_id}:{$module}" class="noBullet2">{$module}</li>
54 {/foreach}
55 </ul>
56 </div>
57 </td>
58 <td>
59 <div id="{$source_id}:disabled_div" class="disabled_module_workarea">
60 <ul id="{$source_id}:disabled_ul" class="module_draglist">
61 {foreach from=$disabled_modules item=module}
62 <li id="{$source_id}:{$module}" class="noBullet2">{$module}</li>
63 {/foreach}
64 </ul>
65 </div>
66 </td>
67 <td>&nbsp;</td>
68 </tr>
69 </table>
70
71 <script type="text/javascript">
72 {literal}
73
74 var Dom = YAHOO.util.Dom; 
75 var Event = YAHOO.util.Event; 
76 var DDM = YAHOO.util.DragDropMgr;
77
78 (function() {
79
80 YAHOO.example.DDApp = { 
81 init: function() { 
82 {/literal}          
83         new YAHOO.util.DDTarget("{$source_id}:enabled_ul"); 
84         new YAHOO.util.DDTarget("{$source_id}:disabled_ul");
85         
86         {foreach from=$enabled_modules item=module}
87              new YAHOO.example.DDList("{$source_id}:{$module}");
88         {/foreach}      
89          
90         {foreach from=$disabled_modules item=module}
91              new YAHOO.example.DDList("{$source_id}:{$module}");
92         {/foreach} 
93 {literal}               
94 }
95 };
96
97
98 YAHOO.example.DDList = function(id, sGroup, config) { 
99     YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config); 
100     var el = this.getDragEl(); 
101     Dom.setStyle(el, "opacity", 0.67);
102     this.goingUp = false; 
103     this.lastY = 0; 
104 }; 
105
106
107 YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy, {         
108             startDrag: function(x, y) { 
109                 // make the proxy look like the source element 
110                 var dragEl = this.getDragEl(); 
111                 var clickEl = this.getEl(); 
112                 Dom.setStyle(clickEl, "visibility", "hidden"); 
113                 dragEl.innerHTML = clickEl.innerHTML; 
114                 Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color")); 
115                 Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor")); 
116                 Dom.setStyle(dragEl, "border", "2px solid gray"); 
117             }, 
118          
119             endDrag: function(e) { 
120          
121                 var srcEl = this.getEl(); 
122                 var proxy = this.getDragEl(); 
123          
124                 // Show the proxy element and animate it to the src element's location 
125                 Dom.setStyle(proxy, "visibility", ""); 
126                 var a = new YAHOO.util.Motion(  
127                     proxy, {  
128                         points: {  
129                             to: Dom.getXY(srcEl) 
130                         } 
131                     },  
132                     0.2,  
133                     YAHOO.util.Easing.easeOut  
134                 ) 
135                 var proxyid = proxy.id; 
136                 var thisid = this.id; 
137          
138                 // Hide the proxy and show the source element when finished with the animation 
139                 a.onComplete.subscribe(function() { 
140                         Dom.setStyle(proxyid, "visibility", "hidden"); 
141                         Dom.setStyle(thisid, "visibility", ""); 
142                     }); 
143                 a.animate(); 
144             }, 
145          
146             onDragDrop: function(e, id) {        
147                 // If there is one drop interaction, the li was dropped either on the list, 
148                 // or it was dropped on the current location of the source element. 
149                 if (typeof(DDM.interactionInfo) != 'undefined' && DDM.interactionInfo.drop.length === 1) { 
150          
151                     // The position of the cursor at the time of the drop (YAHOO.util.Point) 
152                     var pt = DDM.interactionInfo.point;  
153          
154                     // The region occupied by the source element at the time of the drop 
155                     var region = DDM.interactionInfo.sourceRegion;  
156                     // Check to see if we are over the source element's location.  We will 
157                     // append to the bottom of the list once we are sure it was a drop in 
158                     // the negative space (the area of the list without any list items) 
159                     if (!region.intersect(pt)) { 
160                         var destEl = Dom.get(id);
161                         var destDD = DDM.getDDById(id); 
162                         destEl.appendChild(this.getEl()); 
163                         destDD.isEmpty = false; 
164                         DDM.refreshCache(); 
165                     } 
166          
167                 } 
168             }, 
169          
170             onDrag: function(e) { 
171          
172                 // Keep track of the direction of the drag for use during onDragOver 
173                 var y = Event.getPageY(e); 
174          
175                 if (y < this.lastY) { 
176                     this.goingUp = true; 
177                 } else if (y > this.lastY) { 
178                     this.goingUp = false; 
179                 } 
180          
181                 this.lastY = y; 
182             },
183         
184             onDragOver: function(e, id) { 
185                 var srcEl = this.getEl(); 
186                 var destEl = Dom.get(id);
187          
188                 if (destEl.nodeName.toLowerCase() == "li") { 
189                     var orig_p = srcEl.parentNode; 
190                     var p = destEl.parentNode; 
191                         if (this.goingUp) { 
192                         p.insertBefore(srcEl, destEl); // insert above 
193                     } else { 
194                         p.insertBefore(srcEl, destEl.nextSibling); // insert below 
195                     } 
196                         DDM.refreshCache(); 
197                 }  
198             } 
199 }); 
200
201  
202 Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);
203
204
205 })();
206 {/literal}
207 </script>