5 callFileRead: rpc.declare({
12 callFileWrite: rpc.declare({
15 params: [ 'path', 'data' ]
19 return this.callFileRead('/etc/crontabs/root');
22 handleSave: function(ev) {
23 var value = (document.querySelector('textarea').value || '').trim().replace(/\r\n/g, '\n') + '\n';
25 return this.callFileWrite('/etc/crontabs/root', value).then(function(rc) {
27 throw rpc.getStatusText(rc);
29 document.querySelector('textarea').value = value;
30 L.ui.addNotification(null, E('p', _('Contents have been saved.')), 'info');
32 }).catch(function(e) {
33 L.ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e)));
37 render: function(crontab) {
39 E('h2', _('Scheduled Tasks')),
41 _('This is the system crontab in which scheduled tasks can be defined.') +
42 _('<br/>Note: you need to manually restart the cron service if the crontab file was empty before editing.')),
43 E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 10 }, crontab != null ? crontab : ''))
47 handleSaveApply: null,