diff --git a/web/css/main.css b/web/css/main.css index 7ac06a0a..779f87c7 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -3,7 +3,7 @@ Title : Vesta Author : Eugen Lobicov, eugen.lobicov@gmail.com created : November 27, 2009 -last updated : March 14, 2011 +last updated : July 10, 2011 - - - - - - - - - - - - - - - - - - */ html{ @@ -23,12 +23,8 @@ body{ border:1px solid red; border:solid #a9aa98; border-width:0 2px; -/* padding:0 0 0 10px; - background:url(../images/bg-left.gif) repeat-y;*/ } .outer{ -/* padding:0 10px 0 0; - background:url(../images/bg-right.gif) repeat-y 100% 0;*/ padding-bottom:58px; background:#fff url(../images/footer-bg.gif) repeat-x 0 100%; } @@ -1076,6 +1072,11 @@ input::-moz-focus-inner{ font-size:12px; color:#777; } + .prop-value-collapsed-childs{ + padding-right:15px; + background:url(../images/group-values-collapsed.png) no-repeat 100% 5px; + cursor:pointer; + } .show-records{ display:inline-block; padding-right:15px; @@ -1094,6 +1095,36 @@ input::-moz-focus-inner{ line-height:13px; cursor:pointer; } + + .prop-box_group-values{ + display:block; + } + .prop-box_group-values .prop-title{ + float: left; + margin:2px 0 0; + } + .prop-box_group-values .group-values{ + float:left; + margin-left:3px; + } + .group-values .prop-value{ + display:block; + } + .group-values__bullet .prop-value{ + padding-left:15px; + background:url(../images/group-value-bullet.png) no-repeat 5px 8px; + } + .group-values .group-switcher{ + padding-right:15px; + background:url(../images/group-values-collapsed.png) no-repeat 100% 4px; + } + .group-values .group-values-count{ + font-size:12px; + font-style:italic; + color:#cdcdcd; + border-bottom:1px solid #c9cac4; + cursor:pointer; + } .props-additional .owner-box{ padding-left:45px; @@ -1257,7 +1288,10 @@ input::-moz-focus-inner{ margin:0 20px 0 0; width:230px; cursor:pointer; - } + } + .b-new-entry_dns .ttl-field{ + width:75px; + } .generate-pwd, .context-settings{ position:relative; @@ -1600,11 +1634,7 @@ input::-moz-focus-inner{ .domains-list .ip-adr-box .prop-box{ margin-left:20px; } -/* .domains-list .ip-adr-box .prop-value{ - padding:0; - cursor:pointer; - border-bottom:1px solid #cbcbbf; - } */ + .domains-list .props-additional{ width:230px; padding-top:0; @@ -1676,6 +1706,107 @@ input::-moz-focus-inner{ background-color:#9fec00; } +/* New graphs */ +.stats-box{ + position:relative; + margin-left:-25px; + padding-left:25px; + background:url(../images/stats-brace.png) no-repeat 0 50%; + } + .stats-box-title{ + position:absolute; + top:50%; + left:-65px; + margin-top:-10px; + padding-right:25px; + text-transform:uppercase; + font-size:9px; + line-height:12px; + background:url(../images/stats-curve.png) no-repeat 100% 50%; + color:#acacac; + border-bottom:1px solid #acacac; + } +.b-usage-box2{ + display:block; + margin:0 0 22px; + position:relative; + } + .b-usage-box2 .prop-title{ + float:left; + margin:2px 15px 0 0; + } + .b-usage-box2 .usage-box{ + float:left; + } + .b-usage-box2 .value-box{ + padding-top:11px; + float:left; + width:85px; + } + .b-usage-box2 .max-size{ + position:relative; + top:11px; + float:right; + padding:7px 0 0 3px; + border-left:1px solid #B7B7B9; + font-size:10px; + line-height:1; + color:#acacac; + } + .b-usage-box2 .max-size .units{ + font-size:10px; + color:#acacac; + } + .b-usage-box2 .graph{ + position:relative; + border:solid #b7b7b9; + border-width:1px 0 1px 1px; + font-size:0; + line-height:0; + } + .b-usage-box2 .value{ + position:absolute; + top:-15px; + left:0; + z-index:10; + display:block; + white-space:nowrap; + padding:0 0 7px 3px; + font-size:11px; + line-height:1; + background:url(../images/bar-value-mark.png) no-repeat 0 100%; + color:#797979; + } + .b-usage-box2 .value-size{ + padding-left:3px; + } + .b-usage-box2 .graph .bar{ + position:relative; + display:block; + height:2px; + background-color:#9fec00; + } + + /* Overdraft */ + .b-usage-box2 .overdraft{} + + .b-usage-box2 .overdraft .value{ + margin-left:-1px; + color:#F00; + } + + .b-usage-box2 .bar_overdraft{ + position:absolute; + top:-1px; + z-index:5; + display:block; + height:2px; + border:solid #b7b7b9; + border-width:1px 0; + background:#ff9934 url(../images/overrun-border.png) no-repeat 100% 0; + } + + .domains-list .disk-usage{ margin:0 0 6px; } @@ -1829,7 +1960,7 @@ input::-moz-focus-inner{ padding:0 3px 0 0; } -/* Cron list +/* Users list - - - - - - - - - - - - - - - - - - - */ .users-list{} @@ -1841,9 +1972,11 @@ input::-moz-focus-inner{ } .users-list .props-main{ width:345px; + width:330px; } .users-list .username-box{ padding-top:6px; + margin:0 0 15px; } .users-list .username-box .user{ position:relative; @@ -1866,6 +1999,7 @@ input::-moz-focus-inner{ .users-list .props-additional{ width:200px; + width:225px; } .users-list .props-additional .prop-box, .users-list .props-ext .prop-box{ @@ -1875,23 +2009,34 @@ input::-moz-focus-inner{ .users-list .props-additional .ns2-box{ padding-left:27px; } +/* .users-list .ns-list-box{ + padding-left:40px; + }*/ + .users-list .ns-list-box .group-switcher{ + padding-left:15px; + } .users-list .props-additional .ns1-box .prop-title, .users-list .props-additional .ns2-box .prop-title{ display: inline; float: left; - margin: 2px 0 0 -27px; - } + margin: 2px 0 0 -27px; + } .users-list .props-additional .ns1-box .prop-value, .users-list .props-additional .ns2-box .prop-value{ padding:0; } .users-list .props-ext{ - width:200px; + width:190px; } + + .users-list .db-box, + .users-list .dnsdomains-box{ + margin-top:35px; + } + .username-box .prop-box{ position:relative; -/* top:6px;*/ margin:0; } .user-details{ @@ -1904,6 +2049,14 @@ input::-moz-focus-inner{ .user-details .user-reports{ color:#9c9c9c; } + .user-details-box .prop-box{ + margin:0 0 5px; + } + .user-details-box .user-name .prop-value, + .user-details-box .user-email{ + font-style:italic; + color:#706f6b; + } /* DB list - - - - - - - - - - - - - - - - - - - */ @@ -2261,4 +2414,17 @@ input::-moz-focus-inner{ .users-list .suspended-row .username-box .nickname:active, .users-list .suspended-row .user-backups-box .prop-title:active{ color:#ccc; -} \ No newline at end of file +} + + +select{ + background-color: white; + width:265px; + margin:0; + padding:6px 7px; + border:2px solid #b8c2c3; + color:#555; + font-family:Arial, Helvetica, sans-serif; + font-size:14px; + font-weight:bold; +} diff --git a/web/js/__init__.js b/web/js/__init__.js index e4c133cb..655eee05 100644 --- a/web/js/__init__.js +++ b/web/js/__init__.js @@ -1,17 +1,15 @@ $(document).ready(function(){ try{ App.Utils.detectBrowser(); - - App.Env.world = 'USER'; + App.Env.world = 'CRON'; App.Pages.init(); - App.Ref.init(); - + //App.View.start(); App.Core.listen(); App.Core.initMenu(); App.Helpers.liveValidate(); - + }catch(e){ fb.error(e); } diff --git a/web/js/_settings.js b/web/js/_settings.js index 2f14e033..7f7b4cac 100644 --- a/web/js/_settings.js +++ b/web/js/_settings.js @@ -3,16 +3,18 @@ App.i18n.EN = {}; App.i18n.EN.incorrect_ip = 'Incorrect ip'; App.i18n.EN.confirm = 'Are you sure?'; App.i18n.getMessage = function(key) -{ +{ return 'undefined' != typeof App.i18n[App.Env.lang][key] ? App.i18n[App.Env.lang][key] : ''; } // Constants -App.Constants.IP_FORM_ID = 'ip-form'; -App.Constants.DNS_FORM_ID = 'dns-form'; -App.Constants.USER_FORM_ID = 'user-form'; +App.Constants.IP_FORM_ID = 'ip-form'; +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.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 314d8dbc..1b2ec115 100644 --- a/web/js/actions.js +++ b/web/js/actions.js @@ -104,14 +104,9 @@ App.Actions.save_form = function(evt) { var source = $(elm).find('.source').val(); var values = App.Helpers.getFormValues(elm); if(App.Validate.form(values, $('#'+elm_id))) { - App.Model.add(values, source); - //var form_id = App.Constants[App.Env.world + '_FORM_ID']; - //$('#'+form_id).remove(); + App.Model.add(values, source); App.Model.update(values, source, elm); - } - /*if(App.Validate.form(values, $('#'+elm_id))) { - App.Model.update(values, source); - }*/ + } } } @@ -148,6 +143,16 @@ App.Actions.cancel_form = function(evt, params) { App.Helpers.updateScreen(); } +App.Actions.suspend = function(evt) +{ + alert('Suspend?'); +} + +App.Actions.unsuspend = function(evt) +{ + alert('Unsuspend?'); +} + // do_action_form_help App.Actions.showFormHelp = function(evt) { var tpl_name = App.Env.world + '_form'; @@ -188,3 +193,39 @@ App.Actions.generate_pass = function() { $('.password').val(App.Helpers.generatePassword()); } + +App.Actions.toggle_section = function(evt) +{ + var elm = $(evt.target); + var ref = $(elm).parents('.form-options-group:first'); + fb.log(ref); + if ($('.sub_section:first', ref).hasClass('hidden')) { + $('.sub_section:first', ref).removeClass('hidden'); + $('.group-header:first', ref).removeClass('collapsed').addClass('expanded'); + } + else { + $('.sub_section:first', ref).addClass('hidden'); + $('.group-header:first', ref).removeClass('expanded').addClass('collapsed'); + } +} + +App.Actions.close_inner_popup = function(evt) +{ + App.Helpers.closeInnerPopup(); +} + +App.Actions.open_inner_popup = function(evt) +{ + var elm = $(evt.target); + App.Helpers.openInnerPopup(elm, $(elm).next('.inner-popup-html').val()); +} + +App.Actions.add_db_user = function(evt) +{ + alert('TODO'); +} + +App.Actions.backup_db = function(evt) +{ + alert('TODO'); +} diff --git a/web/js/helpers.js b/web/js/helpers.js index 529cb27c..a858fdac 100644 --- a/web/js/helpers.js +++ b/web/js/helpers.js @@ -1,3 +1,44 @@ + + +App.Helpers.getMbHumanMeasure = function(val) +{ + return App.Helpers.getMbHuman(val, true); +} + +/** + * Currently no bytes are used, minimal value is in MB + * uncomment in case we will use bytes instead + */ +App.Helpers.getMbHuman = function(val, only_measure) +{ + var bytes = val * 1024 * 1024; + var kilobyte = 1024; + var megabyte = kilobyte * 1024; + var gigabyte = megabyte * 1024; + var terabyte = gigabyte * 1024; + var precision = 0; + + /*if ((bytes >= 0) && (bytes < kilobyte)) { + return bytes + ' B'; + + } else if ((bytes >= kilobyte) && (bytes < megabyte)) { + return (bytes / kilobyte).toFixed(precision) + ' KB'; + + } else */ + if ((bytes >= megabyte) && (bytes < gigabyte)) { + return only_measure ? 'MB' : (bytes / megabyte).toFixed(precision); + + } else if ((bytes >= gigabyte) && (bytes < terabyte)) { + return only_measure ? 'GB' : (bytes / gigabyte).toFixed(precision); + + } else if (bytes >= terabyte) { + return only_measure ? 'TB' : (bytes / terabyte).toFixed(precision); + + } else { + return only_measure ? 'MB' : bytes; + } +} + App.Helpers.getFirst = function(obj) { try{ // TODO: remove try / catch @@ -101,22 +142,6 @@ App.Helpers.showConsoleHint = function() // TODO: } - -// UTILS -App.Utils.generatePasswordHash = function(length) -{ - var length = length || 11; - var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!~."; - var pass = ""; - for(var x=0;x.')); tpl.set(':CHECKED', ''); @@ -194,35 +162,39 @@ App.HTML.Build.dns_entry = function(o, is_new) var now = new Date(); tpl.set(':DATE', now.format("d.mm.yyyy")); } - + if (App.Constants.SUSPENDED_YES == o.SUSPEND) { - var sub_tpl = App.Templates.get('SUSPENDED_TPL_ENABLED', 'dns'); + var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general'); } else { - var sub_tpl = App.Templates.get('SUSPENDED_TPL_DISABLED', 'dns'); + var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general'); } - + tpl.set(':SUSPENDED_TPL', sub_tpl.finalize()); - + return tpl.finalize(); } App.HTML.Build.user_entry = function(o, key) { var processed_data = { - 'NICKNAME': key, - 'BANDWIDTH_PERCENTS': 90, - 'U_DISK_PERCENTS': 80 + 'NICKNAME' : key, + 'U_DISK_PERCENTAGE' : o.U_DISK > 0 ? o.U_DISK / o.DISK_QUOTA * 100 : 0.01, + 'U_BANDWIDTH_PERCENTAGE': o.U_BANDWIDTH > 0 ? o.U_BANDWIDTH / o.BANDWIDTH * 100 : 0.01, + 'DISK_QUOTA_MEASURE' : App.Helpers.getMbHumanMeasure(o.DISK_QUOTA), + 'BANDWIDTH_MEASURE' : App.Helpers.getMbHumanMeasure(o.BANDWIDTH), + 'BANDWIDTH' : App.Helpers.getMbHuman(o.BANDWIDTH), + 'DISK_QUOTA' : App.Helpers.getMbHuman(o.DISK_QUOTA) }; var o = $.extend(o, processed_data); var tpl = App.Templates.get('ENTRY', 'user'); tpl = App.HTML.setTplKeys(tpl, o); if (App.Constants.SUSPENDED_YES == o.SUSPENDED) { - var sub_tpl = App.Templates.get('SUSPENDED_TPL_ENABLED', 'ip'); + var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general'); } else { - var sub_tpl = App.Templates.get('SUSPENDED_TPL_DISABLED', 'ip'); + var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general'); } tpl.set(':SUSPENDED_TPL', sub_tpl.finalize()); @@ -258,27 +230,47 @@ App.HTML.Build.user_form = function(options, id) App.HTML.Build.web_domain_entry = function(o, key) { - // TODO: - /*~!:ALIAS~!,\ - naumov-socolov.org.md,\ - naumov-socolov.to\*/ var processed_data = { DOMAIN: key }; var o = $.extend(o, processed_data); - //fb.info(o); var tpl = App.Templates.get('ENTRY', 'web_domain'); tpl = App.HTML.setTplKeys(tpl, o); - /*if (App.Constants.SUSPENDED_YES == o.SUSPENDED) { - var sub_tpl = App.Templates.get('SUSPENDED_TPL_ENABLED', 'ip'); + if (App.Constants.SUSPENDED_YES == o.SUSPENDED) { + var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general'); } else { - var sub_tpl = App.Templates.get('SUSPENDED_TPL_DISABLED', 'ip'); + var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general'); + } + tpl.set(':SUSPENDED_TPL', sub_tpl.finalize()); + + return tpl.finalize(); +} + +App.HTML.Build.web_domain_form = function(options, id) +{ + 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', 'web_domain'); + tpl.set(':source', options); + tpl.set(':id', id || ''); + options = App.Helpers.evalJSON(options) || {}; + if (App.Helpers.isEmpty(options)) { + tpl.set(':title', 'New user'); + tpl.set(':save_button', 'ADD'); + } + else { + tpl.set(':title', 'Edit user'); + tpl.set(':save_button', 'SAVE'); } - tpl.set(':SUSPENDED_TPL', sub_tpl.finalize()); - */ + options = !App.Helpers.isEmpty(options) ? options : {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','NS':''}; + + tpl = App.HTML.setTplKeys(tpl, options, true); + tpl = App.HTML.Build.user_selects(tpl, options); + return tpl.finalize(); } @@ -295,17 +287,57 @@ App.HTML.Build.mail_entry = function(o, key) } App.HTML.Build.db_entry = function(o, key) -{ +{ + var user_list_html = []; + $(o['USERS']).each(function(i, o) + { + var tpl = App.Templates.get('USER_ITEM', 'db'); + tpl.set(':NAME', o); + user_list_html.push(tpl.finalize()); + }); + var wrapper = App.Templates.get('USER_ITEMS_WRAPPER', 'db'); + wrapper.set(':CONTENT', user_list_html.done()); var processed_data = { - DOMAIN: key + 'USER_LIST': wrapper.finalize(), + 'USERS': o['USERS'].length || 0, + 'U_DISK_PERCENTAGE' : o.U_DISK > 0 ? o.U_DISK / o.DISK * 100 : 0.01, + 'DISK_MEASURE': App.Helpers.getMbHumanMeasure(o.DISK), + 'DISK': App.Helpers.getMbHuman(o.DISK) }; var o = $.extend(o, processed_data); + var tpl = App.Templates.get('ENTRY', 'db'); tpl = App.HTML.setTplKeys(tpl, o); return tpl.finalize(); } +App.HTML.Build.db_form = function(options, id) +{ + 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', 'db'); + tpl.set(':source', options); + tpl.set(':id', id || ''); + options = App.Helpers.evalJSON(options) || {}; + if (App.Helpers.isEmpty(options)) { + tpl.set(':title', 'New database'); + tpl.set(':save_button', 'ADD'); + } + else { + tpl.set(':title', 'Edit database "'+options.DB+'"'); + tpl.set(':save_button', 'SAVE'); + } + + options = !App.Helpers.isEmpty(options) ? options : {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''}; + + tpl = App.HTML.setTplKeys(tpl, options, true); + tpl = App.HTML.Build.db_selects(tpl, options); + + return tpl.finalize(); +} + App.HTML.Build.cron_entry = function(o, key) { var processed_data = { @@ -313,7 +345,15 @@ App.HTML.Build.cron_entry = function(o, key) }; var o = $.extend(o, processed_data); var tpl = App.Templates.get('ENTRY', 'cron'); - tpl = App.HTML.setTplKeys(tpl, o); + tpl = App.HTML.setTplKeys(tpl, o); + + if (App.Constants.SUSPENDED_YES == o.SUSPENDED) { + var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general'); + } + else { + var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general'); + } + tpl.set(':SUSPENDED_TPL', sub_tpl.finalize()); return tpl.finalize(); } @@ -354,6 +394,7 @@ App.HTML.Build.user_selects = function(tpl, options) var tpl = App.Templates.get('select_option', 'general'); tpl.set(':VALUE', val); tpl.set(':TEXT', pkg[val]); + tpl.set(':SELECTED', val == options.PACKAGE ? 'selected="selected"' : ''); acc[acc.length++] = tpl.finalize(); }); tpl.set(':PACKAGE_OPTIONS', acc.done()); @@ -365,6 +406,7 @@ App.HTML.Build.user_selects = function(tpl, options) var tpl = App.Templates.get('select_option', 'general'); tpl.set(':VALUE', val); tpl.set(':TEXT', roles[val]); + tpl.set(':SELECTED', val == options.ROLE ? 'selected="selected"' : ''); acc[acc.length++] = tpl.finalize(); }); tpl.set(':ROLE_OPTIONS', acc.done()); @@ -376,6 +418,7 @@ App.HTML.Build.user_selects = function(tpl, options) var tpl = App.Templates.get('select_option', 'general'); tpl.set(':VALUE', val); tpl.set(':TEXT', shell[val]); + tpl.set(':SELECTED', val == options.SHELL ? 'selected="selected"' : ''); acc[acc.length++] = tpl.finalize(); }); tpl.set(':SHELL_OPTIONS', acc.done()); @@ -383,3 +426,70 @@ App.HTML.Build.user_selects = function(tpl, options) return tpl; } +App.HTML.Build.db_selects = function(tpl, options) +{ + var acc = []; + // PACKAGE + var items = App.Env.initialParams.DB.TYPE; + $.each(items, function(val) + { + var tpl = App.Templates.get('select_option', 'general'); + tpl.set(':VALUE', val); + tpl.set(':TEXT', items[val]); + tpl.set(':SELECTED', val == options.TYPE ? 'selected="selected"' : ''); + acc[acc.length++] = tpl.finalize(); + }); + tpl.set(':TYPE_OPTIONS', acc.done()); + // ROLE + acc = []; + var items = App.Env.initialParams.DB.HOST; + $.each(items, function(val) + { + var tpl = App.Templates.get('select_option', 'general'); + tpl.set(':VALUE', val); + tpl.set(':TEXT', items[val]); + tpl.set(':SELECTED', val == options.HOST ? 'selected="selected"' : ''); + acc[acc.length++] = tpl.finalize(); + }); + tpl.set(':HOST_OPTIONS', acc.done()); + + return tpl; +} + +App.HTML.Build.ip_selects = function(tpl, options) +{ + // OWNER + var users = App.Env.initialParams.IP.SYS_USERS || ['Skid']; + var opts = App.HTML.Build.options(users, options.OWNER); + tpl.set(':owner_options', opts); + + // STATUS + var opts = App.HTML.Build.options(App.Env.initialParams.IP.STATUSES, options.STATUS); + tpl.set(':status_options', opts); + + // INTERFACE + var opts = App.HTML.Build.options(App.Env.initialParams.IP.INTERFACES, options.INTERFACE); + tpl.set(':interface_options', opts); + + return tpl; +} + +App.HTML.Build.dns_selects = function(tpl, options) +{ + try { + // TPL + var obj = App.Env.initialParams.DNS.TPL; + var opts = App.HTML.Build.options(obj, options.TPL); + tpl.set(':TPL', opts); + tpl.set(':TPL_DEFAULT_VALUE', options.TPL || App.Helpers.getFirstKey(obj)); + } + catch (e) { + return ''; + } + + return tpl; +} + + + + diff --git a/web/js/model.js b/web/js/model.js index b68caed4..cc1cf46c 100644 --- a/web/js/model.js +++ b/web/js/model.js @@ -20,12 +20,40 @@ App.Model.WEB_DOMAIN.loadList = function() App.Model.MAIL.loadList = function() { - App.Ajax.request('MAIL.getList', {}, App.View.listItems); + //App.Ajax.request('MAIL.getList', {}, App.View.listItems); + App.Ref.CONTENT.html('

Under maintanance

'); } App.Model.DB.loadList = function() { - App.Ajax.request('DB.getList', {}, App.View.listItems); + App.Ajax.request('DB.getList', {}, function(reply) + { + var acc = []; + var build_method = App.Env.getWorldName() + '_entry'; + var data = reply.data; + // TODO: fix it data.data + $.each(data, function(key) + { + var db_list = data[key]; + fb.warn('KEY: %o', key); + fb.warn('DATA: %o', data[key]); + var tpl_divider = App.Templates.get('DIVIDER', 'db'); + tpl_divider.set(':TYPE', key); + acc[acc.length++] = tpl_divider.finalize(); + $(db_list).each(function(i, o) + { + acc[acc.length++] = App.HTML.Build[build_method](o, key); + }); + + /*var o = data[key]; + fb.warn(key); + acc[acc.length++] = App.HTML.Build[build_method](o, key);*/ + }); + + var html = acc.done().wrapperize('ENTRIES_WRAPPER', App.Env.getWorldName()); + App.Ref.CONTENT.html(html); + App.Helpers.updateScreen(); + }); } App.Model.CRON.loadList = function() @@ -71,7 +99,7 @@ App.Model.remove = function(world, elm) } App.Model.update = function(values, source_json, elm) -{ alert(source_json); +{ var method = App.Settings.getMethodName('update'); var build_method = App.Env.getWorldName() + '_entry'; App.Ajax.request(method, { diff --git a/web/js/templates.js b/web/js/templates.js index 4f36cf63..3e1f322d 100644 --- a/web/js/templates.js +++ b/web/js/templates.js @@ -16,13 +16,23 @@ App.Templates.html = { "Well," the farmer said, "I didn\'t have anymore rope, so I took off my belt and tied her tail to the rafter. In that moment, my pants fell down and my wife walked in ... Some things you just can\'t explain."'] }, general: { - loading: ['
\ + loading: ['
\
Loading...
\
'], popup: ['\ '], + inner_popup: ['
\ +
\ + ×\ +
\ + ~!:CONTENT~!\ +
\ +
\ +
'], select_option: [''], - error_elm: ['
~!:ERROR~!
'] + error_elm: ['
~!:ERROR~!
'], + SUSPENDED_TPL_NOT_SUSPENDED : ['enabled'], + SUSPENDED_TPL_SUSPENDED : ['disabled'] }, popup: { error: ['

Important: An Error Has Occured.


    Something went wrong and some of your actions can be not saved in system. Mostly, it happens when you have network connection errors.
,    However, please notify us about the situation. It would be helpfull if you will write us approximate time the error occured and last actions you were performing. You send your petition on this email: BLABLA,

Sorry for inconvinience. (We recommend you to reload the page)
'] @@ -70,13 +80,10 @@ App.Templates.html = {
\ \ Cancel\ - Help\ + Help\
\
' - ], - SUSPENDED_TPL_ENABLED : ['enabled\ - delete'], - SUSPENDED_TPL_DISABLED : ['suspended'], + ], ENTRIES_WRAPPER: ['
~!:content~!
'], ENTRY: ['
\ \ @@ -162,35 +169,35 @@ App.Templates.html = { FORM: ['\
\ \ + \
~!:title~!
\ -
\ -
\ +
\ +
\
\ \ \
\
\ \ - vesta\ - \ ~!:owner_options~!\ \
\
\ \ - shared\ - \ ~!:status_options~!\ \
\
\ \ - \ + \
\
\ \ - eth1\ - \ ~!:interface_options~!\ \
\ @@ -203,7 +210,7 @@ App.Templates.html = {
\ \ Cancel\ - Help\ + Help\
\
\ '], @@ -216,6 +223,7 @@ App.Templates.html = {
\
\ ~!:SUSPENDED_TPL~!\ + delete\
\
\
\ @@ -224,7 +232,7 @@ App.Templates.html = {
\
\
\ - ~!:IP_ADDRESS~!\ + ~!:IP_ADDRESS~!\
\ \ netmask:\ @@ -273,7 +281,7 @@ App.Templates.html = { \ \
~!:title~!
\ -