* [bug#56872] Fix bug for update os.

This commit is contained in:
liyang
2024-11-13 08:32:15 +08:00
committed by 曹延义
parent 34b724dc99
commit e5c6bdc8f6
3 changed files with 27 additions and 8 deletions
+22 -4
View File
@@ -64,7 +64,7 @@ class host extends control
* @access public
* @return void
*/
public function create(string $osName = 'linux')
public function create()
{
if($_POST)
{
@@ -79,7 +79,6 @@ class host extends control
}
$this->view->title = $this->lang->host->create;
$this->view->osName = $osName;
$this->view->rooms = $this->loadModel('serverroom')->getPairs();
$this->view->accounts = $this->loadModel('account')->getPairs();
$this->view->optionMenu = $this->loadModel('tree')->getOptionMenu(0, 'host');
@@ -95,7 +94,7 @@ class host extends control
* @access public
* @return void
*/
public function edit(int $id, string $osName = '')
public function edit(int $id)
{
if($_POST)
{
@@ -111,7 +110,6 @@ class host extends control
$this->view->title = $this->lang->host->edit;
$this->view->host = $this->host->fetchByID($id);
$this->view->osName = $osName ? $osName : $this->view->host->osName;
$this->view->rooms = $this->loadModel('serverroom')->getPairs();
$this->view->accounts = $this->loadModel('account')->getPairs();
$this->view->optionMenu = $this->loadModel('tree')->getOptionMenu(0, 'host');
@@ -195,4 +193,24 @@ class host extends control
$this->view->type = $type;
$this->display();
}
/**
* Js获取所有的操作系统列表。
* Get all os list.
*
* @param string $type
* @access public
* @return void
*/
public function ajaxGetOS(string $type)
{
$type = "{$type}List";
$osList = $this->lang->host->{$type};
if(empty($osList)) return '';
$osItems = array();
foreach($osList as $version => $os) $osItems[] = array('text' => $os, 'value' => $version);
return print(json_encode($osItems));
}
}