2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 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 ********************************************************************************/
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'}"/>
44 <script language="javascript">
46 var _sourceArray = new Array();
51 _tabView = new YAHOO.widget.TabView();
54 {counter assign=source_count start=0 print=0}
55 {foreach name=connectors from=$SOURCES key=name item=source}
56 {counter assign=source_count}
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},
63 {if $source_count == 1}
70 _sourceArray[{/literal}{$source_count}{literal}-1] = '{/literal}{$source.id}';
71 tab.addListener('contentChange', SourceTabs.tabContentChanged);
72 tab.id = '{$source.id}';
76 _tabView.appendTo('container');
79 tabContentChanged: function(info) {
80 tab = _tabView.get('activeTab');
81 SUGAR.util.evalScript(tab.get('content'));;
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';
91 getTabView : function() {
95 YAHOO.util.Event.onDOMReady(SourceTabs.init);
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="">
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}">
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="">
113 <table border="0" class="actionsContainer">
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}">
119 <table cellspacing="0" cellpadding="0" border="0" width="100%">
122 <div id="container" style="height: 465px">
127 <table border="0" class="actionsContainer">
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}">
136 <script type="text/javascript">
137 function calculateValues() {
138 tabview = SourceTabs.getTabView();
141 sources = new Array();
142 //Get the source divs
143 elements = tabview.getElementsByClassName('sources_table_div', 'div');
144 for(el in elements) {
147 if(typeof elements[el] == 'function') {
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;
159 //Get the table elements
160 tables = tabview.getElementsByClassName('mapping_table', 'table');
164 if(typeof tables[t] == 'function') {
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;
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) : '';
181 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);