diff --git a/uVote/api/api_uvote.php b/uVote/api/api_uvote.php
index 4aea6ee..ac01b77 100644
--- a/uVote/api/api_uvote.php
+++ b/uVote/api/api_uvote.php
@@ -15,6 +15,11 @@ class api_uvote extends \SYSTEM\API\api_login {
}
+ public static function call_vote_action_commentrate($c_ID, $val) {
+ return votes::write_commentrate($c_ID, $val);
+
+ }
+
public static function call_vote_action_new_vote($ID, $title, $iframe_link) {
return votes::write_poll($ID, $title, $iframe_link);
diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php
index 29a9726..da8d590 100644
--- a/uVote/api/votes/votes.php
+++ b/uVote/api/votes/votes.php
@@ -124,6 +124,9 @@ class votes {
public static function get_user_count(){
return \DBD\UVOTE_DATA_USER_COUNT_USERS::Q1(array());}
+ public static function get_commentrate($c_ID, $val){
+ return \DBD\UVOTE_DATA_USER_COMMENTRATE_PER_COMMENT::Q1(array($c_ID, $val));}
+
public static function get_count_user_votes_per_poll($poll_ID){
return \DBD\UVOTE_DATA_USER_COUNT_CHOICE_PER_POLL::Q1(array($poll_ID));}
@@ -187,9 +190,14 @@ class votes {
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.");}
+ throw new ERROR("You need to be logged in.");}
return \DBD\UVOTE_DATA_USER_COMMENT_INSERT::Q1(array($c_choice, $poll_ID, \SYSTEM\SECURITY\Security::getUser()->id, $c_txt, $c_src));}
+ public static function write_commentrate($c_ID, $val){
+ if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
+ throw new ERROR("You need to be logged in.");}
+ return \DBD\UVOTE_DATA_USER_COMMENTRATE_INSERT::Q1(array($c_ID, \SYSTEM\SECURITY\Security::getUser()->id, $val));}
+
public static function get_add_data(){
return \DBD\UVOTE_DATA_USER_ADD_DATA::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id));
}
diff --git a/uVote/dbd/qq/UVOTE_DATA_USER_COMMENTRATE_INSERT.php b/uVote/dbd/qq/UVOTE_DATA_USER_COMMENTRATE_INSERT.php
new file mode 100644
index 0000000..743bea7
--- /dev/null
+++ b/uVote/dbd/qq/UVOTE_DATA_USER_COMMENTRATE_INSERT.php
@@ -0,0 +1,12 @@
+
${timestamp}
${c_txt}
-${c_src}
+
+
+
${nr_up}
+
+
${nr_down}
+
+
+
+Quelle: ${c_src}
+
+
\ No newline at end of file
diff --git a/uVote/page/default_bulletin/default_bulletin.php b/uVote/page/default_bulletin/default_bulletin.php
index f96da42..1d49487 100644
--- a/uVote/page/default_bulletin/default_bulletin.php
+++ b/uVote/page/default_bulletin/default_bulletin.php
@@ -58,7 +58,9 @@ class default_bulletin extends SYSTEM\PAGE\Page {
private function get_pro_comments (){
$result = '';
$vars = votes::getUserComments($this->poll_ID, 1);
+
foreach($vars as $com){
+ $com['count'] = votes::get_commentrate($com['c_ID'], 1);
$com['c_txt'] = utf8_encode($com['c_txt']);
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/comment.tpl'), $com);
}
@@ -67,9 +69,11 @@ class default_bulletin extends SYSTEM\PAGE\Page {
}
private function get_con_comments (){
$result = '';
- $vars = votes::getUserComments($this->poll_ID, 2);
-
+ $vars = votes::getUserComments($this->poll_ID, 2);
+
foreach($vars as $com){
+ $com['count'] = votes::get_commentrate($com['c_ID'], 2);
+ $com['nr_down'] = $c['count'];
$com['c_txt'] = utf8_encode($com['c_txt']);
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/comment.tpl'), $com);
}
@@ -185,6 +189,8 @@ class default_bulletin extends SYSTEM\PAGE\Page {
private function css(){
return ' ';}
+
+
public function html(){
$poll_expired = \DBD\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
$user_vote = votes::getUserPollData($this->poll_ID);
diff --git a/uVote/page/default_comment/comment.tpl b/uVote/page/default_comment/comment.tpl
new file mode 100644
index 0000000..8f01cea
--- /dev/null
+++ b/uVote/page/default_comment/comment.tpl
@@ -0,0 +1,4 @@
+${timestamp}
+${c_txt}
+${c_src}
+
\ No newline at end of file
diff --git a/uVote/page/default_comment/default_comment.php b/uVote/page/default_comment/default_comment.php
new file mode 100644
index 0000000..32b9b0c
--- /dev/null
+++ b/uVote/page/default_comment/default_comment.php
@@ -0,0 +1,87 @@
+poll_ID=$poll_ID;}
+
+ public function vote_choice(){
+ $vars = votes::getUserPollData($this->poll_ID);
+ return $this->tablerow_class($vars);
+ }
+
+ private static function tablerow_class($choice){
+ switch($choice){
+ case 1:
+ return 'pro';
+ case 2:
+ return 'con';
+ case 3:
+ return 'ent';
+ default:
+ return 'open';
+ }
+ }
+
+
+
+ private function get_pro_comments (){
+ $result = '';
+ $vars = votes::getUserComments($this->poll_ID, 1);
+ foreach($vars as $com){
+ $com['c_txt'] = utf8_encode($com['c_txt']);
+ $result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/comment.tpl'), $com);
+ }
+ return $result;
+
+ }
+ private function get_con_comments (){
+ $result = '';
+ $vars = votes::getUserComments($this->poll_ID, 2);
+
+ foreach($vars as $com){
+ $com['c_txt'] = utf8_encode($com['c_txt']);
+ $result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/comment.tpl'), $com);
+ }
+ return $result;
+
+ }
+
+
+
+
+
+
+ private function js(){
+ return '';}
+ private function css(){
+ return ' ';}
+
+ public function html(){
+ $poll_expired = \DBD\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
+ $user_vote = votes::getUserPollData($this->poll_ID);
+
+ $vars = array();
+ $vars['comments_pro'] = '';
+ $vars['comments_con'] = '';
+ $vars['js'] = $this->js();
+ $vars['css'] = $this->css();
+
+ $vars['vote_buttons'] = $this->vote_buttons($poll_expired,$user_vote);
+// $vars['p_fields'] = $this->p_fields();
+ if($user_vote){
+ $vars['comments_pro'] = $this->get_pro_comments();
+ $vars['comments_con'] = $this->get_con_comments();
+ }
+
+ $vars['poll_ID'] = $this->poll_ID; //put it here - so its filled in!
+ $vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
+ $vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE));
+ $vars = array_merge($vars, \SYSTEM\locale::getStrings(150));
+ $vars = array_merge($vars, \SYSTEM\locale::getStrings(100));
+
+ $vars = array_merge($vars,votes::get_voteinfo($this->poll_ID));
+ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_comment/comment.tpl'),$vars);
+ }
+
+}
\ No newline at end of file
diff --git a/uVote/page/default_page/js/loadtexts.js b/uVote/page/default_page/js/loadtexts.js
index 0436b61..cbeeccf 100644
--- a/uVote/page/default_page/js/loadtexts.js
+++ b/uVote/page/default_page/js/loadtexts.js
@@ -45,11 +45,13 @@ $(document).ready(function() {
});
$('.btn_vote').click(function () {
//vote_click($(this).attr('poll_ID'));
- $('#user_main').load('./?action=open_bulletin&poll_ID=' + $(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')).show();
+ });
//load_user_main_tab('user_main_uVote');
});
@@ -133,15 +135,22 @@ function load_user_list_tab(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 +208,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();
@@ -280,6 +301,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/default_page/parties_on_vote.tpl b/uVote/page/default_page/parties_on_vote.tpl
index 5a66521..1762160 100644
--- a/uVote/page/default_page/parties_on_vote.tpl
+++ b/uVote/page/default_page/parties_on_vote.tpl
@@ -1,4 +1,4 @@
-
- ${choice}
+
+
${choice}
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/uVote/page/default_page/vote.tpl b/uVote/page/default_page/vote.tpl
index df93ac5..56a913e 100644
--- a/uVote/page/default_page/vote.tpl
+++ b/uVote/page/default_page/vote.tpl
@@ -1,27 +1,37 @@
-
-
-
- ${title}
-
- ${full_vote_btn}
-
-
-
+
+
+
+
+
+
${bt}
-
-
-
- uVote
-
+
+
+
+
+ uVote
+
${uv}
-
${uv_count}
-
-
-
-
-
-
-
+
+ ${uv_count}
+
+
+
+
+
diff --git a/uVote/page/default_page/vote_bt.tpl b/uVote/page/default_page/vote_bt.tpl
index 57a4a31..02f4418 100644
--- a/uVote/page/default_page/vote_bt.tpl
+++ b/uVote/page/default_page/vote_bt.tpl
@@ -1 +1 @@
-${choice}
\ No newline at end of file
+${choice}
\ No newline at end of file
diff --git a/uVote/page/default_register/register.tpl b/uVote/page/default_register/register.tpl
index 7fd1828..d91f7a0 100644
--- a/uVote/page/default_register/register.tpl
+++ b/uVote/page/default_register/register.tpl
@@ -1,5 +1,6 @@