]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Connectors/tpls/modify_display.tpl
Release 6.4.0
[Github/sugarcrm.git] / modules / Connectors / tpls / modify_display.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
43 {literal}
44
45 <script language="javascript">
46
47 var _sourceArray = new Array();
48
49 var SourceTabs = {
50
51     init : function() {
52          _tabView = new YAHOO.widget.TabView();
53
54         {/literal}
55                  {counter assign=source_count start=0 print=0}
56                 {foreach name=connectors from=$SOURCES key=name item=source}
57                     {counter assign=source_count}
58                 {literal}
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},
62                                 cacheData: true,
63                                 {/literal}
64                                 {if $source_count == 1}
65                                 active: true
66                                 {else}
67                                 active: false
68                                 {/if}
69                                 {literal}
70                             });
71                             _tabView.addTab(tab);
72                             tab.addListener('contentChange', SourceTabs.tabContentChanged);
73                             _sourceArray[{/literal}{$source_count}{literal}-1] = '{/literal}{$source.id}{literal}';
74                 {/literal}
75                {/foreach}
76                   {literal}
77                 _tabView.appendTo('container');
78                 //_tabView.addListener('contentChange', SourceTabs.tabContentChanged);
79                 _tabView.addListener('beforeActiveTabChange', SourceTabs.tabIndexChanged);
80     },
81
82     tabContentChanged: function(info) {
83         tab = _tabView.get('activeTab');
84         SUGAR.util.evalScript(tab.get('content'));
85     },
86
87     tabIndexChanged : function(info){
88
89     },
90
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';
96     },
97
98     getTabView : function() {
99         return _tabView;
100     }
101 }
102 YAHOO.util.Event.onDOMReady(SourceTabs.init);
103 </script>
104 {/literal}
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">
109
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}">
114 {/foreach}
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="">
118
119 <table border="0" class="actionsContainer">
120 <tr><td>
121 <input id="connectors_top_save" title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" 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}">
123 </td></tr>
124 </table>
125 <table cellspacing="0" cellpadding="0" border="0" width="100%">
126 <tr><td>
127 <div >
128 <div id="container" style="height: 465px">
129 </div>
130 </div>
131 </td></tr>
132 </table>
133 <table border="0" class="actionsContainer">
134 <tr><td>
135 <input id="connectors_bottom_save" title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="calculateValues();" type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
136 <input id="connectors_bottom_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}">
137 </td></tr>
138 </table>
139 </form>
140
141 <script type="text/javascript">
142 {literal}
143 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);
144 {/literal}
145 </script>
146
147
148 <script type="text/javascript">
149 {literal}
150 function calculateValues() {
151     tabview = SourceTabs.getTabView();
152     display_vals = ''
153     source_vals = '';
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') {
159            continue;
160         }
161
162         source_vals += ',' + elements[el].id;
163
164     }
165
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') {
170            continue;
171         }
172
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');
178             }
179         }
180     }
181
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) : '';
184 }
185
186 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);
187 {/literal}
188 </script>