diff --git a/web/js/_settings.js b/web/js/_settings.js index 7f7b4cac..a70b181f 100644 --- a/web/js/_settings.js +++ b/web/js/_settings.js @@ -15,6 +15,7 @@ App.Constants.DNS_FORM_ID = 'dns-form'; App.Constants.USER_FORM_ID = 'user-form'; App.Constants.WEB_DOMAIN_FORM_ID = 'web_domain-form'; App.Constants.DB_FORM_ID = 'db-form'; +App.Constants.CRON_FORM_ID = 'cron-form'; App.Settings.ajax_url = 1; App.Settings.uri = location.href.replace('index.html', ''); diff --git a/web/js/actions.js b/web/js/actions.js index 1b2ec115..299093f3 100644 --- a/web/js/actions.js +++ b/web/js/actions.js @@ -135,6 +135,7 @@ App.Actions.cancel_form = function(evt, params) { $('#' + form_id).remove(); } else { + fb.warn(elm.find('.source').val()); var options = App.Helpers.evalJSON(elm.find('.source').val()); var entry_name = App.Env.world.toLowerCase() + '_entry'; var tpl = App.HTML.Build[entry_name](options); diff --git a/web/js/app.js b/web/js/app.js index 8d741dfb..aa7ac706 100644 --- a/web/js/app.js +++ b/web/js/app.js @@ -189,13 +189,15 @@ App.Ajax.request = function(jedi_method, data, callback) type: data.request_method || "POST", data: $.extend(data, {'jedi_method': jedi_method}), dataType: "text", - async:true, + async: true, success: function(reply) { - timer.start(); + reply = reply.replace(/\\'/gi, ''); + reply = reply.replace(/\'/gi, ''); + //timer.start(); callback && callback(jsonParse(reply)); App.Helpers.afterAjax(); - timer.stop(jedi_method); + //timer.stop(jedi_method); }, error: function() { diff --git a/web/js/helpers.js b/web/js/helpers.js index a858fdac..ae620fb9 100644 --- a/web/js/helpers.js +++ b/web/js/helpers.js @@ -123,14 +123,17 @@ App.Helpers.getFirstValue = function(obj) return first; } -App.Helpers.evalJSON = function(string) +App.Helpers.evalJSON = function(str) { - return $.parseJSON(string); + /*str = str.replace(/\\'/gi, ''); + str = str.replace(/\'/gi, ''); + fb.warn(str);*/ + return $.parseJSON(str); } App.Helpers.toJSON = function(object) -{ - return ($.toJSON(object).replace(/'/gi, '')); +{ + return ($.toJSON(object).replace(/\\'/gi, '')); } diff --git a/web/js/html.js b/web/js/html.js index a2cf68bd..7a432eb9 100644 --- a/web/js/html.js +++ b/web/js/html.js @@ -357,6 +357,38 @@ App.HTML.Build.cron_entry = function(o, key) return tpl.finalize(); } + + +App.HTML.Build.cron_form = function(options, id) +{try{ + if('undefined' == typeof App.Env.initialParams) { + return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.'); + } + var tpl = App.Templates.get('FORM', 'cron'); + tpl.set(':source', options); + + options = App.Helpers.evalJSON(options) || {}; + if (App.Helpers.isEmpty(options)) { + tpl.set(':title', 'New cron entry'); + tpl.set(':save_button', 'ADD'); + } + else { + tpl.set(':title', 'Edit cron entry'); + tpl.set(':save_button', 'SAVE'); + } + + options = !App.Helpers.isEmpty(options) ? options : {DAY:'', MONTH: '', WDAY:'',HOUR:'',CMD:'',MIN:''}; + tpl = App.HTML.setTplKeys(tpl, options); + + /*tpl.set(':id', id || ''); + tpl.set(':IP_ADDRESS', options.IP_ADDRESS || ''); + tpl.set(':NETMASK', options.NETMASK || ''); + tpl.set(':NAME', options.NAME || '');*/ + + //tpl = App.HTML.Build.ip_selects(tpl, options); +}catch(e){fb.error(e);} + return tpl.finalize(); +} App.HTML.Build.dns_records = function(records) diff --git a/web/js/templates.js b/web/js/templates.js index 3e1f322d..f9cf32a4 100644 --- a/web/js/templates.js +++ b/web/js/templates.js @@ -44,7 +44,7 @@ App.Templates.html = { dns: { FORM: [ '
\ - \ + \ \
~!:title~!
\
\ @@ -86,8 +86,8 @@ App.Templates.html = { ], ENTRIES_WRAPPER: ['
~!:content~!
'], ENTRY: ['
\ - \ - \ + \ + \
\
\
\ @@ -763,9 +763,66 @@ App.Templates.html = {
'] }, cron: { + FORM: ['
\ + \ + \ +
~!:title~!
\ +
\ +
\ +
\ +
\ +
\ + run at:\ +
\ + \ +
\ + \ +
\ +
\ +
\ + \ +
\ + \ +
\ +
\ +
\ + \ +
\ + \ +
\ +
\ +
\ + \ +
\ + \ +
\ +
\ +
\ + \ +
\ + \ +
\ +
\ +
\ +
\ + \ + \ +
\ +
\ + \ + \ +
\ +
\ + \ + Cancel\ + Help\ +
\ +
'], ENTRIES_WRAPPER: ['
~!:content~!
'], ENTRY: ['
\ -
\ + \ + \ +
\
\
\ ~!:SUSPENDED_TPL~!\