comment function working now

This commit is contained in:
Nael 2014-03-10 00:43:00 +01:00
parent cb333417a5
commit cc998349a8
4 changed files with 68 additions and 60 deletions

View File

@ -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.");}

View File

@ -1,45 +1,55 @@
<div style="float: left;">
<h4>${title}</h4>
<div>
<div style="float: left; width: 100%;">
<h4>${title}</h4>
${vote_buttons}
<div style="float: left;">
<img src="${frontend_logos}icon_urn_${vote_class}.png"/>
<img src="${frontend_logos}icon_urn_${vote_class}.png"/>
</div>
<div style="margin-top: 30px;">
${openvote_help_text}
${title}
${openvote_help_text1}
</div>
<div>
${voice_weight}
</div>
<div style="float: left; width: 50%">
<div>
${bars_user}
</div>
<div>
${bars_bt}
<div style="margin-top: 30px;">
${openvote_help_text}
${title}
${openvote_help_text1}
</div>
</div>
<div style="float: left; width: 50%;">
${icons_party}
${choice_party}
</div>
<div style="clear: both"></div>
</div>
<div>
${voice_weight}
</div>
<div style="float: left; width: 50%">
<div>
${bars_user}
</div>
<div>
${bars_bt}
</div>
</div>
<div style="width: 50%;">
${icons_party}
${choice_party}
</div>
<div style="clear: both"></div>
<div style="width: 50%">
${comments_pro}
${comments_con}
<font></font>
<textarea id="c_txt_pro">
</textarea>
<font></font>
<input type="text" id="c_src_pro"/><br>
<div class="btn btn-primary submit_pro" id="submit_pro" poll_ID="${poll_ID}">${submit}</div>
</div>
<div style="padding-top: 30px; width: 100%;">
<div style="width: 50%; float: left">
<h5>Pro</h5>
${comments_pro}
</div>
<div style="width: 50%; float: right">
<h5>Contra</h5>
${comments_con}
</div>
</div>
<div style="clear: both"></div>
<div>
<font size="2">Kommentar</font><br>
<textarea id="c_txt_pro"></textarea><br>
<font size="2">Quelle</font><br>
<input type="text" id="c_src_pro" placeholder="optional"/><br>
<select id="side_select" name="side_select">
<option>Seite</option>
<option value="1">Argument Pro</option>
<option value="2">Argument Con</option>
</select><br>
<div class="btn btn-primary submit_pro" id="submit_pro" poll_ID="${poll_ID}">${submit}</div>
</div>

View File

@ -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');
});

View File

@ -68,7 +68,7 @@
</div>
</div>
<div id="site-content" style="padding: 0; margin: 0; margin-left: 40px;">
<div id="site-content" style="padding: 0; margin: 0; margin-left: 35px;">
<div id="user_main" style="position: absolute; padding: 0; padding-top: 0px; width: 49%;"></div>