Index: branches/1.0.x/elements/html_head.elm.tpl =================================================================== diff -u -N -r14747 -r14759 --- branches/1.0.x/elements/html_head.elm.tpl (.../html_head.elm.tpl) (revision 14747) +++ branches/1.0.x/elements/html_head.elm.tpl (.../html_head.elm.tpl) (revision 14759) @@ -14,7 +14,7 @@ - + @@ -32,22 +32,41 @@ + + - - + + + + + + + + + + \ No newline at end of file Index: branches/1.0.x/inc/profile.css =================================================================== diff -u -N -r14708 -r14759 --- branches/1.0.x/inc/profile.css (.../profile.css) (revision 14708) +++ branches/1.0.x/inc/profile.css (.../profile.css) (revision 14759) @@ -51,6 +51,11 @@ font-weight: bold; padding-bottom: 3px; } +.field-content label { + display: inline; + font-weight: normal; + padding: 0; +} .red { color: #cd0000; font-weight: normal; @@ -67,9 +72,9 @@ background: url(@templates_base@/img/bg-field-success.jpg) repeat-x 0 0; border: 1px solid #80d04d; } -.field.statusError { +.field.statusError, .error .field { background: url(@templates_base@/img/bg-field-error.jpg) repeat-x 0 0; - border: 1px solid #d80000; + border: 1px solid #d80000 !important; } .terms { @@ -92,20 +97,22 @@ .password-block p.pasfield2 { padding: 0; } .password-block .field { width: 121px; } #change-password { color: #267bd1; } -#result-password { display: none; font-weight: bold; } + + .colorbar { display: inline-block; height: 8px; width: 29px; } -#result-password .meterDefault { color: #aaa; } -#result-password .meterFail { color: #daa; } -#result-password .meterWarn { color: #fd6; } -#result-password .meterGood { color: #ada; } -#result-password .meterExcel { color: #66c133; } -#result-password .colorbar.meterDefault { background-color: #ddd; } -#result-password .colorbar.meterFail { background-color: #fdd; } -#result-password .colorbar.meterWarn { background-color: #feb; } -#result-password .colorbar.meterGood { background-color: #dfd; } -#result-password .colorbar.meterExcel { background-color: #66c133; } +.password-strength { display: none; font-weight: bold; } +.password-strength .meterDefault { color: #aaa; } +.password-strength .meterFail { color: #daa; } +.password-strength .meterWarn { color: #fd6; } +.password-strength .meterGood { color: #ada; } +.password-strength .meterExcel { color: #66c133; } +.password-strength .colorbar.meterDefault { background-color: #ddd; } +.password-strength .colorbar.meterFail { background-color: #fdd; } +.password-strength .colorbar.meterWarn { background-color: #feb; } +.password-strength .colorbar.meterGood { background-color: #dfd; } +.password-strength .colorbar.meterExcel { background-color: #66c133; } Index: branches/1.0.x/designs/default_design.des.tpl =================================================================== diff -u -N -r14754 -r14759 --- branches/1.0.x/designs/default_design.des.tpl (.../default_design.des.tpl) (revision 14754) +++ branches/1.0.x/designs/default_design.des.tpl (.../default_design.des.tpl) (revision 14759) @@ -6,6 +6,7 @@ + <inp2:m_RenderElement name="page_title" default_element="default_page_title" no_editing="1"/> Index: branches/1.0.x/img/no_picture.gif =================================================================== diff -u -N Binary files differ Index: branches/1.0.x/inc/cart.css =================================================================== diff -u -N -r14708 -r14759 --- branches/1.0.x/inc/cart.css (.../cart.css) (revision 14708) +++ branches/1.0.x/inc/cart.css (.../cart.css) (revision 14759) @@ -175,23 +175,23 @@ width: 150px; } -#result-password { display: none; font-weight: bold; } .colorbar { display: inline-block; height: 8px; width: 29px; } -#result-password .meterDefault { color: #aaa; } -#result-password .meterFail { color: #daa; } -#result-password .meterWarn { color: #fd6; } -#result-password .meterGood { color: #ada; } -#result-password .meterExcel { color: #66c133; } -#result-password .colorbar.meterDefault { background-color: #ddd; } -#result-password .colorbar.meterFail { background-color: #fdd; } -#result-password .colorbar.meterWarn { background-color: #feb; } -#result-password .colorbar.meterGood { background-color: #dfd; } -#result-password .colorbar.meterExcel { background-color: #66c133; } +.password-strength { display: none; font-weight: bold; } +.password-strength .meterDefault { color: #aaa; } +.password-strength .meterFail { color: #daa; } +.password-strength .meterWarn { color: #fd6; } +.password-strength .meterGood { color: #ada; } +.password-strength .meterExcel { color: #66c133; } +.password-strength .colorbar.meterDefault { background-color: #ddd; } +.password-strength .colorbar.meterFail { background-color: #fdd; } +.password-strength .colorbar.meterWarn { background-color: #feb; } +.password-strength .colorbar.meterGood { background-color: #dfd; } +.password-strength .colorbar.meterExcel { background-color: #66c133; } .checkout-form .safe-shop { background: url(@templates_base@/img/safe-shop.jpg) no-repeat 0 40px; Index: branches/1.0.x/inc/js/thickbox/thickbox.js =================================================================== diff -u -N --- branches/1.0.x/inc/js/thickbox/thickbox.js (revision 0) +++ branches/1.0.x/inc/js/thickbox/thickbox.js (revision 14759) @@ -0,0 +1,474 @@ +/* + * Thickbox 3.1 - One Box To Rule Them All. + * By Cody Lindley (http://www.codylindley.com) + * Copyright (c) 2007 cody lindley + * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +// on page load call TB.init +$(document).ready( + function() { + // pass where to apply thickbox + TB.init('a.thickbox, area.thickbox, input.thickbox'); + + // preload image + TB.imgLoader = new Image(); + TB.imgLoader.src = $base_url + 'inc/js/thickbox/loadingAnimation.gif'; + } +); + +function TB () { + this.imgLoader = null; + this.pathToImage = $base_url + 'inc/js/thickbox/loadingAnimation.gif'; + + this.Width = null; + this.Height = null; +} + +//add thickbox to href & area elements that have a class of .thickbox +TB.init = function (domChunk) { + $(domChunk).click( + function() { + var t = this.title || this.name || null; + var a = this.href || this.alt; + var g = this.rel || false; + + TB.show( {caption: t, url: a, imageGroup: g} ); + this.blur(); + return false; + } + ); +} + +// function called when the user clicks on a thickbox link +TB.show = function (params) { + +// caption, url, imageGroup, onDataReceived, onAfterShow, postParams + + try { + if (typeof document.body.style.maxHeight === 'undefined') { + // if IE 6 + $('body', 'html').css( {height: '100%', width: '100%'} ); + $('html').css('overflow', 'hidden'); + + if (document.getElementById('TB_HideSelect') === null) { + // iframe to hide select elements in ie6 + $('body').append("
"); + $('#TB_overlay').click(TB.remove); + } + } else { + // all others + if (document.getElementById('TB_overlay') === null) { + $('body').append("
"); + $('#TB_overlay').click(TB.remove); + } + } + + if (TB.detectMacXFF()) { + $('#TB_overlay').addClass('TB_overlayMacFFBGHack'); // use png overlay so hide flash + } else { + $('#TB_overlay').addClass('TB_overlayBG'); // use background and opacity + } + + if (params.caption === null) { + params.caption = ''; + } + + $('body').append("
"); // add loader to the page + $('#TB_load').show(); // show loader + + var baseURL; + if (params.url.indexOf('?') !== -1) { + // ff there is a query string involved + baseURL = params.url.substr(0, params.url.indexOf('?')); + } else { + baseURL = params.url; + } + + var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; + var url_params = {}; + + if ( baseURL.toLowerCase().match(urlString) ) { + TB.processImages(params, urlString); + } else { + var queryString = params.url.replace(/^[^\?]+\??/,''); + url_params = TB.parseQuery(queryString); + + TB.processDialog(params, url_params); + } + + if (url_params['modal'] != 'true') { + $(document).bind( + 'keyup', + function(e){ + if (e.which == 27){ + // close + TB.remove(); + } + } + ); + } + } catch(e) { + //nothing here + } +} + +// helper functions below +TB.processImages = function (params, urlString) { + // code to show images + var TB_PrevCaption = ''; + var TB_PrevURL = ''; + var TB_PrevHTML = ''; + var TB_NextCaption = ''; + var TB_NextURL = ''; + var TB_NextHTML = ''; + var TB_imageCount = ''; + var TB_FoundURL = false; + + if (params.imageGroup) { + // scan images in group to create Prev/Next links + var TB_TempArray = $('a[rel=' + params.imageGroup + ']').get(); + for (var TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === '')); TB_Counter++) { + var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); + if (!(TB_TempArray[TB_Counter].href == params.url)) { + if (TB_FoundURL) { + TB_NextCaption = TB_TempArray[TB_Counter].title; + TB_NextURL = TB_TempArray[TB_Counter].href; + TB_NextHTML = "  Next >"; + } else { + TB_PrevCaption = TB_TempArray[TB_Counter].title; + TB_PrevURL = TB_TempArray[TB_Counter].href; + TB_PrevHTML = "  < Prev"; + } + } else { + TB_FoundURL = true; + TB_imageCount = 'Image ' + (TB_Counter + 1) + ' of ' + TB_TempArray.length; + } + } + } + + var imgPreloader = new Image(); + $(imgPreloader).bind( + 'load', + function() { + $(this).unbind('load'); + var $image_size = TB.scaleImage.call(TB, this); + + TB.Width = $image_size.width + 30; + TB.Height = $image_size.height + 60; + $('#TB_window').append("" + params.caption + "" + "
" + params.caption + "
" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "
close or Esc Key
"); + $('#TB_closeWindowButton').click(TB.remove); + + if (TB_PrevHTML !== '') { + function goPrev() { + $('#TB_window').remove(); + $('body').append("
"); + TB.show( {caption: TB_PrevCaption, url: TB_PrevURL, imageGroup: params.imageGroup} ); + return false; + } + + $('#TB_prev').click(goPrev); + } + + if (TB_NextHTML !== '') { + function goNext() { + $('#TB_window').remove(); + $('body').append("
"); + TB.show( {caption: TB_NextCaption, url: TB_NextURL, imageGroup: params.imageGroup} ); + return false; + } + + $('#TB_next').click(goNext); + + } + + $(document).bind( + 'keydown', + function(e) { + var keycode = e.which; + + if (keycode == 27) { // close + TB.remove(); + } else if (keycode == 190) { + // display previous image + if (TB_NextHTML != '') { + $(this).unbind('keydown'); + goNext(); + } + } else if (keycode == 188) { + // display next image + if(TB_PrevHTML != ''){ + $(this).unbind('keydown'); + goPrev(); + } + } + } + ); + + // show image after it's loaded + TB.position(); + $('#TB_load').remove(); + $('#TB_ImageOff').click(TB.remove); + $('#TB_window').css('display', 'block'); // for safari using css instead of show + } + ); + + imgPreloader.src = params.url; +} + +TB.scaleImage = function ($image) { + // resizing large images - orginal by Christian Montoya edited by me + var pagesize = TB.getPageSize(); + var x = pagesize[0] - 150; + var y = pagesize[1] - 150; + + var imageWidth = $image.width; + var imageHeight = $image.height; + + if (imageWidth > x) { + imageHeight = imageHeight * (x / imageWidth); + imageWidth = x; + if (imageHeight > y) { + imageWidth = imageWidth * (y / imageHeight); + imageHeight = y; + } + } else if (imageHeight > y) { + imageWidth = imageWidth * (y / imageHeight); + imageHeight = y; + if (imageWidth > x) { + imageHeight = imageHeight * (x / imageWidth); + imageWidth = x; + } + } + + return {width: imageWidth, height: imageHeight}; +} + +TB.processDialog = function (params, url_params) { + // code to show html + + // window size is global + TB.Width = (url_params['width'] * 1) || 630; // 17 - #TB_Window left&right padding + TB.Height = (url_params['height'] * 1) || 440; // 14 - #TB_Window top&bottom padding + + var ajaxContentW = TB.Width /*+ 17*2*/ - (50*2 + 9*2); // #TB_ajaxContent left&right padding - left&right border + var ajaxContentH = TB.Height /*+ 14*2*/ - (40*2 /*+ 9*2*/); // #TB_ajaxContent top&bottom padding + + var $window_title = ''; + + if (params.url.indexOf('TB_iframe') != -1) { + // either iframe or ajax window + urlNoQuery = params.url.split('TB_'); + $('#TB_iframeContent').remove(); + + if (url_params['modal'] != 'true') { + // iframe no modal + $window_title = "
" + params.caption + "
close or Esc Key
"; + + $('#TB_window').append($window_title + ""); + }else{ + // iframe modal + $('#TB_overlay').unbind(); + $('#TB_window').append(""); + } + } else { + // not an iframe, ajax + if ($('#TB_window').css('display') != 'block') { + if (url_params['modal'] != 'true') { + // ajax no modal +// $window_title = "
" + params.caption + "
close or Esc Key
"; + $window_title = "
close [Esc]
"; + + $('#TB_window').append($window_title + "
"); + } else { + // ajax modal + $('#TB_overlay').unbind(); + $('#TB_window').append("
"); + } + } else { + // this means the window is already up, we are just loading new content via ajax + $('#TB_ajaxContent')[0].style.width = ajaxContentW + 'px'; + $('#TB_ajaxContent')[0].style.height = ajaxContentH + 'px'; + $('#TB_ajaxContent')[0].scrollTop = 0; + $('#TB_ajaxWindowTitle').html(params.caption); + } + } + + $('#TB_closeWindowButton').click(TB.remove); + + if (params.url.indexOf('TB_inline') != -1) { + $('#TB_ajaxContent').html( $('#' + url_params['inlineId']).html() ); + $('#TB_window').unload( + function () { + // move elements back when you're finished + $('#' + url_params['inlineId']).html( $('#TB_ajaxContent').html() ); + } + ); + + TB.position(); + $('#TB_load').remove(); + $('#TB_window').css('display', 'block'); + } else if (params.url.indexOf('TB_iframe') != -1) { + TB.position(); + + if ($.browser.safari) { + // safari needs help because it will not fire iframe onload + $('#TB_load').remove(); + $('#TB_window').css('display', 'block'); + } + } else { + var $content_url = params.url + '&random=' + (new Date().getTime()); + + if (params.postParams === undefined) { + $.get( + $content_url, + function ($data) { + TB.onDataReceived($data, params); + } + ); + } + else { + $.post( + $content_url, + params.postParams, + function ($data) { + TB.onDataReceived($data, params); + } + ); + } + + /*$('#TB_ajaxContent').load( + params.url += '&random=' + (new Date().getTime()), + params.postParams, + function() { + //to do a post change this load method + TB.position(); + $('#TB_load').remove(); + TB.init('#TB_ajaxContent a.thickbox'); + $('#TB_window').css('display', 'block'); + + if ( $.isFunction(params.showCallback) ) { + params.showCallback(); + } + } + );*/ + } +} + +TB.parseRedirect = function ($data) { + var $match_redirect = new RegExp('^#redirect#(.*?)($|\\s.*)').exec($data); + if ($match_redirect != null) { + // redirect to external template requested + return $match_redirect[1]; + } + + return false; +} + +TB.onDataReceived = function ($data, $params) { + if ( $.isFunction($params.onDataReceived) ) { + $data = $params.onDataReceived($data); + if ($data === false) { + // this callback even could prevent redirect action + // callback requested to stop processing + return ; + } + } + + var $redirect = TB.parseRedirect($data); + if ($redirect !== false) { + window.location.href = $redirect; + return ; + } + + $('#TB_ajaxContent').html($data); + + TB.position(); + $('#TB_load').remove(); + TB.init('#TB_ajaxContent a.thickbox'); + $('#TB_window').css('display', 'block'); + + if ( $.isFunction($params.onAfterShow) ) { + $params.onAfterShow(); + } +} + +TB.showIframe = function () { + $('#TB_load').remove(); + $('#TB_window').css('display', 'block'); +} + +TB.remove = function () { + $('#TB_imageOff').unbind('click'); + $('#TB_closeWindowButton').unbind('click'); + + $('#TB_window').fadeOut( + 'fast', + function(){ + $('#TB_window,#TB_overlay,#TB_HideSelect').trigger('unload').unbind().remove(); + } + ); + + $('#TB_load').remove(); + if (typeof document.body.style.maxHeight == 'undefined') { + // if IE 6 + $('body','html').css( {height: 'auto', width: 'auto'} ); + $('html').css('overflow', ''); + } + + $(document).unbind('keydown').unbind('keyup'); + + return false; +} + +TB.position = function () { + $('#TB_window').css( {marginLeft: '-' + parseInt(TB.Width / 2) + 'px', width: TB.Width + 'px'} ); + + if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { + // take away IE6 + $('#TB_window').css( {marginTop: '-' + parseInt(TB.Height / 2) + 'px'} ); + } +} + +TB.parseQuery = function (query) { + var Params = {}; + if (!query) { + // return empty object + return Params; + } + + var Pairs = query.split(/[;&]/); + + for (var i = 0; i < Pairs.length; i++ ) { + var KeyVal = Pairs[i].split('='); + if (!KeyVal || KeyVal.length != 2) { + continue; + } + + var key = unescape( KeyVal[0] ); + var val = unescape( KeyVal[1] ); + val = val.replace(/\+/g, ' '); + Params[key] = val; + } + + return Params; +} + +TB.getPageSize = function () { + var de = document.documentElement; + var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth; + var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight; + + return [w, h]; +} + +TB.detectMacXFF = function () { + var userAgent = navigator.userAgent.toLowerCase(); + if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox') != -1) { + return true; + } + + return false; +} + + Index: branches/1.0.x/elements/header.elm.tpl =================================================================== diff -u -N -r14754 -r14759 --- branches/1.0.x/elements/header.elm.tpl (.../header.elm.tpl) (revision 14754) +++ branches/1.0.x/elements/header.elm.tpl (.../header.elm.tpl) (revision 14759) @@ -51,7 +51,8 @@ -
Welcome! Please Register for an account or +
+ Welcome! Please Register for an account or @@ -76,10 +77,10 @@ Items: $1,759.99 | - Checkout + Checkout
- +
- +
Index: branches/1.0.x/inc/js/passwordStrengthMeter.js =================================================================== diff -u -N -r14600 -r14759 --- branches/1.0.x/inc/js/passwordStrengthMeter.js (.../passwordStrengthMeter.js) (revision 14600) +++ branches/1.0.x/inc/js/passwordStrengthMeter.js (.../passwordStrengthMeter.js) (revision 14759) @@ -1,70 +1,138 @@ -var shortPass = ' Too Short Password' -var badPass = ' Week; Use letters & numbers' -var goodPass = ' Medium; Use special charecters' -var strongPass = ' Strong Password' +function PasswordStrengthMeter($settings) { + this.inputSelector = ''; -function passwordStrength(password) -{ - score = 0 - - //password < 4 - if (password.length < 4 ) { return shortPass } + this.phrases = { + 'short': 'Too Short Password', + 'bad': 'Week; Use letters & numbers', + 'good': 'Medium; Use special characters', + 'strong': 'Strong Password' + }; - //password length - score += password.length * 4 - score += ( checkRepetition(1,password).length - password.length ) * 1 - score += ( checkRepetition(2,password).length - password.length ) * 1 - score += ( checkRepetition(3,password).length - password.length ) * 1 - score += ( checkRepetition(4,password).length - password.length ) * 1 + this.cssClasses = { + 'short': 'meterFail', + 'bad': 'meterWarn', + 'good': 'meterGood', + 'strong': 'meterExcel' + }; - //password has 3 numbers - if (password.match(/(.*[0-9].*[0-9].*[0-9])/)) score += 5 - - //password has 2 sybols - if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) score += 5 - - //password has Upper and Lower chars - if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) score += 10 - - //password has number and chars - if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) score += 15 - // - //password has number and symbol - if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/)) score += 15 - - //password has char and symbol - if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/)) score += 15 - - //password is just a nubers or chars - if (password.match(/^\w+$/) || password.match(/^\d+$/) ) score -= 10 - - //verifing 0 < score < 100 - if ( score < 0 ) score = 0 - if ( score > 100 ) score = 100 - - if (score < 34 ) return badPass - if (score < 68 ) return goodPass - return strongPass + $.extend(true, this, $settings); + + var $me = this; + + $(document).ready( + function() { + $($me.inputSelector).keyup( + function($e) { + $($me.inputSelector + '_strength') + .html( $me.getStrengthHTML( $(this).val() ) ) + .show(); + } + ); + } + ); } -// checkRepetition(1,'aaaaaaabcbc') = 'abcbc' -// checkRepetition(2,'aaaaaaabcbc') = 'aabc' -// checkRepetition(2,'aaaaaaabcdbcd') = 'aabcd' +PasswordStrengthMeter.prototype.getStrength = function (password) { + var score = 0; -function checkRepetition(pLen,str) { - res = "" - for ( i=0; i 100) { + score = 100; + } + + if (score < 34) { + return 'bad'; + } + + if (score < 68) { + return 'good'; + } + + return 'strong'; +} + +PasswordStrengthMeter.prototype.getStrengthHTML = function (password) { + var $strength = this.getStrength(password), + $css_class = this.cssClasses[$strength], + $phrase = this.phrases[$strength]; + + return ' ' + $phrase + ''; +} + +PasswordStrengthMeter.prototype.checkRepetition = function(pLen, str) { + var res = "", + repeated = true; + + for (i = 0; i < str.length; i++) { + repeated = true; + + for (j = 0; j < pLen && (j + i + pLen) < str.length; j++) { + repeated = repeated && (str.charAt(j + i) == str.charAt(j + i + pLen)); + } + + if (j < pLen) { + repeated = false; + } + + if (repeated) { + i += pLen - 1; + repeated = false; + } + else { + res += str.charAt(i); + } + } + + return res; } \ No newline at end of file Index: branches/1.0.x/inc/js/jquery.scripts.js =================================================================== diff -u -N -r14754 -r14759 --- branches/1.0.x/inc/js/jquery.scripts.js (.../jquery.scripts.js) (revision 14754) +++ branches/1.0.x/inc/js/jquery.scripts.js (.../jquery.scripts.js) (revision 14759) @@ -1,3 +1,7 @@ +function jq($selector) { + return $selector.replace(/(\[|\]|\.)/g, '\\$1'); +} + function DBlocks() { var $me = this; this.selectors = ['#lang', '#currency', '#login', '#login-alt']; @@ -71,16 +75,6 @@ return false; } ); - - $('#password').keyup( - function($e) { - var $password = $('#password').val(); - - $('#result-password') - .html( passwordStrength($password) ) - .show(); - } - ); }); new DBlocks(); \ No newline at end of file Index: branches/1.0.x/inc/js/thickbox/loadingAnimation.gif =================================================================== diff -u -N Binary files differ Index: branches/1.0.x/login/register.tpl =================================================================== diff -u -N --- branches/1.0.x/login/register.tpl (revision 0) +++ branches/1.0.x/login/register.tpl (revision 14759) @@ -0,0 +1,81 @@ + + + + + + + +
+
+

Registration

+

Required fields are marked by *

+
+
+ +
+
+ + + + + + +
+ +
+ + + + + + + + +
+
+ +
+ +
+ + +     + + + + +
+
+ + Index: branches/1.0.x/inc/js/thickbox/thickbox.css =================================================================== diff -u -N --- branches/1.0.x/inc/js/thickbox/thickbox.css (revision 0) +++ branches/1.0.x/inc/js/thickbox/thickbox.css (revision 14759) @@ -0,0 +1,176 @@ +/* ----------------------------------------------------------------------------------------------------------------*/ +/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/ +/* ----------------------------------------------------------------------------------------------------------------*/ +*{padding: 0; margin: 0;} + +/* ----------------------------------------------------------------------------------------------------------------*/ +/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ +/* ----------------------------------------------------------------------------------------------------------------*/ +/*#TB_window { + font: 12px Arial, Helvetica, sans-serif; + color: #333333; +}*/ + +#TB_secondLine { + font: 10px Arial, Helvetica, sans-serif; + color:#666666; +} + +#TB_window a:link {color: #666666;} +#TB_window a:visited {color: #666666;} +#TB_window a:hover {color: #000;} +#TB_window a:active {color: #666666;} +#TB_window a:focus{color: #666666;} + +/* ----------------------------------------------------------------------------------------------------------------*/ +/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ +/* ----------------------------------------------------------------------------------------------------------------*/ +#TB_overlay { + position: fixed; + z-index:100; + top: 0px; + left: 0px; + height:100%; + width:100%; +} + +.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;} +.TB_overlayBG { + background-color:#000; + filter:alpha(opacity=75); + -moz-opacity: 0.75; + opacity: 0.75; +} + +* html #TB_overlay { /* ie6 hack */ + position: absolute; + height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); +} + +#TB_window { + /*position: fixed;*/ + position: absolute; + background-color: #ffffff; + z-index: 102; + display: none; + border: 1px solid #404040; + border-radius: 3px; + text-align: left; + top: 50%; + left: 50%; + padding: 14px 17px; + font-size: 1em; +} + +* html #TB_window { /* ie6 hack */ +position: absolute; +margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); +} + +#TB_window img#TB_Image { + display:block; + margin: 15px 0 0 15px; + border-right: 1px solid #ccc; + border-bottom: 1px solid #ccc; + border-top: 1px solid #666; + border-left: 1px solid #666; +} + +#TB_caption{ + height:25px; + padding:7px 30px 10px 25px; + float:left; +} + +#TB_closeWindow{ + height:25px; + padding:11px 25px 10px 0; + float:right; +} + +#TB_closeAjaxWindow{ + background: url("@templates_base@/img/modal/close.png") no-repeat scroll 100% 0 transparent; + color: #5A5A5A; + cursor: pointer; + font: bold 11px Arial; + height: 15px; + padding-right: 20px; + position: absolute; + right: 30px; + text-align: right; + top: 30px; + width: 100px; + +} + +#TB_ajaxWindowTitle{ + float:left; + padding:7px 0 5px 10px; + margin-bottom:1px; + font-weight: bold; +} + +#TB_title{ + background-color:#e8e8e8; + height:27px; +} + +#TB_ajaxContent{ + clear: both; + border: 9px solid #E6E6E6; + padding: 40px 50px; + overflow: auto; + text-align: left; + line-height: 1.4em; +} + +#TB_ajaxContent.TB_modal{ + padding:15px; +} + +/*#TB_ajaxContent p{ + padding:5px 0px 5px 0px; +}*/ + +#TB_load{ + position: fixed; + display:none; + height:13px; + width:208px; + z-index:103; + top: 50%; + left: 50%; + margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ +} + +* html #TB_load { /* ie6 hack */ +position: absolute; +margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); +} + +#TB_HideSelect{ + z-index:99; + position:fixed; + top: 0; + left: 0; + background-color:#fff; + border:none; + filter:alpha(opacity=0); + -moz-opacity: 0; + opacity: 0; + height:100%; + width:100%; +} + +* html #TB_HideSelect { /* ie6 hack */ + position: absolute; + height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); +} + +#TB_iframeContent{ + clear:both; + border:none; + margin-bottom:-1px; + margin-top:1px; + _margin-bottom:1px; +} Index: branches/1.0.x/inc/js/form_manager.js =================================================================== diff -u -N --- branches/1.0.x/inc/js/form_manager.js (revision 0) +++ branches/1.0.x/inc/js/form_manager.js (revision 14759) @@ -0,0 +1,507 @@ +function FormManager() { } + +FormManager.init = function ($settings) { + $.ajaxSetup( {cache: false} ); + + this.url = ''; + this.fieldMask = '#PREFIX#[#ID#][#FIELD_NAME#]'; + + this.noErrorsHTML = '' + this.checkTimeout = 1000; + this.pendingChecks = {}; + + this.fields = {}; + this.fieldTypes = {}; + this.forms = {}; + this.fieldWatermarks = {}; + + this.xhrRequests = []; + + $.extend(this, $settings); +} + +FormManager.resetFields = function ($prefix) { + this.fields[$prefix] = []; +} + +FormManager.registerField = function ($prefix, $field, $watermark, $field_type) { + // fields are registered before form -> store them in separate array + if (!this.fields[$prefix]) { + this.fields[$prefix] = []; + } + + if ($watermark === undefined) { + $watermark = ''; + } + + this.fieldWatermarks[$prefix + '_' + $field] = $watermark; + + this.fields[$prefix].push($field); + + if ($field_type !== undefined) { + this.fieldTypes[$prefix + '_' + $field] = $field_type; + } +} + +FormManager.getFieldMask = function ($prefix) { + return this.fieldMask.replace('#PREFIX#', $prefix).replace('#ID#', this.form_param($prefix, 'id')); +} + +FormManager.getField = function ($prefix, $field, $prepend, $append) { + if ($prepend === undefined) { + $prepend = ''; + } + + if ($append === undefined) { + $append = ''; + } + + var $control_id = this.getFieldMask($prefix).replace('#FIELD_NAME#', $field); + + return document.getElementById($prepend + $control_id + $append); +} + +FormManager.getBlurFields = function ($prefix, $field) { + var $field_mask = this.getFieldMask($prefix); + + switch ( this.fieldTypes[$prefix + '_' + $field] ) { + case 'swf_upload': + return this.getField($prefix, $field, undefined, '[tmp_names]'); + break; + + case 'date': + $field += '_date'; + break; + + case 'radio': + return $("input[name='" + jq($field_mask.replace('#FIELD_NAME#', $field)) + "']"); + break; + + case 'checkbox': + return get_control($field_mask, $field, undefined, '_cb'); + break; + + case 'checkboxes': + return $("input[id^='" + jq($field_mask.replace('#FIELD_NAME#', $field)) + "_']"); + break; + } + + return this.getField($prefix, $field); +} + +FormManager.registerForm = function ($settings) { + var $defaults = { + url: false, // url for form submission + prefix: '', // unit prefix, used in the form + enabled: true, // form submit enabled + enabledTimer: null, // timer that performs form-resubmit countdown + save_event: '', // event to use for form data processing + id: 0, // id of item being add/edited on a form + form_id: '', // form id to work with + before_close: '', // before window close callback + validation_failure: '', // on validate failure callback + immediate_validation: true // perfom validation on blur + } + + this.forms[$settings.prefix] = {}; + $.extend(this.forms[$settings.prefix], $defaults, $settings); + + // when form is registred, then all it's fields should also be registred + + if ( !this.form_param($settings.prefix, 'immediate_validation') ) { + return ; + } + + var $me = this; + + $( this.fields[$settings.prefix] ).each( + function () { + $( $me.getBlurFields($settings.prefix, this) ).blur( + function ($e) { + $me.checkField(this); + } + ); + } + ); + + $('input[title], select[title], textarea[title]', '#' + this.forms[$settings.prefix].form_id).qtip( + { + style: { + classes: 'ui-tooltip-light ui-tooltip-shadow' + }, + position: { + my: 'left center', + at: 'right center' + }, + show: { + event: 'focus' + } + } + ); + + $('img.help-icon', '#' + this.forms[$settings.prefix].form_id ).qtip( + { + style: { + classes: 'ui-tooltip-light ui-tooltip-shadow' + }, + position: { + my: 'bottom left', + at: 'top center' + } + } + ); +} + +FormManager.getURL = function ($prefix, $template, $event, $params) { + var $url = this.form_param($prefix, 'url'); + + if (!$url) { + $url = this.url; + } + + if ($template === undefined) { + $template = ''; + } + + $url = $url.replace('#TEMPLATE#', $template); + + if ($event !== undefined) { + $url += ($url.indexOf('?') == -1 ? '?' : '&') + 'events[' + $prefix + ']=' + $event; + } + + if ( typeof($params) == 'object' ) { + for (key in $params) { + $url += ($url.indexOf('?') == -1 ? '?' : '&') + key + '=' + $params[key]; + } + } + + return $url; +} + +FormManager.processResponse = function ($prefix, $data, $add_params) { + // enable form back +// alert('enabling for for [' + $prefix + '] in processResponse'); + + if ( $add_params !== undefined ) { + $add_params.response = $data; + } + else { + $add_params = {response: $data}; + } + + this.clearErrors($prefix); + + if ($data.status == 'OK') { + var $next_template = this.getNextTemplate($prefix, $data); + + if ( $next_template || $data.do_refresh ) { + var $before_close = this.getFormParamOverride($prefix, 'before_close', $add_params); + + if ( $.isFunction($before_close) ) { + $before_close.call(this, $data, $add_params); + } + + if ( $next_template ) { + // load another template instead of current form + $('#TB_ajaxContent').html('').load( this.getURL($prefix, $next_template, undefined, $data.params) ); + } + else if ( $data.do_refresh ) { + // refresh whole page + window.location.href = window.location.href; + } + } + else { + // close form without refreshing the page + this.closeForm($prefix, $data, $add_params); + } + } + else { + // set new errors + for ($field in $data.field_errors) { + this.setFieldStatus($prefix, $field, $data.field_errors[$field]); + } + + var $validation_failure = this.form_param($prefix, 'validation_failure'); + + if ( $.isFunction($validation_failure) ) { + $validation_failure.call(this, $data, $add_params); + } + } + + this.enableForm($prefix, true); + +// var $me = this; +// setTimeout(function () { $me.enableForm($prefix, true); }, 1000); +} + +/** + * Clear errors from all from fields + * + * @param $prefix + */ +FormManager.clearErrors = function ($prefix) { + var $fields = this.fields[$prefix]; + + if (typeof($fields) == 'undefined') { + $fields = []; + } + + for (var $i = 0; $i < $fields.length; $i++) { + this.setFieldStatus($prefix, $fields[$i]); + } +} + +FormManager.getNextTemplate = function ($prefix, $responce) { + if ( $responce.next_template && $responce.next_template != '' ) { + return $responce.next_template; + } + else if ( this.form_param($prefix, 'next_template') ) { + return this.form_param($prefix, 'next_template'); + } + + return false; +} + +FormManager.setFieldStatus = function ($prefix, $field_name, $error_msg) { + var field_cell = this.getField($prefix, $field_name, undefined, '_field_cell'); + var status_cell = this.getField($prefix, $field_name, undefined, '_status_cell'); + + if (!field_cell) { + alert('Error field "' + $field_name + '" missing.'); + return ; + } + + if ($error_msg === undefined || !$error_msg) { + // show OK + $(field_cell).parents('p:first').removeClass('error'); //.addClass('ok'); + $(status_cell)/*.removeClass('field-error')*/.html(this.noErrorsHTML); + + var $fields = this.fields[$prefix]; + + for (var $i = 0; $i < $fields.length; $i++) { + if ( this.fieldHasError($prefix, $fields[$i]) ) { + return ; + } + } + } + else { + // show error message + $(field_cell).parents('p:first')/*.removeClass('ok')*/.addClass('error'); + $(status_cell)/*.addClass('field-error')*/.html($error_msg); + } +} + +FormManager.fieldHasError = function ($prefix, $field) { + var status_cell = this.getField($prefix, $field, undefined, '_status_cell'); + + return $.trim( $(status_cell).html() ) != $.trim( this.noErrorsHTML ); +} + +FormManager.checkField = function ($input, $delayed) { + if ( !$input.id.match(/^(.*?)\[.*?\]\[(.*?)\].*?$/) ) { + return ; + } + + var $prefix = RegExp.$1; + var $field = RegExp.$2.replace(/(_date|_time)$/, ''); + + if ( this.pendingChecks[$field] ) { + clearTimeout( this.pendingChecks[$field] ); + delete this.pendingChecks[$field]; + } + + var $me = this; + + this.pendingChecks[$field] = setTimeout( + function () { + $me.validateField($prefix, $field, $input) + }, + ($delayed === true ? this.checkTimeout : 0) + ); +} + +FormManager.validateField = function ($prefix, $field, $input) { + var $me = this; + var form = document.getElementById( this.form_param($prefix, 'form_id') ); + + var $request = $.post( + this.getURL($prefix, undefined, 'OnValidateField') + '&field=' + encodeURIComponent($field) + '&' + $input.name + '=' + encodeURIComponent($input.value), + $(form).serialize(), + function ($data) { + $data = eval('(' + $data + ')'); + $me.setFieldStatus($prefix, $field, $data.status == 'OK' ? undefined : $data.status); + } + ); + + this.xhrRequests.push($request); +}; + +FormManager.form_param = function ($prefix, $param, $value) { + if ($value === undefined) { + return this.forms[$prefix][$param]; + } + + this.forms[$prefix][$param] = $value; +} + +FormManager.getFormParamOverride = function ($prefix, $param, $overrides) { + if ( $overrides[$param] !== undefined ) { + return $overrides[$param]; + } + + return this.form_param($prefix, $param); +} + +/* === related to form opening/closing/submitting === */ +FormManager.openForm = function ($prefix, $template, $width, $height, $source_form, $params) { + var $url = this.getURL($prefix, $template, undefined, $params); + + $url += ($url.indexOf('?') == -1 ? '?' : '&') + 'width=' + $width + '&height=' + $height + '&modal=true'; + + var $tb_settings = {url: $url}; + + if ($source_form !== undefined) { + $tb_settings.postParams = $($source_form).serialize(); + } + + TB.show($tb_settings); +} + +FormManager.validateAll = function ($prefix, $status) { + var $fields = this.fields[$prefix]; + + for (var $i = 0; $i < $fields.length; $i++) { + this.setFieldStatus($prefix, $fields[$i], $status); + } +} + +FormManager.closeForm = function ($prefix, $data, $add_params) { + if ( $data === undefined ) { + $data = {}; + } + + if ( $add_params === undefined ) { + $add_params = {}; + } + + var $before_close = this.getFormParamOverride($prefix, 'before_close', $add_params); + + this.cancelXHRRequests(); + this.validateAll($prefix); + + if ( $.isFunction($before_close) ) { + var $result = $before_close.call(this, $data, $add_params); + + if ($result === false) { + return; + } + } + + TB.remove(); +} + +FormManager._getFormFields = function ($prefix) { + var $fields = this.fields[$prefix]; + + if (typeof($fields) == 'undefined') { + $fields = []; + } + + // remove watermakrs from input fields + for (var $i = 0; $i < $fields.length; $i++) { + var $control = this.getField($prefix, $fields[$i]); + var $watermark = this.fieldWatermarks[ $prefix + '_' + $fields[$i] ]; + + if ($control && $watermark !== undefined && $control.value == $watermark) { + $control.value = ''; + } + } + + var form = document.getElementById( this.form_param($prefix, 'form_id') ); + var $form_fields = $(form).serialize(); + + // restore watermarks in input fields + for (var $i = 0; $i < $fields.length; $i++) { + var $control = this.getField($prefix, $fields[$i]); + var $watermark = this.fieldWatermarks[$prefix + '_' + $fields[$i]]; + + if ($control && $watermark !== undefined && !$control.value) { + $control.value = $watermark; + } + } + + return $form_fields; +} + +FormManager.enableForm = function ($prefix, $enabled) { + if ($enabled === undefined) { + $enabled = true; + } + + if ($enabled) { + clearTimeout( this.form_param($prefix, 'enabledTimer') ); + this.form_param($prefix, 'enabledTimer', null); + } + else { + var $me = this; + + // set timer for 10 seconds to enable form back (just in case if ajax responce fails) + var $timer = setTimeout( + function () { +// alert('enabling for for [' + $prefix + '] in setTimeout'); + $me.enableForm($prefix, true); + } + , 10000 + ); + + this.form_param($prefix, 'enabledTimer', $timer); + } + + this.form_param($prefix, 'enabled', $enabled); +} + +FormManager.cancelXHRRequests = function () { + while ( this.xhrRequests.length > 0 ) { + this.xhrRequests.shift().abort(); + } +} + +FormManager.submitForm = function ($prefix, $add_params) { + if ( !this.form_param($prefix, 'enabled') ) { + return ; + } + + // disable form + this.enableForm($prefix, false); + + var $me = this; + this.cancelXHRRequests(); + + $.post( + this.getURL( $prefix, '', this.form_param($prefix, 'save_event') ), + this._getFormFields($prefix), + function ($data) { + var $redirect = TB.parseRedirect($data); + + if ( $redirect !== false ) { + window.location.href = $redirect; + + return ; + } + + $me.processResponse($prefix, eval('(' + $data + ')'), $add_params); + } + ) +} + +FormManager.beforeClose = function () { + this.cancelXHRRequests(); + + for (var $prefix in this.forms) { + var $before_close = this.form_param($prefix, 'before_close'); + + if ( $.isFunction($before_close) ) { + $before_close.call(this, {}, {}); + } + } +} \ No newline at end of file Index: branches/1.0.x/elements/forms.elm.tpl =================================================================== diff -u -N --- branches/1.0.x/elements/forms.elm.tpl (revision 0) +++ branches/1.0.x/elements/forms.elm.tpl (revision 14759) @@ -0,0 +1,386 @@ + + + + + +

+ + +
+ + +

+ +

+
+
+ + + + + + + + + + + + + + + + + + + +

+ + + + + + + +    + + + +

+
+ + + + + + + + + + + + + + + + + title="" + + name="" + id="" + value="" + tabindex="" + + maxlength="" + + style="" + /> + + + + + + + title="" + + name="" + id="" + value="" + tabindex="" + + maxlength="" + + style="" + />
+ + + title="" + + name="" + id="" + value="" + tabindex="" + + maxlength="" + + style="" + /> +
+
+ + + + + + + +
+ + + title="" + + name="" + id="" + value="" + tabindex="" + style="" + /> + + + + + title="" + + name="" + id="" + value="" + tabindex="" + style="" + /> + + +
+ +
Enter your password
+ + + + + +
+
+ + + + + title="" + + name="" + tabindex="" + style="" + /> + + () + + [upload]" value="" /> + + + + + " id="" value="" /> + + + + + " + id="" + value="" + tabindex="" + size="" + style="" + datepickerIcon="img/calendar_icon.gif" + /> + + " id="" value="" /> + + + + + + + + + + " id="" value="" /> + + + + + + " + id="" + value="" + tabindex="" + size="" + style="" + datepickerIcon="core/admin_templates/img/calendar_icon.gif" + /> + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + " style="" name="" id="_" value="">
  
+
+ + + " style="" name="" id="_" value="">
  
+
+ + + + + + + + + + + + + + " alt=""/>
+
+ " id="" value="" tabindex="" style=""/> +
+
+ + + + " name="" value="" /> + " type="checkbox" id="_cb_" name="_cb_" style="" onchange="update_checkbox(this, document.getElementById(''));"> + + + + +   id="_" value="" onclick="update_checkbox_options(/^_([0-9A-Za-z-]+)/, '');">
  
+
+ + +   id="_" value="" onclick="update_checkbox_options(/^_([0-9A-Za-z-]+)/, '');">
  
+
+ + + + + + + + + + + + \ No newline at end of file