Info texts are loading correctly :)

This commit is contained in:
Nael 2013-07-03 01:21:12 +02:00
parent 07106507d1
commit 48cb0b1f0e
5 changed files with 25 additions and 13 deletions

View File

@ -4,4 +4,7 @@ class ApiClass extends \SYSTEM\API\apiloginclass {
public static function call_vote_action_vote($poll_ID, $vote) {
return votes::write_vote($poll_ID, $vote);
}
public static function call_vote_action_openinfo($poll_ID) {
return votes::get_openinfo($poll_ID);
}
}

View File

@ -12,6 +12,14 @@ class votes {
return $result;
}
public static function get_openinfo($poll_ID){
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
$res = $con->prepare( 'selVoteByID',
'SELECT * FROM `uvote_votes` WHERE `ID` = ?;',
array($poll_ID));
$result = $res->next();
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/openvoteinfo.tpl'),$result == NULL ? array() : $result);
}
public static function write_vote($poll_ID, $vote){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
throw new ERROR("You need to be logged in.");}

View File

@ -17,7 +17,7 @@ $(document).ready(function() {
});
$('.btn_openvoteinfo').click(function () {
load_openvoteinfo($(this).attr('openvoteinfo'));
load_openvoteinfo($(this).attr('poll_ID'));
});
// $('#register_btn').click(function () {
// account_create ($(this).attr ('#inputEmail'))
@ -70,24 +70,24 @@ $(document).ready(function() {
});
function account_create(inputEmail, inputPassword){
$.get('.api.php?call=account&action=create&username=' + NULL + '&password_sha=' + password + '&email=' + email + '&locale=deDE', function (data) {
$.get('./api.php?call=account&action=create&username=' + NULL + '&password_sha=' + password + '&email=' + email + '&locale=deDE', function (data) {
dataTmp = data;
}).complete(function() {
});
}
function load_openvoteinfo (openvoteinfo){
var dataTmp;
$.get(openvoteinfo, function (data) {
dataTmp = data;
function load_openvoteinfo (poll_ID){
var openvoteinfo;
$.get('./api.php?call=vote&action=openinfo&poll_ID=' + poll_ID, function (data) {
openvoteinfo = data;
bodyelem = $("");
bodyelem.animate();
}).complete(function() {
$('#openvoteinfo').slideUp({duration: 'slow',
$('#openvoteinfo'+poll_ID).slideUp({duration: 'slow',
complete: function(){
$('#openvoteinfo').html(dataTmp);
$('#openvoteinfo').slideDown('slow');
$('#openvoteinfo'+poll_ID).html(openvoteinfo);
$('#openvoteinfo'+poll_ID).slideDown('slow');
site_content_is_visible = true;
}});
});

View File

@ -1,3 +1,3 @@
<div class="container" style="margin: 0;">
<p>${vote_text}</p>
<p>${text}</p>
</div>

View File

@ -4,10 +4,11 @@ box-shadow: 1px 1px 4px 1px rgba(0, 0, 0, 0.5);">
<div class="span6">
<h3>${vote_title}</h3>
<div class="span5" id="openvoteinfo" style="margin: 0; display: none;">
<p>${vote_text}</p>
<div class="span5" id="openvoteinfo${poll_ID}" style="margin: 0; display: none;">
</div>
<button class="btn btn-mini btn_openvoteinfo" data-toggle="dropdown">
<br>
<button class="btn btn-mini btn_openvoteinfo" data-toggle="dropdown" poll_ID=${poll_ID}>
<span class="caret"></span>
</button>
</div>