diff options
Diffstat (limited to 'modules-available')
5 files changed, 51 insertions, 27 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json b/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json index 30b46e82..f5356a72 100644 --- a/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json +++ b/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json @@ -17,10 +17,12 @@ "lang_bootentryTitle": "Men\u00fceintrag", "lang_chooseIP": "Bitte w\u00e4hlen Sie die IP-Adresse, \u00fcber die der Server von den Clients zum Booten angesprochen werden soll.", "lang_commandLine": "Command line", + "lang_copy": "Kopieren", "lang_count": "Anzahl", "lang_createUsbImage": "Bootbaren USB-Stick erstellen", "lang_downloadBootImage": "Boot-Image herunterladen", "lang_downloadRufus": "Rufus herunterladen", + "lang_editBootEntryHead": "Men\u00fceintrag bearbeiten", "lang_editBuiltinWarn": "Achtung! Sie bearbeiten einen der vorgegebenen Eintr\u00e4ge! Bei einem Update k\u00f6nnten Ihre \u00c4nderungen wieder \u00fcberschrieben werden", "lang_editMenuHead": "Men\u00fc bearbeiten", "lang_efiOnly": "Nur EFI", diff --git a/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json b/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json index ba6d3a85..4bf78a5d 100644 --- a/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json +++ b/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json @@ -10,17 +10,19 @@ "lang_assignMenuToLocation": "Assign menu to location", "lang_biosOnly": "BIOS only", "lang_bootAddress": "Boot Address of the Server", - "lang_bootEntryData": "Menu entry data", + "lang_bootEntryData": "Menu item data", "lang_bootentryDeleteConfirm": "Are you sure you want to delete this menu item?", "lang_bootentryHead": "Menu items", - "lang_bootentryIntro": "This is where you can add, edit and remove menu items, which can be added to menus. A menu entry is either a combination of a kernel\/image to load (and an optional initrd), or a custom iPXE-script.", + "lang_bootentryIntro": "This is where you can add, edit and remove menu items, which can be added to menus. A menu item is either a combination of a kernel\/image to load (and an optional initrd), or a custom iPXE-script.", "lang_bootentryTitle": "Menu item", "lang_chooseIP": "Please select the IP address that the client server will use to boot.", "lang_commandLine": "Command line", + "lang_copy": "Copy", "lang_count": "Count", "lang_createUsbImage": "Create bootable thumb drive", "lang_downloadBootImage": "Download boot-image", "lang_downloadRufus": "Download Rufus", + "lang_editBootEntryHead": "Edit menu item", "lang_editBuiltinWarn": "WARNING! You're editing a predefined item. Future updates might reset your changes!", "lang_editMenuHead": "Edit menu", "lang_efiOnly": "EFI only", @@ -58,7 +60,7 @@ "lang_ok": "OK", "lang_override": "Override", "lang_pxeMenuContent": "pxelinux.cfg\/ menu definition", - "lang_pxelinuxEntriesOnly": "Import menu entries only, don't create menu", + "lang_pxelinuxEntriesOnly": "Import menu items only, don't create menu", "lang_pxelinuxImport": "Import PXELinux menu", "lang_pxelinuxImportIntro": "Here you can paste a pxelinux menu to convert it to an iPXE menu.", "lang_recompileHint": "Recompile iPXE binaries now. Usually this happens automatically on changes, but if you suspect problems caused by outdated binaries, you can trigger recompilation here.", diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php index 9b97ff01..4061fa2b 100644 --- a/modules-available/serversetup-bwlp-ipxe/page.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php @@ -151,7 +151,7 @@ class Page_ServerSetup extends Page switch (Request::get('show')) { case 'editbootentry': - User::assertPermission('ipxe.bootentry.edit'); + User::assertPermission('ipxe.bootentry.*'); $this->showEditBootEntry(); break; case 'editmenu': @@ -482,7 +482,9 @@ class Page_ServerSetup extends Page } $entry->addFormFields($params); $params['title'] = $row['title']; - $params['oldentryid'] = $params['entryid'] = $row['entryid']; + if (!Request::get('copy')) { + $params['oldentryid'] = $params['entryid'] = $row['entryid']; + } $params['builtin'] = $row['builtin']; if (!is_array($params['entries'])) { $params['entries'] = []; @@ -498,6 +500,7 @@ class Page_ServerSetup extends Page WHERE me.entryid = :entryid', ['entryid' => $row['entryid']]); } + $params['disabled'] = User::hasPermission('ipxe.bootentry.edit') ? '' : 'disabled'; Render::addTemplate('ipxe-new-boot-entry', $params); } @@ -555,8 +558,11 @@ class Page_ServerSetup extends Page Message::addError('main.parameter-missing', 'deleteid'); return; } - Database::exec("DELETE FROM serversetup_bootentry WHERE entryid = :entryid", array("entryid" => $id)); - Message::addSuccess('bootentry-deleted'); + $res = Database::exec("DELETE FROM serversetup_bootentry + WHERE entryid = :entryid AND builtin = 0", array("entryid" => $id)); + if ($res > 0) { + Message::addSuccess('bootentry-deleted'); + } Util::redirect('?do=serversetup&show=bootentry'); } @@ -777,7 +783,7 @@ class Page_ServerSetup extends Page } else { // Edit existing entry $params['oldid'] = $oldEntryId; - Database::exec('UPDATE serversetup_bootentry SET entryid = :entryid, title = :title, data = :data + Database::exec('UPDATE serversetup_bootentry SET entryid = If(builtin = 0, :entryid, entryid), title = :title, data = :data WHERE entryid = :oldid', $params); Message::addSuccess('boot-entry-updated', $newId); } diff --git a/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html b/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html index 8185ad06..edfc0e5f 100644 --- a/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html +++ b/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html @@ -12,6 +12,7 @@ <th>{{lang_hotkey}}</th> <th class="slx-smallcol">{{lang_refCount}}</th> <th class="slx-smallcol">{{lang_edit}}</th> + {{#allowEdit}}<th class="slx-smallcol">{{lang_copy}}</th>{{/allowEdit}} <th class="slx-smallcol">{{lang_delete}}</th> </tr> </thead> @@ -31,17 +32,24 @@ {{refs}} </td> <td align="center"> - {{#allowEdit}} <a href="?do=serversetup&show=editbootentry&id={{entryid}}" class="btn btn-xs btn-default"> - <span class="glyphicon glyphicon-edit"></span> + <span class="glyphicon glyphicon-{{#allowEdit}}edit{{/allowEdit}}{{^allowEdit}}eye-open{{/allowEdit}}"></span> + </a> + </td> + {{#allowEdit}} + <td align="center"> + <a href="?do=serversetup&show=editbootentry&id={{entryid}}©=true" class="btn btn-xs btn-default"> + <span class="glyphicon glyphicon-duplicate"></span> </a> - {{/allowEdit}} </td> + {{/allowEdit}} <td align="center"> {{#allowEdit}} - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteBootentry('{{entryid}}', '{{builtin}}')"> - <span class="glyphicon glyphicon-trash"></span> - </button> + {{^builtin}} + <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteBootentry('{{entryid}}')"> + <span class="glyphicon glyphicon-trash"></span> + </button> + {{/builtin}} {{/allowEdit}} </td> </tr> diff --git a/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html b/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html index a6955642..c04661f2 100644 --- a/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html +++ b/modules-available/serversetup-bwlp-ipxe/templates/ipxe-new-boot-entry.html @@ -1,4 +1,9 @@ +{{^oldentryid}} <h2>{{lang_newBootEntryHead}}</h2> +{{/oldentryid}} +{{#oldentryid}} + <h2>{{lang_editBootEntryHead}}</h2> +{{/oldentryid}} {{#builtin}} <div class="alert alert-warning"> @@ -18,11 +23,11 @@ <div class="form-group"> <div class="radio"> - <input class="type-radio" type="radio" name="type" value="exec" id="type-exec" {{exec_checked}}> + <input class="type-radio" type="radio" name="type" value="exec" id="type-exec" {{exec_checked}} {{disabled}}> <label for="type-exec">{{lang_typeExecEntry}}</label> </div> <div class="radio"> - <input class="type-radio" type="radio" name="type" value="script" id="type-script" {{script_checked}}> + <input class="type-radio" type="radio" name="type" value="script" id="type-script" {{script_checked}} {{disabled}}> <label for="type-script">{{lang_typeScriptEntry}}</label> </div> </div> @@ -31,13 +36,14 @@ <label for="input-id"> {{lang_entryId}} {{lang_idFormatHint}} </label> - <input id="input-id" class="form-control" name="newid" value="{{entryid}}" pattern="^[a-z0-9\-_]{1,16}$" minlength="1" maxlength="16" required> + <input id="input-id" class="form-control" name="newid" value="{{entryid}}" pattern="^[a-z0-9\-_]{1,16}$" + minlength="1" maxlength="16" required {{#builtin}}readonly{{/builtin}} {{disabled}}> </div> <div class="form-group"> <label for="input-title"> {{lang_entryTitle}} </label> - <input id="input-title" class="form-control" name="title" value="{{title}}" maxlength="100"> + <input id="input-title" class="form-control" name="title" value="{{title}}" maxlength="100" {{disabled}}> </div> <div class="type-form" id="form-exec"> @@ -45,7 +51,7 @@ <label for="arch-selector"> {{lang_archSelector}} </label> - <select id="arch-selector" class="form-control" name="entry[arch]"> + <select id="arch-selector" class="form-control" name="entry[arch]" {{disabled}}> <option value="agnostic" {{agnostic_selected}}>{{lang_archAgnostic}}</option> <option value="PCBIOS" {{PCBIOS_selected}}>{{lang_biosOnly}}</option> <option value="EFI" {{EFI_selected}}>{{lang_efiOnly}}</option> @@ -62,39 +68,39 @@ <label for="input-ex"> {{lang_imageToLoad}} </label> - <input id="input-ex" class="form-control" name="entry[executable][{{mode}}]" value="{{executable}}"> + <input id="input-ex" class="form-control" name="entry[executable][{{mode}}]" value="{{executable}}" {{disabled}}> </div> <div class="form-group"> <label for="input-rd"> {{lang_initRd}} </label> - <input id="input-rd" class="form-control" name="entry[initRd][{{mode}}]" value="{{initRd}}"> + <input id="input-rd" class="form-control" name="entry[initRd][{{mode}}]" value="{{initRd}}" {{disabled}}> </div> <div class="form-group"> <label for="input-cmd"> {{lang_commandLine}} </label> <input id="input-cmd" class="form-control" name="entry[commandLine][{{mode}}]" - value="{{commandLine}}"> + value="{{commandLine}}" {{disabled}}> </div> <div class="form-group"> <div class="checkbox checkbox-inline"> <input id="exec-replace-{{mode}}" class="form-control" type="checkbox" - name="entry[replace][{{mode}}]" {{replace_checked}}> + name="entry[replace][{{mode}}]" {{replace_checked}} {{disabled}}> <label for="exec-replace-{{mode}}">{{lang_execReplace}}</label> </div> </div> <div class="form-group"> <div class="checkbox checkbox-inline"> <input id="exec-au-{{mode}}" class="form-control" type="checkbox" - name="entry[autoUnload][{{mode}}]" {{autoUnload_checked}}> + name="entry[autoUnload][{{mode}}]" {{autoUnload_checked}} {{disabled}}> <label for="exec-au-{{mode}}">{{lang_execAutoUnload}}</label> </div> </div> <div class="form-group"> <div class="checkbox checkbox-inline"> <input id="exec-reset-{{mode}}" class="form-control" type="checkbox" - name="entry[resetConsole][{{mode}}]" {{resetConsole_checked}}> + name="entry[resetConsole][{{mode}}]" {{resetConsole_checked}} {{disabled}}> <label for="exec-reset-{{mode}}">{{lang_execResetConsole}}</label> </div> </div> @@ -111,7 +117,7 @@ {{lang_scriptContent}} </label> <textarea id="script-ta" class="form-control" rows="10" - name="entry[script]">{{entry.script}}</textarea> + name="entry[script]" {{disabled}}>{{entry.script}}</textarea> </div> </div> @@ -129,7 +135,7 @@ </ul> <div class="buttonbar text-right"> - <button type="submit" class="btn btn-primary"> + <button type="submit" class="btn btn-primary" {{disabled}}> <span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}} </button> |