From 3ab6d3f47f2873744373f9141f96d091a8ab1a7a Mon Sep 17 00:00:00 2001 From: Cat Date: Wed, 10 Apr 2013 13:07:15 +0200 Subject: [PATCH] LSP: added new limit edit style from MM --- lsp/functions.js | 519 ++++++++++++++++++++++++++++++++++++++++++++++- lsp/main.js | 158 ++++++--------- lsp/style.css | 13 ++ 3 files changed, 590 insertions(+), 100 deletions(-) diff --git a/lsp/functions.js b/lsp/functions.js index 56427740..aed0861b 100644 --- a/lsp/functions.js +++ b/lsp/functions.js @@ -390,8 +390,10 @@ "log": {}, "statistics": {} }, d) - if (settings.settings.LTS != 1) { - $('.LTSonly').remove(); + if (settings.settings.LTS == 1) { + $('.LTSonly').show(); + } else { + $('.LTSonly').hide(); } } if(callback) @@ -460,4 +462,517 @@ } } } +/** + * Build a HTML limit row + * @param l the limit data + * @return a (jQuery'd) HTML Element + */ +function BuildLimitRow(l) +{ + l['type'] = l['type'] || 'soft'; + l['name'] = l['name'] || 'kb_total'; + l['val'] = l['val'] || 0; + var i, j, lv, db, + output = $("").addClass("limits_row"), + selects = [$("")], + options = + [ + [ + ['soft', 'Softlimit', 'Allow this limit to be passed. (Usefull for alerts)'], + ['hard', 'Hardlimit','Do not allow this limit to be passed.'] + ], + [ + ['kb_total', 'Total bandwidth','Total bandwidth in bytes.'], + ['kbps_max', 'Current bandwidth', 'Current bandwidth in bytes/s.'], + ['users', 'Concurrent users','Maximum concurrent users.'], + ['geo', 'Geolimited', 'Either a blacklist or whitelist containing country codes.'], + ['host', 'Hostlimited', 'Either a blacklist or whitelist containing hosts seperated by spaces.'], + ], + ['type', 'name'] + ]; + /* + Limits that are currently not in use but may return later: + ['duration', 'Duration', 'Maximum duration a user may be connected in seconds.'], + ['str_kbps_min', 'Minimum bitrate','Minimum bitrate in bytes/s.'], + ['str_kbps_max', 'Maximum bitrate','Maximum bitrate in bytes/s.'] + */ + + for(i = 0; i < 2; i++) + { + + for(j = 0; j < options[i].length; j++) + { + selects[i].append( + $('