2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 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'}"/>
45 <script language="javascript">
47 var _sourceArray = new Array();
52 _tabView = new YAHOO.widget.TabView();
55 {counter assign=source_count start=0 print=0}
56 {foreach name=connectors from=$SOURCES key=name item=source}
57 {counter assign=source_count}
59 tab = new YAHOO.widget.Tab({
60 label: '{/literal}{$source.name}{literal} ',
61 dataSrc: {/literal}'index.php?module=Connectors&action=DisplayProperties&source_id={$source.id}'{literal},
64 {if $source_count == 1}
72 tab.addListener('contentChange', SourceTabs.tabContentChanged);
73 _sourceArray[{/literal}{$source_count}{literal}-1] = '{/literal}{$source.id}{literal}';
77 _tabView.appendTo('container');
78 //_tabView.addListener('contentChange', SourceTabs.tabContentChanged);
79 _tabView.addListener('beforeActiveTabChange', SourceTabs.tabIndexChanged);
82 tabContentChanged: function(info) {
83 tab = _tabView.get('activeTab');
84 SUGAR.util.evalScript(tab.get('content'));
87 tabIndexChanged : function(info){
91 fitContainer: function() {
92 _tabView = SourceTabs.getTabView();
93 content_div = _tabView.getElementsByClassName('yui-content', 'div')[0];
94 content_div.style.overflow='auto';
95 content_div.style.height='405px';
98 getTabView : function() {
102 YAHOO.util.Event.onDOMReady(SourceTabs.init);
105 <form name="ModifyDisplay" method="POST">
106 <input type="hidden" name="modify" value="true">
107 <input type="hidden" name="module" value="Connectors">
108 <input type="hidden" name="action" value="SaveModifyDisplay">
110 {counter assign=source_count start=0 print=0}
111 {foreach name=connectors from=$SOURCES key=name item=source}
112 {counter assign=source_count}
113 <input type="hidden" name="source{$source_count}" value="{$source.id}">
115 <input type="hidden" name="display_values" value="">
116 <input type="hidden" name="display_sources" value="">
117 <input type="hidden" name="reset_to_default" value="">
119 <table border="0" class="actionsContainer">
121 <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}">
122 <input id="connectors_top_cancel" title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="document.ModifyDisplay.action.value='ConnectorSettings'; document.ModifyDisplay.module.value='Connectors';" type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
125 <table cellspacing="0" cellpadding="0" border="0" width="100%">
128 <div id="container" style="height: 465px">
133 <table border="0" class="actionsContainer">
135 <input id="connectors_bottom_save" title="{$APP.LBL_SAVE_BUTTON_LABEL}" class="button" onclick="calculateValues();" type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
136 <input id="connectors_bottom_cancel" title="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="button" onclick="document.ModifyDisplay.action.value='ConnectorSettings'; document.ModifyDisplay.module.value='Connectors';" type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
141 <script type="text/javascript">
143 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);
148 <script type="text/javascript">
150 function calculateValues() {
151 tabview = SourceTabs.getTabView();
154 sources = new Array();
155 //Get the source divs
156 elements = tabview.getElementsByClassName('sources_table', 'table');
157 for(el in elements) {
158 if(typeof elements[el] == 'function') {
162 source_vals += ',' + elements[el].id;
166 //Get the enabled div elements
167 elements = tabview.getElementsByClassName('enabled_module_workarea', 'div');
168 for(el in elements) {
169 if(typeof elements[el] == 'function') {
173 //Get the li elements
174 enabled_list = YAHOO.util.Dom.getElementsByClassName('noBullet2', 'li', elements[el]);
175 for(li in enabled_list) {
176 if(typeof enabled_list[li] != 'function') {
177 display_vals += ',' + enabled_list[li].getAttribute('id');
182 document.ModifyDisplay.display_values.value = display_vals != '' ? display_vals.substr(1,display_vals.length) : '';
183 document.ModifyDisplay.display_sources.value = source_vals != '' ? source_vals.substr(1, source_vals.length) : '';
186 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);