summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules-available/serversetup-bwlp/page.inc.php47
-rw-r--r--modules-available/serversetup-bwlp/templates/ipaddress.html11
2 files changed, 28 insertions, 30 deletions
diff --git a/modules-available/serversetup-bwlp/page.inc.php b/modules-available/serversetup-bwlp/page.inc.php
index ba2e5433..6b1d20b6 100644
--- a/modules-available/serversetup-bwlp/page.inc.php
+++ b/modules-available/serversetup-bwlp/page.inc.php
@@ -37,6 +37,12 @@ class Page_ServerSetup extends Page
$this->getLocalAddresses();
}
+ if ($action === 'compile') {
+ User::assertPermission("edit.address");
+ Trigger::ipxe();
+ Util::redirect('?do=serversetup');
+ }
+
if ($action === 'ip') {
User::assertPermission("edit.address");
// New address is to be set
@@ -44,12 +50,6 @@ class Page_ServerSetup extends Page
$this->updateLocalAddress();
}
- if ($action === 'ipxe') {
- User::assertPermission("edit.menu");
- // iPXE stuff changes
- $this->updatePxeMenu();
- }
-
if ($action === 'savebootentry') {
User::assertPermission('ipxe.bootentry.edit');
$this->saveBootEntry();
@@ -132,6 +132,10 @@ class Page_ServerSetup extends Page
User::assertPermission('ipxe.bootentry.view');
$this->showBootentryList();
break;
+ case 'address':
+ User::assertPermission('edit.address');
+ $this->showEditAddress();
+ break;
default:
Util::redirect('?do=serversetup');
break;
@@ -284,6 +288,14 @@ class Page_ServerSetup extends Page
Render::addTemplate('ipxe-new-boot-entry', $params);
}
+ private function showEditAddress()
+ {
+ Render::addTemplate('ipaddress', array(
+ 'ips' => $this->taskStatus['data']['addresses'],
+ 'chooseHintClass' => $this->hasIpSet ? '' : 'alert alert-danger',
+ ));
+ }
+
// -----------------------------------------------------------------------------------------------
private function getLocalAddresses()
@@ -469,7 +481,7 @@ class Page_ServerSetup extends Page
private function updateLocalAddress()
{
- $newAddress = Request::post('ip', 'none');
+ $newAddress = Request::post('ip', 'none', 'string');
$valid = false;
foreach ($this->taskStatus['data']['addresses'] as $item) {
if ($item['ip'] !== $newAddress)
@@ -486,27 +498,6 @@ class Page_ServerSetup extends Page
Util::redirect();
}
- private function updatePxeMenu()
- {
- $timeout = Request::post('timeout', 10);
- if ($timeout === '')
- $timeout = 0;
- if (!is_numeric($timeout) || $timeout < 0) {
- Message::addError('main.value-invalid', 'timeout', $timeout);
- }
- $this->currentMenu['defaultentry'] = Request::post('defaultentry', 'net');
- $this->currentMenu['timeout'] = $timeout;
- $this->currentMenu['custom'] = Request::post('custom', '');
- $this->currentMenu['masterpasswordclear'] = Request::post('masterpassword', '');
- if (empty($this->currentMenu['masterpasswordclear']))
- $this->currentMenu['masterpassword'] = 'invalid';
- else
- $this->currentMenu['masterpassword'] = Crypto::hash6($this->currentMenu['masterpasswordclear']);
- Property::setBootMenu($this->currentMenu);
- Trigger::ipxe();
- Util::redirect('?do=ServerSetup');
- }
-
private function handleGetImage()
{
$file = "/opt/openslx/ipxe/openslx-bootstick.raw";
diff --git a/modules-available/serversetup-bwlp/templates/ipaddress.html b/modules-available/serversetup-bwlp/templates/ipaddress.html
index 8d73dfac..ef8cc914 100644
--- a/modules-available/serversetup-bwlp/templates/ipaddress.html
+++ b/modules-available/serversetup-bwlp/templates/ipaddress.html
@@ -20,7 +20,7 @@
{{/default}}
{{^default}}
<td>
- <button class="btn btn-primary btn-xs" name="ip" value="{{ip}}" {{perms.edit.address.disabled}}>
+ <button class="btn btn-primary btn-xs" name="ip" value="{{ip}}">
<span class="glyphicon glyphicon-flag"></span>
{{lang_set}}
</button>
@@ -30,8 +30,15 @@
{{/ips}}
</table>
<p>
- {{lang_bootHint}}
+ {{lang_recompileHint}}
</p>
</form>
+ <form method="post" action="?do=ServerSetup">
+ <input type="hidden" name="token" value="{{token}}">
+ <button class="btn btn-default" name="action" value="compile">
+ <span class="glyphicon glyphicon-refresh"></span>
+ {{lang_forceRecompile}}
+ </button>
+ </form>
</div>
</div> \ No newline at end of file