From cc998349a88c5dfddcb06c11202373293e2d0b10 Mon Sep 17 00:00:00 2001 From: Nael Date: Mon, 10 Mar 2014 00:43:00 +0100 Subject: [PATCH] comment function working now --- uVote/api/votes/votes.php | 2 +- uVote/page/default_bulletin/bulletin.tpl | 84 +++++++++++++----------- uVote/page/default_page/js/loadtexts.js | 40 ++++++----- uVote/page/default_page/page.tpl | 2 +- 4 files changed, 68 insertions(+), 60 deletions(-) diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php index 11a86e4..29a9726 100644 --- a/uVote/api/votes/votes.php +++ b/uVote/api/votes/votes.php @@ -184,7 +184,7 @@ class votes { if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ throw new ERROR("You need to be logged in.");} return \DBD\UVOTE_DATA_USER_ADD_DATA_INSERT::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id, $location, $birthyear, $gender, $children, \SYSTEM\SECURITY\Security::getUser()->id, $location, $birthyear, $gender, $children));} - + public static function write_comment($poll_ID, $c_choice, $c_txt, $c_src){ if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ throw new ERROR("You need to be logged in.");} diff --git a/uVote/page/default_bulletin/bulletin.tpl b/uVote/page/default_bulletin/bulletin.tpl index 59555ce..a27dcec 100644 --- a/uVote/page/default_bulletin/bulletin.tpl +++ b/uVote/page/default_bulletin/bulletin.tpl @@ -1,45 +1,55 @@ -
- -

${title}

-
+
+

${title}

${vote_buttons}
- +
-
- ${openvote_help_text} - ${title} - ${openvote_help_text1} -
- -
- ${voice_weight} -
-
-
- ${bars_user} -
-
- ${bars_bt} +
+ ${openvote_help_text} + ${title} + ${openvote_help_text1}
-
-
- ${icons_party} - ${choice_party} -
-
-
+
+ ${voice_weight} +
+
+
+ ${bars_user} +
+
+ ${bars_bt} +
+
+
+ ${icons_party} + ${choice_party} +
+
-
- ${comments_pro} - ${comments_con} - - - -
-
${submit}
-
+ +
+
+
Pro
+ ${comments_pro} +
+
+
Contra
+ ${comments_con} +
+
+
+
+ Kommentar
+
+ Quelle
+
+
+
${submit}
+
diff --git a/uVote/page/default_page/js/loadtexts.js b/uVote/page/default_page/js/loadtexts.js index d8b7d32..0436b61 100644 --- a/uVote/page/default_page/js/loadtexts.js +++ b/uVote/page/default_page/js/loadtexts.js @@ -132,22 +132,22 @@ function load_user_list_tab(action){ switch(action){ case 'user_list_active': - $('#tab_active').load('./?action='+ 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(); - }); + $('#tab_active').load('./?action='+ action, function(){ + $('.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); - $('.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(); - }); + $('#tab_ended').load('./?action='+ action, function(){ + $('.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; default: } @@ -199,9 +199,11 @@ function vote_click (poll_ID, vote) { } }); } -function submit_c_data (poll_ID, c_choice) { - var c_txt = document.getElementById("c_txt_pro").textContent; - var c_src = document.getElementById("c_src_pro").textContent; +function submit_c_data (poll_ID) { + var c_txt = $("#c_txt_pro").val(); + var c_src = $("#c_src_pro").val(); + var a = document.getElementById("side_select"); + var c_choice = a.options[a.selectedIndex].value; alert(c_choice); $.getJSON('./api.php?call=vote&action=comment&poll_ID=' + poll_ID + '&c_choice=' + c_choice + '&c_txt=' + c_txt + '&c_src=' + c_src, function(data) { var items = []; @@ -275,10 +277,6 @@ function open_vote (poll_ID) { vote_click($(this).attr('poll_ID'),3); }); $('.submit_pro').click(function () { - submit_c_data($(this).attr('poll_ID',1)); - alert('success'); - }); - $('.submit_con').click(function () { submit_c_data($(this).attr('poll_ID')); alert('success'); }); diff --git a/uVote/page/default_page/page.tpl b/uVote/page/default_page/page.tpl index eaff81b..86ac927 100644 --- a/uVote/page/default_page/page.tpl +++ b/uVote/page/default_page/page.tpl @@ -68,7 +68,7 @@
-
+