mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch 'feature/ticket#1862-Metaconsole-offline-um' into develop
This commit is contained in:
commit
21b7dc03b7
@ -16,21 +16,25 @@
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
ui_require_css_file('update_manager', 'godmode/update_manager/');
|
// ui_require_css_file('update_manager', 'godmode/update_manager/');
|
||||||
|
|
||||||
|
$baseurl = ui_get_full_url(false, false, false, false);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<!-- Add the stylesheet here cause somehow the 'ui_require_css_file' is not working on the metaconsole and there is no time to fix it -->
|
||||||
|
<link rel="stylesheet" type="text/css" href="<?php echo $baseurl; ?>/godmode/update_manager/update_manager.css">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<?php
|
var drop_the_package_here_or = "<?php echo __('Drop the package here or'); ?>\n";
|
||||||
echo "var drop_the_package_here_or ='" . __('Drop the package here or') . "';\n";
|
var browse_it = "<?php echo __('browse it'); ?>\n";
|
||||||
echo "var browse_it ='" . __('browse it') . "';\n";
|
var the_package_has_been_uploaded_successfully = "<?php echo __('The package has been uploaded successfully.'); ?>\n";
|
||||||
echo "var the_package_has_been_uploaded_successfully ='" . __('The package has been uploaded successfully.') . "';\n";
|
var remember_that_this_package_will = "<?php echo __('Remember that this package will override the actual Pandora FMS files and it is recommended to do a backup before continue with the update.'); ?>\n";
|
||||||
echo "var remember_that_this_package_will =\"" . __('Remember that this package will override the actual Pandora FMS files and it is recommended to do a backup before continue with the update.') . "\";\n";
|
var click_on_the_file_below_to_begin = "<?php echo __('Click on the file below to begin.'); ?>\n";
|
||||||
echo "var click_on_the_file_below_to_begin ='" . __('Click on the file below to begin.') . "';\n";
|
var updating = "<?php echo __('Updating'); ?>\n";
|
||||||
echo "var updating ='" . __('Updating') . "';\n";
|
var package_updated_successfully = "<?php echo __('Package updated successfully.'); ?>\n";
|
||||||
echo "var package_updated_successfully ='" . __('Package updated successfully.') . "';\n";
|
var if_there_are_any_database_change = "<?php echo __('If there are any database change, it will be applied on the next login.'); ?>\n";
|
||||||
echo "var if_there_are_any_database_change ='" . __('If there are any database change, it will be applied on the next login.') . "';\n";
|
var package_not_updated = "<?php echo __('Package not updated.'); ?>\n";
|
||||||
echo "var package_not_updated ='" . __('Package not updated.') . "';\n";
|
|
||||||
?>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form id="form-offline_update" method="post" enctype="multipart/form-data" class="fileupload_form">
|
<form id="form-offline_update" method="post" enctype="multipart/form-data" class="fileupload_form">
|
||||||
@ -38,12 +42,12 @@ ui_require_css_file('update_manager', 'godmode/update_manager/');
|
|||||||
<ul></ul>
|
<ul></ul>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="include/javascript/jquery.fileupload.js"></script>
|
<script src="<?php echo $baseurl; ?>/include/javascript/jquery.fileupload.js"></script>
|
||||||
<script src="include/javascript/jquery.iframe-transport.js"></script>
|
<script src="<?php echo $baseurl; ?>/include/javascript/jquery.iframe-transport.js"></script>
|
||||||
<script src="include/javascript/jquery.knob.js"></script>
|
<script src="<?php echo $baseurl; ?>/include/javascript/jquery.knob.js"></script>
|
||||||
|
|
||||||
<script src="include/javascript/update_manager.js"></script>
|
<script src="<?php echo $baseurl; ?>/include/javascript/update_manager.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
form_upload();
|
form_upload("<?php echo $baseurl; ?>");
|
||||||
</script>
|
</script>
|
||||||
|
@ -53,14 +53,14 @@ ui_print_page_header($title,
|
|||||||
|
|
||||||
switch ($tab) {
|
switch ($tab) {
|
||||||
case 'setup':
|
case 'setup':
|
||||||
require("update_manager.setup.php");
|
require($config['homedir'] . "/update_manager.setup.php");
|
||||||
break;
|
break;
|
||||||
case 'offline':
|
case 'offline':
|
||||||
require("update_manager.offline.php");
|
require($config['homedir'] . "/update_manager.offline.php");
|
||||||
break;
|
break;
|
||||||
case 'online':
|
case 'online':
|
||||||
default:
|
default:
|
||||||
require("update_manager.online.php");
|
require($config['homedir'] . "/update_manager.online.php");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
BIN
pandora_console/images/update.png
Normal file
BIN
pandora_console/images/update.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 507 B |
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once("include/functions_update_manager.php");
|
require_once($config['homedir'] . "/include/functions_update_manager.php");
|
||||||
require_once("include/functions_graph.php");
|
require_once($config['homedir'] . "/include/functions_graph.php");
|
||||||
enterprise_include_once("include/functions_update_manager.php");
|
enterprise_include_once("include/functions_update_manager.php");
|
||||||
|
|
||||||
$upload_file = (boolean) get_parameter("upload_file");
|
$upload_file = (boolean) get_parameter("upload_file");
|
||||||
@ -131,7 +131,7 @@ if ($install_package) {
|
|||||||
if (file_exists($config["homedir"]."/".$line)) {
|
if (file_exists($config["homedir"]."/".$line)) {
|
||||||
rename($config["homedir"]."/".$line, $package."/backup/".$line);
|
rename($config["homedir"]."/".$line, $package."/backup/".$line);
|
||||||
}
|
}
|
||||||
// Tries to move the new file to the Integria directory
|
// Tries to move the new file to the Pandora directory
|
||||||
$dirname = dirname($line);
|
$dirname = dirname($line);
|
||||||
if (!file_exists($config["homedir"]."/".$dirname)) {
|
if (!file_exists($config["homedir"]."/".$dirname)) {
|
||||||
$dir_array = explode("/", $dirname);
|
$dir_array = explode("/", $dirname);
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
var correct_install_progress = true;
|
var correct_install_progress = true;
|
||||||
|
|
||||||
function form_upload () {
|
function form_upload (homeurl) {
|
||||||
|
if (typeof homeurl !== 'undefined')
|
||||||
|
homeurl += '/';
|
||||||
|
else
|
||||||
|
homeurl = '';
|
||||||
|
|
||||||
//Thanks to: http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
|
//Thanks to: http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
|
||||||
var ul = $('#form-offline_update ul');
|
var ul = $('#form-offline_update ul');
|
||||||
|
|
||||||
@ -18,7 +23,7 @@ function form_upload () {
|
|||||||
// Initialize the jQuery File Upload plugin
|
// Initialize the jQuery File Upload plugin
|
||||||
$('#form-offline_update').fileupload({
|
$('#form-offline_update').fileupload({
|
||||||
|
|
||||||
url: 'ajax.php?page=include/ajax/update_manager.ajax&upload_file=true',
|
url: homeurl + 'ajax.php?page=include/ajax/update_manager.ajax&upload_file=true',
|
||||||
|
|
||||||
// This element will accept file drag/drop uploading
|
// This element will accept file drag/drop uploading
|
||||||
dropZone: $('#drop_file'),
|
dropZone: $('#drop_file'),
|
||||||
@ -139,7 +144,7 @@ function form_upload () {
|
|||||||
data.context.find('input').val(0).change();
|
data.context.find('input').val(0).change();
|
||||||
|
|
||||||
// Begin the installation
|
// Begin the installation
|
||||||
install_package(res.package, 'filename');
|
install_package(res.package, homeurl);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -188,30 +193,12 @@ function formatFileSize(bytes) {
|
|||||||
return (bytes / 1000).toFixed(2) + ' KB';
|
return (bytes / 1000).toFixed(2) + ' KB';
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_package(package) {
|
function install_package (package, homeurl) {
|
||||||
var parameters = {};
|
if (typeof homeurl !== 'undefined')
|
||||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
homeurl += '/';
|
||||||
parameters['install_package'] = 1;
|
else
|
||||||
parameters['package'] = package;
|
homeurl = '';
|
||||||
|
|
||||||
jQuery.post(
|
|
||||||
"ajax.php",
|
|
||||||
parameters,
|
|
||||||
function (data) {
|
|
||||||
if (data["status"] == "success") {
|
|
||||||
install_package_step2(package);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#box_online .loading").hide();
|
|
||||||
$("#box_online .content").html(data['message']);
|
|
||||||
stop_check_progress = 1;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"json"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function install_package (package) {
|
|
||||||
var parameters = {};
|
var parameters = {};
|
||||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
parameters['install_package'] = 1;
|
parameters['install_package'] = 1;
|
||||||
@ -222,7 +209,7 @@ function install_package (package) {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: 'ajax.php',
|
url: homeurl + 'ajax.php',
|
||||||
data: parameters,
|
data: parameters,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
@ -245,10 +232,10 @@ function install_package (package) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Check the status of the update
|
// Check the status of the update
|
||||||
check_install_package(package);
|
check_install_package(package, homeurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_install_package(package) {
|
function check_install_package(package, homeurl) {
|
||||||
var parameters = {};
|
var parameters = {};
|
||||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
parameters['check_install_package'] = 1;
|
parameters['check_install_package'] = 1;
|
||||||
@ -256,7 +243,7 @@ function check_install_package(package) {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: 'ajax.php',
|
url: homeurl + 'ajax.php',
|
||||||
data: parameters,
|
data: parameters,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
@ -275,13 +262,18 @@ function check_install_package(package) {
|
|||||||
var isInstalling = $('#form-offline_update ul').find('li').hasClass('loading');
|
var isInstalling = $('#form-offline_update ul').find('li').hasClass('loading');
|
||||||
if (data.progress < 100 && isInstalling) {
|
if (data.progress < 100 && isInstalling) {
|
||||||
// Recursive call to check the update status
|
// Recursive call to check the update status
|
||||||
check_install_package(package);
|
check_install_package(package, homeurl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_online_free_packages() {
|
function check_online_free_packages(homeurl) {
|
||||||
|
if (typeof homeurl !== 'undefined')
|
||||||
|
homeurl += '/';
|
||||||
|
else
|
||||||
|
homeurl = '';
|
||||||
|
|
||||||
$("#box_online .checking_package").show();
|
$("#box_online .checking_package").show();
|
||||||
|
|
||||||
var parameters = {};
|
var parameters = {};
|
||||||
@ -289,7 +281,7 @@ function check_online_free_packages() {
|
|||||||
parameters['check_online_free_packages'] = 1;
|
parameters['check_online_free_packages'] = 1;
|
||||||
|
|
||||||
jQuery.post(
|
jQuery.post(
|
||||||
"ajax.php",
|
homeurl + "ajax.php",
|
||||||
parameters,
|
parameters,
|
||||||
function (data) {
|
function (data) {
|
||||||
$("#box_online .checking_package").hide();
|
$("#box_online .checking_package").hide();
|
||||||
@ -301,7 +293,12 @@ function check_online_free_packages() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_last_package(package, version) {
|
function update_last_package(package, version, homeurl) {
|
||||||
|
if (typeof homeurl !== 'undefined')
|
||||||
|
homeurl += '/';
|
||||||
|
else
|
||||||
|
homeurl = '';
|
||||||
|
|
||||||
version_update = version;
|
version_update = version;
|
||||||
|
|
||||||
$("#box_online .content").html("");
|
$("#box_online .content").html("");
|
||||||
@ -316,7 +313,7 @@ function update_last_package(package, version) {
|
|||||||
parameters['version'] = version;
|
parameters['version'] = version;
|
||||||
|
|
||||||
jQuery.post(
|
jQuery.post(
|
||||||
"ajax.php",
|
homeurl + "ajax.php",
|
||||||
parameters,
|
parameters,
|
||||||
function (data) {
|
function (data) {
|
||||||
if (data['in_progress']) {
|
if (data['in_progress']) {
|
||||||
@ -325,8 +322,10 @@ function update_last_package(package, version) {
|
|||||||
|
|
||||||
$("#box_online .content").html(data['message']);
|
$("#box_online .content").html(data['message']);
|
||||||
|
|
||||||
install_free_package(package,version);
|
install_free_package(package, version, homeurl);
|
||||||
setTimeout(check_progress_update, 1000);
|
setTimeout(function () {
|
||||||
|
check_progress_update(homeurl);
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#box_online .content").html(data['message']);
|
$("#box_online .content").html(data['message']);
|
||||||
@ -336,7 +335,12 @@ function update_last_package(package, version) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_progress_update() {
|
function check_progress_update(homeurl) {
|
||||||
|
if (typeof homeurl !== 'undefined')
|
||||||
|
homeurl += '/';
|
||||||
|
else
|
||||||
|
homeurl = '';
|
||||||
|
|
||||||
if (stop_check_progress) {
|
if (stop_check_progress) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -346,7 +350,7 @@ function check_progress_update() {
|
|||||||
parameters['check_update_free_package'] = 1;
|
parameters['check_update_free_package'] = 1;
|
||||||
|
|
||||||
jQuery.post(
|
jQuery.post(
|
||||||
"ajax.php",
|
homeurl + "ajax.php",
|
||||||
parameters,
|
parameters,
|
||||||
function (data) {
|
function (data) {
|
||||||
if (stop_check_progress) {
|
if (stop_check_progress) {
|
||||||
@ -363,7 +367,9 @@ function check_progress_update() {
|
|||||||
$("#box_online .progressbar .progressbar_img").attr('src',
|
$("#box_online .progressbar .progressbar_img").attr('src',
|
||||||
data['progressbar']);
|
data['progressbar']);
|
||||||
|
|
||||||
setTimeout(check_progress_update, 1000);
|
setTimeout(function () {
|
||||||
|
check_progress_update(homeurl);
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -375,7 +381,12 @@ function check_progress_update() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_free_package(package,version) {
|
function install_free_package(package, version, homeurl) {
|
||||||
|
if (typeof homeurl !== 'undefined')
|
||||||
|
homeurl += '/';
|
||||||
|
else
|
||||||
|
homeurl = '';
|
||||||
|
|
||||||
var parameters = {};
|
var parameters = {};
|
||||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||||
parameters['install_free_package'] = 1;
|
parameters['install_free_package'] = 1;
|
||||||
@ -385,7 +396,7 @@ function install_free_package(package,version) {
|
|||||||
jQuery.ajax ({
|
jQuery.ajax ({
|
||||||
data: parameters,
|
data: parameters,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: "ajax.php",
|
url: homeurl + "ajax.php",
|
||||||
timeout: 600000,
|
timeout: 600000,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
@ -393,7 +404,7 @@ function install_free_package(package,version) {
|
|||||||
stop_check_progress = 1;
|
stop_check_progress = 1;
|
||||||
|
|
||||||
$("#box_online .loading").hide();
|
$("#box_online .loading").hide();
|
||||||
$("#box_online .progressbar").hide();
|
$("#box_online .progressbar").hide();
|
||||||
$("#box_online .content").html(unknown_error_update_manager);
|
$("#box_online .content").html(unknown_error_update_manager);
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user