From dcee499b7ceddfb17bb764ffee00ad778756cf6e Mon Sep 17 00:00:00 2001 From: olevole Date: Fri, 7 Apr 2023 14:04:54 +0300 Subject: [PATCH] WIP: upgrade button --- php/clonos.php | 8 ++++++-- public/css/styles.css | 3 +++ public/dialogs/settings-update.php | 1 + public/js/clonos.js | 19 ++++++++++++++++++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/php/clonos.php b/php/clonos.php index d6d23c6e..93f77e28 100644 --- a/php/clonos.php +++ b/php/clonos.php @@ -159,8 +159,6 @@ class ClonOS { } echo json_encode($new_array); return; - }else{ - echo json_encode(array('error'=>true,'error_message'=>'PHP Method is not exists: '.$this->mode)); } $included_result_array=''; @@ -252,6 +250,12 @@ class ClonOS { echo json_encode($this->saveHelperValues()); return; */ + if(!method_exists($this,$cfunc)) + { + //echo json_encode(array('error'=>true,'error_message'=>'PHP Method is not exists: '.$this->mode)); + $this->vars['error']=true; + $this->vars['error_message']='PHP Method is not exists: '.$this->mode; + } } } } diff --git a/public/css/styles.css b/public/css/styles.css index 05ceff7e..a53ed00a 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -870,6 +870,9 @@ dialog.fullscreen #vnc-iframe { background-color:coral; text-shadow:1px 1px 2px black; } +.buttons .button.hidden { + display:none; +} .window-box h1 { color:gray; diff --git a/public/dialogs/settings-update.php b/public/dialogs/settings-update.php index 83a82988..7e0fd10a 100644 --- a/public/dialogs/settings-update.php +++ b/public/dialogs/settings-update.php @@ -4,6 +4,7 @@ Check for updates…
+
diff --git a/public/js/clonos.js b/public/js/clonos.js index fa3177f8..4f31e2e5 100644 --- a/public/js/clonos.js +++ b/public/js/clonos.js @@ -5,6 +5,8 @@ var clonos={ lastX:0, oldHash:'', authorized:false, + updates_exists:false, + updates:{}, commands: { 'jstart':{stat:['Not launched','Starting','Launched'],cmd:'jailStart'}, @@ -882,7 +884,19 @@ var clonos={ }, onSettingsUpdateCheck:function(data) { - $('dialog#settings-update .window-content').append('

'+data.installed+'

'); + var msg='

'+this.translate('No updates…')+'

'; + if(this.updates_exists) + { + msg='

'+this.translate('Updates available:')+'

'; + for(n in this.updates) + { + msg+='

'+n+', version: '+this.updates[n]+'

'; + } + $('#settings-update .button.ok-but').removeClass('hidden'); + }else{ + $('#settings-update .button.ok-but').addClass('hidden'); + } + $('dialog#settings-update .window-content').html(msg); }, onUsersAdd:function(data) @@ -2229,12 +2243,15 @@ var clonos={ checkLatestUpdates:function(data) { + this.updates_exists=false; for(n in data) { var key='updlist_'+n; $('#'+key).addClass('changed'); $('#'+key).find('td:eq(2)').text(data[n]); + this.updates_exists=true; } + if(this.updates_exists) this.updates=data; },