From fdf5fb3a94b20d54dfe9f3f92dfcc8e93429934f Mon Sep 17 00:00:00 2001 From: rylon Date: Mon, 10 Mar 2014 20:51:51 +0100 Subject: [PATCH] uvote js fixes --- uVote/page/default_page/default_page.php | 3 +- uVote/page/default_page/js/loadtexts.js | 192 +++++++++++------------ uVote/page/user_main/main_menu.tpl | 15 +- 3 files changed, 105 insertions(+), 105 deletions(-) diff --git a/uVote/page/default_page/default_page.php b/uVote/page/default_page/default_page.php index 7076d02..72b012d 100644 --- a/uVote/page/default_page/default_page.php +++ b/uVote/page/default_page/default_page.php @@ -1,7 +1,6 @@ '. ''. diff --git a/uVote/page/default_page/js/loadtexts.js b/uVote/page/default_page/js/loadtexts.js index 0436b61..8dc5244 100644 --- a/uVote/page/default_page/js/loadtexts.js +++ b/uVote/page/default_page/js/loadtexts.js @@ -1,74 +1,66 @@ -/* jQuery on document ready */ -$(document).ready(function() { - // handle navigation link click - /*$('.navbar ul li a').not('#menu_uvote').click(function () { - loadAjaxContent($(this).attr('url')); - - //loadUrlPic($(this).attr('url')); - });*/ - - - - /*$('.btn_openvoteinfo').click(function () { - if($("#openvoteinfo"+$(this).attr('poll_ID')).is(':visible')){ - $('#openvoteinfo'+$(this).attr('poll_ID')).slideUp('slow'); - }else{ - load_openvoteinfo($(this).attr('poll_ID')); - } - });*/ +$(document).ready(function() { + load_user_main(); + load_user_list(); + register_login(); + register_logout(); +}); - //jqBootstrapValidation - - - $('#user_main').load('./?action=user_main', function(){ - register_registerform(); - $('#feedback_submit').click(function (data){ - var test = $('textarea#feedback_text').val(); - send_feedback(test); - - }); - $('#tabs_user_main a').click(function (e) { - e.preventDefault(); - $(this).tab('show'); - load_user_main_tab($(this).attr('action')); - }); - - //load_user_main_tab('user_main_uVote'); - }); - +function load_user_list(){ $('#user_list').load('./?action=user_list', function(){ - $('#tabs_user_list a').click(function (e) { - e.preventDefault(); - $(this).tab('show'); - load_user_list_tab($(this).attr('action')); - - }); - $('.btn_vote').click(function () { - //vote_click($(this).attr('poll_ID')); - $('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID')); - open_vote($(this).attr('poll_ID')); - register_registerform(); - }); - + register_user_list();}); +} +function load_user_main(){ + $('#user_main').load('./?action=user_main', function(){ + register_user_main(); + }); +} - //load_user_main_tab('user_main_uVote'); - }); - $("#form_login input").not("[type=submit]").jqBootstrapValidation({ - +function register_user_list(){ + $('#tabs_user_list a').click(function (e) { + e.preventDefault(); + load_user_list_tab($(this).attr('action')); + $(this).tab('show'); + }); + $('.btn_vote').click(function () { + //vote_click($(this).attr('poll_ID')); + $('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID')); + open_vote($(this).attr('poll_ID')); + register_registerform(); + }); + $('.btn_fade').click(function () { + $('#vote_data_panel' + $(this).attr('poll_ID')).toggle(); + }); +} +function register_user_main(){ + register_registerform(); + $('#feedback_submit').click(function (data){ + var test = $('textarea#feedback_text').val(); + send_feedback(test); + }); + $('#tabs_user_main a').click(function (e) { + e.preventDefault(); + load_user_main_tab($(this).attr('action')); + $(this).tab('show'); + }); +} + +function register_login(){ + $("#form_login input").not("[type=submit]").jqBootstrapValidation({ preventSubmit: true, submitError: function($form, event, errors) {}, submitSuccess: function($form, event){ $.get('./api.php?call=account&action=login&username=' + $('#bt_login_user').val()+'&password_sha='+$.sha1($('#bt_login_password').val())+'&password_md5='+$.md5($('#bt_login_password').val()), function (data) { - if(data == 1){ - window.location.reload(); - } else { - $('#help-block-user-password-combi-wrong').attr('style', 'display: block;'); - } - }); - event.preventDefault(); - } + if(data == 1){ + window.location.reload(); + } else { + $('#help-block-user-password-combi-wrong').attr('style', 'display: block;'); + } + }); + event.preventDefault(); + } }); - +} +function register_logout(){ $("#form_logout input").not("[type=submit]").jqBootstrapValidation( { preventSubmit: true, @@ -80,8 +72,7 @@ $(document).ready(function() { event.preventDefault(); } }); - -}); +} function register_registerform(){ console.log("wegwegwegwegwegweg"); @@ -102,46 +93,45 @@ function register_registerform(){ }); } -function drawChart(){ - //load_visualisation('#graph_bt_uv_overall',84600); -} - -function load_user_main_tab(action){ - - switch(action){ - +function load_user_main_tab(action){ + switch(action){ case 'user_main_uVote': - $('#tab_uVote').load('./?action='+ action); + //$('#tab_uVote').load('./?action='+ action); //causes error return; case 'user_main_urVote': $('#tab_urVote').load('./?action='+ action); return; case 'user_main_myVote': $('#tab_myVote').load('./?action='+ action, function(){ - $('.add_data_submit').click(function () { - submit_add_data(); - alert('success'); - }); + $('.add_data_submit').click(function () { + submit_add_data(); + alert('success'); + }); }); return; default: } } -function load_user_list_tab(action){ - - switch(action){ - +function load_user_list_tab(action){ + switch(action){ case 'user_list_active': $('#tab_active').load('./?action='+ action, function(){ + $('.btn_fade').click(function () { + $('#vote_data_panel' + $(this).attr('poll_ID')).show(); + }); $('.btn_vote').click(function () { //vote_click($(this).attr('poll_ID')); $('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID')); open_vote($(this).attr('poll_ID')); register_registerform(); + })}); return; case 'user_list_ended': $('#tab_ended').load('./?action='+ action, function(){ + $('.btn_fade').click(function () { + $('#vote_data_panel' + $(this).attr('poll_ID')).show(); + }); $('.btn_vote').click(function () { //vote_click($(this).attr('poll_ID')); $('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID')); @@ -199,6 +189,18 @@ function vote_click (poll_ID, vote) { } }); } + +function submit_commentrate (c_ID, val) { + $.getJSON('./api.php?call=vote&action=commentrate&c_ID=' + c_ID + '&val=' + val, function(data) { + var items = []; + if(data.status == true){ + alert("success"); + } else { + alert(data.result.message); + } + }); +} + function submit_c_data (poll_ID) { var c_txt = $("#c_txt_pro").val(); var c_src = $("#c_src_pro").val(); @@ -238,19 +240,7 @@ function submit_add_data () { } function send_feedback (feedback) { - -// $.getJSON('./api.php?call=vote&action=feedback&feedback=' + feedback, function(data) { -// console.log("hallo3672rt2ziuzir"); -// var items = []; -// alert(feedback); -// if(data.status == true){ -// alert("success"); -// } else { -// alert(data.result.message); -// } -// }); - -$.ajax({ + $.ajax({ url: 'http://mojotrollz.eu/web/uVote/api.php', // contentType : "application/json; charset=utf-8", data : { @@ -262,7 +252,8 @@ $.ajax({ type : 'POST' , success: function(data) { alert("success"); - }}); + } + }); } function open_vote (poll_ID) { @@ -280,6 +271,15 @@ function open_vote (poll_ID) { submit_c_data($(this).attr('poll_ID')); alert('success'); }); + $('.c_up').click(function () { + submit_commentrate($(this).attr('c_ID'), 1); + }); + $('.c_down').click(function () { + submit_commentrate($(this).attr('c_ID'), 2); + }); + $('.c_spam').click(function () { + submit_commentrate($(this).attr('c_ID'), 3); + }); $('#test').click(function(){ $('#myModal').modal(); }); diff --git a/uVote/page/user_main/main_menu.tpl b/uVote/page/user_main/main_menu.tpl index 6d6d4c5..a17bff2 100644 --- a/uVote/page/user_main/main_menu.tpl +++ b/uVote/page/user_main/main_menu.tpl @@ -10,10 +10,11 @@
-
-
-

uVote BETA Feedback

- -
- -
+ +
+
+

uVote BETA Feedback

+ +
+ +