function delete_data(url) {
if (confirm("Are you sure you want to delete it?"))
{
window.location = url;
}
}
function edit_data(url) {
if (confirm("Are you sure?"))
{
window.location = url;
}
}
function save_contactdata(){
//alert("hiii");
var name= $("#name").val();
var email= $("#email").val();
var phone= $("#phone").val();
//var subject= $("#subject").val();
var message= $("#message").val();
var CaptchaInputText = $("#CaptchaInputText").val();
var captcha_val = $("#captcha_val").val();
var my_url= $("#my_url").val();
if(name==""){
Lobibox.notify('error', { msg: 'please insert name.' } );
$("#name").focus();
}
else if(!name.match(/^[a-zA-Z\s]+$/)){
Lobibox.notify('error', { msg: 'please insert only alphabets in name field.' } );
$("#name").focus();
}
else if(email==''){
Lobibox.notify('error', { msg: 'please insert email.' } );
$("#email").focus();
}
else if(!email.match(/^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i)){
Lobibox.notify('error', { msg: 'please insert valid emailid emailid allow only .,-,_,@.' } );
$("#email").focus();
}
else if(phone==''){
Lobibox.notify('error', { msg: 'please insert phone number.' } );
$("#phone").focus();
}
else if(!phone.match(/^[1-9][0-9]{9}$/)){
Lobibox.notify('error', { msg: 'please insert only number in phone number field and phone number is not started with 0.' } );
$("#phone").focus();
}
else if(message==''){
Lobibox.notify('error', { msg: 'please insert message.' } );
$("#message").focus();
}
else if(!message.match(/^[a-zA-Z\s]+$/) && (!message.match(/^[1-9][0-9]{9}$/))){
Lobibox.notify('error', { msg: 'message box allow only alphabets ,numbers and space so please do not use special character or tags.' } );
$("#message").focus();
}
else if(captcha_val!=CaptchaInputText){
Lobibox.notify('error', { msg: 'please insert Valid Captcha Value.' } );
$("#CaptchaInputText").focus();
}
else{
// alert(my_url);
$.ajax({
url: my_url,
type:"get",
data:{name:name,email:email,phone:phone,message:message},
cache:false,
dataType:"json",
success:function(datas){
Lobibox.notify('success', { msg: datas.msg} );
$("#name").val('');
$("#email").val('');
$("#phone").val('');
$("#message").val('');
$("#CaptchaInputText").val('');
//$("#cnt_form").rese(data.msg);
}
});
}
}
function update_c_code(id){
//$(this).find('option:selected').attr("langid");
//alert($("#country").find('option:selected').attr('data_id'));
$("#c_code").val($("#country").find('option:selected').attr('data_id'));
}
function register_user(){
var fname = $("#fname").val();
var lname = $("#lname").val();
var email = $("#email").val();
var phone = $("#phone").val();
var country = $("#country").val();
var email = $("#email").val();
var password = $("#pass").val();
var cpassword = $("#cpass").val();
var user_type=$("input[type='radio']:checked").val();
//alert(user_type);
if(user_type=="" ){
Lobibox.notify('error', { msg: 'please Select first User Type.' } );
$("#user_type").focus();
}
else if(fname==""){
Lobibox.notify('error', { msg: 'please insert first name.' } );
$("#fname").focus();
}
else if(!fname.match(/^[a-zA-Z\s]+$/)){
Lobibox.notify('error', { msg: 'please insert only alphabets in name field.' } );
$("#fname").focus();
}
else if(lname==""){
Lobibox.notify('error', { msg: 'please insert Last name.' } );
$("#lname").focus();
}
else if(!lname.match(/^[a-zA-Z\s]+$/)){
Lobibox.notify('error', { msg: 'please insert only alphabets in name field.' } );
$("#lname").focus();
}
else if(email==''){
Lobibox.notify('error', { msg: 'please insert email.' } );
$("#email").focus();
}
else if(!email.match(/^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i)){
Lobibox.notify('error', { msg: 'please insert valid emailid emailid allow only .,-,_,@.' } );
$("#email").focus();
}
else if(phone==''){
Lobibox.notify('error', { msg: 'please insert phone number.' } );
$("#phone").focus();
}
else if(!phone.match(/^[1-9][0-9]{9}$/)){
Lobibox.notify('error', { msg: 'please insert only number in phone number field and phone number is not started with 0.' } );
$("#phone").focus();
}
else if(password==''){
Lobibox.notify('error', { msg: 'please insert Password.' } );
$("#pass").focus();
}
else if(password!=cpassword){
Lobibox.notify('error', { msg: 'password and conform password are different please insert same password in both both place' } );
$("#cpass").focus();
}
else{
// alert(my_url);
$.ajax({
url: SITE_URL+"user/register_user",
type:"get",
data:{fname:fname,lname:lname,email:email,phone:phone,country:country,password:cpassword,user_type:user_type},
cache:false,
dataType:"json",
success:function(datas){
Lobibox.notify('success', { msg: datas.msg} );
$("#fname").val('');
$("#lname").val('');
$("#email").val('');
$("#phone").val('');
$("#pass").val('');
$("#cpass").val('');
//$("#cnt_form").rese(data.msg);
}
});
}
}
function get_captche(){
$.getJSON(SITE_URL+"user/get_captche", {},function(data){
//console.log(data);
$("#my_captcha").html(data.image);
$("#captcha_val").val(data.word);
})
}
function get_issue(id=''){
//alert(id);
$.ajax({
url: SITE_URL+"user/all_issue",
type:"get",
data:{id:id},
cache:false,
dataType:"json",
success:function(datas){
//Lobibox.notify('success', { msg: datas.msg} );
var my_data='';
$.each(datas,function(key,val){
my_data+='';
});
$("#All_Issue").html(my_data);
}
});
}
function search_article(){
var publisher_category=$("#publisher_category").val();
var All_Issue=$("#All_Issue").val();
var ArticleTitle=$("#ArticleTitle").val();
var AuthorNames=$("#AuthorNames").val();
$("#search_article_data").html('
Search Article
');
var total_article='Total Article: 21';
//alert(publisher_category+"/"+All_Issue+"/"+ArticleTitle+"/"+AuthorNames);
$.ajax({
url: SITE_URL+"user/all_articles",
type:"get",
data:{publisher_category:publisher_category,All_Issue:All_Issue,ArticleTitle:ArticleTitle,AuthorNames:AuthorNames},
cache:false,
dataType:"json",
success:function(datas){
//Lobibox.notify('success', { msg: datas.msg} );
var my_data='';
if(Array.isArray(datas)){
$.each(datas,function(key,val){
my_data+=' '+val.name+' |
';
my_data+=' Journal : '+val.category_name+' ('+val.category_short_name+') |
';
my_data+=' Authors Name : '+val.auther_name+' |
';
my_data+=' Volume No. : '+val.volume+' | Issue No. : '+val.ishue+' |
';
my_data+=' Abstract : '+(val.abstract).substring(0,400)+' ...Read More |
';
my_data+=' |
';
});
$(".total_article").html('Total Article: '+datas.length+'');
}else{
var my_data='No Record Found
';
}
$("#search_article_data").html(my_data);
}
});
}
function user_login(){
var user_type=$("#user_type").val();
var email=$("#email").val();
var pass=$("#password").val();
//alert(user_type+"/"+email+"/"+pass);
if(user_type=="" ){
Lobibox.notify('error', { msg: 'please Select first User Type.' } );
$("#user_type").focus();
}
else if(email==''){
Lobibox.notify('error', { msg: 'please insert email.' } );
$("#email").focus();
}
else if(!email.match(/^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i)){
Lobibox.notify('error', { msg: 'please insert valid emailid emailid allow only .,-,_,@.' } );
$("#email").focus();
}
else if(pass==''){
Lobibox.notify('error', { msg: 'please insert Password.' } );
$("#password").focus();
}
else{
$.ajax({
url: SITE_URL+"user/user_login",
type:"get",
data:{user_type:user_type,email:email,pass:pass},
cache:false,
dataType:"json",
success:function(datas){
//console.log();
Lobibox.notify(datas.status, { msg: datas.msg} );
window.location = SITE_URL+"user/user_dashboard";
}
});
}
}
function update_profile(){
var id = $("#id").val();
var fname = $("#fname").val();
var lname = $("#lname").val();
var email = $("#email").val();
var designation = $("#designation").val();
var address = $("#address").val();
var country = $("#country").val();
var phone = $("#phone").val();
//alert(user_type);
if(fname==""){
Lobibox.notify('error', { msg: 'please insert first name.' } );
$("#fname").focus();
}
else if(!fname.match(/^[a-zA-Z\s]+$/)){
Lobibox.notify('error', { msg: 'please insert only alphabets in name field.' } );
$("#fname").focus();
}
else if(lname==""){
Lobibox.notify('error', { msg: 'please insert Last name.' } );
$("#lname").focus();
}
else if(!lname.match(/^[a-zA-Z\s]+$/)){
Lobibox.notify('error', { msg: 'please insert only alphabets in name field.' } );
$("#lname").focus();
}
else if(phone==''){
Lobibox.notify('error', { msg: 'please insert phone number.' } );
$("#phone").focus();
}
else if(!phone.match(/^[1-9][0-9]{9}$/)){
Lobibox.notify('error', { msg: 'please insert only number in phone number field and phone number is not started with 0.' } );
$("#phone").focus();
}
else{
$.ajax({
url: SITE_URL+"user/update_profile_data",
type:"get",
data:{id:id,fname:fname,lname:lname,phone:phone,country:country,designation:designation,address:address},
cache:false,
dataType:"json",
success:function(datas){
Lobibox.notify('success', { msg: datas.msg} );
$("#fname").val(fname);
$("#lname").val(lname);
$("#phone").val(phone);
$("#address").val(address);
$("#designation").val(designation);
//$("#cnt_form").rese(data.msg);
}
});
}
}
function change_password(){
var id=$("#id").val();
var opass=$("#opass").val();
var npass=$("#npass").val();
var cpass=$("#cpass").val();
if(opass==''){
Lobibox.notify('error', { msg: 'please insert Old Password.' } );
$("#opass").focus();
}
else if(npass==''){
Lobibox.notify('error', { msg: 'please insert new Password.' } );
$("#npass").focus();
}
else if(cpass==''){
Lobibox.notify('error', { msg: 'please insert conform Password.' } );
$("#cpass").focus();
}
else if(npass!=cpass){
Lobibox.notify('error', { msg: 'password and conform password are different please insert same password in both field' } );
$("#npass").focus();
$("#cpass").focus();
}
else{
// alert(my_url);
$.ajax({
url: SITE_URL+"user/change_password",
type:"get",
data:{id:id,opass:opass,npass:npass,cpass:cpass,action:'update_password'},
cache:false,
dataType:"json",
success:function(datas){
Lobibox.notify(datas.status, { msg: datas.msg} );
$("#opass").val('');
$("#npass").val('');
$("#cpass").val('');
//$("#cnt_form").rese(data.msg);
}
});
}
}
function getvolume_data(id){
//alert(id);
$.getJSON(SITE_URL+'user/getvolume_data',{id:id},function(data){
console.log(data);
var datas='';
if(data.status=='success'){
$.each(data.datas,function(key,val){
if(val.status==1){
datas+='';
}
})
} else{
datas='';
}
$(".getvolume_data").html(datas);
});
}
function getishue_data(volume,category){
//alert(volume+"//"+category);
$.getJSON(SITE_URL+'user/getishue_data',{volume:volume,category:category},function (data){
console.log(data);
var datas='';
if(data.status=='success'){
$.each(data.datas,function(key,val){
datas+='';
})
} else{
datas='';
}
$(".getishue_data").html(datas);
});
}
function check_validation(){
var name=$("#name").val();
var year=$("#year").val();
var category=$("#category").val();
var action=$("#action").val();
//alert(action)
if(name==''){
Lobibox.notify('error', { msg: 'Please Enter Name' });
$("#name").focus();
}
else if(year==''){
Lobibox.notify('error', { msg: 'Please Enter year' });
$("#year").focus();
}
else if(category==''){
Lobibox.notify('error', { msg: 'Please Enter category' });
$("#category").focus();
}
// }else if(content==''){
// Lobibox.notify('error', { msg: 'Please Enter Content' });
// $("#content").focus();
// }
else{
$('#session_form').submit(); }
}
function add_visit(){
var page_url= window.location.href;
//alert(page_url);
$.ajax({
url: SITE_URL+"user/add_visit",
type:"get",
data:{page_url:page_url},
cache:false,
dataType:"json",
success:function(datas){
var old_count=parseInt($("#hit_counter").html());
$("#hit_counter").html(old_count+parseInt(datas.visit_data));
}
});
}