new functionality

This commit is contained in:
Nael 2014-01-17 01:05:31 +01:00
parent ef465496df
commit 8b688882fc
19 changed files with 284 additions and 77 deletions

View File

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

View File

@ -0,0 +1,20 @@
<div style="margin-right: 10px; float: right;">
<h5>Auf einen Blick</h5>
${vote_quick}
<br>
<a class="btn btn-green btnvote_yes"
style="width: 65px;"
href="#"
poll_ID="${poll_ID}"><font
size="3">Pro</font></a>
<a class="btn btn-red btnvote_no"
style="width: 65px;"
href="#"
poll_ID="${poll_ID}"><font
size="3">Contra</font></a>
<a class="btn btn-grey btnvote_off"
style="width: 65px;"
href="#"
poll_ID="${poll_ID}"><font
size="3">Enthaltung</font></a>
</div>

View File

@ -0,0 +1,17 @@
<?php
class default_bulletin extends SYSTEM\PAGE\Page {
private $poll_ID = NULL;
public function __construct($poll_ID) {
$this->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);
}
}

View File

@ -3,6 +3,6 @@ body {
padding-bottom: 40px;
}
#list {
/*#list {
border: 2px solid #ccc;
}
}*/

View File

@ -6,6 +6,7 @@ class default_page extends SYSTEM\PAGE\Page {
return '<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PJQUERY(),'jquery-1.9.1.min.js').'"></script>'.
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PBOOTSTRAP(),'js/bootstrap.min.js').'"></script>'.
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PVALIDATION(),'jqBootstrapValidation.js').'"></script>'.
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PCRYPTOSHA(),'jquery.md5.js').'"></script>'.
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PCRYPTOSHA(),'jquery.sha1.js').'"></script>'.
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PLIB(),'jquery.countdown\jquery.countdown.js').'"></script>'.
'<script src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/timer.js').'"></script>'.

View File

@ -1,21 +1,17 @@
<div style="padding: 5px; background: lightyellow; margin-bottom: 8px; -webkit-box-shadow: 1px 1px 4px 1px rgba(0, 0, 0, 0.5); box-shadow: 1px 1px 4px 1px rgba(0, 0, 0, 0.5);">
<div class="row" style="width: 100%; margin: 0; margin-top: 15px;">
<div class="span6">
<div style="background: lightyellow; margin-bottom: 8px; -webkit-box-shadow: 1px 1px 4px 1px rgba(0, 0, 0, 0.5); box-shadow: 1px 1px 4px 1px rgba(0, 0, 0, 0.5);">
<div class="row" style="margin: 0; margin-top: 15px;">
<div class="span6" style="width: 50%;">
<h4>${vote_title}</h4>
Initiiert von: ${vote_init}
<br>
<div style="">
Initiiert von: ${vote_init}
</div>
<br>
<br>
<div>
${vote_text}
</div>
</div>
<div class="span5" style="margin-top: 15px;">
<a class="btn btn-large btn-green btnvote_yes" style="width: 110px;" poll_ID="${poll_ID}">Pro &raquo;</a>
<a class="btn btn-large btn-red btnvote_no" style="width: 110px; background-color: red;" href="#" poll_ID="${poll_ID}">Contra &raquo;</a>
<a class="btn btn-large btn-grey btnvote_off" style="width: 110px; background-color: grey;" href="#" poll_ID="${poll_ID}">Enthaltung &raquo;</a>-->
<div class="progress">
<div class="bar countdownbar" pollid="${poll_ID}" style="width: 0%;">
</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>
</div>
</div>

View File

@ -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) {

View File

@ -1,5 +1,35 @@
<form class="navbar-form pull-right" id="form_login">
<!--<form class="navbar-form pull-right" id="form_login">
<input class="span2" type="text" id="login_email" placeholder="E-Mail">
<input class="span2" type="password" id="login_password" placeholder="Passwort">
<button type="submit" class="btn">Login</button>
</form> -->
<form class="navbar-form pull-right" style="" id="form_login">
<div class="control-group">
<div class="controls" style="float: left;">
<input type="text"
size="20"
style=""
id="bt_login_user"
placeholder="${sai_mod_login_username}"
minlength="3" data-validation-minlength-message="${sai_error_mod_login_username_too_short}"
maxlength="16" data-validation-maxlength-message="${sai_error_mod_login_username_too_long}"
required data-validation-required-message="${sai_error_mod_login_username_required}"/>
</div>
<div class="controls" style="float: left;">
<input type="password"
size="20"
style=""
id="bt_login_password"
placeholder="${sai_mod_login_password}"
minlength="5" data-validation-minlength-message="${sai_error_mod_login_password_too_short}"
maxlength="16" data-validation-maxlength-message="${sai_error_mod_login_password_too_long}"
required data-validation-required-message="${sai_error_mod_login_password_required}"/>
</div>
<div class="help-block"style="float: left;"></div>
<input type="hidden" />
<button class="btn btn-primary" style="float: left; height: 32px; font-size: 13px;"
type="submit"
id="login_submit">${sai_mod_login_login}</button>
</div>
</form>

View File

@ -19,7 +19,7 @@
</head>
<body style="background-color: #f2f2f2;">
<body style="">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
@ -47,10 +47,10 @@
</div>
<div class="container" id="site-content-wrapper" style="margin-top: 0;">
<div id="site-content" style="padding: 0; margin: 0;">
<div id="list" style="padding: 0px; max-height: 720px; overflow-y: scroll; float: left;">
<div id="list" style="position: fixed; padding: 0px; width: 800px; top: 50px; bottom: 50px; overflow-y: scroll; float: left;">
${votelist}
</div>
<div id="stats" style="float: right;">
<div id="user_main" style="right: 0px; position: fixed; padding: 0px; padding-right: 10px; width: 35%; top: 50px; bottom: 50px; overflow-y: scroll;">
</div>
</div>

View File

@ -1,4 +1,4 @@
<div style="padding: 5px; background: lightyellow; margin-bottom: 8px; -webkit-box-shadow: 1px 1px 4px 1px rgba(0, 0, 0, 0.5); box-shadow: 1px 1px 4px 1px rgba(0, 0, 0, 0.5);">
<div style="padding: 5px; background: #f1f1f1; margin-bottom: 8px; border: 2px solid #ccc;">
<div class="row" style="width: 100%; margin: 0; margin-top: 5px; margin-bottom: 8px;">
<div class="span6">
<h4>${vote_title}</h4>

View File

@ -1,12 +1,11 @@
<?php
class default_page extends SYSTEM\PAGE\Page {
class default_register extends SYSTEM\PAGE\Page {
public function html(){
$vars = array();
$vars['js'] = $this->js();
$vars['PIC_PATH'] = SYSTEM\WEBPATH(new PPAGE(),'uVote/page/default_page/pics/');
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_register/register.html'), $vars);
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_register/register.tpl'), $vars);
$vars['PIC_PATH'] = SYSTEM\WEBPATH(new PPAGE(),'default_register/pics/');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@ -0,0 +1,87 @@
<h1>${register}</h1>
<br />
<br />
<form class="textbox" id="register_user_form">
<div class="control-group" id="register_username_control_group">
<table id="userRegisterTable" class="table table-striped">
<tbody>
<tr>
<th style="width: 200px;">${loginUsername}</th>
<td>
<div class="control-group controls">
<input type="text"
size="30"
style="margin-bottom: 15px; float: left;"
id="register_username"
placeholder="${enter_username}"
minlength="3" data-validation-minlength-message="${login_username_too_short}"
required data-validation-required-message="${login_username_required}"/>
<br/>
<div id="register-help-block-username" class="help-block" style="float: left; margin-top: 3px;"></div>
</div>
</td>
</tr>
<tr>
<th>E-Mail</th>
<td>
<div class="control-group controls">
<input type="email"
size="30"
style="margin-bottom: 15px; float: left;"
id="register_email"
placeholder="${enter_email}"
data-validation-email-message="${check_mail_format}"
required data-validation-required-message="${email_required}"/>
<br/>
<div id="register-help-block-email" class="help-block" style="float: left; margin-top: 3px;"></div>
</div>
</td>
</tr>
<tr>
<th>${loginPassword}</th>
<td>
<div class="control-group" id="change_user_password">
<div class="control-group controls" style="clear: both">
<input type="password"
size="30"
style="margin-bottom: 15px; float: left;"
id="user_register_password1"
name="user_register_password1"
placeholder="${enter_password}"
minlength="5" data-validation-minlength-message="${login_password_too_short}"
required data-validation-required-message="${login_password_required}"/>
<br/>
<div class="help-block" style="float: left; margin-top: 3px;"></div>
</div>
<div class="control-group controls" style="clear: both">
<input type="password"
size="30"
style="margin-bottom: 15px; float: left;"
id="user_register_password2"
name="user_register_password2"
placeholder="${retype_password}"
data-validation-matches-match="user_register_password1"
data-validation-matches-message="${register_password_dont_math}"/>
<br/>
<div class="help-block" style="float: left; margin-top: 3px;"></div>
</div>
</div>
</td>
</tr>
<tr>
<th>${locale}</th>
<td>
<div id="change_user_locale">
<select size="1" id="register_locale_select">
<option value="deDE">deDE</option>
<option value="enUS">enUS</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
<button class="btn btn-primary" type="submit"><i class="icon-ok icon-white"></i> ${register}</button>
<button class="btn btn-primary" type="reset" id="btn_user_registration_cancel"><i class="icon-remove icon-white"></i> ${cancel}</button>
</div>
</form>

View File

@ -7,6 +7,23 @@ class page_uvote extends \SYSTEM\API\api_default {
public static function action_myvote(){
return new default_myvote();}
public static function action_open_bulletin ($poll_ID){
return new default_bulletin($poll_ID);}
public static function action_user_main(){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
return new default_register ();}
return new user_main();}
public static function action_user_main_uVote(){
return new user_main_uVote();}
public static function action_user_main_urVote(){
return new user_main_urVote();}
public static function action_user_main_myVote(){
return new user_main_myVote();}
public static function action_media(){
throw new ERROR("test");

View File

@ -4,3 +4,6 @@ SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_page','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_myvote','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_register','');
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','');

View File

@ -0,0 +1,12 @@
<div class="tabbable">
<ul class="nav nav-tabs" id="tabs_user_main">
<li class="active"><a href="#tab_uVote" action="user_main_uVote">uVote</a></li>
<li><a href="#tab_urVote" action="user_main_urVote">urVote</a></li>
<li><a href="#tab_myVote" action="user_main_myVote">myVote</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_uVote"></div>
<div class="tab-pane" id="tab_urVote" style="overflow: hidden;"></div>
<div class="tab-pane" id="tab_myVote"></div>
</div>
</div>

View File

@ -0,0 +1,8 @@
<?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);
}
}

View File

View File

@ -0,0 +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);
}
}