3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
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">
53 <td scope='row'>{$titleLBL}</td>
55 <input class="text" name="title" size='20' maxlength='80' value='{$title}'>
64 <select name='autoRefresh'>
65 {html_options options=$autoRefreshOptions selected=$autoRefreshSelect}
71 <td scope='row'>{$rowsLBL}</td>
73 <input class="text" name="rows" size='3' value='{$rows}'>
77 <td scope='row'>{$categoriesLBL}</td>
79 <select name='categories[]' multiple=true size=6 onchange='getMultiple(this);' id='categories_{$id}'>
80 {html_options options=$categories selected=$selectedCategories}
85 <td align="right" colspan="2">
86 <div id='externalApiDiv'>
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;'>
97 <script language='javascript'>
98 var externalApiList = {$externalApiList};
99 var authenticatedExternalApiList = new Array();
103 function getMultiple(ob){
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'){
116 for (var j = 0; j < externalApiList.length; j++)
118 if(!authenticatedExternalApiList[externalApiList[j]])
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>';
124 for (var i = 0; i < selected.length; i++){
125 for (var j = 0; j < externalApiList.length; j++)
127 if(selected[i] == externalApiList[j] && !authenticatedExternalApiList[externalApiList[j]])
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>';
134 document.getElementById('externalApiDiv').innerHTML = buttonHtml;
137 function initExternalOptions(){
138 var ob = document.getElementById('{/literal}categories_{$id}{literal}');
142 function hideExternalDiv(id)
144 //Hide the div for the external API link, set the authenticated Array list to true
145 if(YAHOO.util.Dom.get(id + '_div'))
147 YAHOO.util.Dom.get(id + '_div').style.visibility = 'hidden';
148 authenticatedExternalApiList[id] = true;
152 function promptAuthentication()
154 //This is how we know that not all external API links were authenticated
156 categoryElement = YAHOO.util.Dom.get('categories_{$id}');
158 //Only check for prompt warning if the 'ALL' option was selected
159 if(categoryElement.selectedIndex != -1 && categoryElement.options[categoryElement.selectedIndex].value != 'ALL')
164 if(authenticatedExternalApiList.length < externalApiList.length)
167 if(!confirm("{$autenticationPendingLBL}"))
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();
180 YAHOO.util.Event.onDOMReady(initExternalOptions);