diff --git a/uVote/page/default_page/default_page.php b/uVote/page/default_page/default_page.php
index 3171a59..7076d02 100644
--- a/uVote/page/default_page/default_page.php
+++ b/uVote/page/default_page/default_page.php
@@ -9,12 +9,14 @@ class default_page extends SYSTEM\PAGE\Page {
''.
''.
''.
- '';
- '';
+ ''.
+ ''.
+ ''.
+ '';
}
private function css(){
- return '';}
+ return '';}
private function get_party_per_poll($choice){
switch($choice){
@@ -84,7 +86,7 @@ class default_page extends SYSTEM\PAGE\Page {
$vote['bt'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote_bt.tpl'),
array( 'party' => $pv['party'],
'choice' => $this->get_party_per_poll($pv['choice']),
- 'choice_class' => $this->tablerow_class($pv['choice'])));
+ 'choice_class' => $this->badge_class($pv['choice'])));
}
//uvote vote
@@ -93,7 +95,7 @@ class default_page extends SYSTEM\PAGE\Page {
foreach($uvote as $v){
$vote['uv'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote_uv.tpl'),
array( 'badge' => self::badge_class($v['choice']),
- 'perc' => $v['count'] > 0 ? $v['count']/$vote_count['count']*100 : 0));
+ 'perc' => $v['count'] > 0 ? round($v['count']/$vote_count['count']*100, 2) : 0));
}
}
diff --git a/uVote/page/default_page/full_vote.tpl b/uVote/page/default_page/full_vote.tpl
index 77a95af..f181275 100644
--- a/uVote/page/default_page/full_vote.tpl
+++ b/uVote/page/default_page/full_vote.tpl
@@ -1,8 +1,9 @@
-
-
-
-
-
-
+
diff --git a/uVote/page/default_page/js/loadtexts.js b/uVote/page/default_page/js/loadtexts.js
index 36c579a..04fa820 100644
--- a/uVote/page/default_page/js/loadtexts.js
+++ b/uVote/page/default_page/js/loadtexts.js
@@ -6,12 +6,7 @@ $(document).ready(function() {
//loadUrlPic($(this).attr('url'));
});*/
- $('.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'));
-
- });
+
/*$('.btn_openvoteinfo').click(function () {
@@ -23,9 +18,43 @@ $(document).ready(function() {
});*/
//jqBootstrapValidation
-
+
- $("#form_login input").not("[type=submit]").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');
+ });
+
+ $('#user_list').load('./?action=user_list', 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();
+ });
+ $('#tabs_user_list a').click(function (e) {
+ e.preventDefault();
+ $(this).tab('show');
+ load_user_list_tab($(this).attr('action'));
+ });
+
+ //load_user_main_tab('user_main_uVote');
+ });
+
+});
+$("#form_login input").not("[type=submit]").jqBootstrapValidation({
+
preventSubmit: true,
submitError: function($form, event, errors) {},
submitSuccess: function($form, event){
@@ -52,56 +81,63 @@ $(document).ready(function() {
}
});
- $('#user_main').load('./?action=user_main', function(){
-
- $("#register_user_form input").not("[type=submit]").jqBootstrapValidation(
- {
- preventSubmit: true,
- submitError: function($form, event, errors) {},
- submitSuccess: function($form, event){
- $.get('./api.php?call=account&action=create&username=' + $('#register_username').val() + '&password_sha=' + $.sha1($('#user_register_password1').val()) + '&email=' + $('#register_email').val() + '&locale=deDE', function (data) {
- if(data == 1){
- window.location.reload();
- } else {
- $('#help-block-user-password-combi-wrong').attr('style', 'display: block;');
- }
- });
- event.preventDefault();
- }
- });
- $('#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 register_registerform(){
+ console.log("wegwegwegwegwegweg");
+ $("#register_user_form input").not("[type=submit]").jqBootstrapValidation(
+ {
+ preventSubmit: true,
+ submitError: function($form, event, errors) {},
+ submitSuccess: function($form, event){
+ $.get('./api.php?call=account&action=create&username=' + $('#register_username').val() + '&password_sha=' + $.sha1($('#user_register_password1').val()) + '&email=' + $('#register_email').val() + '&locale=deDE', function (data) {
+ if(data == 1){
+ window.location.reload();
+ } else {
+ $('#help-block-user-password-combi-wrong').attr('style', 'display: block;');
+ }
+ });
+ event.preventDefault();
+ }
});
-
-});
+}
+
+function drawChart(){
+ //load_visualisation('#graph_bt_uv_overall',84600);
+}
function load_user_main_tab(action){
+
switch(action){
case 'user_main_uVote':
- window.location.reload();
- $('#tab_uVote').load('./?action='+ action);
+ $('#tab_uVote').load('./?action='+ action);
return;
case 'user_main_urVote':
$('#tab_urVote').load('./?action='+ action);
return;
case 'user_main_myVote':
- $('#tab_myVote').load('./?action='+ action);
+ $('#tab_myVote').load('./?action='+ action, function(){
+ $('.add_data_submit').click(function () {
+ submit_add_data();
+ alert('success');
+ });
+ });
return;
default:
}
}
-
+function load_user_list_tab(action){
+
+ switch(action){
+
+ case 'user_list_active':
+ $('#tab_active').load('./?action='+ action);
+ return;
+ case 'user_list_ended':
+ $('#tab_ended').load('./?action='+ action);
+ return;
+ default:
+ }
+}
function account_create(inputEmail, inputPassword){
$.get('./api.php?call=account&action=create&username=' + NULL + '&password_sha=' + password + '&email=' + email + '&locale=deDE', function (data) {
@@ -138,9 +174,31 @@ function get_barsperparty (poll_ID) {
function vote_click (poll_ID, vote) {
$.getJSON('./api.php?call=vote&action=vote&poll_ID=' + poll_ID + '&vote=' + vote, function(data) {
- var items = [];
+ var items = [];
if(data.status == true){
alert("success");
+ $('#user_main').load('./?action=open_bulletin&poll_ID=' + poll_ID, function(){
+ open_vote(poll_ID);
+ });
+ } else {
+ alert(data.result.message);
+ }
+ });
+}
+
+function submit_add_data () {
+ var a = document.getElementById("location");
+ var location = a.options[a.selectedIndex].text;
+ var b = document.getElementById("birthyear");
+ var birthyear = b.options[b.selectedIndex].text;
+ var c = document.getElementById("gender");
+ var gender = c.options[c.selectedIndex].text;
+ var d = document.getElementById("children");
+ var children = d.options[d.selectedIndex].text;
+ $.getJSON('./api.php?call=vote&action=data&location=' + location + '&birthyear=' + birthyear + '&gender=' + gender + '&children=' + children, function(data) {
+ var items = [];
+ if(data.status == true){
+ alert("success");
} else {
alert(data.result.message);
}
@@ -176,7 +234,7 @@ $.ajax({
}
function open_vote (poll_ID) {
- $('#list').load('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID, function(){
+ $('#user_list').load('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID, function(){
$('.btnvote_yes').click(function () {
vote_click($(this).attr('poll_ID'),1);
});
@@ -186,6 +244,10 @@ function open_vote (poll_ID) {
$('.btnvote_off').click(function () {
vote_click($(this).attr('poll_ID'),3);
});
+ $('#test').click(function(){
+ $('#myModal').modal();
+ });
+ register_registerform();
});
}
@@ -229,4 +291,62 @@ function loadApiPic(id) {
}).complete(function() {
});
+}
+
+function load_visualisation(id, timespan){
+ $('img#loader').show();
+ $.getJSON('./api.php?call=graph_bt_to_uvote_overall_by_time',function(json){
+ if(!json || json.status != true || !json.result){
+ $('img#loader').hide();
+ return;
+ }
+ json = json.result;
+ $('img#loader').hide();
+ var data = new google.visualization.DataTable();
+ first = true;
+ $.each(json[0], function(key, value){
+ if(first){
+ data.addColumn('datetime',key);
+ first = false;
+ } else {
+ data.addColumn('number',key);
+ }
+ });
+ $.each(json, function(key, value){
+ first = true;
+ data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));});
+
+ console.log(data);
+ var options = {title: 'Übereinstimmung uVote Community/Bundestag', aggregationTarget: 'category', selectionMode: 'multiple', /*curveType: 'function',*/ /*focusTarget: 'category',*/ chartArea:{}, vAxis:{format:'#%', logScale: false}, interpolateNulls: false, width: "300", height: "250"};
+ //LineChart
+ new google.visualization.ColumnChart(document.getElementById(id)).draw(data, options);
+ });
+}
+function load_visualisation_urvote(id, timespan){
+ $('img#loader').show();
+ $.getJSON('./api.php?call=graph_bt_to_user_overall_by_time',function(json){
+ if(!json || json.status != true || !json.result){
+ $('img#loader').hide();
+ return;
+ }
+ json = json.result;
+ $('img#loader').hide();
+ var data = new google.visualization.DataTable();
+ first = true;
+ $.each(json[0], function(key, value){
+ if(first){
+ data.addColumn('datetime',key);
+ first = false;
+ } else {
+ data.addColumn('number',key);
+ }
+ });
+ $.each(json, function(key, value){
+ first = true;
+ data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));});
+
+ console.log(data);
+ var options = {title: id, aggregationTarget: 'category', selectionMode: 'multiple', curveType: 'function', /*focusTarget: 'category',*/ chartArea:{}, vAxis:{logScale: false}, interpolateNulls: false, width: "300", height: "250"};
+ new google.visualization.LineChart(document.getElementById(id)).draw(data, options);
+ });
}
\ No newline at end of file
diff --git a/uVote/page/default_page/loginform.tpl b/uVote/page/default_page/loginform.tpl
index b98d11c..750d197 100644
--- a/uVote/page/default_page/loginform.tpl
+++ b/uVote/page/default_page/loginform.tpl
@@ -3,7 +3,6 @@
-->
-