js / index.html update set

This commit is contained in:
Dima Malishev 2011-09-10 02:10:49 +03:00
parent 6ceecb886e
commit 8155d2cd9c
5 changed files with 55 additions and 27 deletions

View file

@ -187,7 +187,7 @@
<div id="actions-toolbar" class="cc"> <div id="actions-toolbar" class="cc">
<a class="add-domain do_action_new_entry" href="javascript:void(0)"> <a class="add-domain do_action_new_entry" href="javascript:void(0)">
<i class="icon do_action_new_entry">&nbsp;</i> <i class="icon do_action_new_entry">&nbsp;</i>
add new entry add new <span id="new-entry-keyword">entry</span>
</a> </a>
</div> </div>

View file

@ -89,16 +89,20 @@ App.Actions.save_form = function(evt) {
// do_action_edit // do_action_edit
App.Actions.edit = function(evt) { App.Actions.edit = function(evt) {
var elm = $(evt.target); if ('undefined' != typeof App.Pages[App.Env.world].edit) {
elm = elm.hasClass('row') ? elm : elm.parents('.row'); App.Pages[App.Env.world].edit(evt);
} else {
var options = elm.find('.source').val(); var elm = $(evt.target);
var build_method = App.Env.getWorldName() + '_form'; elm = elm.hasClass('row') ? elm : elm.parents('.row');
var tpl = App.HTML.Build[build_method](options);
elm.replaceWith(tpl); var options = elm.find('.source').val();
var build_method = App.Env.getWorldName() + '_form';
App.Helpers.disbleNotEditable(); var tpl = App.HTML.Build[build_method](options);
//App.Helpers.updateScreen(); elm.replaceWith(tpl);
App.Helpers.disbleNotEditable();
//App.Helpers.updateScreen();
}
} }
// do_cancel_form // do_cancel_form
@ -334,3 +338,16 @@ App.Actions.view_full_ns_list = function(evt)
var elm = $(evt.target); var elm = $(evt.target);
App.Helpers.openInnerPopup(elm, $(elm).parents('.prop-box').find('.ns-full-list:first').html()); App.Helpers.openInnerPopup(elm, $(elm).parents('.prop-box').find('.ns-full-list:first').html());
} }
App.Actions.view_template_info = function(evt)
{
var elm = $(evt.target);
ref = elm.hasClass('row') ? elm : elm.parents('.row');
var options = ref.find('.source').val();
App.Ajax.request('DNS.getTemplateInfo', {spell: options}, function(reply) {
if (reply.result) {
App.Helpers.openInnerPopup(elm, reply.data);
}
});
}

View file

@ -22,6 +22,7 @@ App.Pages.prepareHTML = function()
else { else {
App.Model[App.Env.world].loadList(); App.Model[App.Env.world].loadList();
} }
$('#new-entry-keyword').text(App.Env.world.toLowerCase().replace('_', ' '));
} }
App.Pages.DNS.showSubform = function(ref) App.Pages.DNS.showSubform = function(ref)
@ -49,3 +50,13 @@ App.Pages.DNS.edit = function(elm) {
elm.replaceWith(tpl); elm.replaceWith(tpl);
} }
App.Pages.USER.new_entry = function(evt)
{
var form_id = App.Constants[App.Env.world + '_FORM_ID'];
$('#'+form_id).remove();
var build_method = App.Env.getWorldName() + '_form';
var tpl = App.HTML.Build[build_method]({}, form_id);
App.Ref.CONTENT.prepend(tpl);
App.Helpers.updateScreen();
$('#'+form_id).find('.ns-entry, .additional-ns-add').addClass('hidden');
}

View file

@ -110,7 +110,7 @@ App.Templates.html = {
<span class="ip-adr">~!:IP~!</span>\ <span class="ip-adr">~!:IP~!</span>\
<span class="prop-box template-box">\ <span class="prop-box template-box">\
<span class="prop-title">template:</span>\ <span class="prop-title">template:</span>\
<span class="prop-value">~!:TPL~!</span>\ <span class="prop-value do_action_view_template_info">~!:TPL~!</span>\
</span>\ </span>\
</div>\ </div>\
</div>\ </div>\
@ -126,7 +126,7 @@ App.Templates.html = {
</div>\ </div>\
</div><!-- // .row-details -->\ </div><!-- // .row-details -->\
</div>'], </div>'],
SUBFORM: ['<div class="b-new-entry b-records-list subform">\ SUBFORM: ['<div class="b-new-entry b-records-list subform" style="margin-top: -20px;">\
<div class="entry-header">\ <div class="entry-header">\
<div class="hide-records do_action_close_subform">Hide records</div>\ <div class="hide-records do_action_close_subform">Hide records</div>\
</div>\ </div>\
@ -153,8 +153,8 @@ App.Templates.html = {
</div>\ </div>\
<div class="field-box dns-type-box">\ <div class="field-box dns-type-box">\
<label for="#" class="field-label">type:</label>\ <label for="#" class="field-label">type:</label>\
<span class="select RECORD_TYPE" id="selectRECORD_TYPE">~!:RECORD_TYPE_VALUE~!</span>\ <!-- span class="select RECORD_TYPE" id="selectRECORD_TYPE">~!:RECORD_TYPE_VALUE~!</span -->\
<select name="RECORD_TYPE" class="styled">\ <select name="RECORD_TYPE" class="not-styled" style="width:70px">\
~!:RECORD_TYPE~!\ ~!:RECORD_TYPE~!\
</select>\ </select>\
</div>\ </div>\
@ -203,7 +203,7 @@ App.Templates.html = {
</div>\ </div>\
<div class="form-row cc">\ <div class="form-row cc">\
<label for="#" class="field-label">netmask:</label>\ <label for="#" class="field-label">netmask:</label>\
<div class="autocomplete-box">\ <div class="_autocomplete-box">\
<input type="text" value="~!:NETMASK~!" name="NETMASK" class="text-field">\ <input type="text" value="~!:NETMASK~!" name="NETMASK" class="text-field">\
</div>\ </div>\
</div>\ </div>\
@ -297,7 +297,7 @@ App.Templates.html = {
</div>\ </div>\
<div class="form-row cc">\ <div class="form-row cc">\
<label for="#" class="field-label">username:</label>\ <label for="#" class="field-label">username:</label>\
<input type="text" class="text-field rule-abc rule-required" value="~!:LOGIN_NAME~!" name="LOGIN_NAME">\ <input type="text" class="text-field rule-required rule-username" value="~!:LOGIN_NAME~!" name="LOGIN_NAME">\
</div>\ </div>\
<div class="form-row pwd-box cc">\ <div class="form-row pwd-box cc">\
<label for="#" class="field-label">password:</label>\ <label for="#" class="field-label">password:</label>\
@ -419,7 +419,7 @@ App.Templates.html = {
<!-- bandwidth usage block -->\ <!-- bandwidth usage block -->\
<div style="margin-bottom:25px;" class="b-usage-box bandwidth-box cc">\ <div style="margin-bottom:25px;" class="b-usage-box bandwidth-box cc">\
<span class="prop-title">bandwidth:</span>\ <span class="prop-title">bandwidth:</span>\
<div class="usage-box">\ <div class="usage-box" style="margin-left: -1px">\
<div class="value-box">\ <div class="value-box">\
<span class="value">~!:U_BANDWIDTH~!</span>\ <span class="value">~!:U_BANDWIDTH~!</span>\
<div class="graph low">\ <div class="graph low">\
@ -435,10 +435,6 @@ App.Templates.html = {
<!-- // bandwidth usage block -->\ <!-- // bandwidth usage block -->\
</div>\ </div>\
<div class="props-additional">\ <div class="props-additional">\
<span class="prop-box webdomains-box">\
<span class="prop-title">web domains:</span>\
<span class="prop-value">~!:U_DNS_DOMAINS~! (~!:WEB_DOMAINS~!)</span>\
</span>\
<span class="prop-box websl-box">\ <span class="prop-box websl-box">\
<span class="prop-title">web ssl:</span>\ <span class="prop-title">web ssl:</span>\
<span class="prop-value">~!:U_WEB_SSL~! (~!:WEB_SSL~!)</span>\ <span class="prop-value">~!:U_WEB_SSL~! (~!:WEB_SSL~!)</span>\
@ -479,7 +475,11 @@ App.Templates.html = {
<span class="prop-title">mail domains:</span>\ <span class="prop-title">mail domains:</span>\
<span class="prop-value">~!:U_MAIL_DOMAINS~! (~!:MAIL_DOMAINS~!)</span>\ <span class="prop-value">~!:U_MAIL_DOMAINS~! (~!:MAIL_DOMAINS~!)</span>\
</span>\ </span>\
<span class="prop-box dnsdomains-box">\ <span class="prop-box webdomains-box">\
<span class="prop-title">web domains:</span>\
<span class="prop-value">~!:U_WEB_DOMAINS~! (~!:WEB_DOMAINS~!)</span>\
</span>\
<span class="prop-box dnsdomains-box">\
<span class="prop-title">dns domains:</span>\ <span class="prop-title">dns domains:</span>\
<span class="prop-value">~!:U_DNS_DOMAINS~! (~!:DNS_DOMAINS~!)</span>\ <span class="prop-value">~!:U_DNS_DOMAINS~! (~!:DNS_DOMAINS~!)</span>\
</span>\ </span>\

View file

@ -30,7 +30,7 @@ App.Validate.Rule = {
if ($(elm).val().trim() == '' || $(elm).val().search(/[^a-zA-Z_]+/) != -1) { if ($(elm).val().trim() == '' || $(elm).val().search(/[^a-zA-Z_]+/) != -1) {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is invalid'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is invalid'};
} }
if ($(elm).val().trim() == '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) { if ($(elm).val().trim() != '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'};
} }
} }
@ -41,7 +41,7 @@ App.Validate.Rule = {
if ($(elm).val().trim() == '') { if ($(elm).val().trim() == '') {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is required'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is required'};
} }
if ($(elm).val().trim() == '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) { if ($(elm).val().trim() != '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'};
} }
} }
@ -51,7 +51,7 @@ App.Validate.Rule = {
if ($(elm).val().trim() != '' && $(elm).val().search(/[^a-zA-Z_]+/) != -1) { if ($(elm).val().trim() != '' && $(elm).val().search(/[^a-zA-Z_]+/) != -1) {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is invalid'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' is invalid'};
} }
if ($(elm).val().trim() == '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) { if ($(elm).val().trim() != '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'};
} }
return {VALID: true}; return {VALID: true};
@ -78,7 +78,7 @@ App.Validate.Rule = {
if ($(elm).val().trim() != '' && $(elm).val().search(/[^a-zA-Z]+/) != -1) { if ($(elm).val().trim() != '' && $(elm).val().search(/[^a-zA-Z]+/) != -1) {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' must contain only letters without spaces or other symbols'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' must contain only letters without spaces or other symbols'};
} }
if ($(elm).val().trim() == '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) { if ($(elm).val().trim() != '' || $(elm).val().length > App.Settings.FIELD_MAX_LEN) {
return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'}; return {VALID: false, ERROR: App.Validate.getFieldName(elm) + ' too long'};
} }
return {VALID: true}; return {VALID: true};