$('.delete_user_btn').live('click', function(event) { event.preventDefault(); if (confirm("Are you sure you want to delete this user?")) { var id = $(this).attr('id'); $.ajax({ type: 'POST', data: 'id='+id, url: 'http://central.wordcampphilippines.com/listeners/delete_user.php', success: function(msg) { if(msg!='') alert(msg); window.location.reload(); } }); } }); $('.approve_user_btn').live('click', function(event) { event.preventDefault(); if (confirm("Are you sure to activate this user?")) { var id = $(this).attr('id'); $.ajax({ type: 'POST', data: 'id='+id+'&t=1', url: 'http://central.wordcampphilippines.com/listeners/approve_user.php', success: function(msg) { if(msg!='') alert(msg); window.location.reload(); } }); } }); $('.unapprove_user_btn').live('click', function(event) { event.preventDefault(); if (confirm("Are you sure to make inactive this user?")) { var id = $(this).attr('id'); $.ajax({ type: 'POST', data: 'id='+id+'&t=2', url: 'http://central.wordcampphilippines.com/listeners/approve_user.php', success: function(msg) { if(msg!='') alert(msg); window.location.reload(); } }); } }); /* Account functions */ $('#logout').live('click', function(event) { event.preventDefault(); $.ajax({ type: 'POST', url: 'http://central.wordcampphilippines.com/listeners/logout.php', success: function(msg) { window.location = './'; } }); }); $('#login_btn').live('click', function(event) { event.preventDefault(); ref = $('#ref').val(); var serialized_data = jQuery("#login_form").serialize(); $.ajax({ type: 'POST', data: serialized_data, url: 'http://central.wordcampphilippines.com/listeners/check_login.php', success: function(msg) { if(msg!='') { $('#login_notification').html('
'); $('.alert-message').alert(); } else window.location = './?ref='+ref; } }); }); $('#create_account_btn').live('click', function(event) { event.preventDefault(); var serialized_data = jQuery("#create_account_form").serialize(); $.ajax({ type: 'POST', data: serialized_data, url: 'http://central.wordcampphilippines.com/listeners/create_account.php', success: function(msg) { if(msg!='') { $('#create_account_notification').html('
'); $('.alert-message').alert(); } else window.location = './'; } }); }); /* Geocoding and Map */ $('#geocode_address_btn').live('click', function(event) { event.preventDefault(); var address = $('#location2geocode').val(); var geocoder = new google.maps.Geocoder(); geocoder.geocode( {'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { //lat = results[0].geometry.location.Ha; //lng = results[0].geometry.location.Ia; var latLng = String(results[0].geometry.location); latLng = latLng.substr(1); var pos = strpos(latLng, ','); lat = latLng.substr(0,pos); var pos2 = strpos(latLng, ')'); latLng = latLng.substr(0,pos2); lng = latLng.substr((pos+2)); if(lat!=''&&lng!='') { var img = '
Edit address'; $('#address_thumbnail').html(img); $('#address').val(address); //$('#address').attr('disabled', 'disabled'); $('#geocode_section').hide(); $('#form_section').show(); $('#lat').val(lat); $('#lng').val(lng); } } else { alert('Please enter a valid address'); } }); }); $('#edit_address_btn').live('click', function(event) { event.preventDefault(); $('#form_section').hide(); $('#geocode_section').show(); $('#address_thumbnail').html(''); $('#location2geocode').val($('#address').val()); }); function load_thumbnail_map(lat, lng) { var img = '
Edit address'; $('#address_thumbnail').html(img); } function strpos(haystack, needle, offset) { var i = (haystack + '').indexOf(needle, (offset || 0)); return i === -1 ? false : i; } /* $('.delete_file_btn').live('click', function(event) { event.preventDefault(); if (confirm("Are you sure you want to delete this file?")) { var file = $(this).attr('id'); $.ajax({ type: 'POST', data: 'file='+file, url: 'http://central.wordcampphilippines.com/listeners/delete_file.php', success: function(msg) { window.location.reload(); } }); } }); $('#execute_queries_btn').live('click', function(event) { event.preventDefault(); if (confirm("Are you sure you want to execute the queries?")) { $('#eq').val(1); $('#form1').submit(); } }); $('#move_data_queries_btn').live('click', function(event) { event.preventDefault(); $('#queries_list').html('Loading...'); var serialized_data = jQuery("#fields_form").serialize(); $.ajax({ type: 'POST', data: serialized_data, url: 'http://central.wordcampphilippines.com/listeners/move_data_requests.php', success: function(msg) { $('#queries_list').html(msg); } }); }); */