]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Connectors/tpls/modify_mapping.tpl
Release 6.4.0
[Github/sugarcrm.git] / modules / Connectors / tpls / modify_mapping.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 <script type="text/javascript" src="{sugar_getjspath file='cache/include/javascript/sugar_grp_yui_widgets.js'}"></script>
39 <script type="text/javascript" src="{sugar_getjspath file='modules/Connectors/Connector.js'}"></script>
40 <link rel="stylesheet" type="text/css" href="{sugar_getjspath file='modules/Connectors/tpls/tabs.css'}"/>
41
42 {literal}
43
44 <script language="javascript">
45
46 var _sourceArray = new Array();
47
48 var SourceTabs = {
49
50     init : function() {    
51          _tabView = new YAHOO.widget.TabView();
52
53         {/literal}      
54                  {counter assign=source_count start=0 print=0} 
55                 {foreach name=connectors from=$SOURCES key=name item=source}   
56                     {counter assign=source_count}
57                 {literal} 
58                         tab = new YAHOO.widget.Tab({
59                                 label: '{/literal}{$source.name}{literal} ',
60                                 dataSrc: {/literal}'index.php?module=Connectors&action=MappingProperties&source_id={$source.id}'{literal},
61                                 cacheData: true,
62                                 {/literal}
63                                 {if $source_count == 1}
64                                 active: true
65                                 {else}
66                                 active: false
67                                 {/if}
68                                 {literal}
69                             });                     
70                             _sourceArray[{/literal}{$source_count}{literal}-1] = '{/literal}{$source.id}';
71                             tab.addListener('contentChange', SourceTabs.tabContentChanged);
72                             tab.id = '{$source.id}';
73                             _tabView.addTab(tab);
74                {/foreach}
75                   {literal} 
76                 _tabView.appendTo('container'); 
77     },
78     
79     tabContentChanged: function(info) { 
80         tab = _tabView.get('activeTab');
81         SUGAR.util.evalScript(tab.get('content'));;
82     },
83
84     fitContainer: function() {
85                 _tabView = SourceTabs.getTabView();
86                 content_div = _tabView.getElementsByClassName('yui-content', 'div')[0];
87                 content_div.style.overflow='auto'; 
88                 content_div.style.height='405px';  
89     },
90      
91     getTabView : function() {
92         return _tabView;
93     }
94 }
95 YAHOO.util.Event.onDOMReady(SourceTabs.init);
96 </script>
97 {/literal}
98 <form name="ModifyMapping" method="POST" onsubmit="return calculateValues();">
99 <input type="hidden" name="modify" value="true">
100 <input type="hidden" name="module" value="Connectors">
101 <input type="hidden" name="action" value="SaveModifyMapping">
102 <input type="hidden" name="source_id" value="">
103
104 {counter assign=source_count start=0 print=0} 
105 {foreach name=connectors from=$SOURCES key=name item=source}  
106 {counter assign=source_count}
107 <input type="hidden" name="source{$source_count}" value="{$source.id}">  
108 {/foreach}
109 <input type="hidden" name="mapping_values" value="">
110 <input type="hidden" name="mapping_sources" value="">
111 <input type="hidden" name="reset_to_default" value="">
112
113 <table border="0" class="actionsContainer">
114 <tr><td>
115 <input id="connectors_top_save" title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
116 <input id="connectors_top_cancel" title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.ModifyMapping.action.value='ConnectorSettings'; document.ModifyMapping.module.value='Connectors';" type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
117 </td></tr>
118 </table>
119 <table cellspacing="0" cellpadding="0" border="0" width="100%">
120 <tr><td>
121 <div>
122 <div id="container" style="height: 465px">
123 </div>
124 </div>
125 </td></tr>
126 </table>
127 <table border="0" class="actionsContainer">
128 <tr><td>
129 <input id="connectors_bottom_save" title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
130 <input id="connectors_bottom_cancel" title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.ModifyMapping.action.value='ConnectorSettings'; document.ModifyMapping.module.value='Connectors';" type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
131 </td></tr>
132 </table>
133 </form>
134
135 {literal}
136 <script type="text/javascript">
137 function calculateValues() {
138     tabview = SourceTabs.getTabView();
139     mapping_vals = ''
140     source_vals = '';
141     sources = new Array();
142     //Get the source divs
143     elements = tabview.getElementsByClassName('sources_table_div', 'div');
144     for(el in elements) {
145
146         //Fix for IE6
147         if(typeof elements[el] == 'function') {
148            continue;
149         }
150         
151         div_id = elements[el].getAttribute('id');
152         source_id = div_id.substr(0, div_id.indexOf('_add_tables'));
153         if(sources[source_id] == null) {
154            sources[source_id] = source_id;
155            source_vals += ',' + source_id;
156         }
157     }
158     
159     //Get the table elements
160     tables = tabview.getElementsByClassName('mapping_table', 'table'); 
161     for(t in tables) {
162
163         //Fix for IE6
164         if(typeof tables[t] == 'function') {
165            continue;
166         }
167
168         select_elements = tables[t].getElementsByTagName("select");
169         for(el in select_elements) {
170             select_dom = document.getElementById(select_elements[el].id);
171             if(select_dom != null && select_elements[el].value != '') {
172                mapping_vals += ',' +  select_elements[el].getAttribute('id') + '=' + select_elements[el].value;
173             }
174         }
175     }
176     document.ModifyMapping.mapping_values.value = mapping_vals != '' ? mapping_vals.substr(1, mapping_vals.length) : '';
177     document.ModifyMapping.mapping_sources.value = source_vals != '' ? source_vals.substr(1, source_vals.length) : '';
178     return true;
179 }
180
181 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);
182 </script>
183 {/literal}