]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Connectors/tpls/display_properties.tpl
Release 6.4.0
[Github/sugarcrm.git] / modules / Connectors / tpls / display_properties.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition 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 {if !empty($external)}
39 <input type="checkbox" value="1" name="{$source_id}_external" id="{$source_id}_external"{$externalChecked}> <label for="{$source_id}_external">{$mod.LBL_EXTERNAL} {if !empty($externalHasProperties)}{$mod.LBL_EXTERNAL_SET_PROPERTIES}{/if}</label><br/>
40 <br/>
41 {/if}
42 {if empty($externalOnly)}
43 <table id="{$source_id}" class="sources_table" border="0" cellspacing="1" cellpadding="1">
44 <tr>
45 <td width="33%">
46 <span><b>{$mod.LBL_ENABLED}</b></span>
47 </td>
48 <td width="33%">
49 <span><b>{$mod.LBL_DISABLED}</b></span>
50 </td>
51 <td width="33%">&nbsp;</td>
52 </tr>
53 <tr>
54 <td>
55 <div id="{$source_id}:enabled_div" class="enabled_module_workarea">
56 <ul id="{$source_id}:enabled_ul" class="module_draglist">
57 {foreach from=$enabled_modules item=module}
58 <li id="{$source_id}:{$module}" class="noBullet2">{sugar_translate label=$module}</li>
59 {/foreach}
60 </ul>
61 </div>
62 </td>
63 <td>
64 <div id="{$source_id}:disabled_div" class="disabled_module_workarea">
65 <ul id="{$source_id}:disabled_ul" class="module_draglist">
66 {foreach from=$disabled_modules item=module}
67 <li id="{$source_id}:{$module}" class="noBullet2">{sugar_translate label=$module}</li>
68 {/foreach}
69 </ul>
70 </div>
71 </td>
72 <td>&nbsp;</td>
73 </tr>
74 </table>
75
76 <script type="text/javascript">
77 {literal}
78
79 var Dom = YAHOO.util.Dom;
80 var Event = YAHOO.util.Event;
81 var DDM = YAHOO.util.DragDropMgr;
82
83 (function() {
84
85 YAHOO.example.DDApp = {
86 init: function() {
87 {/literal}
88         new YAHOO.util.DDTarget("{$source_id}:enabled_ul");
89         new YAHOO.util.DDTarget("{$source_id}:disabled_ul");
90
91         {foreach from=$enabled_modules item=module}
92              new YAHOO.example.DDList("{$source_id}:{$module}");
93         {/foreach}
94
95         {foreach from=$disabled_modules item=module}
96              new YAHOO.example.DDList("{$source_id}:{$module}");
97         {/foreach}
98 {literal}
99 }
100 };
101
102
103 YAHOO.example.DDList = function(id, sGroup, config) {
104     YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config);
105     var el = this.getDragEl();
106     Dom.setStyle(el, "opacity", 0.67);
107     this.goingUp = false;
108     this.lastY = 0;
109 };
110
111
112 YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy, {
113             startDrag: function(x, y) {
114                 // make the proxy look like the source element
115                 var dragEl = this.getDragEl();
116                 var clickEl = this.getEl();
117                 Dom.setStyle(clickEl, "visibility", "hidden");
118                 dragEl.innerHTML = clickEl.innerHTML;
119                 Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
120                 Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
121                 Dom.setStyle(dragEl, "border", "2px solid gray");
122             },
123
124             endDrag: function(e) {
125
126                 var srcEl = this.getEl();
127                 var proxy = this.getDragEl();
128
129                 // Show the proxy element and animate it to the src element's location
130                 Dom.setStyle(proxy, "visibility", "");
131                 var a = new YAHOO.util.Motion(
132                     proxy, {
133                         points: {
134                             to: Dom.getXY(srcEl)
135                         }
136                     },
137                     0.2,
138                     YAHOO.util.Easing.easeOut
139                 )
140                 var proxyid = proxy.id;
141                 var thisid = this.id;
142
143                 // Hide the proxy and show the source element when finished with the animation
144                 a.onComplete.subscribe(function() {
145                         Dom.setStyle(proxyid, "visibility", "hidden");
146                         Dom.setStyle(thisid, "visibility", "");
147                     });
148                 a.animate();
149             },
150
151             onDragDrop: function(e, id) {
152                 // If there is one drop interaction, the li was dropped either on the list,
153                 // or it was dropped on the current location of the source element.
154                 if (typeof(DDM.interactionInfo) != 'undefined' && DDM.interactionInfo.drop.length === 1) {
155
156                     // The position of the cursor at the time of the drop (YAHOO.util.Point)
157                     var pt = DDM.interactionInfo.point;
158
159                     // The region occupied by the source element at the time of the drop
160                     var region = DDM.interactionInfo.sourceRegion;
161                     // Check to see if we are over the source element's location.  We will
162                     // append to the bottom of the list once we are sure it was a drop in
163                     // the negative space (the area of the list without any list items)
164                     if (!region.intersect(pt)) {
165                         var destEl = Dom.get(id);
166                         var destDD = DDM.getDDById(id);
167                         destEl.appendChild(this.getEl());
168                         destDD.isEmpty = false;
169                         DDM.refreshCache();
170                     }
171
172                 }
173             },
174
175             onDrag: function(e) {
176
177                 // Keep track of the direction of the drag for use during onDragOver
178                 var y = Event.getPageY(e);
179
180                 if (y < this.lastY) {
181                     this.goingUp = true;
182                 } else if (y > this.lastY) {
183                     this.goingUp = false;
184                 }
185
186                 this.lastY = y;
187             },
188
189             onDragOver: function(e, id) {
190                 var srcEl = this.getEl();
191                 var destEl = Dom.get(id);
192
193                 if (destEl.nodeName.toLowerCase() == "li") {
194                     var orig_p = srcEl.parentNode;
195                     var p = destEl.parentNode;
196                         if (this.goingUp) {
197                         p.insertBefore(srcEl, destEl); // insert above
198                     } else {
199                         p.insertBefore(srcEl, destEl.nextSibling); // insert below
200                     }
201                         DDM.refreshCache();
202                 }
203             }
204 });
205
206
207 Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);
208
209
210 })();
211 {/literal}
212 </script>
213 {else}
214 <table id="{$source_id}" class="sources_table" border="0" cellspacing="1" cellpadding="1" style="display: none"></table>
215 {/if}