3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 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();'>
96 <script language='javascript'>
97 var externalApiList = {$externalApiList};
98 var authenticatedExternalApiList = new Array();
102 function getMultiple(ob){
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'){
115 for (var j = 0; j < externalApiList.length; j++)
117 if(!authenticatedExternalApiList[externalApiList[j]])
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>';
123 for (var i = 0; i < selected.length; i++){
124 for (var j = 0; j < externalApiList.length; j++)
126 if(selected[i] == externalApiList[j] && !authenticatedExternalApiList[externalApiList[j]])
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>';
133 document.getElementById('externalApiDiv').innerHTML = buttonHtml;
136 function initExternalOptions(){
137 var ob = document.getElementById('{/literal}categories_{$id}{literal}');
141 function hideExternalDiv(id)
143 //Hide the div for the external API link, set the authenticated Array list to true
144 if(YAHOO.util.Dom.get(id + '_div'))
146 YAHOO.util.Dom.get(id + '_div').style.visibility = 'hidden';
147 authenticatedExternalApiList[id] = true;
151 function promptAuthentication()
153 //This is how we know that not all external API links were authenticated
155 categoryElement = YAHOO.util.Dom.get('categories_{$id}');
157 //Only check for prompt warning if the 'ALL' option was selected
158 if(categoryElement.options[categoryElement.selectedIndex].value != 'ALL')
163 if(authenticatedExternalApiList.length < externalApiList.length)
166 if(!confirm("{$autenticationPendingLBL}"))
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();
179 YAHOO.util.Event.onDOMReady(initExternalOptions);