From 31114b20bd84976186e35e534104a8c57ccfe03a Mon Sep 17 00:00:00 2001 From: Priyanka Bhagwat Date: Mon, 25 Aug 2014 17:49:49 +0530 Subject: added search for AICTE books --- js/textbook_companion.js | 22 +++++++++++ js/textbook_companion.js~ | 95 ----------------------------------------------- textbook_companion.module | 14 ++++--- 3 files changed, 31 insertions(+), 100 deletions(-) delete mode 100755 js/textbook_companion.js~ diff --git a/js/textbook_companion.js b/js/textbook_companion.js index ea607df..660ccdf 100755 --- a/js/textbook_companion.js +++ b/js/textbook_companion.js @@ -1,5 +1,27 @@ $( document ).ready(function() { + $('#searchtext').keyup(function(event) { + var search_text = $('#searchtext').val(); + var rg = new RegExp(search_text,'i'); + $('#aicte-list-wrapper .title , .form-item' ).each(function(){ + if($.trim($(this).html()).search(rg) == -1) { + //alert("one"); + $(this).parent('div').css('background-color', '#ffffff'); + $(this).css('display', 'none'); + $(this).next().css('display', 'none'); + $(this).next().next().css('display', 'none'); + } + else { + //alert("two"); + $(this).parent('div').css('background-color', '#ffffff'); + $(this).css('display', ''); + $(this).next().css('display', ''); + $(this).next().next().css('display', ''); + } + }); + }); + + $('#edit-same-address').click(function() { var temp = $('#edit-chq-address').val(); $('#edit-temp-chq-address').val(temp); diff --git a/js/textbook_companion.js~ b/js/textbook_companion.js~ deleted file mode 100755 index de0bbec..0000000 --- a/js/textbook_companion.js~ +++ /dev/null @@ -1,95 +0,0 @@ -$( document ).ready(function() { - -$('#edit-same-address').click(function() { - var temp = $('#edit-chq-address').val(); - $('#edit-temp-chq-address').val(temp); - var temp1 = $('#edit-perm-city').val(); - $('#edit-temp-city').val(temp1); - var temp1 = $('#edit-perm-pincode').val(); - $('#edit-temp-pincode').val(temp1); - var temp1 = $('#edit-perm-state').val(); - $('#edit-temp-state').val(temp1); - - $("#edit-cheque-sent").datepicker(); - - - $("#edit-cheque-cleared").datepicker(); - -}); - -$("#edit-perm-pincode").blur(function() - { - var string_length,string_val; - string_val = $("#edit-perm-pincode").val(); - string_length = $("#edit-perm-pincode").text().length; - //$("#username_warning").empty(); - - if ((isNaN(string_val))&&(string_length < 6)) - alert("Not A Valid Zip Code!!"); - - // $("#username_warning").append("Username is too short"); - }); -$("#edit-temp-pincode").blur(function() - { - var string_length1,string_val1; - string_val = $("#edit-temp-pincode").val(); - string_length = $("#edit-temp-pincode").text().length; - //$("#username_warning").empty(); - - if ((isNaN(string_val))&&(string_length1 < 6)) - alert("Not A Valid Zip Code!!"); - - // $("#username_warning").append("Username is too short"); - }); - -$("#edit-mobileno1").blur(function() - { - var string_length3,string_val3; - string_val3 = $("#edit-mobileno1").val(); - string_length3 = $("#edit-mobileno1").text().length; - //$("#username_warning").empty(); - - if (isNaN(string_val3)) - { - alert("Mobile No should be a number!!"); - // $("#username_warning").append("Username is too short"); - } - if((string_length3 > 0)&&(string_length3 < 11)) - { - alert("Not A Valid Mobile No!!"); - } - }); - -$("#edit-mobileno2").blur(function() - { - var string_length4,string_val4; - string_val4 = $("#edit-mobileno2").val(); - string_length4 = $("#edit-mobileno2").text().length; - //$("#username_warning").empty(); - - if (isNaN(string_val4)) - { - alert("Mobile No should be a number!!"); - // $("#username_warning").append("Username is too short"); - } - if((string_length4 > 0)&&(string_length4 < 11)) - { - alert("Not A Valid Mobile No!!"); - } - }); -$('#edit-older-wrapper').hide(); -$('#edit-version').change(function() { - var selected = $(this).val(); - //$('#edit-older-wrapper').hide(); - if(selected == 'olderversion'){ - $('#edit-older-wrapper').show(); - } - else - { - $('#edit-older-wrapper').hide(); - } - -}); -}); - - diff --git a/textbook_companion.module b/textbook_companion.module index ef51500..aaea2b2 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -579,6 +579,8 @@ function textbook_companion_aicte_proposal_form($form_state) { $form["wrapper"][$row->id] = array( "#type" => "checkbox", "#title" => $title, + "#prefix" => "
Login to create a proposal."; $page_content .= "
  • Unable to propose particular book: Click here
  • "; - $page_content .= "
  • Do not wish to propose any of the above books: Click here
  • "; + $page_content .= "
  • Do not wish to propose any of the below books: Click here
  • "; $page_content .= ""; + $page_content .= "Search :"; $page_content .= "
    "; $num_rows = mysql_num_rows($result); if ($num_rows > 0) { @@ -752,7 +755,7 @@ function textbook_companion_aicte_proposal_all() { break; default: drupal_set_message(t('Invalid proposal state. Please contact site administrator for further information.'), 'error'); - drupal_goto(''); + drupal_goto(''); return; break; } @@ -760,9 +763,10 @@ function textbook_companion_aicte_proposal_all() { } variable_del("aicte_".$user->uid); - $page_content .= "
    * Please select any 3 books from the below available list.
    "; - $page_content .= "Unable to propose particular book: Click here
    "; - $page_content .= "Do not wish to propose any of the above books: Click here"; + $page_content .= "
    * Please select any 3 books from the below available list.

    "; + $page_content .= "Unable to propose particular book: Click here

    "; + $page_content .= "Do not wish to propose any of the below books: Click here

    "; + $page_content .= "Search :