'use strict';
+'require view';
+'require dom';
+'require poll';
'require uci';
'require rpc';
'require fs';
expect: { }
});
-return L.view.extend({
+return view.extend({
callDDnsGetEnv: rpc.declare({
object: 'luci.ddns',
ddns_toggle.innerHTML = status['_enabled'] ? _('Stop DDNS') : _('Start DDNS')
- L.dom.content(ddns_enabled, function() {
+ dom.content(ddns_enabled, function() {
return E([], [
E('div', {}, status['_enabled'] ? _('DDNS Autostart enabled') : [
_('DDNS Autostart disabled'),
E('div', { 'class' : 'cbi-value-description' },
- _("Currently DDNS updates are not started at boot or on interface events.") + "<br>" +
+ _("Currently DDNS updates are not started at boot or on interface events.") + "<br />" +
_("This is the default if you run DDNS scripts by yourself (i.e. via cron with force_interval set to '0')"))
]),]);
});
service_status = '<b>' + _('Running') + '</b> : ' + service[section_id].pid;
}
- cfg_detail_ip.innerHTML = host + '<br>' + ip;
- cfg_update.innerHTML = last_update + '<br>' + next_update;
+ cfg_detail_ip.innerHTML = host + '<br />' + ip;
+ cfg_update.innerHTML = last_update + '<br />' + next_update;
cfg_status.innerHTML = service_status;
}
o.cfgvalue = function() {
var res = status[this.option];
if (!res) {
- this.description = _("Currently DDNS updates are not started at boot or on interface events.") + "<br>" +
+ this.description = _("Currently DDNS updates are not started at boot or on interface events.") + "<br />" +
_("This is the default if you run DDNS scripts by yourself (i.e. via cron with force_interval set to '0')")
}
return res ? _('DDNS Autostart enabled') : _('DDNS Autostart disabled')
};
- o = s.option(form.DummyValue, '_toggle', ' ');
+ o = s.option(form.DummyValue, '_toggle', ' ');
o.cfgvalue = function() {
var action = status['_enabled'] ? 'stop' : 'start';
return E([], [
}, _(action.toUpperCase() + ' DDns'))]);
};
- o = s.option(form.DummyValue, '_restart', ' ');
+ o = s.option(form.DummyValue, '_restart', ' ');
o.cfgvalue = function() {
return E([], [
E('button', {
o = s.option(form.DummyValue, '_no_ipv6');
o.rawhtml = true;
o.title = '<b>' + _("IPv6 not supported") + '</b>';
- o.cfgvalue = function() { return _("IPv6 is currently not (fully) supported by this system") + "<br>" +
- _("Please follow the instructions on OpenWrt's homepage to enable IPv6 support") + "<br>" +
+ o.cfgvalue = function() { return _("IPv6 is currently not (fully) supported by this system") + "<br />" +
+ _("Please follow the instructions on OpenWrt's homepage to enable IPv6 support") + "<br />" +
_("or update your system to the latest OpenWrt Release")};
}
(resolved[section_id].pid && cfg_enabled == '1'))
stop_opt['disabled'] = 'disabled';
- L.dom.content(tdEl.lastChild, [
+ dom.content(tdEl.lastChild, [
E('button', stop_opt, _('Stop')),
E('button', reload_opt, _('Reload')),
tdEl.lastChild.childNodes[0],
return '<b>' + section_id + '</b>';
}
- o = s.option(form.DummyValue, '_cfg_detail_ip', _('Lookup Hostname') + "<br>" + _('Registered IP'));
+ o = s.option(form.DummyValue, '_cfg_detail_ip', _('Lookup Hostname') + "<br />" + _('Registered IP'));
o.rawhtml = true;
o.modalonly = false;
o.textvalue = function(section_id) {
if (resolved[section_id] && resolved[section_id].ip)
ip = resolved[section_id].ip;
- return host + '<br>' + ip;
+ return host + '<br />' + ip;
};
o = s.option(form.Flag, 'enabled', _('Enabled'));
o.editable = true;
o.modalonly = false;
- o = s.option(form.DummyValue, '_cfg_update', _('Last Update') + "<br>" + _('Next Update'));
+ o = s.option(form.DummyValue, '_cfg_update', _('Last Update') + "<br />" + _('Next Update'));
o.rawhtml = true;
o.modalonly = false;
o.textvalue = function(section_id) {
next_update = NextUpdateStrings[resolved[section_id].next_update] || resolved[section_id].next_update;
}
- return last_update + '<br>' + next_update;
+ return last_update + '<br />' + next_update;
};
s.modaltitle = function(section_id) {
o.value('-',"-- " + _("custom") + " --");
o.cfgvalue = function(section_id) {
- return uci.get('ddns', section_id, 'service_name');
+ var service = uci.get('ddns', section_id, 'service_name'),
+ update_script = uci.get('ddns', section_id, 'update_script'),
+ update_url = uci.get('ddns', section_id, 'update_url');
+
+ if (!service && (update_script || update_url))
+ return "-";
+
+ return service;
}
o.write = function(section_id, formvalue) {
_("Update URL to be used for updating your DDNS Provider." + "<br />" +
"Follow instructions you will find on their WEB page."));
o.modalonly = true;
- o.rmempty = false;
+ o.rmempty = true;
+ o.optional = true;
o.depends("ipv6_service_name","-");
o.depends("ipv4_service_name","-");
+ o.validate = function(section_id, value) {
+ var other = this.section.children.filter(function(o) { return o.option == 'update_script' })[0].formvalue(section_id);
+
+ if ((value == "" && other == "") || (value != "" && other != "")) {
+ return _("Insert a Update Script OR a Update URL");
+ }
+
+ return true;
+ }
+
// update_script
o = s.taboption('basic', form.Value, 'update_script', _("Custom update-script"),
_("Custom update script to be used for updating your DDNS Provider."));
o.modalonly = true;
- o.rmempty = false;
+ o.rmempty = true;
+ o.optional = true;
o.depends("ipv6_service_name","-");
o.depends("ipv4_service_name","-");
+ o.validate = function(section_id, value) {
+ var other = this.section.children.filter(function(o) { return o.option == 'update_url' })[0].formvalue(section_id);
+
+ if ((value == "" && other == "") || (value != "" && other != "")) {
+ return _("Insert a Update Script OR a Update URL");
+ }
+
+ return true;
+ }
+
// domain
o = s.taboption('basic', form.Value, 'domain', _("Domain"),
o = s.taboption('basic', form.Value, 'cacert',
_("Path to CA-Certificate"),
- _("directory or path/file") + "<br>" +
+ _("directory or path/file") + "<br />" +
_("or") + '<b>' + " IGNORE " + '</b>' +
_("to run HTTPS without verification of server certificates (insecure)"));
o.modalonly = true;
// ip_url
o = s.taboption('advanced', form.Value, 'ip_url', _("URL to detect"),
- _("Defines the Web page to read systems IP-Address from" + '<br>' +
- _('Example for IPv4' + ': http://checkip.dyndns.com') + '<br>' +
+ _("Defines the Web page to read systems IP-Address from" + '<br />' +
+ _('Example for IPv4' + ': http://checkip.dyndns.com') + '<br />' +
_('Example for IPv6' + ': http://checkipv6.dyndns.com')));
o.depends("ip_source", "web")
if (env['has_bindnet']) {
o = s.taboption('advanced', widgets.ZoneSelect, 'bind_network', _("Bind Network"),
- _('OPTIONAL: Network to use for communication') + '<br>' +
+ _('OPTIONAL: Network to use for communication') + '<br />' +
_("Network on which the ddns-updater scripts will be started"));
o.depends("ip_source", "web");
o.optional = true;
o.optional = true;
o.modalonly = true;
o.cfgvalue = function(section_id) {
- this.description = _("Writes detailed messages to log file. File will be truncated automatically.") + "<br>" +
+ this.description = _("Writes detailed messages to log file. File will be truncated automatically.") + "<br />" +
_("File") + ': "' + logdir + '/' + section_id + '.log"';
return uci.get('ddns', section_id, 'use_logfile');
};
o.default = "minutes"
o.value("minutes", _("minutes"));
o.value("hours", _("hours"));
- o.value("hours", _("days"));
+ o.value("days", _("days"));
// retry_count
o.modalonly = true;
o.update_log = L.bind(function(view, log_data) {
- return document.getElementById('log_area').innerHTML = log_data.result;
+ return document.getElementById('log_area').textContent = log_data.result;
}, o, this)
o.render = L.bind(function() {
o = s.option(form.Value, 'ddns_dateformat', _('Date format'));
o.description = '<a href="http://www.cplusplus.com/reference/ctime/strftime/" target="_blank">'
+ _("For supported codes look here")
- + '</a><br>' +
+ + '</a><br />' +
_('Current setting: ') + '<b>' + status['_curr_dateformat'] + '</b>';
o.default = "%F %R"
o.optional = true;
}
return m.render().then(L.bind(function(m, nodes) {
- L.Poll.add(L.bind(function() {
+ poll.add(L.bind(function() {
return Promise.all([
this.callDDnsGetServicesStatus(),
callDDnsGetStatus()