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 ********************************************************************************/
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 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=SearchProperties&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="ModifySearch" method="POST">
99 <input type="hidden" name="modify" value="true">
100 <input type="hidden" name="module" value="Connectors">
101 <input type="hidden" name="action" value="SaveModifySearch">
102 <input type="hidden" name="source_id" value="">
104 {counter assign=source_count start=0 print=0}
105 {if count($SOURCES) == 0}
106 {$MOD.ERROR_NO_SEARCHDEFS_MAPPED}
108 {foreach name=connectors from=$SOURCES key=name item=source}
109 {counter assign=source_count}
110 <input type="hidden" name="source{$source_count}" value="{$source.id}">
113 <input type="hidden" name="search_values" value="">
114 <input type="hidden" name="search_sources" value="">
115 <input type="hidden" name="reset_to_default" value="">
117 <table border="0" class="actionsContainer">
119 <input id="connectors_top_save" title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="calculateValues();" type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
120 <input id="connectors_top_cancel" title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.ModifySearch.action.value='ConnectorSettings'; document.ModifySearch.module.value='Connectors';" type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
123 <table cellspacing="0" cellpadding="0" border="0" width="100%">
126 <div id="container" style="height: 465px">
131 <table border="0" class="actionsContainer">
133 <input id="connectors_bottom_save" title="{$APP.LBL_SAVE_BUTTON_LABEL}" class="button" onclick="calculateValues();" type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
134 <input id="connectors_bottom_cancel" title="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="button" onclick="document.ModifySearch.action.value='ConnectorSettings'; document.ModifySearch.module.value='Connectors';" type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
140 <script type="text/javascript">
142 function calculateValues() {
143 tabview = SourceTabs.getTabView();
146 sources = new Array();
147 //Get the source divs
148 elements = tabview.getElementsByClassName('sources_table_div', 'div');
149 for(el in elements) {
150 if(typeof elements[el] == 'function') {
154 div_id = elements[el].getAttribute('id');
155 source_id = div_id.substr(0, div_id.indexOf('_add_tables'));
156 if(sources[source_id] == null) {
157 sources[source_id] = source_id;
158 source_vals += ',' + source_id;
162 //Get the enabled div elements
163 elements = tabview.getElementsByClassName('enabled_workarea', 'div');
164 for(el in elements) {
165 if(typeof elements[el] == 'function') {
169 //Get the li elements
170 enabled_list = YAHOO.util.Dom.getElementsByClassName('noBullet2', 'li', elements[el]);
171 for(li in enabled_list) {
172 if(typeof enabled_list[li] != 'function') {
173 search_vals += ',' + enabled_list[li].getAttribute('id');
178 document.ModifySearch.search_values.value = search_vals != '' ? search_vals.substr(1,search_vals.length) : '';
179 document.ModifySearch.search_sources.value = source_vals != '' ? source_vals.substr(1, source_vals.length) : '';
182 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);