2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
39 <link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
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'>
45 </td></tr><tr><td><br></td></tr><tr><td colspan='100'>
47 <form name="ConfigureSubs" method="POST" method="POST" action="index.php">
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">
62 {sugar_action_menu buttons=$BUTTONS}
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">
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 }
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>
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>
94 {sugar_action_menu buttons=$BUTTONS}
98 <script type="text/javascript">
101 var Dom = YAHOO.util.Dom;
102 var Event = YAHOO.util.Event;
103 var DDM = YAHOO.util.DragDropMgr;
106 var enabled_display_vals = '';
107 var disabled_display_vals = '';
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');
118 document.ConfigureSubs.enabled_subs.value = enabled_display_vals != '' ? enabled_display_vals.substr(1,enabled_display_vals.length) : '';
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');
129 document.ConfigureSubs.disabled_subs.value = disabled_display_vals != '' ? disabled_display_vals.substr(1,disabled_display_vals.length) : '';
135 YAHOO.example.DDApp = {
138 new YAHOO.util.DDTarget("enabled_ul");
139 new YAHOO.util.DDTarget("disabled_ul");
141 {foreach from=$enabled_subs key=module item=moduleDisplay}
142 {if $module != $currentTheme}new YAHOO.example.DDList("{$module}");{/if}
145 {foreach from=$disabled_subs key=module item=moduleDisplay}
146 new YAHOO.example.DDList("{$module}");
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;
161 YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy, {
163 startDrag: function(x, y) {
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");
170 dragEl.innerHTML = clickEl.innerHTML;
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");
177 endDrag: function(e) {
179 var srcEl = this.getEl();
180 var proxy = this.getDragEl();
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(
191 YAHOO.util.Easing.easeOut
193 var proxyid = proxy.id;
194 var thisid = this.id;
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", "");
204 onDragDrop: function(e, id) {
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) {
210 // The position of the cursor at the time of the drop (YAHOO.util.Point)
211 var pt = DDM.interactionInfo.point;
213 // The region occupied by the source element at the time of the drop
214 var region = DDM.interactionInfo.sourceRegion;
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;
230 onDrag: function(e) {
232 // Keep track of the direction of the drag for use during onDragOver
233 var y = Event.getPageY(e);
235 if (y < this.lastY) {
237 } else if (y > this.lastY) {
238 this.goingUp = false;
244 onDragOver: function(e, id) {
246 var srcEl = this.getEl();
247 var destEl = Dom.get(id);
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;
256 p.insertBefore(srcEl, destEl); // insert above
258 p.insertBefore(srcEl, destEl.nextSibling); // insert below
266 Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);