]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/SugarFeed/Dashlets/SugarFeedDashlet/Options.tpl
Release 6.5.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-2012 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         <input type='submit' class='button' value='{$clearLBL}' onclick='SUGAR.searchForm.clear_form(this.form,["title","autoRefresh","rows"]);return false;'>
94         </td>
95 </tr>
96 </table>
97 <script language='javascript'>
98 var externalApiList = {$externalApiList};
99 var authenticatedExternalApiList = new Array();
100 {literal}
101
102
103 function getMultiple(ob){
104     var showAll = false;
105     var selected = new Array();
106     for (var i = 0; i < ob.options.length; i++){
107         if (ob.options[ i ].selected){
108             selected.push(ob.options[ i ].value);
109             if(ob.options[ i ].value == 'ALL'){
110                 showAll = true;
111             }
112         }
113     }
114     var buttonHtml = '';
115     if(showAll){
116         for (var j = 0; j < externalApiList.length; j++) 
117         {
118             if(!authenticatedExternalApiList[externalApiList[j]])
119             {
120                     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>';
121             }
122         }
123     }else{
124         for (var i = 0; i < selected.length; i++){
125             for (var j = 0; j < externalApiList.length; j++)
126             {
127                 if(selected[i] == externalApiList[j] && !authenticatedExternalApiList[externalApiList[j]]) 
128                 {
129                     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>';
130                 }
131             }
132         }
133     }
134     document.getElementById('externalApiDiv').innerHTML = buttonHtml;
135 }
136
137 function initExternalOptions(){
138     var ob = document.getElementById('{/literal}categories_{$id}{literal}');
139     getMultiple(ob);
140 }
141
142 function hideExternalDiv(id)
143 {
144     //Hide the div for the external API link, set the authenticated Array list to true
145     if(YAHOO.util.Dom.get(id + '_div'))
146     {
147                 YAHOO.util.Dom.get(id + '_div').style.visibility = 'hidden';
148                 authenticatedExternalApiList[id] = true;
149         }
150 }
151
152 function promptAuthentication()
153 {
154     //This is how we know that not all external API links were authenticated
155 {/literal}
156      categoryElement = YAHOO.util.Dom.get('categories_{$id}');  
157 {literal} 
158     //Only check for prompt warning if the 'ALL' option was selected
159     if(categoryElement.selectedIndex != -1 && categoryElement.options[categoryElement.selectedIndex].value != 'ALL')
160     {
161        return;
162     }
163     
164         if(authenticatedExternalApiList.length < externalApiList.length)
165         {
166 {/literal}
167                 if(!confirm("{$autenticationPendingLBL}")) 
168 {literal}               
169                 {
170                     //Cancel form submission here
171                     e = event ? event : window.event;
172                     if (e.preventDefault) e.preventDefault();
173                     e.returnValue = false;
174                     e.cancelBubble = true;
175                     if (e.stopPropagation) e.stopPropagation();
176                 }
177         }
178 }
179
180 YAHOO.util.Event.onDOMReady(initExternalOptions);
181 </script>
182 {/literal}
183 </form>
184 </div>