diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php index a0a79f4..65e3a92 100644 --- a/uVote/api/votes/votes.php +++ b/uVote/api/votes/votes.php @@ -97,17 +97,11 @@ class votes { } public static function open_vote($poll_ID){ new \SYSTEM\LOG\INFO($poll_ID); - if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ - throw new ERROR("You need to be logged in.");} - - $con = new \SYSTEM\DB\Connection(new \DBD\uVote()); - $res = $con->prepare( 'selVote', - 'SELECT * FROM `uvote_votes` WHERE ID = ?;', - array($poll_ID)); + $vote = votes::getVoteOfGroup($poll_ID); new INFO(print_r($vote, true)); - $vars = array('vote_text' => $vote['text'], 'vote_title' => $vote['title'], 'vote_init' => $vote['initiative'], 'poll_ID' => $vote['ID'], 'time_end' => $vote['time_end']); - $result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vars); - return $res; + $vars = array('vote_text' => $vote['text'], 'vote_quick' => $vote['quick'], 'vote_title' => $vote['title'], 'vote_init' => $vote['initiative'], 'poll_ID' => $vote['ID'], 'time_end' => $vote['time_end']); + $result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/full_vote.tpl'), $vars); + return $result; } } diff --git a/uVote/page/default_bulletin/bulletin.tpl b/uVote/page/default_bulletin/bulletin.tpl new file mode 100644 index 0000000..9e93865 --- /dev/null +++ b/uVote/page/default_bulletin/bulletin.tpl @@ -0,0 +1,20 @@ +
+
Auf einen Blick
+ ${vote_quick} +
+ Pro + Contra + Enthaltung +
\ No newline at end of file diff --git a/uVote/page/default_bulletin/default_bulletin.php b/uVote/page/default_bulletin/default_bulletin.php new file mode 100644 index 0000000..e0c3b40 --- /dev/null +++ b/uVote/page/default_bulletin/default_bulletin.php @@ -0,0 +1,17 @@ +poll_ID=$poll_ID; + } + + + + public function html(){ + + $result = array(); + $result = array_merge($result,votes::get_voteinfo($this->poll_ID)); + return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/bulletin.tpl'),$result); + } + +} \ No newline at end of file diff --git a/uVote/page/default_page/css/default_page.css b/uVote/page/default_page/css/default_page.css index a380817..f38aae6 100644 --- a/uVote/page/default_page/css/default_page.css +++ b/uVote/page/default_page/css/default_page.css @@ -3,6 +3,6 @@ body { padding-bottom: 40px; } -#list { +/*#list { border: 2px solid #ccc; -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/uVote/page/default_page/default_page.php b/uVote/page/default_page/default_page.php index 1c88411..6c08da9 100644 --- a/uVote/page/default_page/default_page.php +++ b/uVote/page/default_page/default_page.php @@ -6,6 +6,7 @@ class default_page extends SYSTEM\PAGE\Page { return ''. ''. ''. + ''. ''. ''. ''. diff --git a/uVote/page/default_page/full_vote.tpl b/uVote/page/default_page/full_vote.tpl index 0747e6a..7f44afc 100644 --- a/uVote/page/default_page/full_vote.tpl +++ b/uVote/page/default_page/full_vote.tpl @@ -1,21 +1,17 @@ -
-
-
+
+
+

${vote_title}

- Initiiert von: ${vote_init} +
+
+ Initiiert von: ${vote_init} +
+
+
+
+ ${vote_text} +
-
- Pro » - Contra » - Enthaltung »--> - -
-
-
-
-
-
- -
\ No newline at end of file + +
+
\ 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 bfeaaf0..9eea037 100644 --- a/uVote/page/default_page/js/loadtexts.js +++ b/uVote/page/default_page/js/loadtexts.js @@ -1,16 +1,17 @@ /* jQuery on document ready */ $(document).ready(function() { // handle navigation link click - $('.navbar ul li a').not('#menu_uvote').click(function () { + /*$('.navbar ul li a').not('#menu_uvote').click(function () { loadAjaxContent($(this).attr('url')); //loadUrlPic($(this).attr('url')); - }); + });*/ $('.btn_vote').click(function () { //vote_click($(this).attr('poll_ID')); open_vote($(this).attr('poll_ID')); + $('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID')); }); - $('.btnvote_yes').click(function () { + /*$('.btnvote_yes').click(function () { vote_click($(this).attr('poll_ID'),1); }); $('.btnvote_no').click(function () { @@ -26,33 +27,16 @@ $(document).ready(function() { }else{ load_openvoteinfo($(this).attr('poll_ID')); } - }); + });*/ //jqBootstrapValidation - $("#form_register input").not("[type=submit]").jqBootstrapValidation( - { - preventSubmit: true, - submitError: function($form, event, errors) {}, - submitSuccess: function($form, event){ -// alert ('.api.php?call=account&action=create&username=' + $('#bt_login_user').val() + '&password_sha=' + $.sha1($('#bt_login_password').val()) + '&email=' + $('#bt_login_user').val() + '&locale=deDE'); - $.get('./api.php?call=account&action=create&username=' + $('#bt_login_user').val() + '&password_sha=' + $.sha1($('#bt_login_password').val()) + '&email=' + $('#bt_login_user').val() + '&locale=deDE', function (data) { - if(data == 1){ - window.location.reload(); - } else { - $('#help-block-user-password-combi-wrong').attr('style', 'display: block;'); - } - }); - event.preventDefault(); - } - }); - - $("#form_login input").not("[type=submit]").jqBootstrapValidation( - { - preventSubmit: true, - submitError: function($form, event, errors) {}, - submitSuccess: function($form, event){ -// alert ('.api.php?call=account&action=create&username=' + $('#bt_login_user').val() + '&password_sha=' + $.sha1($('#bt_login_password').val()) + '&email=' + $('#bt_login_user').val() + '&locale=deDE'); - $.get('./api.php?call=account&action=login&username=' + $('#login_email').val() + '&password_sha=' + $.sha1($('#login_password').val()) + '&password_md5=' + $.md5($('#login_password').val()), function (data) { + + + $("#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 { @@ -74,9 +58,47 @@ $(document).ready(function() { event.preventDefault(); } }); - + + $('#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(); + } + }); + $('#tabs_user_main a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + load_user_main_tab($(this).attr('action')); + }); + }); + }); +function load_user_main_tab(action){ + switch(action){ + case 'user_main_uVote': + $('#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); + 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) { dataTmp = data; @@ -122,14 +144,7 @@ function vote_click (poll_ID, vote) { } function open_vote (poll_ID) { - $.getJSON('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID , function(data) { - var items = []; - if(data.status == true){ - alert("sucess"); - } else { - alert(data.result.message); - } - }); + $('#list').load('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID); } function loadAjaxContent(url) { diff --git a/uVote/page/default_page/loginform.tpl b/uVote/page/default_page/loginform.tpl index de60f06..d6ef44c 100644 --- a/uVote/page/default_page/loginform.tpl +++ b/uVote/page/default_page/loginform.tpl @@ -1,5 +1,35 @@ - \ No newline at end of file diff --git a/uVote/page/default_page/page.html b/uVote/page/default_page/page.html index 81c5db5..5667f58 100644 --- a/uVote/page/default_page/page.html +++ b/uVote/page/default_page/page.html @@ -19,7 +19,7 @@ - +