Merge branch 'feature/ticket#1862-Metaconsole-offline-um' into develop
This commit is contained in:
commit
21b7dc03b7
|
@ -16,21 +16,25 @@
|
|||
|
||||
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">
|
||||
<?php
|
||||
echo "var drop_the_package_here_or ='" . __('Drop the package here or') . "';\n";
|
||||
echo "var browse_it ='" . __('browse it') . "';\n";
|
||||
echo "var the_package_has_been_uploaded_successfully ='" . __('The package has been uploaded successfully.') . "';\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";
|
||||
echo "var click_on_the_file_below_to_begin ='" . __('Click on the file below to begin.') . "';\n";
|
||||
echo "var updating ='" . __('Updating') . "';\n";
|
||||
echo "var package_updated_successfully ='" . __('Package updated successfully.') . "';\n";
|
||||
echo "var if_there_are_any_database_change ='" . __('If there are any database change, it will be applied on the next login.') . "';\n";
|
||||
echo "var package_not_updated ='" . __('Package not updated.') . "';\n";
|
||||
?>
|
||||
var drop_the_package_here_or = "<?php echo __('Drop the package here or'); ?>\n";
|
||||
var browse_it = "<?php echo __('browse it'); ?>\n";
|
||||
var the_package_has_been_uploaded_successfully = "<?php echo __('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";
|
||||
var click_on_the_file_below_to_begin = "<?php echo __('Click on the file below to begin.'); ?>\n";
|
||||
var updating = "<?php echo __('Updating'); ?>\n";
|
||||
var package_updated_successfully = "<?php echo __('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";
|
||||
var package_not_updated = "<?php echo __('Package not updated.'); ?>\n";
|
||||
</script>
|
||||
|
||||
<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>
|
||||
</form>
|
||||
|
||||
<script src="include/javascript/jquery.fileupload.js"></script>
|
||||
<script src="include/javascript/jquery.iframe-transport.js"></script>
|
||||
<script src="include/javascript/jquery.knob.js"></script>
|
||||
<script src="<?php echo $baseurl; ?>/include/javascript/jquery.fileupload.js"></script>
|
||||
<script src="<?php echo $baseurl; ?>/include/javascript/jquery.iframe-transport.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">
|
||||
form_upload();
|
||||
</script>
|
||||
form_upload("<?php echo $baseurl; ?>");
|
||||
</script>
|
||||
|
|
|
@ -53,14 +53,14 @@ ui_print_page_header($title,
|
|||
|
||||
switch ($tab) {
|
||||
case 'setup':
|
||||
require("update_manager.setup.php");
|
||||
require($config['homedir'] . "/update_manager.setup.php");
|
||||
break;
|
||||
case 'offline':
|
||||
require("update_manager.offline.php");
|
||||
require($config['homedir'] . "/update_manager.offline.php");
|
||||
break;
|
||||
case 'online':
|
||||
default:
|
||||
require("update_manager.online.php");
|
||||
require($config['homedir'] . "/update_manager.online.php");
|
||||
break;
|
||||
}
|
||||
?>
|
Binary file not shown.
After Width: | Height: | Size: 507 B |
|
@ -15,8 +15,8 @@
|
|||
|
||||
global $config;
|
||||
|
||||
require_once("include/functions_update_manager.php");
|
||||
require_once("include/functions_graph.php");
|
||||
require_once($config['homedir'] . "/include/functions_update_manager.php");
|
||||
require_once($config['homedir'] . "/include/functions_graph.php");
|
||||
enterprise_include_once("include/functions_update_manager.php");
|
||||
|
||||
$upload_file = (boolean) get_parameter("upload_file");
|
||||
|
@ -131,7 +131,7 @@ if ($install_package) {
|
|||
if (file_exists($config["homedir"]."/".$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);
|
||||
if (!file_exists($config["homedir"]."/".$dirname)) {
|
||||
$dir_array = explode("/", $dirname);
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
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/
|
||||
var ul = $('#form-offline_update ul');
|
||||
|
||||
|
@ -18,7 +23,7 @@ function form_upload () {
|
|||
// Initialize the jQuery File Upload plugin
|
||||
$('#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
|
||||
dropZone: $('#drop_file'),
|
||||
|
@ -139,7 +144,7 @@ function form_upload () {
|
|||
data.context.find('input').val(0).change();
|
||||
|
||||
// Begin the installation
|
||||
install_package(res.package, 'filename');
|
||||
install_package(res.package, homeurl);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -188,30 +193,12 @@ function formatFileSize(bytes) {
|
|||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
}
|
||||
|
||||
function install_package(package) {
|
||||
var parameters = {};
|
||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||
parameters['install_package'] = 1;
|
||||
parameters['package'] = package;
|
||||
function install_package (package, homeurl) {
|
||||
if (typeof homeurl !== 'undefined')
|
||||
homeurl += '/';
|
||||
else
|
||||
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 = {};
|
||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||
parameters['install_package'] = 1;
|
||||
|
@ -222,7 +209,7 @@ function install_package (package) {
|
|||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php',
|
||||
url: homeurl + 'ajax.php',
|
||||
data: parameters,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
|
@ -245,10 +232,10 @@ function install_package (package) {
|
|||
});
|
||||
|
||||
// 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 = {};
|
||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||
parameters['check_install_package'] = 1;
|
||||
|
@ -256,7 +243,7 @@ function check_install_package(package) {
|
|||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php',
|
||||
url: homeurl + 'ajax.php',
|
||||
data: parameters,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
@ -275,13 +262,18 @@ function check_install_package(package) {
|
|||
var isInstalling = $('#form-offline_update ul').find('li').hasClass('loading');
|
||||
if (data.progress < 100 && isInstalling) {
|
||||
// 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();
|
||||
|
||||
var parameters = {};
|
||||
|
@ -289,7 +281,7 @@ function check_online_free_packages() {
|
|||
parameters['check_online_free_packages'] = 1;
|
||||
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
homeurl + "ajax.php",
|
||||
parameters,
|
||||
function (data) {
|
||||
$("#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;
|
||||
|
||||
$("#box_online .content").html("");
|
||||
|
@ -316,7 +313,7 @@ function update_last_package(package, version) {
|
|||
parameters['version'] = version;
|
||||
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
homeurl + "ajax.php",
|
||||
parameters,
|
||||
function (data) {
|
||||
if (data['in_progress']) {
|
||||
|
@ -325,8 +322,10 @@ function update_last_package(package, version) {
|
|||
|
||||
$("#box_online .content").html(data['message']);
|
||||
|
||||
install_free_package(package,version);
|
||||
setTimeout(check_progress_update, 1000);
|
||||
install_free_package(package, version, homeurl);
|
||||
setTimeout(function () {
|
||||
check_progress_update(homeurl);
|
||||
}, 1000);
|
||||
}
|
||||
else {
|
||||
$("#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) {
|
||||
return;
|
||||
}
|
||||
|
@ -346,7 +350,7 @@ function check_progress_update() {
|
|||
parameters['check_update_free_package'] = 1;
|
||||
|
||||
jQuery.post(
|
||||
"ajax.php",
|
||||
homeurl + "ajax.php",
|
||||
parameters,
|
||||
function (data) {
|
||||
if (stop_check_progress) {
|
||||
|
@ -363,7 +367,9 @@ function check_progress_update() {
|
|||
$("#box_online .progressbar .progressbar_img").attr('src',
|
||||
data['progressbar']);
|
||||
|
||||
setTimeout(check_progress_update, 1000);
|
||||
setTimeout(function () {
|
||||
check_progress_update(homeurl);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
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 = {};
|
||||
parameters['page'] = 'include/ajax/update_manager.ajax';
|
||||
parameters['install_free_package'] = 1;
|
||||
|
@ -385,7 +396,7 @@ function install_free_package(package,version) {
|
|||
jQuery.ajax ({
|
||||
data: parameters,
|
||||
type: 'POST',
|
||||
url: "ajax.php",
|
||||
url: homeurl + "ajax.php",
|
||||
timeout: 600000,
|
||||
dataType: "json",
|
||||
error: function(data) {
|
||||
|
@ -393,7 +404,7 @@ function install_free_package(package,version) {
|
|||
stop_check_progress = 1;
|
||||
|
||||
$("#box_online .loading").hide();
|
||||
$("#box_online .progressbar").hide();
|
||||
$("#box_online .progressbar").hide();
|
||||
$("#box_online .content").html(unknown_error_update_manager);
|
||||
},
|
||||
success: function (data) {
|
||||
|
|
Loading…
Reference in New Issue