2 title: L.tr('Startup'),
5 var redraw = function() { return self.execute(); };
6 var allow_write = self.options.acls.startup;
9 L.system.initList().then(function(list) {
10 /* filter init scripts with no start prio */
11 for (var i = 0; i < list.length; i++)
13 if (typeof(list[i].start) != 'undefined')
19 var initTable = new L.ui.table({
21 caption: L.tr('Start priority'),
24 caption: L.tr('Initscript'),
28 caption: L.trc('Init script table heading', 'Enable'),
30 format: function(v, n) {
31 return $('<button />')
32 .attr('disabled', !allow_write)
33 .attr('name', list[n].name)
34 .addClass('cbi-button')
35 .addClass(v ? 'cbi-button-apply' : 'cbi-button-reset')
36 .text(v ? L.trc('Init script state', 'Enabled') : L.trc('Init script state', 'Disabled'))
40 L.system.initDisable(this.getAttribute('name')).then(redraw);
42 L.system.initEnable(this.getAttribute('name')).then(redraw);
46 caption: L.trc('Init script table heading', 'Restart'),
48 format: function(v, n) {
49 return $('<button />')
50 .attr('disabled', !allow_write)
51 .attr('name', list[n].name)
52 .addClass('cbi-button')
53 .addClass('cbi-button-reload')
54 .text(L.trc('Init script action', 'Restart'))
57 L.system.initRestart(this.getAttribute('name')).then(redraw)
61 caption: L.trc('Init script table heading', 'Stop'),
63 format: function(v, n) {
64 return $('<button />')
65 .attr('disabled', !allow_write)
66 .attr('name', list[n].name)
67 .addClass('cbi-button')
68 .addClass('cbi-button-remove')
69 .text(L.trc('Init script action', 'Stop'))
72 L.system.initStop(this.getAttribute('name')).then(redraw)
79 initTable.insertInto('#init_table');
83 L.system.getRcLocal().then(function(data) {
84 $('#maps').accordion({ heightStyle: 'content' });
86 $('textarea').val(data).attr('disabled', !allow_write);
87 $('input.cbi-button-save').attr('disabled', !allow_write).click(function() {
88 var data = ($('textarea').val() || '').replace(/\r/g, '').replace(/\n?$/, '\n');
90 L.system.setRcLocal(data).then(function() {
91 $('textarea').val(data);