mirror of
https://github.com/myvesta/vesta
synced 2025-07-16 10:03:23 -07:00
Php+Js update set
This commit is contained in:
parent
257423147e
commit
eb2e896a8e
11 changed files with 249 additions and 140 deletions
|
@ -28,6 +28,7 @@ App.Settings.ajax_url = 1;
|
|||
App.Settings.uri = location.href.replace('index.html', '');
|
||||
App.Settings.popup_conf = { 'centered' : true, 'bgcolor' : '#FF0000', 'lightboxSpeed' : 'fast', 'destroyOnClose': true };
|
||||
|
||||
App.Settings.PASSWORD_IMMUTE = '********';
|
||||
|
||||
// Messages
|
||||
App.Messages.total_dns_records = {single: 'total record', plural: 'total records'};
|
||||
|
@ -42,12 +43,14 @@ App.Settings.Imutable = {};
|
|||
App.Settings.Imutable.USER = ['LOGIN_NAME'];
|
||||
App.Settings.Imutable.DB = ['DB', 'TYPE', 'USER'];
|
||||
App.Settings.Imutable.DNS = ['DNS_DOMAIN'];
|
||||
App.Settings.Imutable.IP = ['INTERFACE'];
|
||||
|
||||
|
||||
// Empty
|
||||
App.Empty = {};
|
||||
App.Empty.USER = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','LNAME':'', 'FNAME':'','NS1':'','NS2':'','NS3':'','NS4':'','NS5':'','NS6':'','NS7':'','NS8':''};
|
||||
App.Empty.USER = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','LNAME':'', 'FNAME':'','NS1':'','NS2':'','NS3':'','NS4':'','NS5':'','NS6':'','NS7':'','NS8':''};
|
||||
App.Empty.WEB_DOMAIN = {'CONTACT':'', 'PASSWORD':'','LOGIN_NAME':'','NS':'', 'DOMAIN':'','SSL_CERT':'','SSL_HOME':'','STATS_PASSWORD':'','STATS_LOGIN':'','ALIAS':''};
|
||||
App.Empty.DB = {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''};
|
||||
|
||||
App.Settings.getMethodName = function(action)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
|
||||
App.Helpers.scrollTo = function(elm)
|
||||
{
|
||||
fb.log(elm);
|
||||
var scroll_to = $(elm).offset().top;
|
||||
if (scroll_to > 1000) {
|
||||
var scroll_time = 300;
|
||||
}
|
||||
else {
|
||||
var scroll_time = 550;
|
||||
}
|
||||
$('html, body').animate({
|
||||
'scrollTop': scroll_to
|
||||
}, scroll_time);
|
||||
}
|
||||
|
||||
App.Helpers.getMbHumanMeasure = function(val)
|
||||
{
|
||||
|
@ -201,7 +214,7 @@ App.Helpers.getFormValuesFromElement = function(ref)
|
|||
|
||||
App.Helpers.updateScreen = function()
|
||||
{
|
||||
Custom.init();
|
||||
//Custom.init();
|
||||
App.Ajax.request('MAIN.getInitial', {}, function(reply){
|
||||
App.Env.initialParams = reply.data;
|
||||
App.Helpers.updateInitial();
|
||||
|
|
|
@ -190,12 +190,6 @@ App.HTML.Build.user_entry = function(o, key)
|
|||
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_SUSPENDED', 'general');
|
||||
}
|
||||
else {
|
||||
var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general');
|
||||
}*/
|
||||
tpl.set(':SUSPENDED_TPL', '');//sub_tpl.finalize());
|
||||
|
||||
var ns = [];
|
||||
|
@ -225,13 +219,18 @@ App.HTML.Build.user_entry = function(o, key)
|
|||
tpl.set(':NS', ns_custom.finalize());
|
||||
}
|
||||
|
||||
|
||||
tpl.set(':REPORTS_ENABLED', o.REPORTS_ENABLED == 'yes' ? 'enabled' : 'DISABLED');
|
||||
|
||||
return tpl.finalize();
|
||||
}
|
||||
|
||||
|
||||
App.HTML.Build.user_form = function(options, id)
|
||||
{
|
||||
var in_edit = false;
|
||||
if (!App.Helpers.isEmpty(options)) {
|
||||
in_edit = true;
|
||||
}
|
||||
if('undefined' == typeof App.Env.initialParams) {
|
||||
return alert('Please wait a bit. Some background processes are not yet executed. Thank you for patience.');
|
||||
}
|
||||
|
@ -253,7 +252,7 @@ App.HTML.Build.user_form = function(options, id)
|
|||
// NS
|
||||
var ns = [];
|
||||
$([3,4,5,6,7,8]).each(function(i, index)
|
||||
{fb.warn(options);
|
||||
{
|
||||
if (options['NS'+index].trim() != '') {
|
||||
var tpl_ns = App.Templates.get('NS_INPUT', 'user');
|
||||
tpl_ns.set(':NS_LABEL', 'NS #' + (index));
|
||||
|
@ -264,7 +263,9 @@ App.HTML.Build.user_form = function(options, id)
|
|||
ns[ns.length++] = App.Templates.get('PLUS_ONE_NS', 'user').finalize();
|
||||
|
||||
tpl.set(':NS', ns.done());
|
||||
|
||||
if (in_edit == true) {
|
||||
options.PASSWORD = App.Settings.PASSWORD_IMMUTE;
|
||||
}
|
||||
tpl = App.HTML.setTplKeys(tpl, options, true);
|
||||
tpl = App.HTML.Build.user_selects(tpl, options);
|
||||
|
||||
|
@ -287,7 +288,7 @@ App.HTML.Build.web_domain_entry = function(o, key)
|
|||
var tpl = App.Templates.get('ENTRY', 'web_domain');
|
||||
tpl = App.HTML.setTplKeys(tpl, o);
|
||||
|
||||
if (App.Constants.SUSPENDED_YES == o.SUSPENDED) {
|
||||
if (App.Constants.SUSPENDED_YES == o.SUSPEND) {
|
||||
var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general');
|
||||
}
|
||||
else {
|
||||
|
@ -364,6 +365,10 @@ App.HTML.Build.db_entry = function(o, key)
|
|||
|
||||
App.HTML.Build.db_form = function(options, id)
|
||||
{
|
||||
var in_edit = false;
|
||||
if (!App.Helpers.isEmpty(options)) {
|
||||
in_edit = true;
|
||||
}
|
||||
if('undefined' == typeof App.Env.initialParams) {
|
||||
return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
|
||||
}
|
||||
|
@ -380,11 +385,12 @@ App.HTML.Build.db_form = function(options, id)
|
|||
tpl.set(':save_button', 'SAVE');
|
||||
}
|
||||
|
||||
options = !App.Helpers.isEmpty(options) ? options : {'DB':'', 'USER':'','FORM':'', 'PASSWORD': ''};
|
||||
options = !App.Helpers.isEmpty(options) ? options : App.Empty.DB;
|
||||
if (in_edit == true) {
|
||||
options.PASSWORD = App.Settings.PASSWORD_IMMUTE;
|
||||
}
|
||||
tpl = App.HTML.setTplKeys(tpl, options, true);
|
||||
tpl = App.HTML.Build.db_selects(tpl, options);
|
||||
|
||||
tpl.set(':PASSWORD', '');
|
||||
tpl = App.HTML.Build.db_selects(tpl, options);
|
||||
|
||||
return tpl.finalize();
|
||||
}
|
||||
|
@ -542,7 +548,7 @@ App.HTML.Build.db_selects = function(tpl, options)
|
|||
App.HTML.Build.ip_selects = function(tpl, options)
|
||||
{
|
||||
// OWNER
|
||||
var users = App.Env.initialParams.IP.SYS_USERS;
|
||||
var users = App.Env.initialParams.IP.OWNER;
|
||||
var opts = App.HTML.Build.options(users, options.OWNER);
|
||||
tpl.set(':owner_options', opts);
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ App.Templates.html = {
|
|||
~!:PACKAGE_OPTIONS~!\
|
||||
</select>\
|
||||
</div>\
|
||||
<div class="form-row cc hidden">\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">shell:</label>\
|
||||
<select class="not-styled" name="SHELL">\
|
||||
~!:SHELL_OPTIONS~!\
|
||||
|
@ -511,7 +511,15 @@ App.Templates.html = {
|
|||
</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
<!-- advanced options -->\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">CGI:</label>\
|
||||
<input type="checkbox" value="~!:CGI~!" ~!:CHECKED_CGI~! name="CGI" class="not-styled">\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">ELOG:</label>\
|
||||
<input type="checkbox" value="~!:ELOG~!" ~!:CHECKED_ELOG~! name="ELOG" class="not-styled">\
|
||||
</div>\
|
||||
<!-- advanced options -->\
|
||||
<div class="form-options-group">\
|
||||
<div class="group-header cc collapsed">\
|
||||
<span class="group-title-outer do_action_toggle_section">\
|
||||
|
@ -531,26 +539,26 @@ App.Templates.html = {
|
|||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">statistics:</label>\
|
||||
<input type="checkbox" name="STATS" ~!:stats_checked~!="" value="~!:STATS~!" class="styled">\
|
||||
<input type="checkbox" name="STATS" ~!:stats_checked~!="" value="~!:STATS~!" class="not-styled">\
|
||||
</div>\
|
||||
<div class="stats-settings">\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">stats auth:</label>\
|
||||
<input type="checkbox" name="STATS_AUTH" ~!:stats_auth_checked~!="" value="~!:STATS_AUTH~!" class="styled">\
|
||||
<input id="stats-auth-enable" type="checkbox" name="STATS_AUTH" ~!:stats_auth_checked~!="" value="~!:STATS_AUTH~!" class="not-styled">\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">login:</label>\
|
||||
<input type="text" class="text-field rule-username" name="STATS_LOGIN" value="~!:STATS_LOGIN~!">\
|
||||
<label for="#" class="field-label">stats login:</label>\
|
||||
<input type="text" class="text-field rule-statslogin" name="STATS_LOGIN" value="~!:STATS_LOGIN~!">\
|
||||
</div>\
|
||||
<div class="form-row pwd-box cc">\
|
||||
<label for="#" class="field-label">password:</label>\
|
||||
<input type="text" value="~!:STATS_PASSWORD~!" name="STATS_PASSWORD" class="text-field rule-password">\
|
||||
<input type="text" value="~!:STATS_PASSWORD~!" name="STATS_PASSWORD" class="text-field rule-statspassword password">\
|
||||
<span class="generate-pwd do_action_generate_pass">Generate</span>\
|
||||
</div>\
|
||||
</div><!-- // stats settings -->\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">ssl:</label>\
|
||||
<input type="checkbox" class="styled" ~!:ssl_checked~!="" value="~!SSL~!">\
|
||||
<input type="checkbox" name="SSL" class="styled" ~!:ssl_checked~!="" value="~!SSL~!">\
|
||||
</div>\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">ssl home:</label>\
|
||||
|
@ -572,7 +580,7 @@ App.Templates.html = {
|
|||
<div class="sub_section hidden">\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">create dns domain:</label>\
|
||||
<input type="checkbox" value="" class="not-styled">\
|
||||
<input type="checkbox" value="~!:DNS~!" ~!:CHECKED_DNS~! name="DNS" class="not-styled">\
|
||||
</div>\
|
||||
</div><!-- DNS options -->\
|
||||
<div class="form-options-group">\
|
||||
|
@ -584,7 +592,7 @@ App.Templates.html = {
|
|||
<div class="sub_section hidden">\
|
||||
<div class="form-row cc">\
|
||||
<label for="#" class="field-label">create mail domain:</label>\
|
||||
<input type="checkbox" value="" class="not-styled">\
|
||||
<input type="checkbox" value="~!:MAIL~!" ~!:CHECKED_MAIL~! name="MAIL" class="not-styled">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
|
|
|
@ -25,9 +25,25 @@ App.Validate.getFieldName = function(elm)
|
|||
}
|
||||
|
||||
App.Validate.Rule = {
|
||||
'statslogin' : function(elm) {
|
||||
if (!!$('#stats-auth-enable').attr('checked') == true) {
|
||||
if ($(elm).val().trim() == '' || $(elm).val().search(/[^a-zA-Z_]+/) != -1) {
|
||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is invalid'};
|
||||
}
|
||||
}
|
||||
return {VALID: true};
|
||||
},
|
||||
'statspassword': function(elm) {
|
||||
if (!!$('#stats-auth-enable').attr('checked') == true) {
|
||||
if ($(elm).val().trim() == '') {
|
||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is required'};
|
||||
}
|
||||
}
|
||||
return {VALID: true};
|
||||
},
|
||||
'username' : function(elm) {
|
||||
if ($(elm).val().trim() != '' && $(elm).val().search(/[^a-zA-Z_]+/) != -1) {
|
||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is required'};
|
||||
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is invalid'};
|
||||
}
|
||||
return {VALID: true};
|
||||
},
|
||||
|
@ -173,6 +189,7 @@ App.Validate.displayFormErrors = function(world, elm)
|
|||
var ref = $('.form-error', elm);
|
||||
ref.removeClass('hidden');
|
||||
ref.html(errors_tpl);
|
||||
App.Helpers.scrollTo(ref);
|
||||
}
|
||||
|
||||
App.Validate.getRules = function(elm)
|
||||
|
@ -180,7 +197,8 @@ App.Validate.getRules = function(elm)
|
|||
try {
|
||||
var rules_string = $(elm).attr('class');
|
||||
var rules = [];
|
||||
$(rules_string.split(/\s/)).each(function(i, str)
|
||||
var rules_splitted = rules_string.split(/\s/);
|
||||
$(rules_splitted).each(function(i, str)
|
||||
{
|
||||
var rule = str.split('rule-');
|
||||
if (rule.length > 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue