]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/SugarFeed/Dashlets/SugarFeedDashlet/Options.tpl
Release 6.2.0
[Github/sugarcrm.git] / modules / SugarFeed / Dashlets / SugarFeedDashlet / Options.tpl
1 {*
2
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38
39
40
41 *}
42
43
44 <div style='width:100%'>
45 <form name='configure_{$id}' action="index.php" method="post">
46 <input type='hidden' name='id' value='{$id}'>
47 <input type='hidden' name='module' value='Home'>
48 <input type='hidden' name='action' value='ConfigureDashlet'>
49 <input type='hidden' name='to_pdf' value='true'>
50 <input type='hidden' name='configure' value='true'>
51 <table width="100%" cellpadding="0" cellspacing="0" border="0" class="edit view" align="center">
52 <tr>
53     <td scope='row'>{$titleLBL}</td>
54     <td>
55         <input class="text" name="title" size='20' maxlength='80' value='{$title}'>
56     </td>
57 </tr>
58 {if $isRefreshable}
59 <tr>
60     <td scope='row'>
61         {$autoRefresh}
62     </td>
63     <td>
64         <select name='autoRefresh'>
65             {html_options options=$autoRefreshOptions selected=$autoRefreshSelect}
66         </select>
67     </td>
68 </tr>
69 {/if}
70 <tr>
71     <td scope='row'>{$rowsLBL}</td>
72     <td>
73         <input class="text" name="rows" size='3' value='{$rows}'>
74     </td>
75 </tr>
76 <tr>
77     <td scope='row'>{$categoriesLBL}</td>
78     <td>
79         <select name='categories[]' multiple=true size=6 onchange='getMultiple(this);' id='categories_{$id}'>
80         {html_options options=$categories selected=$selectedCategories}
81         </select>
82     </td>
83 </tr>
84 <tr>
85   <td align="right" colspan="2">
86     <div id='externalApiDiv'>
87     </div>
88   </td>
89 </tr>
90 <tr>
91     <td align="right" colspan="2">
92         <input type='button' class='button' value='{$saveLBL}' id='save_{$id}' onclick='promptAuthentication(); if(SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage)) this.form.submit();'>
93         </td>
94 </tr>
95 </table>
96 <script language='javascript'>
97 var externalApiList = {$externalApiList};
98 var authenticatedExternalApiList = new Array();
99 {literal}
100
101
102 function getMultiple(ob){
103     var showAll = false;
104     var selected = new Array();
105     for (var i = 0; i < ob.options.length; i++){
106         if (ob.options[ i ].selected){
107             selected.push(ob.options[ i ].value);
108             if(ob.options[ i ].value == 'ALL'){
109                 showAll = true;
110             }
111         }
112     }
113     var buttonHtml = '';
114     if(showAll){
115         for (var j = 0; j < externalApiList.length; j++) 
116         {
117             if(!authenticatedExternalApiList[externalApiList[j]])
118             {
119                     buttonHtml += '<div id="' + externalApiList[j] + '_div" style="visibility:;"><a href="#" onclick="window.open(\'index.php?module=EAPM&callbackFunction=hideExternalDiv&closeWhenDone=1&action=QuickSave&application='+externalApiList[j]+'\',\'EAPM\');">{/literal}{$authenticateLBL}{literal} '+externalApiList[j]+'</a></div>';
120             }
121         }
122     }else{
123         for (var i = 0; i < selected.length; i++){
124             for (var j = 0; j < externalApiList.length; j++)
125             {
126                 if(selected[i] == externalApiList[j] && !authenticatedExternalApiList[externalApiList[j]]) 
127                 {
128                     buttonHtml += '<div id="' + externalApiList[j] + '_div" style="visibility:";><a href="#" onclick="window.open(\'index.php?module=EAPM&callbackFunction=hideExternalDiv&closeWhenDone=1&action=QuickSave&application='+externalApiList[j]+'\',\'EAPM\');">{/literal}{$authenticateLBL}{literal} '+externalApiList[j]+'</a></div>';
129                 }
130             }
131         }
132     }
133     document.getElementById('externalApiDiv').innerHTML = buttonHtml;
134 }
135
136 function initExternalOptions(){
137     var ob = document.getElementById('{/literal}categories_{$id}{literal}');
138     getMultiple(ob);
139 }
140
141 function hideExternalDiv(id)
142 {
143     //Hide the div for the external API link, set the authenticated Array list to true
144     if(YAHOO.util.Dom.get(id + '_div'))
145     {
146                 YAHOO.util.Dom.get(id + '_div').style.visibility = 'hidden';
147                 authenticatedExternalApiList[id] = true;
148         }
149 }
150
151 function promptAuthentication()
152 {
153     //This is how we know that not all external API links were authenticated
154 {/literal}
155      categoryElement = YAHOO.util.Dom.get('categories_{$id}');  
156 {literal} 
157     //Only check for prompt warning if the 'ALL' option was selected
158     if(categoryElement.options[categoryElement.selectedIndex].value != 'ALL')
159     {
160        return;
161     }
162     
163         if(authenticatedExternalApiList.length < externalApiList.length)
164         {
165 {/literal}
166                 if(!confirm("{$autenticationPendingLBL}")) 
167 {literal}               
168                 {
169                     //Cancel form submission here
170                     e = event ? event : window.event;
171                     if (e.preventDefault) e.preventDefault();
172                     e.returnValue = false;
173                     e.cancelBubble = true;
174                     if (e.stopPropagation) e.stopPropagation();
175                 }
176         }
177 }
178
179 YAHOO.util.Event.onDOMReady(initExternalOptions);
180 </script>
181 {/literal}
182 </form>
183 </div>