mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-31 18:07:46 +00:00
rollback 7c15bdadce: this change breaks the page
This commit is contained in:
@@ -1,35 +1,38 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$html='';
|
||||||
|
|
||||||
$db=new Db('base','nodes');
|
$db=new Db('base','nodes');
|
||||||
$nodes=$db->select('select nodename,ip from nodelist order by nodename desc', []);
|
$nodes=$db->select('select nodename,ip from nodelist order by nodename desc', []);
|
||||||
$nodes[] = ['nodename' => 'local'];
|
$nodes[]=array('nodename'=>'local');
|
||||||
$nodes=array_reverse($nodes);
|
$nodes=array_reverse($nodes);
|
||||||
|
|
||||||
$ids = [];
|
$ids=array();
|
||||||
$nth=0;
|
$nth=0;
|
||||||
$html = '';
|
|
||||||
$html_tpl = '';
|
|
||||||
$hres=$this->getTableChunk('baseslist','tbody');
|
$hres=$this->getTableChunk('baseslist','tbody');
|
||||||
|
if(!empty($nodes))foreach($nodes as $node)
|
||||||
foreach($nodes as $node){
|
{
|
||||||
|
|
||||||
$db1=new Db('base',$node['nodename']);
|
$db1=new Db('base',$node['nodename']);
|
||||||
if(!$db1->error){
|
if($db1!==false)
|
||||||
|
{
|
||||||
$bases=$db1->select("SELECT idx,platform,name,arch,targetarch,ver,stable,elf,date FROM bsdbase order by cast(ver AS int)", []);
|
$bases=$db1->select("SELECT idx,platform,name,arch,targetarch,ver,stable,elf,date FROM bsdbase order by cast(ver AS int)", []);
|
||||||
$num = $nth & 1;
|
|
||||||
|
|
||||||
foreach($bases as $base){
|
$num=$nth & 1;
|
||||||
|
if(!empty($bases)) foreach($bases as $base)
|
||||||
|
{
|
||||||
$idle=1;
|
$idle=1;
|
||||||
if($node['nodename'] != 'local'){
|
//print_r($node);exit;
|
||||||
|
if($node['nodename']!='local')
|
||||||
|
{
|
||||||
$idle=$this->check_locktime($node['ip']);
|
$idle=$this->check_locktime($node['ip']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ids[]=$base['idx'];
|
$ids[]=$base['idx'];
|
||||||
$id='base'.$base['ver'].'-'.$base['arch'].'-'.$base['stable'];
|
$id='base'.$base['ver'].'-'.$base['arch'].'-'.$base['stable'];
|
||||||
|
|
||||||
if($hres !== false){
|
if($hres!==false)
|
||||||
$vars = [
|
{
|
||||||
|
$html_tpl=$hres[1];
|
||||||
|
$vars=array(
|
||||||
'id'=>$id,
|
'id'=>$id,
|
||||||
'nth-num'=>'nth'.$num,
|
'nth-num'=>'nth'.$num,
|
||||||
'node'=>$node['nodename'],
|
'node'=>$node['nodename'],
|
||||||
@@ -43,26 +46,35 @@ foreach($nodes as $node){
|
|||||||
'date'=>$base['date'],
|
'date'=>$base['date'],
|
||||||
'jstatus'=>'',
|
'jstatus'=>'',
|
||||||
'maintenance'=>($idle==0)?' maintenance':'',
|
'maintenance'=>($idle==0)?' maintenance':'',
|
||||||
'deltitle' => $this->translate('Delete')
|
'deltitle'=>$this->translate('Delete'),
|
||||||
];
|
);
|
||||||
|
|
||||||
|
foreach($vars as $var=>$val)
|
||||||
|
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||||
|
|
||||||
foreach($vars as $var => $val){
|
|
||||||
$html_tpl = str_replace('#'.$var.'#', $val, $hres[1]);
|
|
||||||
}
|
|
||||||
$html.=$html_tpl;
|
$html.=$html_tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$ids[]='#base'.$bid;
|
||||||
$ids[]='#'.$id;
|
$ids[]='#'.$id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nth++;
|
$nth++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tasks = (empty($ids)) ? '' : $tasks = $this->getRunningTasks($ids);
|
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||||
|
|
||||||
if($hres !== false){
|
$tasks='';
|
||||||
$html_tpl = str_replace(["\n","\r","\t"], '', $hres[1]);
|
if(!empty($ids))
|
||||||
$vars = [
|
{
|
||||||
|
$tasks=$this->getRunningTasks($ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
$html_tpl=str_replace(array("\n","\r","\t"),'',$hres[1]);
|
||||||
|
if($hres!==false)
|
||||||
|
{
|
||||||
|
$vars=array(
|
||||||
'nth-num'=>'nth0',
|
'nth-num'=>'nth0',
|
||||||
'status'=>'',
|
'status'=>'',
|
||||||
//'jstatus'=>$this->translate('Updating'),
|
//'jstatus'=>$this->translate('Updating'),
|
||||||
@@ -70,19 +82,27 @@ if($hres !== false){
|
|||||||
'desktop'=>' s-off',
|
'desktop'=>' s-off',
|
||||||
'maintenance'=>' maintenance busy',
|
'maintenance'=>' maintenance busy',
|
||||||
'updtitle'=>$this->translate('Update'),
|
'updtitle'=>$this->translate('Update'),
|
||||||
'deltitle' => $this->translate('Delete')
|
'deltitle'=>$this->translate('Delete'),
|
||||||
];
|
);
|
||||||
|
|
||||||
foreach($vars as $var => $val){
|
foreach($vars as $var=>$val)
|
||||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||||
}
|
}
|
||||||
}
|
/*
|
||||||
|
echo json_encode(array(
|
||||||
$included_result_array = [
|
'tbody'=>$html,
|
||||||
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
|
||||||
'error'=>false,
|
'error'=>false,
|
||||||
'func'=>'fillTable',
|
'func'=>'fillTable',
|
||||||
'id'=>'baseslist',
|
'id'=>'baseslist',
|
||||||
'tasks'=>$tasks,
|
'tasks'=>$tasks,
|
||||||
'template' => $html_tpl
|
'template'=>$html_tpl,
|
||||||
];
|
));
|
||||||
|
*/
|
||||||
|
$included_result_array=array(
|
||||||
|
'tbody'=>$html,
|
||||||
|
'error'=>false,
|
||||||
|
'func'=>'fillTable',
|
||||||
|
'id'=>'baseslist',
|
||||||
|
'tasks'=>$tasks,
|
||||||
|
'template'=>$html_tpl,
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user