Author: mgallegos Date: 2013-02-04 23:42:27 +0100 (Mon, 04 Feb 2013) New Revision: 600 Modified: trunk/src/mc-dia-form2.js Log: CLOSED - Defect #500: The RC areas should be disabled until I click Yes/No Modified: trunk/src/mc-dia-form2.js =================================================================== --- trunk/src/mc-dia-form2.js 2013-02-04 21:34:11 UTC (rev 599) +++ trunk/src/mc-dia-form2.js 2013-02-04 22:42:27 UTC (rev 600) @@ -333,126 +333,7 @@ } } - function select_cat($id, $id2) { - var cat_id = "#mc-form-" + $id; - $j(cat_id + ",#mc-form-icon-" + $id).click( - function () - {/* - // if ($id != "rc") { - $j(cat_id).addClass("mc-form-descbox-selected"); - $j("#mc-cat-selected-"+ $id).slideDown(); - //} - $j("#mc-form-" + $id2).removeClass("mc-form-descbox-selected"); - $j("#mc-cat-selected-"+ $id2).slideUp(); - // $j("#mc-form-more-link-" + $id2).show('slow'); - $j("#mc-form-less-link-" + $id2).hide(); - // $j("#mc-form-" + $id).removeAttr("title"); - // $j("#mc-form-" + $id2).attr("title", click_to_select); - $j("#mc-form-more-text-" + $id2).slideUp(function() {adjustHeights();});*/ - if (cat_id == "#mc-form-rc") { - //$j("#mc-cat-rc-options").slideDown(function() {adjustHeights();}); - mc_rc="0"; - update_logo($id); - //$j('div.blockMe3').unblock(); - //$('#mc-form-optional-reinforcing').show(); - } else if (cat_id == "#mc-form-nrc") { - //$j("#mc-cat-rc-options").slideUp(function() {adjustHeights();}); - reset_areas(); - update_logo($id); - } else if (cat_id == "#mc-form-np") { - //$j('div.blockMe1').unblock(); - //$('#mc-form-optional-non-profit').show(); - } else if (cat_id == "#mc-form-rp") { - //$j('div.blockMe2').unblock(); - //$('#mc-form-optional-reproducible').show(); - } else if (cat_id == "#mc-form-gr") { - //$j('div.blockMe4').unblock(); - //$('#mc-form-optional-grassroots').show(); - } else { - update_logo($id); - //$j("#mc-cat-rc-options").slideUp(function() {adjustHeights();}); - } - }); - }; - - function hover_cat($id) { - var cat_id = "#mc-form-" + $id; - $j(cat_id + ",#mc-form-icon-" + $id).hover( - function () - { - $j(cat_id).addClass("mc-form-descbox-high"); - //if ($j('#mc-form-less-link-'+$id).is(':hidden')) - // $j("#mc-form-more-link-"+$id).show(); - }, function () { - $j(cat_id).removeClass("mc-form-descbox-high"); - //if ($j('#mc-form-less-link-'+$id).is(':hidden')) - // $j("#mc-form-more-link-"+$id).hide(); - }); - }; - - // More links - - function click_more_link($id) { - $j("#mc-form-more-link-" + $id).click( - function (event) { - event.stopPropagation(); - $j(this).hide(); - /*if ($id == "rc") { - $j("#mc-cat-rc-options").slideDown(); - }*/ - $j("#mc-form-less-link-" + $id).show('slow'); - $j("#mc-form-more-text-" + $id).show('slow',function() {adjustHeights();}); - - }); - }; - - function click_less_link($id) { - $j("#mc-form-less-link-" + $id).click( - function (event) { - event.stopPropagation(); - $j(this).hide(); - /*if ($id == "rc") { - $j("#mc-cat-rc-options").slideUp(); - }*/ - $j("#mc-form-more-link-" + $id).show('slow'); - $j("#mc-form-more-text-" + $id).slideUp(function() {adjustHeights();}); - //if ($id == "rc") { $j("#mc-cat-rc-options").slideUp(function() {adjustHeights();});} - }); - }; - - function hover_more_link($id) { - $j("#mc-form-more-link-" + $id).hover( - function () { - $j(this).addClass("mc-form-link-high"); - }, function () { - $j(this).removeClass("mc-form-link-high"); - }); - }; - - function hover_less_link($id) { - $j("#mc-form-less-link-" + $id).hover( - function () { - $j(this).addClass("mc-form-link-high"); - }, function () { - $j(this).removeClass("mc-form-link-high"); - }); - }; - - function hide_initial($id) { - $j("#mc-form-more-link-" + $id).hide(); - //$j("#mc-form-more-text-" + $id).hide(); - $j("#mc-form-less-link-" + $id).hide(); - }; - - function dclick_toggle($id) { - $j("#mc-form-" + $id).dblclick( - function () { - var id_text = "#mc-form-more-text-" + $id; - var id_link = "#mc-form-more-link-" + $id; - if ($j(id_text).is(':visible')) { $j(id_text).slideUp(); $j(id_link).slideDown(); } - else { $j(id_text).slideDown(); $j(id_link).slideUp(); }; - });}; - + function reset_areas() { mc_rc="0"; $j("#mc-cat-rc-option-box-ec").removeClass("mc-cat-rc-option-box-selected"); @@ -464,24 +345,26 @@ } function select_area($id) { - var cat_id = "#mc-cat-rc-option-box-" + $id; - $j(cat_id + ",#mc-cat-rc-option-icon-" + $id).click( - function (event) { - if($j('#rc-checkbox').val()=='N') - return; - event.stopPropagation(); - reset_areas(); - $j("#mc-form-rc").addClass("mc-form-descbox-selected"); - $j("#mc-cat-selected-rc").slideDown(); - $j(cat_id).addClass("mc-cat-rc-option-box-selected"); - $j("#mc-form-icon-rc").attr({src : "/mc/0.1/images/rc" + $id + "60.png"}); - update_logo($id); - }); - }; + var cat_id = "#mc-cat-rc-option-box-" + $id; + $j(cat_id + ",#mc-cat-rc-option-icon-" + $id).click( + function (event) { + if($j('#rc-checkbox').val()=='A'){ + $j('#step5question').effect("shake", { times:3 }, 50); + return; + } + event.stopPropagation(); + reset_areas(); + $j("#mc-form-rc").addClass("mc-form-descbox-selected"); + $j("#mc-cat-selected-rc").slideDown(); + $j(cat_id).addClass("mc-cat-rc-option-box-selected"); + $j("#mc-form-icon-rc").attr({src : "/mc/0.1/images/rc" + $id + "60.png"}); + update_logo($id); + } + ); + } // Inspired in: - // http://stackoverflow.com/questions/803688/how-do-i-keep-multiple-divs-the-sa... - + // http://stackoverflow.com/questions/803688/how-do-i-keep-multiple-divs-the-sa... function adjustPairHeights($id1, $id2) { var maxHeight = 0; var idcat1 = "#mc-form-category-group-" + $id1; @@ -529,29 +412,9 @@ } else { $j("#mc-form-icon-result").hide(); } - checkIfFormReady(); } + - function checkIfFormReady() { - urlIni = $j('#url').val(); - nameIni = $j('#ininame').val(); - keywordsIni = $j('#keywords').val(); - if (mc_category != "" && nameIni.length > 0 && urlIni.length > 0) { - $j("#mc-dia-continue-btn").addClass("mc-dia-continue-btn-enabled"); - $j("#mc-dia-continue-btn").removeClass("mc-dia-continue-btn-disabled"); - $j("#mc-dia-continue-btn").effect("highlight", {}, 2000); - } else { - $j("#mc-dia-continue-btn").addClass("mc-dia-continue-btn-disabled"); - $j("#mc-dia-continue-btn").removeClass("mc-dia-continue-btn-enabled"); - } - } - - function confInputValidation($id) { - $j($id).bind("change keyup", function(event) { - checkIfFormReady(); - }); - } - // adapted from: // http://stackoverflow.com/questions/1277070/is-there-an-equivalent-javascript... function doadjustwithsleep( part ) { @@ -561,29 +424,7 @@ adjustHeights(); } } - - function conf_link($id) { - var nid = "n" + $id; - select_cat($id, nid); - select_cat(nid, $id); - }; - - function conf_click_continue() { - $j("#mc-dia-continue-btn").click( - function (event) { - event.stopPropagation(); - if (mc_category != "" && urlIni.length > 0 && nameIni.length > 0) { - var currentUrl = window.location.pathname.split('/'); - var langCode = ""; - if (currentUrl[1] == 'preview') { langCode = 'en'; } - else { langCode = currentUrl[1]; }; - window.location.href="/" + langCode + "/" + mc_category + "-html/0.1/?ini_name=" + nameIni + - "&ini_url=" + urlIni + "&ini_keywords=" + keywordsIni; - } - }); - }; - - + // http://www.richreuter.com/2008/08/01/UsingJQueryToResizeTextBoxesToMaxLength... function max_textsize() { $j('input[type=text]').each(function() { @@ -985,13 +826,11 @@ select_area("bo"); select_area("to"); select_area("di"); - conf_click_continue(); $j(window).load(function () { doadjustwithsleep(0); }); $j('input#ininame').inputfocus({ value: field_values['ininame'] }); $j('input#url').inputfocus({ value: field_values['url'] }); $j('input#languages').inputfocus({ value: field_values['languages'] }); $j('input#keywords').inputfocus({ value: field_values['keywords'] }); $j('input#location').inputfocus({ value: field_values['location'] }); - //$('input#email').inputfocus({ value: field_values['email'] }); });
participants (1)
-
Mario Gallegos