]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Campaigns/Subscriptions.tpl
Release 6.5.0
[Github/sugarcrm.git] / modules / Campaigns / Subscriptions.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2012 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
39 <link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
40
41 <table width="100%" border="0" cellspacing="0" cellpadding="0">
42 <tr><td colspan='100'><h2>{$title}</h2></td></tr>
43 <tr><td colspan='100'>
44 {$description}
45 </td></tr><tr><td><br></td></tr><tr><td colspan='100'>
46
47 <form name="ConfigureSubs" method="POST"  method="POST" action="index.php">
48
49     <form enctype="multipart/form-data" id="SubsForm" name="SubsForm" method="POST" action="index.php">
50     <input type="hidden" name="module" value="Campaigns">
51     <input type="hidden" name="action" value="Subscriptions">
52     <input type="hidden" name="enabled_subs" value="">
53     <input type="hidden" name="disabled_subs" value="">
54     <input type="hidden" name="return_module" value="{$RETURN_MODULE}">
55     <input type="hidden" name="return_action" value="{$RETURN_ACTION}">
56     <input type="hidden" name="module_tab" value="{$smarty.request.module_tab}">
57     <input type="hidden" name="orig_disabled_values" id="orig_disabled_values" value="{$disabled_subs_string}">
58     <input type="hidden" name="orig_enabled_values" id="orig_enabled_values" value="{$enabled_subs_string}">
59     <input type="hidden" name="record" value="{$RECORD}">
60     <input type="hidden" name="subs_action" value="process">
61
62     {sugar_action_menu buttons=$BUTTONS}
63
64     <div class='add_table' style='margin-bottom:5px'>
65         <table id="ConfigureSubs" class="themeSettings edit view" style='margin-bottom:0px;' border="0" cellspacing="0" cellpadding="0">
66             <tr>
67                 <td><span><b>{$MOD.LBL_ALREADY_SUBSCRIBED_HEADER}</b></span></td>
68                 <td><span><b>{$MOD.LBL_UNSUBSCRIBED_HEADER}</b>{sugar_help text=$MOD.LBL_UNSUBSCRIBED_HEADER_EXPL }
69                 </span></td>
70             </tr>
71             <tr>
72                 <td width='1%'>
73                     <div id="enabled_div" class="enabled_tab_workarea">
74                         <ul id="enabled_ul" class="module_draglist">
75                             {foreach from=$enabled_subs key=dirname item=name}
76                             <li id="{$dirname}" class="noBullet2">{$name}</li>
77                             {/foreach}
78                         </ul>
79                     </div>
80                 </td>
81                 <td>
82                     <div id="disabled_div" class="disabled_tab_workarea">
83                         <ul id="disabled_ul" class="module_draglist">
84                             {foreach from=$disabled_subs key=dirname item=name}
85                             <li id="{$dirname}" class="noBullet2">{$name}</li>
86                             {/foreach}
87                         </ul>
88                     </div>
89                 </td>
90             </tr>
91         </table>
92     </div>
93
94     {sugar_action_menu buttons=$BUTTONS}
95 </form>
96
97
98 <script type="text/javascript">
99 {literal}
100
101 var Dom = YAHOO.util.Dom;
102 var Event = YAHOO.util.Event;
103 var DDM = YAHOO.util.DragDropMgr;
104
105 function save() {
106     var enabled_display_vals = '';
107     var disabled_display_vals = '';
108
109     //Get the enabled div elements
110     var elements = document.getElementById('enabled_div');
111     //Get the li elements
112         var enabled_list = YAHOO.util.Dom.getElementsByClassName('noBullet2', 'li', elements);
113     for(var li in enabled_list) {
114         if(typeof enabled_list[li] != 'function') {
115             enabled_display_vals += ',' + enabled_list[li].getAttribute('id');
116         }
117     }
118     document.ConfigureSubs.enabled_subs.value = enabled_display_vals != '' ? enabled_display_vals.substr(1,enabled_display_vals.length) : '';
119
120     var elements = document.getElementById('disabled_div');
121     //Get the li elements
122     var disabled_list = YAHOO.util.Dom.getElementsByClassName('noBullet2', 'li', elements);
123     for(var li in disabled_list) {
124         if(typeof disabled_list[li] != 'function') {
125             disabled_display_vals += ',' + disabled_list[li].getAttribute('id');
126         }
127     }
128
129     document.ConfigureSubs.disabled_subs.value = disabled_display_vals != '' ? disabled_display_vals.substr(1,disabled_display_vals.length) : '';
130 }
131
132
133 (function() {
134
135 YAHOO.example.DDApp = {
136 init: function() {
137 {/literal}
138     new YAHOO.util.DDTarget("enabled_ul");
139     new YAHOO.util.DDTarget("disabled_ul");
140
141     {foreach from=$enabled_subs key=module item=moduleDisplay}
142     {if $module != $currentTheme}new YAHOO.example.DDList("{$module}");{/if}
143     {/foreach}
144
145     {foreach from=$disabled_subs key=module item=moduleDisplay}
146          new YAHOO.example.DDList("{$module}");
147     {/foreach}
148 {literal}
149 }
150 };
151
152 YAHOO.example.DDList = function(id, sGroup, config) {
153     YAHOO.example.DDList.superclass.constructor.call(this, id, sGroup, config);
154     var el = this.getDragEl();
155     Dom.setStyle(el, "opacity", 0.67);
156     this.goingUp = false;
157     this.lastY = 0;
158 };
159
160
161 YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy, {
162
163     startDrag: function(x, y) {
164
165         // make the proxy look like the source element
166         var dragEl = this.getDragEl();
167         var clickEl = this.getEl();
168         Dom.setStyle(clickEl, "visibility", "hidden");
169
170         dragEl.innerHTML = clickEl.innerHTML;
171
172         Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
173         Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
174         Dom.setStyle(dragEl, "border", "2px solid gray");
175     },
176
177     endDrag: function(e) {
178
179         var srcEl = this.getEl();
180         var proxy = this.getDragEl();
181
182         // Show the proxy element and animate it to the src element's location
183         Dom.setStyle(proxy, "visibility", "");
184         var a = new YAHOO.util.Motion(
185             proxy, {
186                 points: {
187                     to: Dom.getXY(srcEl)
188                 }
189             },
190             0.2,
191             YAHOO.util.Easing.easeOut
192         )
193         var proxyid = proxy.id;
194         var thisid = this.id;
195
196         // Hide the proxy and show the source element when finished with the animation
197         a.onComplete.subscribe(function() {
198                 Dom.setStyle(proxyid, "visibility", "hidden");
199                 Dom.setStyle(thisid, "visibility", "");
200             });
201         a.animate();
202     },
203
204     onDragDrop: function(e, id) {
205
206         // If there is one drop interaction, the li was dropped either on the list,
207         // or it was dropped on the current location of the source element.
208         if (DDM.interactionInfo.drop.length === 1) {
209
210             // The position of the cursor at the time of the drop (YAHOO.util.Point)
211             var pt = DDM.interactionInfo.point;
212
213             // The region occupied by the source element at the time of the drop
214             var region = DDM.interactionInfo.sourceRegion;
215
216             // Check to see if we are over the source element's location.  We will
217             // append to the bottom of the list once we are sure it was a drop in
218             // the negative space (the area of the list without any list items)
219             if (!region.intersect(pt)) {
220                 var destEl = Dom.get(id);
221                 var destDD = DDM.getDDById(id);
222                 destEl.appendChild(this.getEl());
223                 destDD.isEmpty = false;
224                 DDM.refreshCache();
225             }
226
227         }
228     },
229
230     onDrag: function(e) {
231
232         // Keep track of the direction of the drag for use during onDragOver
233         var y = Event.getPageY(e);
234
235         if (y < this.lastY) {
236             this.goingUp = true;
237         } else if (y > this.lastY) {
238             this.goingUp = false;
239         }
240
241         this.lastY = y;
242     },
243
244     onDragOver: function(e, id) {
245
246         var srcEl = this.getEl();
247         var destEl = Dom.get(id);
248
249         // We are only concerned with list items, we ignore the dragover
250         // notifications for the list.
251         if (destEl.nodeName.toLowerCase() == "li") {
252             var orig_p = srcEl.parentNode;
253             var p = destEl.parentNode;
254
255             if (this.goingUp) {
256                 p.insertBefore(srcEl, destEl); // insert above
257             } else {
258                 p.insertBefore(srcEl, destEl.nextSibling); // insert below
259             }
260
261             DDM.refreshCache();
262         }
263     }
264 });
265
266 Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);
267
268 })();
269 {/literal}
270 </script>