[php, js, css] change password is highly nice. checkbox fixes

This commit is contained in:
naumov-socolov 2012-02-03 00:44:02 +03:00
parent d53c7d889b
commit 74c83ed412
16 changed files with 694 additions and 699 deletions

View file

@ -143,9 +143,8 @@ App.Actions.reset_batch = function()
App.Actions.do_change_password = function()
{
var params = {
email: $('#change-email').val(),
login: $('#change-login').val(),
captcha: $('#captcha').val()
}
@ -261,11 +260,13 @@ App.Actions.new_entry = function() {
var build_method = App.Env.getWorldName() + '_form';
var tpl = App.HTML.Build[build_method]({}, form_id);
var box = $('<div>').html(tpl);
$(box).find('.suspended').addClass('hidden');
App.Ref.CONTENT.prepend($(box).html());
App.Helpers.updateScreen();
}
$('.cust-checkbox').checkBox();
}
// execute authorisation
@ -403,6 +404,7 @@ App.Actions.edit = function(evt)
App.Helpers.disableNotEditable();
App.Helpers.updateScreen();
}
$('.cust-checkbox').checkBox();
}
// do_cancel_form

View file

@ -43,7 +43,7 @@ App.HTML.Build.dns_form = function (options, id) {
tpl.set(':DATE', options.DATE || '');
tpl = App.HTML.Build.dns_selects(tpl, options);
tpl = App.HTML.toggle_suspended_form(tpl, options);
return tpl.finalize();
}
@ -218,7 +218,6 @@ App.HTML.Build.web_domain_form = function (options, id) {
tpl.set(':DNS_DOMAIN_ALSO', in_edit? 'hidden' : '');
return tpl.finalize();
}

View file

@ -1,236 +1,236 @@
/*!
* jQuery UI Widget 1.8
*
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Widget
*/
(function( $ ) {
var _remove = $.fn.remove;
$.fn.remove = function( selector, keepData ) {
return this.each(function() {
if ( !keepData ) {
if ( !selector || $.filter( selector, [ this ] ).length ) {
$( "*", this ).add( this ).each(function() {
$( this ).triggerHandler( "remove" );
});
}
}
return _remove.call( $(this), selector, keepData );
});
};
$.widget = function( name, base, prototype ) {
var namespace = name.split( "." )[ 0 ],
fullName;
name = name.split( "." )[ 1 ];
fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[ ":" ][ fullName ] = function( elem ) {
return !!$.data( elem, name );
};
$[ namespace ] = $[ namespace ] || {};
$[ namespace ][ name ] = function( options, element ) {
// allow instantiation without initializing for simple inheritance
if ( arguments.length ) {
this._createWidget( options, element );
}
};
var basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
// $.each( basePrototype, function( key, val ) {
// if ( $.isPlainObject(val) ) {
// basePrototype[ key ] = $.extend( {}, val );
// }
// });
basePrototype.options = $.extend( {}, basePrototype.options );
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
namespace: namespace,
widgetName: name,
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
widgetBaseClass: fullName
}, prototype );
$.widget.bridge( name, $[ namespace ][ name ] );
};
$.widget.bridge = function( name, object ) {
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = Array.prototype.slice.call( arguments, 1 ),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.extend.apply( null, [ true, options ].concat(args) ) :
options;
// prevent calls to internal methods
if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
return returnValue;
}
if ( isMethodCall ) {
this.each(function() {
var instance = $.data( this, name ),
methodValue = instance && $.isFunction( instance[options] ) ?
instance[ options ].apply( instance, args ) :
instance;
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue;
return false;
}
});
} else {
this.each(function() {
var instance = $.data( this, name );
if ( instance ) {
if ( options ) {
instance.option( options );
}
instance._init();
} else {
$.data( this, name, new object( options, this ) );
}
});
}
return returnValue;
};
};
$.Widget = function( options, element ) {
// allow instantiation without initializing for simple inheritance
if ( arguments.length ) {
this._createWidget( options, element );
}
};
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
options: {
disabled: false
},
_createWidget: function( options, element ) {
// $.widget.bridge stores the plugin instance, but we do it anyway
// so that it's stored even before the _create function runs
this.element = $( element ).data( this.widgetName, this );
this.options = $.extend( true, {},
this.options,
$.metadata && $.metadata.get( element )[ this.widgetName ],
options );
var self = this;
this.element.bind( "remove." + this.widgetName, function() {
self.destroy();
});
this._create();
this._init();
},
_create: function() {},
_init: function() {},
destroy: function() {
this.element
.unbind( "." + this.widgetName )
.removeData( this.widgetName );
this.widget()
.unbind( "." + this.widgetName )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetBaseClass + "-disabled " +
this.namespace + "-state-disabled" );
},
widget: function() {
return this.element;
},
option: function( key, value ) {
var options = key,
self = this;
if ( arguments.length === 0 ) {
// don't return a reference to the internal hash
return $.extend( {}, self.options );
}
if (typeof key === "string" ) {
if ( value === undefined ) {
return this.options[ key ];
}
options = {};
options[ key ] = value;
}
$.each( options, function( key, value ) {
self._setOption( key, value );
});
return self;
},
_setOption: function( key, value ) {
this.options[ key ] = value;
if ( key === "disabled" ) {
this.widget()
[ value ? "addClass" : "removeClass"](
this.widgetBaseClass + "-disabled" + " " +
this.namespace + "-state-disabled" )
.attr( "aria-disabled", value );
}
return this;
},
enable: function() {
return this._setOption( "disabled", false );
},
disable: function() {
return this._setOption( "disabled", true );
},
_trigger: function( type, event, data ) {
var callback = this.options[ type ];
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
data = data || {};
// copy original event properties over to the new event
// this would happen if we could call $.event.fix instead of $.Event
// but we don't have a way to force an event to be fixed multiple times
if ( event.originalEvent ) {
for ( var i = $.event.props.length, prop; i; ) {
prop = $.event.props[ --i ];
event[ prop ] = event.originalEvent[ prop ];
}
}
this.element.trigger( event, data );
return !( $.isFunction(callback) &&
callback.call( this.element[0], event, data ) === false ||
event.isDefaultPrevented() );
}
};
})( jQuery );
/*!
* jQuery UI Widget 1.8
*
* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Widget
*/
(function( $ ) {
var _remove = $.fn.remove;
$.fn.remove = function( selector, keepData ) {
return this.each(function() {
if ( !keepData ) {
if ( !selector || $.filter( selector, [ this ] ).length ) {
$( "*", this ).add( this ).each(function() {
$( this ).triggerHandler( "remove" );
});
}
}
return _remove.call( $(this), selector, keepData );
});
};
$.widget = function( name, base, prototype ) {
var namespace = name.split( "." )[ 0 ],
fullName;
name = name.split( "." )[ 1 ];
fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[ ":" ][ fullName ] = function( elem ) {
return !!$.data( elem, name );
};
$[ namespace ] = $[ namespace ] || {};
$[ namespace ][ name ] = function( options, element ) {
// allow instantiation without initializing for simple inheritance
if ( arguments.length ) {
this._createWidget( options, element );
}
};
var basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
// $.each( basePrototype, function( key, val ) {
// if ( $.isPlainObject(val) ) {
// basePrototype[ key ] = $.extend( {}, val );
// }
// });
basePrototype.options = $.extend( {}, basePrototype.options );
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
namespace: namespace,
widgetName: name,
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
widgetBaseClass: fullName
}, prototype );
$.widget.bridge( name, $[ namespace ][ name ] );
};
$.widget.bridge = function( name, object ) {
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = Array.prototype.slice.call( arguments, 1 ),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.extend.apply( null, [ true, options ].concat(args) ) :
options;
// prevent calls to internal methods
if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
return returnValue;
}
if ( isMethodCall ) {
this.each(function() {
var instance = $.data( this, name ),
methodValue = instance && $.isFunction( instance[options] ) ?
instance[ options ].apply( instance, args ) :
instance;
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue;
return false;
}
});
} else {
this.each(function() {
var instance = $.data( this, name );
if ( instance ) {
if ( options ) {
instance.option( options );
}
instance._init();
} else {
$.data( this, name, new object( options, this ) );
}
});
}
return returnValue;
};
};
$.Widget = function( options, element ) {
// allow instantiation without initializing for simple inheritance
if ( arguments.length ) {
this._createWidget( options, element );
}
};
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
options: {
disabled: false
},
_createWidget: function( options, element ) {
// $.widget.bridge stores the plugin instance, but we do it anyway
// so that it's stored even before the _create function runs
this.element = $( element ).data( this.widgetName, this );
this.options = $.extend( true, {},
this.options,
$.metadata && $.metadata.get( element )[ this.widgetName ],
options );
var self = this;
this.element.bind( "remove." + this.widgetName, function() {
self.destroy();
});
this._create();
this._init();
},
_create: function() {},
_init: function() {},
destroy: function() {
this.element
.unbind( "." + this.widgetName )
.removeData( this.widgetName );
this.widget()
.unbind( "." + this.widgetName )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetBaseClass + "-disabled " +
this.namespace + "-state-disabled" );
},
widget: function() {
return this.element;
},
option: function( key, value ) {
var options = key,
self = this;
if ( arguments.length === 0 ) {
// don't return a reference to the internal hash
return $.extend( {}, self.options );
}
if (typeof key === "string" ) {
if ( value === undefined ) {
return this.options[ key ];
}
options = {};
options[ key ] = value;
}
$.each( options, function( key, value ) {
self._setOption( key, value );
});
return self;
},
_setOption: function( key, value ) {
this.options[ key ] = value;
if ( key === "disabled" ) {
this.widget()
[ value ? "addClass" : "removeClass"](
this.widgetBaseClass + "-disabled" + " " +
this.namespace + "-state-disabled" )
.attr( "aria-disabled", value );
}
return this;
},
enable: function() {
return this._setOption( "disabled", false );
},
disable: function() {
return this._setOption( "disabled", true );
},
_trigger: function( type, event, data ) {
var callback = this.options[ type ];
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
data = data || {};
// copy original event properties over to the new event
// this would happen if we could call $.event.fix instead of $.Event
// but we don't have a way to force an event to be fixed multiple times
if ( event.originalEvent ) {
for ( var i = $.event.props.length, prop; i; ) {
prop = $.event.props[ --i ];
event[ prop ] = event.originalEvent[ prop ];
}
}
this.element.trigger( event, data );
return !( $.isFunction(callback) &&
callback.call( this.element[0], event, data ) === false ||
event.isDefaultPrevented() );
}
};
})( jQuery );

View file

@ -1,75 +1,75 @@
/**
* @author trixta
*/
(function($){
$.userMode = (function(){
var userBg,
timer,
testDiv,
boundEvents = 0;
function testBg(){
testDiv = testDiv || $('<div></div>').css({position: 'absolute', left: '-999em', top: '-999px', width: '0px', height: '0px'}).appendTo('body');
var black = $.curCSS( testDiv.css({backgroundColor: '#000000'})[0], 'backgroundColor', true),
white = $.curCSS( testDiv.css({backgroundColor: '#ffffff'})[0], 'backgroundColor', true),
newBgStatus = (black === white || white === 'transparent');
if(newBgStatus != userBg){
userBg = newBgStatus;
$.event.trigger('_internalusermode');
}
return userBg;
}
function init(){
testBg();
timer = setInterval(testBg, 3000);
}
function stop(){
clearInterval(timer);
testDiv.remove();
testDiv = null;
}
$.event.special.usermode = {
setup: function(){
(!boundEvents && init());
boundEvents++;
var jElem = $(this)
.bind('_internalusermode', $.event.special.usermode.handler);
//always trigger
setTimeout(function(){
jElem.triggerHandler('_internalusermode');
}, 1);
return true;
},
teardown: function(){
boundEvents--;
(!boundEvents && stop());
$(this).unbind('_internalusermode', $.event.special.usermode.handler);
return true;
},
handler: function(e){
e.type = 'usermode';
e.disabled = !userBg;
e.enabled = userBg;
return jQuery.event.handle.apply(this, arguments);
}
};
return {
get: testBg
};
})();
$.fn.userMode = function(fn){
return this[(fn) ? 'bind' : 'trigger']('usermode', fn);
};
$(function(){
$('html').userMode(function(e){
$('html')[e.enabled ? 'addClass' : 'removeClass']('hcm');
});
});
})(jQuery);
/**
* @author trixta
*/
(function($){
$.userMode = (function(){
var userBg,
timer,
testDiv,
boundEvents = 0;
function testBg(){
testDiv = testDiv || $('<div></div>').css({position: 'absolute', left: '-999em', top: '-999px', width: '0px', height: '0px'}).appendTo('body');
var black = $.curCSS( testDiv.css({backgroundColor: '#000000'})[0], 'backgroundColor', true),
white = $.curCSS( testDiv.css({backgroundColor: '#ffffff'})[0], 'backgroundColor', true),
newBgStatus = (black === white || white === 'transparent');
if(newBgStatus != userBg){
userBg = newBgStatus;
$.event.trigger('_internalusermode');
}
return userBg;
}
function init(){
testBg();
timer = setInterval(testBg, 3000);
}
function stop(){
clearInterval(timer);
testDiv.remove();
testDiv = null;
}
$.event.special.usermode = {
setup: function(){
(!boundEvents && init());
boundEvents++;
var jElem = $(this)
.bind('_internalusermode', $.event.special.usermode.handler);
//always trigger
setTimeout(function(){
jElem.triggerHandler('_internalusermode');
}, 1);
return true;
},
teardown: function(){
boundEvents--;
(!boundEvents && stop());
$(this).unbind('_internalusermode', $.event.special.usermode.handler);
return true;
},
handler: function(e){
e.type = 'usermode';
e.disabled = !userBg;
e.enabled = userBg;
return jQuery.event.handle.apply(this, arguments);
}
};
return {
get: testBg
};
})();
$.fn.userMode = function(fn){
return this[(fn) ? 'bind' : 'trigger']('usermode', fn);
};
$(function(){
$('html').userMode(function(e){
$('html')[e.enabled ? 'addClass' : 'removeClass']('hcm');
});
});
})(jQuery);

View file

@ -1,276 +1,276 @@
/**
* @author alexander.farkas
* @version 1.4.3
*/
(function($){
var supportsValidity;
(function(){
if(!$.prop || supportsValidity){return;}
var supportTest = function(){
supportsValidity = !!$('<input />').prop('validity');
};
supportTest();
$(supportTest);
})();
$.widget('ui.checkBox', {
options: {
hideInput: true,
addVisualElement: true,
addLabel: true
},
_create: function(){
var that = this,
opts = this.options
;
if(!this.element.is(':radio,:checkbox')){
if(this.element[0].elements && $.nodeName(this.element[0], 'form')){
$(this.element[0].elements).filter(':radio,:checkbox').checkBox(opts);
}
return false;
}
this._proxiedReflectUI = $.proxy(this, 'reflectUI');
this.labels = $([]);
this.checkedStatus = false;
this.disabledStatus = false;
this.hoverStatus = false;
this.inputType = this.element[0].type;
this.radio = this.inputType == 'radio';
this.visualElement = $([]);
if (opts.hideInput) {
this.element.addClass('ui-helper-hidden-accessible');
if(opts.addVisualElement){
this.visualElement = $('<span />')
.addClass('ui-'+this.inputType)
;
this.element.after(this.visualElement[0]);
}
}
if(opts.addLabel){
var id = this.element[0].id;
if(id){
this.labels = $('label[for="' + id + '"]', this.element[0].form || this.element[0].ownerDocument).add(this.element.parent('label'));
}
if(!this.labels[0]){
this.labels = this.element.closest('label', this.element[0].form);
}
this.labels.addClass(this.radio ? 'ui-radio' : 'ui-checkbox');
}
this.visualGroup = this.visualElement.add(this.labels);
this._addEvents();
this.initialized = true;
this.reflectUI({type: 'initialreflect'});
return undefined;
},
_addEvents: function(){
var that = this,
opts = this.options,
toggleHover = function(e){
if(that.disabledStatus){
return false;
}
that.hover = (e.type == 'focus' || e.type == 'mouseenter');
if(e.type == 'focus'){
that.visualGroup.addClass(that.inputType +'-focused');
} else if(e.type == 'blur'){
that.visualGroup.removeClass(that.inputType +'-focused');
}
that._changeStateClassChain();
return undefined;
}
;
this.element
.bind('click.checkBox invalid.checkBox', this._proxiedReflectUI)
.bind('focus.checkBox blur.checkBox', toggleHover)
;
if (opts.hideInput){
this.element
.bind('usermode', function(e){
(e.enabled &&
that.destroy.call(that, true));
})
;
}
if(opts.addVisualElement){
this.visualElement
.bind('click.checkBox', function(e){
that.element[0].click();
return false;
})
;
}
this.visualGroup.bind('mouseenter.checkBox mouseleave.checkBox', toggleHover);
},
_changeStateClassChain: function(){
var allElements = this.labels.add(this.visualElement),
stateClass = '',
baseClass = 'ui-'+ this.inputType
;
if(this.checkedStatus){
stateClass += '-checked';
allElements.addClass(baseClass+'-checked');
} else {
allElements.removeClass(baseClass+'-checked');
}
if(this.disabledStatus){
stateClass += '-disabled';
allElements.addClass(baseClass+'-disabled');
} else {
allElements.removeClass(baseClass+'-disabled');
}
if(this.hover){
stateClass += '-hover';
allElements.addClass(baseClass+'-hover');
} else {
allElements.removeClass(baseClass+'-hover');
}
baseClass += '-state';
if(stateClass){
stateClass = baseClass + stateClass;
}
function switchStateClass(){
var classes = this.className.split(' '),
found = false;
$.each(classes, function(i, classN){
if(classN.indexOf(baseClass) === 0){
found = true;
classes[i] = stateClass;
return false;
}
return undefined;
});
if(!found){
classes.push(stateClass);
}
this.className = classes.join(' ');
}
this.visualGroup.each(switchStateClass);
},
destroy: function(onlyCss){
this.element.removeClass('ui-helper-hidden-accessible');
this.visualElement.addClass('ui-helper-hidden');
if (!onlyCss) {
var o = this.options;
this.element.unbind('.checkBox');
this.visualElement.remove();
this.labels
.unbind('.checkBox')
.removeClass('ui-state-hover ui-state-checked ui-state-disabled')
;
}
},
disable: function(status){
if(status === undefined){
status = true;
}
this.element[0].disabled = status;
this.reflectUI({type: 'manuallydisabled'});
},
enable: function(){
this.element[0].disabled = false;
this.reflectUI({type: 'manuallyenabled'});
},
toggle: function(e){
this.changeCheckStatus(!(this.element.is(':checked')), e);
},
changeCheckStatus: function(status, e){
if(e && e.type == 'click' && this.element[0].disabled){
return false;
}
this.element[0].checked = !!status;
this.reflectUI(e || {
type: 'changecheckstatus'
});
return undefined;
},
propagate: function(n, e, _noGroupReflect){
if(!e || e.type != 'initialreflect'){
if (this.radio && !_noGroupReflect) {
var elem = this.element[0];
//dynamic
$('[name="'+ elem.name +'"]', elem.form || elem.ownerDocument).checkBox('reflectUI', e, true);
}
return this._trigger(n, e, {
options: this.options,
checked: this.checkedStatus,
labels: this.labels,
disabled: this.disabledStatus
});
}
return undefined;
},
changeValidityState: function(){
if(supportsValidity){
this.visualGroup[ !this.element.prop('willValidate') || (this.element.prop('validity') || {valid: true}).valid ? 'removeClass' : 'addClass' ](this.inputType +'-invalid');
}
},
reflectUI: function(e){
var oldChecked = this.checkedStatus,
oldDisabledStatus = this.disabledStatus
;
this.disabledStatus = this.element.is(':disabled');
this.checkedStatus = this.element.is(':checked');
if(!e || e.type !== 'initialreflect'){
this.changeValidityState();
}
if (this.disabledStatus != oldDisabledStatus || this.checkedStatus !== oldChecked) {
this._changeStateClassChain();
(this.disabledStatus != oldDisabledStatus &&
this.propagate('disabledchange', e));
(this.checkedStatus !== oldChecked &&
this.propagate('change', e));
}
}
});
if($.propHooks){
$.each({checked: 'changeCheckStatus', disabled: 'disable'}, function(name, fn){
//be hook friendly
if(!$.propHooks[name]){
$.propHooks[name] = {};
}
var oldSetHook = $.propHooks[name].set;
$.propHooks[name].set = function(elem, value){
var widget = $.data(elem, 'checkBox');
if(widget){
widget[fn](!!value);
}
return oldSetHook && oldSetHook(elem, value) ;
};
});
}
})(jQuery);
/**
* @author alexander.farkas
* @version 1.4.3
*/
(function($){
var supportsValidity;
(function(){
if(!$.prop || supportsValidity){return;}
var supportTest = function(){
supportsValidity = !!$('<input />').prop('validity');
};
supportTest();
$(supportTest);
})();
$.widget('ui.checkBox', {
options: {
hideInput: true,
addVisualElement: true,
addLabel: true
},
_create: function(){
var that = this,
opts = this.options
;
if(!this.element.is(':radio,:checkbox')){
if(this.element[0].elements && $.nodeName(this.element[0], 'form')){
$(this.element[0].elements).filter(':radio,:checkbox').checkBox(opts);
}
return false;
}
this._proxiedReflectUI = $.proxy(this, 'reflectUI');
this.labels = $([]);
this.checkedStatus = false;
this.disabledStatus = false;
this.hoverStatus = false;
this.inputType = this.element[0].type;
this.radio = this.inputType == 'radio';
this.visualElement = $([]);
if (opts.hideInput) {
this.element.addClass('ui-helper-hidden-accessible');
if(opts.addVisualElement){
this.visualElement = $('<span />')
.addClass('ui-'+this.inputType)
;
this.element.after(this.visualElement[0]);
}
}
if(opts.addLabel){
var id = this.element[0].id;
if(id){
this.labels = $('label[for="' + id + '"]', this.element[0].form || this.element[0].ownerDocument).add(this.element.parent('label'));
}
if(!this.labels[0]){
this.labels = this.element.closest('label', this.element[0].form);
}
this.labels.addClass(this.radio ? 'ui-radio' : 'ui-checkbox');
}
this.visualGroup = this.visualElement.add(this.labels);
this._addEvents();
this.initialized = true;
this.reflectUI({type: 'initialreflect'});
return undefined;
},
_addEvents: function(){
var that = this,
opts = this.options,
toggleHover = function(e){
if(that.disabledStatus){
return false;
}
that.hover = (e.type == 'focus' || e.type == 'mouseenter');
if(e.type == 'focus'){
that.visualGroup.addClass(that.inputType +'-focused');
} else if(e.type == 'blur'){
that.visualGroup.removeClass(that.inputType +'-focused');
}
that._changeStateClassChain();
return undefined;
}
;
this.element
.bind('click.checkBox invalid.checkBox', this._proxiedReflectUI)
.bind('focus.checkBox blur.checkBox', toggleHover)
;
if (opts.hideInput){
this.element
.bind('usermode', function(e){
(e.enabled &&
that.destroy.call(that, true));
})
;
}
if(opts.addVisualElement){
this.visualElement
.bind('click.checkBox', function(e){
that.element[0].click();
return false;
})
;
}
this.visualGroup.bind('mouseenter.checkBox mouseleave.checkBox', toggleHover);
},
_changeStateClassChain: function(){
var allElements = this.labels.add(this.visualElement),
stateClass = '',
baseClass = 'ui-'+ this.inputType
;
if(this.checkedStatus){
stateClass += '-checked';
allElements.addClass(baseClass+'-checked');
} else {
allElements.removeClass(baseClass+'-checked');
}
if(this.disabledStatus){
stateClass += '-disabled';
allElements.addClass(baseClass+'-disabled');
} else {
allElements.removeClass(baseClass+'-disabled');
}
if(this.hover){
stateClass += '-hover';
allElements.addClass(baseClass+'-hover');
} else {
allElements.removeClass(baseClass+'-hover');
}
baseClass += '-state';
if(stateClass){
stateClass = baseClass + stateClass;
}
function switchStateClass(){
var classes = this.className.split(' '),
found = false;
$.each(classes, function(i, classN){
if(classN.indexOf(baseClass) === 0){
found = true;
classes[i] = stateClass;
return false;
}
return undefined;
});
if(!found){
classes.push(stateClass);
}
this.className = classes.join(' ');
}
this.visualGroup.each(switchStateClass);
},
destroy: function(onlyCss){
this.element.removeClass('ui-helper-hidden-accessible');
this.visualElement.addClass('ui-helper-hidden');
if (!onlyCss) {
var o = this.options;
this.element.unbind('.checkBox');
this.visualElement.remove();
this.labels
.unbind('.checkBox')
.removeClass('ui-state-hover ui-state-checked ui-state-disabled')
;
}
},
disable: function(status){
if(status === undefined){
status = true;
}
this.element[0].disabled = status;
this.reflectUI({type: 'manuallydisabled'});
},
enable: function(){
this.element[0].disabled = false;
this.reflectUI({type: 'manuallyenabled'});
},
toggle: function(e){
this.changeCheckStatus(!(this.element.is(':checked')), e);
},
changeCheckStatus: function(status, e){
if(e && e.type == 'click' && this.element[0].disabled){
return false;
}
this.element[0].checked = !!status;
this.reflectUI(e || {
type: 'changecheckstatus'
});
return undefined;
},
propagate: function(n, e, _noGroupReflect){
if(!e || e.type != 'initialreflect'){
if (this.radio && !_noGroupReflect) {
var elem = this.element[0];
//dynamic
$('[name="'+ elem.name +'"]', elem.form || elem.ownerDocument).checkBox('reflectUI', e, true);
}
return this._trigger(n, e, {
options: this.options,
checked: this.checkedStatus,
labels: this.labels,
disabled: this.disabledStatus
});
}
return undefined;
},
changeValidityState: function(){
if(supportsValidity){
this.visualGroup[ !this.element.prop('willValidate') || (this.element.prop('validity') || {valid: true}).valid ? 'removeClass' : 'addClass' ](this.inputType +'-invalid');
}
},
reflectUI: function(e){
var oldChecked = this.checkedStatus,
oldDisabledStatus = this.disabledStatus
;
this.disabledStatus = this.element.is(':disabled');
this.checkedStatus = this.element.is(':checked');
if(!e || e.type !== 'initialreflect'){
this.changeValidityState();
}
if (this.disabledStatus != oldDisabledStatus || this.checkedStatus !== oldChecked) {
this._changeStateClassChain();
(this.disabledStatus != oldDisabledStatus &&
this.propagate('disabledchange', e));
(this.checkedStatus !== oldChecked &&
this.propagate('change', e));
}
}
});
if($.propHooks){
$.each({checked: 'changeCheckStatus', disabled: 'disable'}, function(name, fn){
//be hook friendly
if(!$.propHooks[name]){
$.propHooks[name] = {};
}
var oldSetHook = $.propHooks[name].set;
$.propHooks[name].set = function(elem, value){
var widget = $.data(elem, 'checkBox');
if(widget){
widget[fn](!!value);
}
return oldSetHook && oldSetHook(elem, value) ;
};
});
}
})(jQuery);

View file

@ -44,20 +44,22 @@ App.Templates.html = {
'<div id="change-psw-block" class="page2">\
<div class="b-auth-form">\
<div class="b-auth-form-wrap">\
<a href="/">\
<img width="72" height="24" alt="" src="~!:LOGO_URL~!" class="vesta-logo">\
</a>\
<span style="color: #5E696B; float: right; margin-top: -48px;">~!:VERSION~!</span>\
<div class="b-client-title">\
<span class="client-title-wrap">~!:PRODUCT_NAME~!<i class="planets">&nbsp;</i></span>\
</div>\
<form id="change_psw-form" method="post" action="#" class="auth">\
<div class="form-row cc">\
<label for="change-email" class="field-label">Email</label>\
<input type="text" tabindex="1" id="change-email" class="field-text">\
<label for="change-login" class="field-label">Login</label>\
<input type="text" tabindex="1" id="change-login" class="field-text">\
</div>\
<div class="form-row cc">\
<label for="captcha" class="field-label">Captcha</label>\
<label class="captcha"><img id="captcha-img" width="127px;" src="~!:CAPTCHA_URL~!" style="cursor: pointer; float: left; margin-top: -7px; padding-left: 20px;" onClick="this.src = \'~!:CAPTCHA_URL_2~!?\'+Math.floor(Math.random() * 9999)"/></label>\
<input type="text" id="captcha" class="field-text" style="margin-left: 11px; width: 132px; margin-bottom: 27px;">\
<input type="text" id="captcha" tabindex=2 class="field-text" style="margin-left: 11px; width: 132px; margin-bottom: 27px;">\
</div>\
<div id="change-psw-success" class="success-box hidden"></div>\
<div id="change-psw-error" class="error-box hidden"></div>\
@ -65,7 +67,7 @@ App.Templates.html = {
<div class="b-remember">\
<span class="remember-me">&nbsp;</span>\
</div>\
<input type="submit" tabindex="4" value="Send confirmation" class="sumbit-btn do_action_do_change_password">\
<input type="submit" tabindex="3" value="Send confirmation" class="sumbit-btn do_action_do_change_password">\
</div>\
</form>\
<p class="forgot-pwd"><a href="#" class="forgot-pwd-url do_action_back_to_login">Back to login?</a></p>\
@ -80,7 +82,9 @@ App.Templates.html = {
login: ['<div id="auth-block" class="page2">\
<div class="b-auth-form">\
<div class="b-auth-form-wrap">\
<a href="/">\
<img width="72" height="24" alt="" src="~!:LOGO_URL~!" class="vesta-logo">\
</a>\
<span style="color: #5E696B; float: right; margin-top: -48px;">~!:VERSION~!</span>\
<div class="b-client-title">\
<span class="client-title-wrap">~!:PRODUCT_NAME~!<i class="planets">&nbsp;</i></span>\

View file

@ -1,3 +1,3 @@
$(document).ready(function(){
$('.cust-checkbox').checkBox();
$(document).ready(function(){
$('.cust-checkbox').checkBox();
});

View file

@ -126,18 +126,18 @@ App.Templates.html = {
</div>\
<div class="form-row cc">\
<input type="hidden" value="~!:DATE~!" name="DATE">\
<label for="#" class="field-label">Domain:</label>\
<input type="text" name="DNS_DOMAIN" value="~!:DNS_DOMAIN~!" class="text-field rule-required rule-domain">\
<label for="dns-domain" class="field-label"><span class="mandatory">Domain:</span></label>\
<input type="text" id="dns-domain" name="DNS_DOMAIN" value="~!:DNS_DOMAIN~!" class="text-field rule-required rule-domain">\
</div>\
<div class="form-row cc">\
<label for="#" class="field-label">IP:</label>\
<label for="ip" class="field-label"><span class="mandatory">IP:</span></label>\
<div class="autocomplete-box">\
<input type="text" name="IP" value="~!:IP~!" class="text-field rule-required rule-ip">\
<input type="text" id="ip" name="IP" value="~!:IP~!" class="text-field rule-required rule-ip">\
<i class="arrow">&nbsp;</i>\
</div>\
</div>\
<div class="form-row dns-template-box cc">\
<label for="#" class="field-label">Template:</label>\
<label for="selecttemplate" class="field-label">Template:</label>\
<span class="select" id="selecttemplate">~!:TPL_DEFAULT_VALUE~! t </span>\
<select name="TPL" class="styled tpl-item">\
~!:TPL~!\
@ -149,8 +149,8 @@ App.Templates.html = {
<input type="text" value="~!:TTL~!" name="TTL" class="text-field ttl-field rule-required rule-numeric">\
</div>\
<div class="form-row cc">\
<label for="#" class="field-label">SOA:</label>\
<input type="text" value="~!:SOA~!" name="SOA" class="text-field rule-required rule-ns">\
<label for="soa" class="field-label"><span class="mandatory">SOA:</span></label>\
<input type="text" value="~!:SOA~!" id="soa" name="SOA" class="text-field rule-required rule-ns">\
</div -->\
<div class="form-row suspended cc">\
<label for="#" class="field-label">Suspended:</label>\
@ -584,8 +584,8 @@ App.Templates.html = {
<span class="prop-value">~!:SHELL~!</span>\
</span>\
<span class="prop-box backups-box">\
<span class="prop-title">backups:</span>\
<span class="prop-value">retention ~!:BACKUPS~!</span>\
<span class="prop-title">backup retention:</span>\
<span class="prop-value">~!:BACKUPS~!</span>\
</span>\ </div>\
</div><!-- // .row-details -->\
</div>']