diff options
Diffstat (limited to 'modules-available/serversetup-bwlp/templates')
9 files changed, 804 insertions, 131 deletions
diff --git a/modules-available/serversetup-bwlp/templates/bootentry-list.html b/modules-available/serversetup-bwlp/templates/bootentry-list.html new file mode 100644 index 00000000..929b8c47 --- /dev/null +++ b/modules-available/serversetup-bwlp/templates/bootentry-list.html @@ -0,0 +1,73 @@ +<table class="table"> + <thead> + <tr> + <th>{{lang_bootentryTitle}}</th> + <th>Hotkey</th> + <th class="slx-smallcol">{{lang_edit}}</th> + <th class="slx-smallcol">{{lang_delete}}</th> + </tr> + </thead> + <tbody> + {{#bootentryTable}} + <tr> + <td> + {{title}} + </td> + <td> + {{hotkey}} + </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> + </a> + {{/allowEdit}} + </td> + <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> + {{/allowEdit}} + </td> + </tr> + {{/bootentryTable}} + </tbody> +</table> +<div class="pull-right"> + {{#allowEdit}} + <a href="?do=serversetup&show=editbootentry" class="btn btn-success"> + <span class="glyphicon glyphicon-plus"></span> + {{lang_addBootentry}} + </a> + {{/allowEdit}} +</div> + +<!-- Modals --> +<form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> + </div> + <div class="modal-body"> + <p>{{lang_bootentryDeleteConfirm}}</p> + </div> + <div class="modal-footer"> + <input type="hidden" id="delete-bootentry-id" name="deleteid" value=""> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> + <button type="submit" name="action" value="deleteBootentry" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> + </div> + </div> + </div> + </div> +</form> + +<script> + function deleteBootentry(entryid) { + $("#delete-bootentry-id").val(entryid); + } +</script>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp/templates/download.html b/modules-available/serversetup-bwlp/templates/download.html new file mode 100644 index 00000000..6752f7fc --- /dev/null +++ b/modules-available/serversetup-bwlp/templates/download.html @@ -0,0 +1,38 @@ +<div class="panel-footer"> + <div> + <div class="btn-group" role="group"> + <a class="btn btn-default" href="?do=ServerSetup&action=getimage"> + <span class="glyphicon glyphicon-download-alt"></span> + {{lang_downloadImage}} + </a> + <span class="btn btn-default" data-toggle="modal" data-target="#help-usbimg"><span class="glyphicon glyphicon-question-sign"></span></span> + </div> + </div> +</div> + +<div class="modal fade" id="help-usbimg" tabindex="-1" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + {{lang_usbImage}} + </div> + <div class="modal-body"> + <p>{{lang_usbImgHelp}}</p> + <p> + <b>Linux</b> + <br> + {{lang_usbImgHelpLinux}} + </p> + <p> + <b>Windows</b> + <br> + {{lang_usbImgHelpWindows}} + </p> + <p> + <a href="https://rufus.akeo.ie/#download">{{lang_downloadRufus}}</a> + </p> + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp/templates/heading.html b/modules-available/serversetup-bwlp/templates/heading.html index d68360f1..e2aa0bff 100644 --- a/modules-available/serversetup-bwlp/templates/heading.html +++ b/modules-available/serversetup-bwlp/templates/heading.html @@ -1 +1,3 @@ -<h1>{{lang_moduleHeading}}</h1>
\ No newline at end of file +<div class="page-header"> + <h1>{{lang_moduleHeading}}</h1> +</div>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp/templates/ipaddress.html b/modules-available/serversetup-bwlp/templates/ipaddress.html index 8d73dfac..ea19c417 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}}" {{disabled}}> <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" {{disabled}}> + <span class="glyphicon glyphicon-refresh"></span> + {{lang_forceRecompile}} + </button> + </form> </div> </div>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp/templates/ipxe-new-boot-entry.html b/modules-available/serversetup-bwlp/templates/ipxe-new-boot-entry.html new file mode 100644 index 00000000..fe496029 --- /dev/null +++ b/modules-available/serversetup-bwlp/templates/ipxe-new-boot-entry.html @@ -0,0 +1,158 @@ +<h2>{{lang_newBootEntryHead}}</h2> + +{{#builtin}} + <div class="alert alert-warning"> + {{lang_editBuiltinWarn}} + </div> +{{/builtin}} + +<div class="panel panel-default"> + <div class="panel-heading"> + {{lang_bootEntryData}} + </div> + <div class="panel-body"> + <form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="savebootentry"> + <input type="hidden" name="entryid" value="{{oldentryid}}"> + + <div class="form-group"> + <div class="radio"> + <input class="type-radio" type="radio" name="type" value="exec" id="type-exec" {{exec_checked}}> + <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}}> + <label for="type-script">{{lang_typeScriptEntry}}</label> + </div> + </div> + + <div class="form-group"> + <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> + </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"> + </div> + <div class="form-group"> + <label for="arch-selector"> + {{lang_archSelector}} + </label> + <select id="arch-selector" class="form-control" name="entry[arch]"> + <option value="agnostic" {{agnostic_selected}}>{{lang_archAgnostic}}</option> + <option value="PCBIOS" {{PCBIOS_selected}}>{{lang_biosOnly}}</option> + <option value="EFI" {{EFI_selected}}>{{lang_efiOnly}}</option> + <option value="PCBIOS-EFI" {{PCBIOS-EFI_selected}}>{{lang_archBoth}}</option> + </select> + </div> + + <div class="type-form" id="form-exec"> + <div class="row"> + {{#entries}} + <div class="mode-class col-md-6" id="col-{{mode}}"> + <div class="panel panel-default"> + <div class="panel-body"> + <h4 class="arch-heading">{{mode}}</h4> + <div class="form-group"> + <label for="input-ex"> + {{lang_imageToLoad}} + </label> + <input id="input-ex" class="form-control" name="entry[executable][{{mode}}]" value="{{executable}}"> + </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}}"> + </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}}"> + </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}}> + <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}}> + <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}}> + <label for="exec-reset-{{mode}}">{{lang_execResetConsole}}</label> + </div> + </div> + </div> + </div> + </div> + {{/entries}} + </div> + </div> + + <div class="type-form" id="form-script"> + <div class="form-group"> + <label for="script-ta"> + {{lang_scriptContent}} + </label> + <textarea id="script-ta" class="form-control" rows="10" + name="entry[script]">{{entry.script}}</textarea> + </div> + </div> + + {{#builtin}} + <div class="alert alert-warning"> + {{lang_editBuiltinWarn}} + </div> + {{/builtin}} + + <div class="buttonbar text-right"> + <button type="submit" class="btn btn-primary"> + <span class="glyphicon glyphicon-floppy-disk"></span> + {{lang_save}} + </button> + </div> + </form> + </div> +</div> + +<script><!-- +document.addEventListener('DOMContentLoaded', function () { + $('.type-radio').click(function () { + $('.type-form').hide(); + $('#form-' + $(this).val()).show(); + }); + $('.type-radio[checked]').click(); + var $as = $('#arch-selector'); + $as.change(function() { + var v = $as.val(); + if (v === 'agnostic') { + v = 'PCBIOS'; + $('.arch-heading').hide(); + } else { + $('.arch-heading').show(); + } + var vs = v.split('-'); + var cols = 12 / vs.length; + $('.mode-class').hide(); + for (var i = 0; i < vs.length; ++i) { + $('#col-' + vs[i]).attr('class', 'mode-class col-md-' + cols).show(); + } + }).change(); +}); +// --></script>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp/templates/ipxe.html b/modules-available/serversetup-bwlp/templates/ipxe.html deleted file mode 100644 index f4b0b4d3..00000000 --- a/modules-available/serversetup-bwlp/templates/ipxe.html +++ /dev/null @@ -1,117 +0,0 @@ -<form method="post" action="?do=ServerSetup"> - <input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-2000px" tabindex="-1"> - <input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-2000px" tabindex="-1"> - <input type="hidden" name="action" value="ipxe"> - <input type="hidden" name="token" value="{{token}}"> - <div class="panel panel-default"> - <div class="panel-heading"> - {{lang_bootMenu}} - </div> - <div class="panel-body"> - <p> - {{lang_bootInfo}} - </p> - <br> - - <div class="form-group"> - <strong>{{lang_bootBehavior}}</strong> - <div class="radio"> - <input type="radio" name="defaultentry" value="net" {{active-net}} id="id-net" {{perms.edit.menu.disabled}}> - <label for="id-net">bwLehrpool</label> - </div> - <div class="radio"> - <input type="radio" name="defaultentry" value="hdd" {{active-hdd}} id="id-hdd" {{perms.edit.menu.disabled}}> - <label for="id-hdd">{{lang_localHDD}}</label> - </div> - <div class="radio"> - <input type="radio" name="defaultentry" value="custom" {{active-custom}} id="id-custom" {{perms.edit.menu.disabled}}> - <label for="id-custom">{{lang_customEntry}} ("custom")</label> - </div> - </div> - - <div class="form-group"> - <strong>{{lang_menuDisplayTime}}</strong> - <div class="input-group form-narrow"> - <input type="text" class="form-control" name="timeout" value="{{timeout}}" pattern="\d+" {{perms.edit.menu.readonly}}> - <span class="input-group-addon">{{lang_seconds}}</span> - </div> - </div> - - <div class="form-group"> - <strong>{{lang_masterPassword}}</strong> - <div class="form-narrow"> - <input type="{{password_type}}" class="form-control" name="masterpassword" value="{{masterpasswordclear}}" {{perms.edit.menu.readonly}}> - </div> - <i>{{lang_masterPasswordHelp}}</i> - </div> - - <div class="form-group"> - <strong>{{lang_menuCustom}}</strong> <a class="btn btn-default btn-xs" data-toggle="modal" data-target="#help-custom"><span class="glyphicon glyphicon-question-sign"></span></a> - <textarea class="form-control" name="custom" rows="8" {{perms.edit.menu.readonly}}>{{custom}}</textarea> - </div> - </div> - - <div class="panel-footer"> - <button class="btn btn-primary pull-right" name="action" value="ipxe" {{perms.edit.menu.disabled}}>{{lang_bootMenuCreate}}</button> - <div> - <div class="btn-group" role="group"> - <a class="btn btn-default {{perms.download.disabled}}" href="?do=ServerSetup&action=getimage"> - <span class="glyphicon glyphicon-download-alt"></span> - {{lang_downloadImage}} - </a> - <span class="btn btn-default" data-toggle="modal" data-target="#help-usbimg"><span class="glyphicon glyphicon-question-sign"></span></span> - </div> - </div> - </div> - </div> -</form> - -<div class="modal fade" id="help-custom" tabindex="-1" role="dialog"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - {{lang_menuCustom}} - </div> - <div class="modal-body"> - {{lang_menuCustomHint1}} - <br>{{lang_example}}: - <pre>LABEL custom - MENU LABEL ^My Boot Entry - KERNEL http://1.2.3.4/kernel - INITRD http://1.2.3.4/initramfs-stage31 - APPEND custom=option - IPAPPEND 3</pre> - {{lang_menuCustomHint2}} LABEL <strong>custom</strong> - {{lang_menuCustomHint3}} - </div> - </div> - </div> -</div> - -<div class="modal fade" id="help-usbimg" tabindex="-1" role="dialog"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - {{lang_usbImage}} - </div> - <div class="modal-body"> - <p>{{lang_usbImgHelp}}</p> - <p> - <b>Linux</b> - <br> - {{lang_usbImgHelpLinux}} - </p> - <p> - <b>Windows</b> - <br> - {{lang_usbImgHelpWindows}} - </p> - <p> - <a href="https://rufus.akeo.ie/#download">{{lang_downloadRufus}}</a> - </p> - </div> - </div> - </div> -</div>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp/templates/ipxe_update.html b/modules-available/serversetup-bwlp/templates/ipxe_update.html index c5aafa1c..344d3905 100644 --- a/modules-available/serversetup-bwlp/templates/ipxe_update.html +++ b/modules-available/serversetup-bwlp/templates/ipxe_update.html @@ -1,31 +1,35 @@ <div class="panel panel-default"> <div class="panel-heading">{{lang_menuGeneration}}</div> <div class="panel-body"> - <div id="built-pxe" class="invisible"> - <span class="glyphicon glyphicon-ok"></span> - {{lang_pxeBuilt}} - </div> - <div id="built-usb" class="invisible"> - <span class="glyphicon glyphicon-ok"></span> - {{lang_usbBuilt}} + <div id="file-list"> + {{#files}} + <div id="built-{{namehyphen}}"> + <span class="glyphicon glyphicon-question-sign"></span> + {{name}} + </div> + {{/files}} </div> <div id="genfailed" class="collapse"> <div class="alert alert-danger"> {{lang_generationFailed}} </div> </div> - <div data-tm-id="{{taskid}}" data-tm-log="log" data-tm-log-height="31em" data-tm-callback="ipxeGenCb">{{lang_menuGeneration}}</div> + <div id="tm-compile-div" data-tm-id="{{taskid}}" data-tm-log="log" data-tm-log-height="36em" data-tm-callback="ipxeGenCb">{{lang_menuGeneration}}</div> </div> </div> <script type="text/javascript"> + document.addEventListener('DOMContentLoaded', function() { + var slxFileList = $('#file-list').find('.glyphicon'); + }); + function ipxeGenCb(task) { if (!task || !task.statusCode) return; - if (task.data) { - if (task.data.pxeDone) $('#built-pxe').removeClass('invisible'); - if (task.data.usbDone) $('#built-usb').removeClass('invisible'); + + if (task.statusCode === 'TASK_FINISHED') { + $('#tm-compile-div').find('pre').hide(); } if (task.statusCode === 'TASK_ERROR') { var $gf = $('#genfailed'); @@ -33,6 +37,18 @@ $gf.append($('<pre>').text(task.data.errors)); } $gf.show('slow'); + slxFileList.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-stop'); + } else { + // Working or finished + if (task.data && task.data.files && task.data.files) { + for (var k in task.data.files) { + if (!task.data.files[k]) + continue; + var f = '#built-' + k.replace('/', '-').replace('.', '-'); + var $e = $(f); + $e.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-ok text-success'); + } + } } } </script> diff --git a/modules-available/serversetup-bwlp/templates/menu-edit.html b/modules-available/serversetup-bwlp/templates/menu-edit.html new file mode 100644 index 00000000..2141103f --- /dev/null +++ b/modules-available/serversetup-bwlp/templates/menu-edit.html @@ -0,0 +1,405 @@ +<h2>{{lang_editMenuHead}}</h2> + +<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="position:absolute;top:-2000px" tabindex="-1"> +<input type="password" name="password_fake" id="password_fake" value="" style="position:absolute;top:-2000px" tabindex="-1"> + +<div class="panel panel-default"> + <div class="panel-heading"> + {{title}} + {{^title}} + {{lang_newMenu}} + {{/title}} + </div> + <div class="panel-body list-group"> + <form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="savemenu"> + <input type="hidden" name="menuid" value="{{menuid}}"> + + <div class="row list-group-item"> + <div class="col-sm-3"> + <label for="panel-title">{{lang_menuTitle}}</label> + </div> + <div class="col-sm-9"> + <input class="form-control" name="title" id="panel-title" type="text" value="{{title}}" {{readonly}}> + </div> + </div> + <div class="row list-group-item"> + <div class="col-sm-3"> + <label for="panel-timeout">{{lang_menuTimeout}}</label> + </div> + <div class="col-sm-9"> + <div class="input-group"> + <input class="form-control" name="timeout" id="panel-timeout" type="number" min="0" max="9999" + value="{{timeout}}" {{readonly}}> + <span class="input-group-addon">{{lang_seconds}}</span> + </div> + </div> + </div> + <div class="row list-group-item"> + <div class="col-sm-3"> + <label for="panel-locations">{{lang_menuLocations}}</label> + </div> + <div class="col-sm-9"> + <select id="panel-locations" multiple name="locations[]"> + {{#locations}} + <option value="{{locationid}}" {{disabled}} {{#selected}}selected{{/selected}}>{{locationpad}} {{locationname}}</option> + {{/locations}} + </select> + {{#globalMenuWarning}} + <span id="global-menu-warning" style="margin-left: 20px; color: red; display: none;">{{lang_globalMenuWarning}}</span> + {{/globalMenuWarning}} + </div> + </div> + <div> + <table class="table"> + <thead> + <tr> + <th style="width: 10px"></th> + <th style="width: 10px"></th> + <th style="width: 10px">{{lang_entryId}}</th> + <th>{{lang_title}}</th> + <th style="width: 150px">{{lang_hotkey}}</th> + <th style="width: 200px">{{lang_password}}</th> + <th style="width: 10px"><span class="glyphicon glyphicon-eye-close"></span></th> + <th style="width: 10px"></th> + </tr> + </thead> + <tbody id="table-body" style="overflow: auto;"> + {{#entries}} + <tr> + <input type="hidden" class="sort-val" name="entry[{{menuentryid}}][sortval]" value="{{sortval}}"> + <input type="hidden" name="entry[{{menuentryid}}][hidden]" value="0"> + <td class="drag-handler" style="cursor: pointer;text-align: center; vertical-align: middle;"> + <span class="glyphicon glyphicon-th-list"></span> + </td> + + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <div class="radio radio-inline no-spacer" style="margin: 0;{{^entryid}}display: none;{{/entryid}}"> + <input type="radio" name="defaultentry" value="{{menuentryid}}" + {{#isdefault}}checked{{/isdefault}} {{perms.ipxe.menu.edit.disabled}} {{disabled}}> + <label></label> + </div> + </td> + + <td class="text-nowrap"> + <input class="entry-id" type="hidden" name="entry[{{menuentryid}}][entryid]" value="{{entryid}}"> + <button type="button" class="btn btn-default" style="width: 100%; text-align: left" {{disabled}} data-toggle="modal" data-target="#entry-chooser-modal"> + {{#entryid}} + {{entryid}} + {{/entryid}} + {{^entryid}} + {{lang_spacer}} + {{/entryid}} + </button> + </td> + <td> + <input class="form-control title" name="entry[{{menuentryid}}][title]" value="{{title}}" + maxlength="100" {{readonly}}> + </td> + + <td> + <select class="form-control key-list no-spacer" {{^entryid}}style="display: none;"{{/entryid}} name="entry[{{menuentryid}}][hotkey]" {{readonly}} data-default="{{hotkey}}"> + </select> + </td> + + <td> + <input class="form-control no-spacer" {{^entryid}}style="display: none;"{{/entryid}} name="entry[{{menuentryid}}][plainpass]" type="{{password_type}}" + value="{{plainpass}}" {{readonly}}> + </td> + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <div class="checkbox checkbox-inline no-spacer" style="text-align: left;margin: 0;{{^entryid}}display: none;{{/entryid}}"> + <input name="entry[{{menuentryid}}][hidden]" value="1" type="checkbox" {{#hidden}}checked{{/hidden}}> + <label></label> + </div> + </td> + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <button type="button" class="btn btn-default remove-button"><span class="glyphicon glyphicon-remove"></span></button> + </td> + </tr> + {{/entries}} + </tbody> + </table> + </div> + <div class="text-right" style="margin-bottom: 20px"> + <button id="add-btn" type="button" class="btn btn-success" {{disabled}}> + <span class="glyphicon glyphicon-plus-sign"></span> + {{lang_add}} + </button> + </div> + <div class="text-right"> + <a href="?do=serversetup&show=menu" type="button" class="btn btn-default">{{lang_cancel}}</a> + <button id="save-button" type="submit" class="btn btn-primary" {{disabled}}> + <span class="glyphicon glyphicon-floppy-disk"></span> + {{lang_save}} + </button> + </div> + </form> + + <div class="modal fade" id="entry-chooser-modal" tabindex="-1" role="dialog"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title">{{lang_entryChooserTitle}}</h5> + </div> + <div class="modal-body"> + <div class="form-group"> + <select id="entry-list" class="form-control"> + <option value="">{{lang_spacer}}</option> + {{#entrylist}} + <option value="{{entryid}}">{{entryid}}</option> + {{/entrylist}} + </select> + </div> + {{#entrylist}} + <div id="entrydata-{{entryid}}" class="entrydata"> + <div class="form-group"> + <label for="{{entryid}}-name">{{lang_entryTitle}}</label> + <pre id="{{entryid}}-name">{{title}}</pre> + </div> + {{#data}} + {{#script}} + <div class="form-group"> + <label for="{{entryid}}-script">{{lang_scriptContent}}</label> + <pre id="{{entryid}}-script">{{.}}</pre> + </div> + {{/script}} + {{^script}} + <div class="form-group"> + <label for="{{entryid}}-script">{{lang_archSelector}}</label> + <pre id="{{entryid}}-arch">{{arch}}</pre> + </div> + {{#archAgnostic}} + <div class="form-group"> + <label for="{{entryid}}-executable">{{lang_imageToLoad}}</label> + <pre id="{{entryid}}-executable">{{executable}}</pre> + </div> + <div class="form-group"> + <label for="{{entryid}}-initRd">{{lang_initRd}}</label> + <pre id="{{entryid}}-initRd">{{initRd}}</pre> + </div> + <div class="form-group"> + <label for="{{entryid}}-commandLine">{{lang_commandLine}}</label> + <pre id="{{entryid}}-commandLine" >{{commandLine}}</pre> + </div> + {{/archAgnostic}} + {{#PCBIOS}} + <div class="panel panel-default"> + <div class="panel-heading">PCBIOS</div> + <div class="panel-body"> + <div class="form-group"> + <label for="{{entryid}}-executable">{{lang_imageToLoad}}</label> + <pre id="{{entryid}}-executable">{{executable}}</pre> + </div> + <div class="form-group"> + <label for="{{entryid}}-initRd">{{lang_initRd}}</label> + <pre id="{{entryid}}-initRd">{{initRd}}</pre> + </div> + <div class="form-group"> + <label for="{{entryid}}-commandLine">{{lang_commandLine}}</label> + <pre id="{{entryid}}-commandLine" >{{commandLine}}</pre> + </div> + </div> + </div> + {{/PCBIOS}} + {{#EFI}} + <div class="panel panel-default"> + <div class="panel-heading">EFI</div> + <div class="panel-body"> + <div class="form-group"> + <label for="{{entryid}}-executable">{{lang_imageToLoad}}</label> + <pre id="{{entryid}}-executable">{{executable}}</pre> + </div> + <div class="form-group"> + <label for="{{entryid}}-initRd">{{lang_initRd}}</label> + <pre id="{{entryid}}-initRd">{{initRd}}</pre> + </div> + <div class="form-group"> + <label for="{{entryid}}-commandLine">{{lang_commandLine}}</label> + <pre id="{{entryid}}-commandLine" >{{commandLine}}</pre> + </div> + </div> + </div> + {{/EFI}} + {{/script}} + {{/data}} + </div> + {{/entrylist}} + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> + <button type="button" class="btn btn-primary" id="choose-entry">{{lang_save}}</button> + </div> + </div> + </div> + </div> + </div> +</div> +<div class="hidden"> + <select id="key-list-template"> + <option value="">{{lang_none}}</option> + {{#keys}} + <option value="{{key}}">{{key}}</option> + {{/keys}} + </select> +</div> +<table class="hidden" id="row-template"> + <tr> + <input type="hidden" class="sort-val" name="entry[%new%][sortval]" value="99999"> + <td class="drag-handler" style="cursor: pointer;text-align: center; vertical-align: middle;"> + <span class="glyphicon glyphicon-th-list"></span> + </td> + + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <div class="radio radio-inline no-spacer" style="margin: 0; display: none;"> + <input type="radio" name="defaultentry" value="%new%"> + <label></label> + </div> + </td> + + <td class="text-nowrap"> + <input class="entry-id" type="hidden" name="entry[%new%][entryid]" value=""> + <button type="button" class="btn btn-default" style="width: 100%; text-align: left" {{disabled}} data-toggle="modal" data-target="#entry-chooser-modal"> + {{lang_spacer}} + </button> + </td> + <td> + <input class="form-control title" data-old="#new#" name="entry[%new%][title]" maxlength="100"> + </td> + <td> + <select class="form-control key-list no-spacer" style="display: none;" name="entry[%new%][hotkey]"> + </select> + </td> + <td> + <input class="form-control no-spacer" style="display: none;" name="entry[%new%][plainpass]" type="{{password_type}}"> + </td> + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <div class="checkbox checkbox-inline no-spacer" style="text-align: left;margin: 0;{{^entryid}}display: none;{{/entryid}}"> + <input name="entry[%new%][hidden]" value="1" type="checkbox"> + <label></label> + </div> + </td> + <td class="slx-smallcol" style="text-align: center; vertical-align: middle;"> + <button type="button" class="btn btn-default remove-button"><span class="glyphicon glyphicon-remove"></span></button> + </td> + </tr> +</table> + +<script type="text/javascript"> + var spacerText = "{{lang_spacer}}"; + + document.addEventListener("DOMContentLoaded", function() { + var locationSelect = $('#panel-locations'); + locationSelect.multiselect({numberDisplayed: 1}); + var globalMenuWarning = $('#global-menu-warning'); + if (globalMenuWarning.length) { + var saveButton = $('#save-button'); + if (locationSelect.val() !== null) { + saveButton.prop('disabled', false); + globalMenuWarning.hide(); + } else { + saveButton.prop('disabled', true); + globalMenuWarning.show(); + } + locationSelect.change(function () { + if ($(this).val() !== null) { + saveButton.prop('disabled', false); + globalMenuWarning.hide(); + } else { + saveButton.prop('disabled', true); + globalMenuWarning.show(); + } + }); + } + + function reassignSortValues() { + var startValue = 1; + $('.sort-val').each(function(index, element) { + element.value = startValue * 10; + startValue++; + }); + } + + $('#table-body').sortable({ + opacity: 0.8, + handle: '.drag-handler', + start: function(evt, ui) { + ui.placeholder.css("visibility", "visible"); + ui.placeholder.css("opacity", "0.152"); + ui.placeholder.css("background-color", "#ddd"); + }, + stop: reassignSortValues + }); + + $('.key-list').each(function() { + $select = $(this); + $source = $('#key-list-template').find('option'); + var def = $select.data('default'); + $select.append($source.clone(true)); + $select.find('option[value="' + def + '"]').attr('selected', true); + }); + var newIndex = 0; + $('#add-btn').click(function() { + var $new = $('#row-template').find('tr').clone(true); + newIndex++; + $('#table-body').append($new); + $new.find('[name]').each(function() { + var $this = $(this); + var val = $this.val(); + var name = $this.attr('name'); + if (name) { + $this.attr('name', name.replace('%new%', 'new-' + newIndex)); + } + if (val) { + $this.val(val.replace('%new%', 'new-' + newIndex)); + } + }); + reassignSortValues(); + }); + + $('.remove-button').click(function() { + $(this).parent().parent().remove(); + reassignSortValues(); + }); + + $('#entry-list').change(function(e) { + var modal = $('#entry-chooser-modal'); + modal.find('.entrydata').hide(); + modal.find('#entrydata-' + $(this).val()).show(); + }); + + var currentEntryButton = null; + + $('#entry-chooser-modal').on('show.bs.modal', function(e) { + currentEntryButton = $(e.relatedTarget); + var entryId = currentEntryButton.parent().find('.entry-id').val(); + $('#entry-list').val(entryId).change(); + }); + + $('#choose-entry').click(function() { + $('#entry-chooser-modal').modal('hide'); + var entryId = $('#entry-list').val(); + currentEntryButton.parent().find('.entry-id').val(entryId); + currentEntryButton.text(entryId || spacerText); + var tableRow = currentEntryButton.parent().parent(); + if (!entryId) { + tableRow.find('.no-spacer').hide(); + tableRow.find('input.no-spacer').val(''); + tableRow.find('div.no-spacer').find('input').prop('checked', false); + + } else { + tableRow.find('.no-spacer').show(); + } + var $title = tableRow.find('.title'); + var oldval = $title.data('old'); + if (oldval === '#stop#') + return; + if (oldval !== '#new#' && oldval !== $title.val()) { + $title.data('old', '#stop#'); + return; + } + var text = $('#' + entryId + '-name').text(); + $title.val(text).data('old', text); + }); + }); +</script>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp/templates/menu-list.html b/modules-available/serversetup-bwlp/templates/menu-list.html new file mode 100644 index 00000000..67365a33 --- /dev/null +++ b/modules-available/serversetup-bwlp/templates/menu-list.html @@ -0,0 +1,91 @@ +<h2>{{lang_listOfMenus}}</h2> + +<table class="table"> + <thead> + <tr> + <th>{{lang_menuTitle}}</th> + <th class="slx-smallcol">{{lang_locationCount}}</th> + <th class="slx-smallcol">{{lang_isDefault}}</th> + <th class="slx-smallcol">{{lang_edit}}</th> + <th class="slx-smallcol">{{lang_delete}}</th> + </tr> + </thead> + <tbody> + {{#menuTable}} + <tr> + <td> + {{title}} + </td> + <td class="text-right"> + {{locationCount}} + </td> + <td align="center"> + {{^isdefault}} + {{#showSetDefault}} + <form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="menuid" value="{{menuid}}"> + <button type="submit" name="action" value="setDefaultMenu" class="btn btn-xs btn-info"> + <span class="glyphicon glyphicon-flag"></span> + </button> + </form> + {{/showSetDefault}} + {{/isdefault}} + {{#isdefault}} + <span class="glyphicon glyphicon-ok"></span> + {{/isdefault}} + </td> + <td align="center"> + {{#allowEdit}} + <a href="?do=serversetup&show=editmenu&id={{menuid}}" class="btn btn-xs btn-primary"> + <span class="glyphicon glyphicon-edit"></span> + </a> + {{/allowEdit}} + </td> + <td align="center"> + {{#allowDelete}} + <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteMenu('{{menuid}}')"> + <span class="glyphicon glyphicon-trash"></span> + </button> + {{/allowDelete}} + </td> + </tr> + {{/menuTable}} + </tbody> +</table> +<div class="pull-right"> + <a href="?do=serversetup&show=editmenu&id=0" class="btn btn-success {{allowAddMenu}}"> + <span class="glyphicon glyphicon-plus"></span> + {{lang_addMenu}} + </a> +</div> + + +<!-- Modals --> +<form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> + </div> + <div class="modal-body"> + <p>{{lang_menuDeleteConfirm}}</p> + </div> + <div class="modal-footer"> + <input type="hidden" id="delete-menu-id" name="deleteid" value=""> + <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> + <button type="submit" name="action" value="deleteMenu" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> + </div> + </div> + </div> + </div> +</form> + +<script> + function deleteMenu(menuid) { + $("#delete-menu-id").val(menuid); + } +</script>
\ No newline at end of file |