2 * JavaScript for admin ext-network AJAX stuff
3 * --------------------------------------------------------------------
4 * Copyright (c) 2003 - 2009 by Roland Haeder
5 * Copyright (c) 2009 - 2016 by Mailer Developer Team
6 * For more information visit: http://mxchange.org
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 // Sends a request out to query a network API
25 function sendNetworkQueryByTypeId (typeId) {
26 // Send out the request
27 return sendAjaxRequest('admin', 'network_query_single_api', '&network_type_id=' + typeId, false);
30 // Queries a single network type handler
31 function doQueryNetworkType (typeId, displayMessage) {
33 closeAllWindows('admin');
36 updateStatusField('status_' + typeId, '', 'CHECKING ...');
38 // Does the request work?
39 if (sendNetworkQueryByTypeId(typeId) === false) {
41 if (displayMessage === true) {
42 // Display error message
43 displayErrorWindow('admin', getAjaxContent());
47 if (displayMessage === true) {
48 // Display success message
49 displaySuccessWindow('admin', getAjaxContent());
53 updateStatusField('status_' + typeId, 'good', 'OKAY');
60 updateStatusField('status_' + typeId, 'bad', 'ERROR!');
66 // Query all network APIs
67 // @TODO Add support for checkboxes
68 // @TODO Make progress window working
69 function doQueryNetwork (networkId) {
70 // Open progress window
71 //displayProgressWindow('admin', 'Init ...');
73 // Do the AJAX request (JSON as content is enabled)
74 if (sendAjaxRequest('admin', 'network_list_by_id', '&network_id=' + networkId, true) === true) {
75 // Get content (as it is an array)
76 var queries = getAjaxContent();
77 var total = getTotalCountFromObject(queries);
80 $.each(queries, function (i, typeId) {
81 // Set progress content
82 //setProgressContent('admin', typeId);
85 if (doQueryNetworkType(typeId, false) === false) {
86 // Stop processing and display error message
87 displayErrorWindow('admin', getAjaxContent() + 'typeId=' + typeId);
93 // Update progress bar
94 updateProgressBar(queries.length);
101 if (counterSuccess == total) {
102 // Display success message
103 displaySuccessWindow('admin', 'OKAY');
106 // Display error window
107 displayErrorWindow('admin', getAjaxContent());