diff --git a/web/js/app.js b/web/js/app.js new file mode 100644 index 00000000..86d86276 --- /dev/null +++ b/web/js/app.js @@ -0,0 +1,308 @@ +/** + * jQuery.browser.mobile (http://detectmobilebrowser.com/) + * + * jQuery.browser.mobile will be true if the browser is a mobile device + * + **/ +(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera); + +/*! jQuery JSON plugin 2.4.0 | code.google.com/p/jquery-json */ +(function(jQuery){'use strict';var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},hasOwn=Object.prototype.hasOwnProperty;jQuery.toJSON=typeof JSON==='object'&&JSON.stringify?JSON.stringify:function(o){if(o===null){return'null';} +var pairs,k,name,val,type=jQuery.type(o);if(type==='undefined'){return undefined;} +if(type==='number'||type==='boolean'){return String(o);} +if(type==='string'){return jQuery.quoteString(o);} +if(typeof o.toJSON==='function'){return jQuery.toJSON(o.toJSON());} +if(type==='date'){var month=o.getUTCMonth()+1,day=o.getUTCDate(),year=o.getUTCFullYear(),hours=o.getUTCHours(),minutes=o.getUTCMinutes(),seconds=o.getUTCSeconds(),milli=o.getUTCMilliseconds();if(month<10){month='0'+month;} +if(day<10){day='0'+day;} +if(hours<10){hours='0'+hours;} +if(minutes<10){minutes='0'+minutes;} +if(seconds<10){seconds='0'+seconds;} +if(milli<100){milli='0'+milli;} +if(milli<10){milli='0'+milli;} +return'"'+year+'-'+month+'-'+day+'T'+ +hours+':'+minutes+':'+seconds+'.'+milli+'Z"';} +pairs=[];if(jQuery.isArray(o)){for(k=0;k + */ +var _DEBUG = true; +var _DEBUG_LEVEL = 'ALL'; +// possible levels: ALL, IMPORTANT +var Error = {FATAL: 1, WARNING: 0, NORMAL: -1}; + +// +// GLOBAL SETTINGS +// +GLOBAL = {}; +GLOBAL.FTP_USER_PREFIX = 'admin_'; +GLOBAL.AJAX_URL = ''; + +/** + * Init debug, grabs console object if accessible, or makes dummy debugger + */ +var fb = _DEBUG && 'undefined' != typeof(console) ? console : { + log : function(){}, + debug : function(){}, + info : function(){}, + warn : function(){}, + error : function(){}, + assert : function(){}, + dir : function(){}, + dirxml : function(){}, + trace : function(){}, + group : function(){}, + groupEnd : function(){}, + time : function(){}, + timeEnd : function(){}, + profile : function(){}, + profileEnd : function(){}, + count : function(){}, + msg : function(){} +}; + +// +var App = { + // Main namespases for page specific functions + // Core namespaces + Ajax: { Busy: {} }, + Core: {}, + // Actions. More widly used funcs + Actions: { + WEB: {} + }, + // Utilities + Helpers: {}, + HTML: {Build: {}}, + Filters: {}, + Env: { + lang: GLOBAL.lang, + }, + i18n: {}, + Listeners: { + WEB: {} + }, + View:{ + HTML: { + Build: {} + }, + // pages related views + }, + Cache: { + clear: function(){} // TODO: stub method, will be used later + }, + Ref: {}, + Tmp: {}, + Thread: { + run: function(delay, ref){ + setTimeout(function(){ + ref(); + }, delay*10); + } + }, + Settings: { GLOBAL: {}, General: {}}, + Templates: { + Templator: null, + Tpl: {}, + _indexes: {} + } +}; + +// Internals +Array.prototype.set = function(key, value){ + var index = this[0][key]; + this[1][index] = value; +} +Array.prototype.get = function(key){ + var index = this[0][key]; + return this[1][index]; +} +Array.prototype.finalize = function(){ + this.shift(); + this[0] = this[0].join(''); + return this[0]; +} +Array.prototype.done = function(){ + return this.join(''); +} + +String.prototype.wrapperize = function(key, ns){ + var tpl = App.Templates.get(key, ns); + tpl.set(':content', this); + + return tpl.finalize(); +} + + + +App.Ajax.request = function(method, data, callback, onError){ + // this will prevent multiple ajaxes on user clicks + /*if (App.Helpers.isAjaxBusy(method, data)) { + fb.warn('ajax request ['+method+'] is busy'); + return; + }*/ + //App.Helpers.setAjaxBusy(method, data); + data = data || {}; + + jQuery.ajax({ + url: GLOBAL.ajax_url, + global: false, + type: data.request_method || "GET", + data: jQuery.extend(data, {'action': method}), + dataType: "text boost", + converters: { + "text boost": function(value) { + value = value.trim(); + return jsonParse(value); + }}, + async: true, + cache: false, + error: function(jqXHR, textStatus, errorThrown) + { + onError && onError(); + if ('undefined' != typeof onError) { + fb.error(textStatus); + } + }, + complete: function() + { + //App.Helpers.setAjaxFree(method, data); + }, + success: function(reply) + { + //App.Helpers.setAjaxFree(method, data); + try { + callback && callback(reply); + } + catch(e) { + alert('GENERAL ERROR: '+e); + //App.Helpers.generalError(); + } + } + }); +} + +jQuery.extend({ + keys: function(obj){ + if (!obj) { + return []; + } + var a = []; + jQuery.each(obj, function(k){ a.push(k) }); + return a; + } +}) + + +App.Core.create_hidden_form = function(action){ + var form = jQuery('
', { + id : 'hidden-form', + method : 'post', + action : action + }); + jQuery('body').append(form); + + return form; +}; + +App.Core.extend_from_json = function(elm, data, prefix){ + elm = jQuery(elm); + var data = App.Core.flatten_json(data, prefix); + var keys = jQuery.keys(data); + for(var i=0, cnt=keys.length; i', { + name : keys[i], + value: data[keys[i]], + type : 'hidden' + })); + } + + return elm; +} + +App.Core.flatten_json = function(data, prefix){ + var keys = jQuery.keys(data); + var result = {}; + + prefix || (prefix = ''); + + if(keys.length) + { + for(var i=0, cnt=keys.length; i= 0; i--) { + if (/\S/.test(str.charAt(i))) { + str = str.substring(0, i + 1); + break; + } + } + return str; +} diff --git a/web/js/pages/add.web.js b/web/js/pages/add.web.js new file mode 100644 index 00000000..c66a8f21 --- /dev/null +++ b/web/js/pages/add.web.js @@ -0,0 +1,23 @@ +App.Actions.WEB.update_ftp_username_hint = function(elm, hint) { + if (hint.trim() == '') { + $(elm).parent().find('.ftp_username_hint').html(''); + } + if (hint.indexOf(GLOBAL.FTP_USER_PREFIX) == 0) { + hint = hint.slice(GLOBAL.FTP_USER_PREFIX.length, hint.length); + } + $(elm).parent().find('.ftp_username_hint').html(GLOBAL.FTP_USER_PREFIX + hint); +} + +App.Listeners.WEB.keypress_ftp_username = function() { + $('input[name="v_ftp_user"]').bind('keypress', function(evt) { + clearTimeout(window.frp_usr_tmt); + window.frp_usr_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val()); + }, 100); + }); +} + +// +// Page entry point +App.Listeners.WEB.keypress_ftp_username(); diff --git a/web/js/pages/edit.web.js b/web/js/pages/edit.web.js new file mode 100644 index 00000000..c66a8f21 --- /dev/null +++ b/web/js/pages/edit.web.js @@ -0,0 +1,23 @@ +App.Actions.WEB.update_ftp_username_hint = function(elm, hint) { + if (hint.trim() == '') { + $(elm).parent().find('.ftp_username_hint').html(''); + } + if (hint.indexOf(GLOBAL.FTP_USER_PREFIX) == 0) { + hint = hint.slice(GLOBAL.FTP_USER_PREFIX.length, hint.length); + } + $(elm).parent().find('.ftp_username_hint').html(GLOBAL.FTP_USER_PREFIX + hint); +} + +App.Listeners.WEB.keypress_ftp_username = function() { + $('input[name="v_ftp_user"]').bind('keypress', function(evt) { + clearTimeout(window.frp_usr_tmt); + window.frp_usr_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val()); + }, 100); + }); +} + +// +// Page entry point +App.Listeners.WEB.keypress_ftp_username(); diff --git a/web/js/templates.js b/web/js/templates.js new file mode 100644 index 00000000..ee5aeda6 --- /dev/null +++ b/web/js/templates.js @@ -0,0 +1,96 @@ +/** + * + * @author: Malishev Dmitry + */ +App.Templates.html = { + WEB: { + hint: [''] + } +}; + +// Internals +var Tpl = App.Templates; + +var Templator = function() +{ + var init = function() + { + fb.info('Templator work'); + Templator.splitThemAll(); + Templator.freezeTplIndexes(); + }; + + + /** + * Split the tpl strings into arrays + */ + Templator.splitThemAll = function(){ + fb.info('splitting tpls'); + jQuery.each(App.Templates.html, function(o){ + //try{ + var tpls = App.Templates.html[o]; + jQuery.each(tpls, function(t){ + tpls[t] = tpls[t][0].split('~!'); + }); + //}catch(e){fb.error('%o %o', o, e);} + }); + + }, + + /** + * Iterates tpls + */ + Templator.freezeTplIndexes = function(){ + fb.info('freezing tpl keys'); + jQuery.each(App.Templates.html, Templator.cacheTplIndexes); + }, + + /** + * Grab the tpl group key and process it + */ + Templator.cacheTplIndexes = function(key) + { + var tpls = App.Templates.html[key]; + + jQuery.each(tpls, function(o) + { + var tpl = tpls[o]; + Templator.catchIndex(key, o, tpl); + }); + }, + + /** + * Set the indexes + */ + Templator.catchIndex = function(key, ref_key, tpl) + { + 'undefined' == typeof App.Templates._indexes[key] ? App.Templates._indexes[key] = {} : false; + 'undefined' == typeof App.Templates._indexes[key][ref_key] ? + App.Templates._indexes[key][ref_key] = {} : false; + + jQuery(tpl).each(function(index, o) { + if (':' == o.charAt(0)) { + App.Templates._indexes[key][ref_key][o.toString()] = index; + } + }); + } + + /** + * Get concrete templates + */ + init(); + return Templator; +}; + +Templator.getTemplate = function(ns, key){ + return [ + App.Templates._indexes[ns][key], + App.Templates.html[ns][key].slice(0) + ]; +} +// init templator +Tpl.Templator = Templator(); + +Tpl.get = function(key, group){ + return Tpl.Templator.getTemplate(group, key); +} diff --git a/web/templates/admin/add_web.html b/web/templates/admin/add_web.html index 565eea05..df937fea 100644 --- a/web/templates/admin/add_web.html +++ b/web/templates/admin/add_web.html @@ -1,359 +1,366 @@ - - - - - - - - - - - - - -
- - - - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - -
- -
- -
- > -
- -
- > -
- -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- onclick="javascript:elementHideShow('proxytable');"> -
- +
- - - -
- -
- onclick="javascript:elementHideShow('ssltable');"> -
- +
+ + + + + + + + - - - - - - - - - - - - - - -
+ - + +
- +
+
+ + + + +
+ + + + + + - - - - - -
+
- + +
+
- + +
- + >
- + +
- + >
- () -
- + +
-
- -
- -
- -
- onclick="javascript:elementHideShow('statstable');"> -
- +
- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -
- + +
-
- + +
- + onclick="javascript:elementHideShow('proxytable');"> +
+ + + + + + + +
+ +
+ +
+
+ +
+ onclick="javascript:elementHideShow('ssltable');"> +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ () +
+ +
+
+ +
+ +
+ +
+ onclick="javascript:elementHideShow('statstable');"> +
+ + + + + + + + + + +
+ +
+ + +
+ +
+
+ +
+ onclick="javascript:elementHideShow('ftptable');"> +
+ + + + + + + + + + + + + + + - - - - - -
+
+ +
+ +
+ +
+ + +
+ - -
- onclick="javascript:elementHideShow('ftptable');"> -
- +
- - - - - - - - - -
-
- +
+
- - -
- - -
- +
- - - - - -
- - - -
-
- + + + diff --git a/web/templates/admin/edit_web.html b/web/templates/admin/edit_web.html index 3941fcbe..43062080 100644 --- a/web/templates/admin/edit_web.html +++ b/web/templates/admin/edit_web.html @@ -1,174 +1,140 @@ - - - - + + + +
+ - - - -
- - - - - -
-
- -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - -
- -
- -
- -
- -
- -
- -
- onclick="javascript:elementHideShow('proxytable');"> -
- + +
+ + + - - - - - - - - -
+ - + + +
- + +
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + - - -
+
- + +
+ +
+ +
+ +
+ +
+
- + +
- -
-
- -
- onclick="javascript:elementHideShow('ssltable');"> -
- - - + + + + + + + + + + + + + + + + + + - - - + onclick="javascript:elementHideShow('ftptable');"> +
- + onclick="javascript:elementHideShow('proxytable');">
- + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+
+ +
+ onclick="javascript:elementHideShow('ssltable');"> +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ () +
+ +
+
+ +
+
- +
- + onclick="javascript:elementHideShow('statstable');"> +
+ + + + + + + + + + +
+ +
+ + +
+ +
- +
- -
- () -
- + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - -
+ + ' . __('Prefix will be automaticaly added to username',$user."_") . '' ?> +
+ +
+ +
+ + +
+ - -
- -
- -
- onclick="javascript:elementHideShow('statstable');"> -
- +
- + - - - - - - -
- + + + +
- - -
- -
-
- -
- onclick="javascript:elementHideShow('ftptable');"> -
- - - - - - - - - - - - - - - -
- - ' . __('Prefix will be automaticaly added to username',$user."_") . '' ?> -
- - -
- - -
- -
- - - -
-
- + + + + + diff --git a/web/templates/header.html b/web/templates/header.html index 1f50c960..cde44828 100644 --- a/web/templates/header.html +++ b/web/templates/header.html @@ -4,9 +4,900 @@ Vesta - <?php echo "$TAB"; ?> - + + @@ -67,5 +959,9 @@ }); }); + + + + diff --git a/web/templates/user/add_web.html b/web/templates/user/add_web.html index ae51b86f..7a772bee 100644 --- a/web/templates/user/add_web.html +++ b/web/templates/user/add_web.html @@ -1,360 +1,366 @@ - - - - - - - -
- - - - - -
- - - - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - -
- -
- -
- > -
- -
- > -
- -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- onclick="javascript:elementHideShow('proxytable');"> -
- +
- - - -
- -
- onclick="javascript:elementHideShow('ssltable');"> -
- +
+ + + + + + + + - - - - - - - - - - - - - - -
+ - + +
- +
+
+ + + + +
+ + + + + + - - - - - -
+
- + +
+
- + +
- + >
- + +
- + >
- () -
- + +
-
- -
- -
- -
- onclick="javascript:elementHideShow('statstable');"> -
- +
- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -
- + +
-
- + +
- + onclick="javascript:elementHideShow('proxytable');"> +
+ + + + + + + +
+ +
+ +
+
+ +
+ onclick="javascript:elementHideShow('ssltable');"> +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ () +
+ +
+
+ +
+ +
+ +
+ onclick="javascript:elementHideShow('statstable');"> +
+ + + + + + + + + + +
+ +
+ + +
+ +
+
+ +
+ onclick="javascript:elementHideShow('ftptable');"> +
+ + + + + + + + + + + + + + + - - - - - -
+
+ +
+ +
+ +
+ + +
+ - -
- onclick="javascript:elementHideShow('ftptable');"> -
- +
- - - - - - - - - -
-
- +
+
- - -
- - -
- +
- - - - - -
- - - -
-
- -
+ + + diff --git a/web/templates/user/edit_web.html b/web/templates/user/edit_web.html index f8fd0a72..f67a647f 100644 --- a/web/templates/user/edit_web.html +++ b/web/templates/user/edit_web.html @@ -1,339 +1,343 @@ - + - - - + + + +
+ - - - -
- - - - - -
-
- -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- -
- - -
- -
- -
- -
- -
- onclick="javascript:elementHideShow('proxytable');"> -
- + +
+ + - - - - - - - - -
+ - - - - +
- -
- + +
+
- -
- onclick="javascript:elementHideShow('ssltable');"> -
- +
+ - + +
- +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
- + +
+
- +
- +
- +
- + onclick="javascript:elementHideShow('proxytable');"> +
+ + + + + + + +
+ +
+ +
- () +
- + onclick="javascript:elementHideShow('ssltable');"> +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ () +
+ +
+
+ +
+ +
+ +
+ onclick="javascript:elementHideShow('statstable');"> +
+ + + + + + + + + + +
+ +
+ + +
+ +
+
+ +
+ onclick="javascript:elementHideShow('ftptable');"> +
+ + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - -
+ + ' . __('Prefix will be automaticaly added to username',$user."_") . '' ?> +
+ +
+ +
+ + +
+ - -
- -
- -
- onclick="javascript:elementHideShow('statstable');"> -
- +
- + - - - - - - -
- + + + +
- - -
- -
-
- -
- onclick="javascript:elementHideShow('ftptable');"> -
- - - - - - - - - - - - - - - -
- - ' . __('Prefix will be automaticaly added to username',$user."_") . '' ?> -
- - -
- - -
- -
- - - -
-
- + +