]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Connectors/tpls/modify_search.tpl
Release 6.5.0
[Github/sugarcrm.git] / modules / Connectors / tpls / modify_search.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2012 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 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=SearchProperties&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="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="">
103
104 {counter assign=source_count start=0 print=0} 
105 {if count($SOURCES) == 0}
106         {$MOD.ERROR_NO_SEARCHDEFS_MAPPED}
107 {else}
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}">  
111         {/foreach}
112 {/if}
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="">
116
117 <table border="0" class="actionsContainer">
118 <tr><td>
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}">
121 </td></tr>
122 </table>
123 <table cellspacing="0" cellpadding="0" border="0" width="100%">
124 <tr><td>
125 <div>
126 <div id="container" style="height: 465px">
127 </div>
128 </div>
129 </td></tr>
130 </table>
131 <table border="0" class="actionsContainer">
132 <tr><td>
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}">
135 </td></tr>
136 </table>
137 </form>
138
139
140 <script type="text/javascript">
141 {literal}
142 function calculateValues() {
143     tabview = SourceTabs.getTabView();
144     search_vals = ''
145     source_vals = '';
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') {
151            continue;
152         }
153     
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;
159         }
160     }
161     
162     //Get the enabled div elements
163     elements = tabview.getElementsByClassName('enabled_workarea', 'div');    
164     for(el in elements) {
165         if(typeof elements[el] == 'function') {
166            continue;
167         }
168     
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');       
174             }
175         }
176     }
177     
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) : '';
180 }
181
182 YAHOO.util.Event.onDOMReady(SourceTabs.fitContainer);
183 {/literal}
184 </script>