This commit is contained in:
2026-03-28 11:33:56 +01:00
parent 412e235512
commit aa8e21862d
132 changed files with 24381 additions and 10882 deletions

View File

@@ -1,176 +1,140 @@
<?
global $db;
ob_start();
?>
<?= \Html::form_text(
array(
'label' => 'Twoja wersja systemu',
'id' => 'ver',
'text' => $this -> ver
)
);?>
<?= \Html::form_text(
array(
'label' => 'Aktualna wersja systemu',
'text' => $this -> new_ver,
'id' => 'new_ver'
)
);?>
<?
$valuemax = ( $this -> new_ver - $this -> ver ) * 1000;
?>
<div class="progress-box hidden">
<div class="version">
<h3> Aktualizacja <p class="version_curent">0</p> / <p class="version_diff">0</p></h3>
</div>
<div class="progress ">
<div class="progress-bar progress-bar-info progress-bar-striped active" role="progressbar"
accesskey=""aria-valuenow="" aria-valuemin="0" aria-valuemax="<?=$valuemax?>" style="width:">
<div class="panel">
<div class="panel-heading">
<span class="panel-title">Aktualizacja systemu</span>
</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-lg-4">Twoja wersja systemu</label>
<div class="col-lg-8">
<p class="form-control-static"><?= $this->ver; ?></p>
</div>
</div>
</div>
<div class="row">
<? if ( $this -> ver < $this -> new_ver ):?>
<div class="form-group col-lg-6 text-right">
<div class="">
<a href="#" class="btn btn-system btn-sm mb5" id="confirm">Aktualizuj do wyższej wersji</a>
<div class="form-group">
<label class="control-label col-lg-4">Aktualna wersja systemu</label>
<div class="col-lg-8">
<p class="form-control-static"><?= $this->new_ver; ?></p>
</div>
</div>
</div>
<? endif;?>
<? if ( $this -> ver < $this -> new_ver ):?>
<div class="form-group col-lg-6">
<div class="">
<a href="#" class="btn btn-system btn-sm mb5" id="confirmUpdateAll">Aktualizuj do najwyższej wersji</a>
<div class="progress-box hidden">
<div class="version">
<h3>Aktualizacja <span class="version_curent">0</span> / <span class="version_diff">0</span></h3>
</div>
<div class="progress">
<div class="progress-bar progress-bar-info progress-bar-striped active" role="progressbar"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
</div>
</div>
</div>
<? if ( $this->ver < $this->new_ver ): ?>
<div class="row mt15">
<div class="form-group col-lg-6 text-right">
<a href="#" class="btn btn-system btn-sm mb5" id="confirm">Aktualizuj do wyższej wersji</a>
</div>
<div class="form-group col-lg-6">
<a href="#" class="btn btn-system btn-sm mb5" id="confirmUpdateAll">Aktualizuj do najwyższej wersji</a>
</div>
</div>
<div class="text-danger text-center">* Przed aktualizacją systemu zalecane jest wykonanie pełnej kopii zapasowej.</div>
<? endif; ?>
</div>
<? endif;?>
</div>
<? if ( $this -> ver < $this -> new_ver ):?>
<div class="text-danger text-center">* Przed aktualizacją systemu zalecane jest wykonanie pełnej kopii zapasowej.</div>
<div class="clear"></div>
<?endif;?>
<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id = 'update-view';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Aktualizacja systemu';
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<?
ob_start();
echo $versions = file_get_contents( 'https://shoppro.project-dc.pl/updates/changelog.php' );
$out = ob_get_clean();
<? if ( !empty( $this->log ) ): ?>
<div class="panel">
<div class="panel-heading">
<span class="panel-title">Log ostatniej aktualizacji</span>
</div>
<div class="panel-body">
<pre style="max-height: 400px; overflow-y: auto; font-size: 12px;"><?= htmlspecialchars( $this->log ); ?></pre>
</div>
</div>
<? endif; ?>
<div class="panel">
<div class="panel-heading">
<span class="panel-title">Changelog</span>
</div>
<div class="panel-body">
<?= @file_get_contents( 'https://shoppro.project-dc.pl/updates/changelog.php?ver=' . $this->ver ); ?>
</div>
</div>
$grid = new \gridEdit;
$grid -> id = 'changelog';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Changelog';
$grid -> default_buttons = false;
$grid -> external_code = $out;
echo $grid -> draw();
?>
<script type="text/javascript">
var version_current = <?= $this -> ver;?>;
var version_new = <?= $this -> new_ver;?>;
var version_diff = Math.round((version_new - version_current )* 1000);
$(function() {
var version_current = <?= $this->ver; ?>;
var version_new = <?= $this->new_ver; ?>;
var version_diff = Math.round( ( version_new - version_current ) * 1000 );
var width = 0;
var ac_lp = 0;
$( document ).ready( function()
{
$( 'body' ).on( 'click', '#confirm', function()
{
$.prompt( 'Na pewno chcesz dokonać aktualizacji systemu?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v == true )
document.location.href = '/admin/update/update/';
},
buttons: {
'tak': true, 'nie': false
},
focus: 1
});
});
$( 'body' ).on( 'click', '#confirmUpdateAll', function()
{
$.prompt( 'Na pewno chcesz dokonać aktualizacji systemu?',
{
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v == true )
{
$('.progress-box').removeClass('hidden');
$('#confirm').css('pointer-events','none');
$('#confirmUpdateAll').css('pointer-events','none');
$('.version_diff').html(version_diff);
updateAll( version_current, version_new, version_diff, width, ac_lp);
}
$( '#confirm' ).on( 'click', function( e ) {
e.preventDefault();
$.confirm({
title: 'Potwierdź',
content: 'Na pewno chcesz dokonać aktualizacji systemu?',
buttons: {
tak: function() {
document.location.href = '/admin/update/update/';
},
buttons: {
'tak': true, 'nie': false
}
});
nie: function() {}
}
});
});
function updateAll( version_current, version_new, version_diff, width, ac_lp)
{
$.ajax(
{
$( '#confirmUpdateAll' ).on( 'click', function( e ) {
e.preventDefault();
$.confirm({
title: 'Potwierdź',
content: 'Na pewno chcesz dokonać aktualizacji systemu do najwyższej wersji?',
buttons: {
tak: function() {
$( '.progress-box' ).removeClass( 'hidden' );
$( '#confirm' ).css( 'pointer-events', 'none' );
$( '#confirmUpdateAll' ).css( 'pointer-events', 'none' );
$( '.version_diff' ).html( version_diff );
updateAll( version_current, version_new, version_diff, width, ac_lp );
},
nie: function() {}
}
});
});
function updateAll( version_current, version_new, version_diff, width, ac_lp ) {
$.ajax({
url: '/admin/update/updateAll/',
type: 'POST',
data:
{
version_current: version_current
},
success: function( data )
{
response = jQuery.parseJSON( data );
if ( response.status == true )
{
ac_lp = ac_lp + 1;
$('.version_curent').html(ac_lp);
width = width + ((1/version_diff)*100);
$('.progress-bar').attr("style", "width:"+ width +"%");
if( response.version < version_new )
{
updateAll( response.version, version_new, version_diff, width, ac_lp );
}
else
{
$.prompt( "Aktualizacja przebiegła pomyślnie.",
{
title: 'Informacja',
close: function(e,v,m,f){
window.location.href ="/admin/update/main_view/";
}
});
}
}
else
{
$.prompt( "W trakcie aktualizacji systemu wystąpił błąd. Proszę spróbować ponownie." ,
{
title: 'Błąd',
close: function(e,v,m,f){
window.location.href ="/admin/update/main_view/";
}
data: { version_current: version_current },
success: function( data ) {
var response = jQuery.parseJSON( data );
if ( response.status == true ) {
ac_lp = ac_lp + 1;
$( '.version_curent' ).html( ac_lp );
width = width + ( ( 1 / version_diff ) * 100 );
$( '.progress-bar' ).css( 'width', width + '%' );
if ( response.version < version_new ) {
updateAll( response.version, version_new, version_diff, width, ac_lp );
} else {
$.alert({
title: 'Informacja',
content: 'Aktualizacja przebiegła pomyślnie.',
onClose: function() {
window.location.href = '/admin/update/main_view/';
}
});
}
} else {
$.alert({
title: 'Błąd',
content: 'W trakcie aktualizacji systemu wystąpił błąd. Proszę spróbować ponownie.',
onClose: function() {
window.location.href = '/admin/update/main_view/';
}
});
}
}
}
);
};
</script>
});
}
});
</script>