This commit is contained in:
Nael 2014-01-24 22:20:25 +01:00
parent 6a19f4378c
commit 2ad90534b3
31 changed files with 173 additions and 117 deletions

View File

@ -4,7 +4,14 @@ class api_uvote extends \SYSTEM\API\api_login {
public static function call_vote_action_vote($poll_ID, $vote) {
return votes::write_vote($poll_ID, $vote);
}
}
public static function call_vote_action_feedback($feedback) {
new \SYSTEM\LOG\INFO($feedback);
return votes::write_feedback($feedback);
}
public static function call_vote_action_open_vote($poll_ID) {
return votes::open_vote($poll_ID);

View File

@ -99,6 +99,18 @@ class votes {
return JsonResult::ok();
}
public static function write_feedback($feedback){
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( 'insertFeedback',
'INSERT INTO uvote_beta_feedback
VALUES (?, ?);',
array(\SYSTEM\SECURITY\Security::getUser()->id, $feedback));
return JsonResult::ok();
}
public static function open_vote($poll_ID){

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 KiB

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

View File

@ -1,2 +1,6 @@
<img src="${frontend_logos}cover.png"/>
<div class="row" style="margin-right: 30px;">
<img src="${frontend_logos}cover.png"/>
<div style="float: right; margin-right: 25px;">
<img src="${frontend_logos}chrome.png" width="200px"/>
</div>
</div>

View File

@ -8,13 +8,13 @@ body {
}*/
.pro{
background: lightgreen;
background: url(http://mojotrollz.eu/web/uVote/api.php?call=img&cat=frontend_logos&id=pro.png);
}
.contra{
background: lightcoral;
background: url(http://mojotrollz.eu/web/uVote/api.php?call=img&cat=frontend_logos&id=contra.png)no-repeat;
}
.ent{
background: lightgray;
background: url(http://mojotrollz.eu/web/uVote/api.php?call=img&cat=frontend_logos&id=enth.png)no-repeat;
}

View File

@ -77,7 +77,7 @@ class default_page extends SYSTEM\PAGE\Page {
public function html(){
$vars = array();
$vars['js'] = $this->js();
$vars['css'] = $this->css();
$vars['css'] = $this->css();
$vars['votelist'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->generate_votelist() : $this->get_coverpage() ;
$vars['vote'] = $this->generate_vote();
$vars['registerform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->getloggedinform() : $this->exchange_registerform();

View File

@ -68,6 +68,11 @@ $(document).ready(function() {
event.preventDefault();
}
});
$('#feedback_submit').click(function (data){
send_feedback($('#feedback_text').val());
});
$('#tabs_user_main a').click(function (e) {
e.preventDefault();
$(this).tab('show');
@ -79,8 +84,10 @@ $(document).ready(function() {
function load_user_main_tab(action){
switch(action){
case 'user_main_uVote':
$('#tab_uVote').load('./?action='+ action);
window.location.reload();
$('#tab_uVote').load('./?action='+ action);
return;
case 'user_main_urVote':
$('#tab_urVote').load('./?action='+ action);
@ -137,6 +144,20 @@ function vote_click (poll_ID, vote) {
});
}
function send_feedback (feedback) {
$.getJSON('./api.php?call=vote&action=feedback&feedback=' + feedback, function(data) {
console.log("hallo3672rt2ziuzir");
var items = [];
alert(feedback);
if(data.status == true){
alert("success");
} else {
alert(data.result.message);
}
});
}
function open_vote (poll_ID) {
$('#list').load('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID, function(){
$('.btnvote_yes').click(function () {

View File

@ -46,17 +46,19 @@
</div>
</div>
<div class="box" style="margin-top: 0; clear: both;">
<div id="site-content" style="padding: 0; margin: 0;">
<div id="list" style="padding: 0px; width: 850px; top: 50px; padding-left: 75px; bottom: 50px;">
<div id="site-content" style="padding: 0; margin: 0; margin-left: 40px;">
<div id="list" style="padding: 0px; float: right; width: 50%;">
${votelist}
</div>
<div id="user_main" style="right: 0px; position: fixed; padding: 0px; right: 70px; width: 35%; top: 50px; bottom: 50px;">
<div id="user_main" style="padding: 0px; width: 600px; float: left; position: fixed;">
</div>
</div>
</div>
<div id="wrap">
<div class="navbar navbar-inverse navbar-fixed-bottom" style="height: 30px; text-align: center; padding-top: 7px;"> copyright by mojotrollz, webcraft media and yeminy
<div class="navbar navbar-inverse navbar-fixed-bottom" style="height: 30px; text-align: center; padding-top: 7px;">
</div>
</div>
</body>

View File

@ -1,12 +1,18 @@
<div class="${vote_class}" style="padding: 5px; margin-bottom: 8px; border: 2px solid #ccc; float: left;">
<div class="row" style="width: 100%; margin: 0; margin-top: 5px; margin-bottom: 8px;">
<div class="span6">
<h4>${vote_title}</h4>
Initiiert von: ${vote_init}
<table class="${vote_class} table table-hover" style="display: table; margin-bottom: 5px; border: 2px solid #ccc; float: left; width: 85%; height: 100px;">
<div style="margin: 0; margin-top: 5px; margin-bottom: 8px;">
<tr>
<td style="border-right: 2px solid #ccc; width: 20px;">Nr.
<br>
Politikfeld(er):
</div>
<a class="btn btn_primary btn_vote" poll_ID="${poll_ID}" style="float: right; margin-top: 10px;">Abstimmen</a>
${poll_ID}</td>
<td class="" style="">
<h4>${vote_title}</h4>
Politikfeld(er):
</td>
<td style="width: 70px; margin-top: 10px; border-left: 2px solid #ccc;">
<a class="btn btn_primary btn_vote" poll_ID="${poll_ID}">Abstimmen</a>
</td>
</tr>
<!--<div class="span5" style="margin-top: 15px;">
<a class="btn btn-large btn-green btnvote_yes" style="width: 110px;" poll_ID="$">Pro &raquo;</a>
<a class="btn btn-large btn-red btnvote_no" style="width: 110px; background-color: red;" href="#" poll_ID="$">Contra &raquo;</a>
@ -18,9 +24,5 @@
</div>
<div class="countdown"></div>
</div>-->
</div>
<div class="span5" id="openvoteinfo${poll_ID}" style="margin: 0; display: none; width: 100%; margin-top: 15px;">
</div>
</div>
</table>

View File

@ -7,4 +7,6 @@ SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_openinfo','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_bulletin','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_uVote','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_urVote','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_myVote','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_cover','');

View File

@ -9,4 +9,5 @@
<div class="tab-pane" id="tab_urVote" style="overflow: hidden;"></div>
<div class="tab-pane" id="tab_myVote"></div>
</div>
</div>
</div>
${uVote}

View File

@ -1,8 +1,13 @@
<?php
class user_main extends SYSTEM\PAGE\Page {
public function html(){
$result = array();
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main/main_menu.tpl'),$result);
class user_main extends SYSTEM\PAGE\Page {
public function get_main_uVote(){
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'), array());}
public function html(){
$vars['uVote'] = $this->get_main_uVote();
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main/main_menu.tpl'),$vars);
}
}

View File

@ -0,0 +1 @@
test123

View File

@ -0,0 +1,8 @@
<?php
class user_main_myVote extends SYSTEM\PAGE\Page {
public function html(){
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_myVote/myVote.tpl'),$vars);
}
}

View File

@ -1,25 +1,8 @@
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Genre', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General',
'Western', 'Literature', { role: 'annotation' } ],
['2010', 10, 24, 20, 32, 18, 5, ''],
['2020', 16, 22, 23, 30, 16, 9, ''],
['2030', 28, 19, 29, 30, 12, 13, ''],
]);
var options = {
width: 600,
height: 400,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
isStacked: true,
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<img src="${frontend_logos}logo2.png"/>
<form>
<br />
<h4>uVote BETA Feedback</h4>
<textarea id="feedback_text">Sag uns was dich stört!</textarea>
<br />
<input type="submit" id="feedback_submit" />
</form>

View File

@ -1,8 +1,8 @@
<?php
class user_main_uVote extends SYSTEM\PAGE\Page {
public function html(){
$result = array();
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'),$result);
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'),$vars);
}
}

View File

@ -0,0 +1,3 @@
<div id="statistics_uvote_users">
${choices_user_ID}
</div>

View File

@ -0,0 +1,8 @@
<?php
class user_main_urVote extends SYSTEM\PAGE\Page {
public function html(){
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/urVote.tpl'),$vars);
}
}

View File

@ -1,5 +1,5 @@
<?php
class PSAI extends \SYSTEM\PATH {
public static function getPath(){
return \SYSTEM\C_ROOT.'mojotrollz/sai/'.\SYSTEM\C_SUBPATH;}
return \SYSTEM\C_ROOT.'uVote/sai/'.\SYSTEM\C_SUBPATH;}
}

View File

@ -1,55 +1,20 @@
function init_saimod_uvote_data_input(){
$('#realm_start').click(function(){
$.ajax({
url: SAI_ENDPOINT,
data: { sai_mod: 'saimod_mojotrollz_server_handling',
action: 'realmstart'
},
type: 'POST',
$('#vote_data_submit').click(function (poll_ID) {
//vote_click($(this).attr('poll_ID'));
alert("doc ready works")
vote_data_submit($(this).attr('poll_ID'));
});
update_realmstatus();
});
$('#realm_stop').click(function(){
$.ajax({
url: SAI_ENDPOINT,
data: { sai_mod: 'saimod_mojotrollz_server_handling',
action: 'realmstop'
},
type: 'POST',
});
update_realmstatus();
});
$('#world_start').click(function(){
$.ajax({
url: SAI_ENDPOINT,
data: { sai_mod: 'saimod_mojotrollz_server_handling',
action: 'worldstart'
},
type: 'POST',
});
update_worldstatus();
});
$('#world_stop').click(function(){
$.ajax({
url: SAI_ENDPOINT,
data: { sai_mod: 'saimod_mojotrollz_server_handling',
action: 'worldstop'
},
type: 'POST',
});
update_worldstatus();
});
}
function update_realmstatus(){
$('status_realm').load(SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_server_handling&action=realmstatus');
}
function update_worldstatus(){
$('status_world').load(SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_server_handling&action=world status');
}
};
function vote_data_submit (poll_ID, vote) {
$.getJSON('./api.php?call=vote&action=vote&poll_ID=' + poll_ID, function(data) {
var items = [];
if(data.status == true){
alert("success");
} else {
alert(data.result.message);
}
});
}

View File

@ -1,5 +1,13 @@
<?php
class saimod_uvote_data_input extends \SYSTEM\SAI\SaiModule {
class saimod_uvote_data_input extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_uvote_data_input_action_add($poll_ID, $title, $text, $p_fields, $time_start, $time_end){
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
$res = null;
$res = $con->prepare('addText' ,'INSERT INTO uvote_votes (poll_ID, title, text, p_fields, time_start, time_end) VALUES (?1, ?2, ?3, ?4, ?5, ?6);', array($poll_ID));
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added")) : \SYSTEM\LOG\JsonResult::ok();
}
public function saimod_uvote_data_input(){
$vars = array();
return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/main.tpl', $vars);}
@ -7,7 +15,7 @@ class saimod_uvote_data_input extends \SYSTEM\SAI\SaiModule {
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_uvote_data_input">data completion</a></li><li class="divider"></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
public static function sai_mod_saimod_uvote_vote_edit_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array(
public static function sai_mod_saimod_uvote_data_input_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array(
\SYSTEM\WEBPATH(new PSAI(),'saimod_uvote_data_input/saimod_uvote_data_input.js')
));}
public static function sai_mod_saimod_uvote_data_input_flag_css(){}

View File

@ -48,7 +48,7 @@
<h5>Auf einen Blick</h5>
<form action="/html/tags/html_form_tag_action.cfm" method="post">
<br />
<textarea name="vote_quick" id="vote_quick">Insert Info into here!</textarea>
<textarea name="vote_quick" id="vote_text">Insert Info into here!</textarea>
<br />
<input type="submit" value="Submit" />
</form>
@ -71,4 +71,4 @@
</div>
</div>
<br>
<a class="btn btn-primary" id="vote_submit">Submit</a>
<a class="btn btn-primary" id="vote_data_submit">Submit</a>

View File

@ -1 +1,24 @@
function init_saimod_uvote_vote_edit(){
alert("doc ready works")
$('#vote_data_submit').click(function () {
//vote_click($(this).attr('poll_ID'));
alert("doc ready works")
// vote_data_edit($(this).attr('poll_ID'));
$.getJSON(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_uvote_vote_edit&action=data_submit',function(){
init__SYSTEM_SAI_uvote_vote_edit();
});
});
};
function vote_data_edit (poll_ID, vote) {
$.getJSON('./api.php?call=vote&action=vote&poll_ID=' + poll_ID, function(data) {
var items = [];
if(data.status == true){
alert("success");
} else {
alert(data.result.message);
}
});
}

View File

@ -1,11 +1,12 @@
<?php
class saimod_uvote_vote_edit extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_uvote_vote_edit_action_add($id, $category){
public static function sai_mod__SYSTEM_SAI_saimod_uvote_vote_edit_action_add($poll_ID, $title, $text, $p_fields, $time_start, $time_end){
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
$res = null;
$res = $con->prepare('addText' ,'INSERT INTO uvote_votes (ID) VALUES ($1);', array($poll_ID));
$res = $con->prepare('addText' ,'INSERT INTO uvote_votes (poll_ID, title, text, p_fields, time_start, time_end) VALUES (?1, ?2, ?3, ?4, ?5, ?6);', array($poll_ID));
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added")) : \SYSTEM\LOG\JsonResult::ok();
}
public static function sai_mod_saimod_uvote_vote_edit(){
$vars = array();
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';