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