diff --git a/uvote/page/default_page/js/loadtexts.js b/uvote/page/default_page/js/loadtexts.js index aec7796..5a08566 100644 --- a/uvote/page/default_page/js/loadtexts.js +++ b/uvote/page/default_page/js/loadtexts.js @@ -4,34 +4,6 @@ $(document).ready(function() { register_logout(); }); -function init_user_list(){ - $('#tabs_user_list a').click(function (e) { - //e.preventDefault(); - $(this).tab('show'); - }); - $('.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(); - }); - $('.btn_fade').click(function () { - $('#vote_data_panel' + $(this).attr('poll_ID')).toggle(); - }); -} -function init_user_main(){ - register_registerform(); - $('#feedback_submit').click(function (data){ - var test = $('textarea#feedback_text').val(); - send_feedback(test); - }); - $('#tabs_user_main a').click(function (e) { - e.preventDefault(); - load_user_main_tab($(this).attr('action')); - $(this).tab('show'); - }); -} - function register_login(){ $("#form_login input").not("[type=submit]").jqBootstrapValidation({ preventSubmit: true, @@ -56,75 +28,13 @@ function register_logout(){ }) } -function register_registerform(){ - //console.log("wegwegwegwegwegweg"); - $("#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(); - } - }); -} - -function load_user_main_tab(action){ - switch(action){ - case 'user_main_uVote': - //$('#tab_uVote').load('./?action='+ action); //causes error - return; - case 'user_main_urVote': - $('#tab_urVote').load('./?action='+ action); - return; - case 'user_main_myVote': - $('#tab_myVote').load('./?action='+ action, function(){ - $('.add_data_submit').click(function () { - submit_add_data(); - alert('success'); - }); - }); - return; - default: - } -} -function init_user_list_active(){ - $('.btn_fade').click(function () { - $('#vote_data_panel' + $(this).attr('poll_ID')).show(); - }); - $('.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(); - - }) -} -function init_user_list_ended(){ - $('.btn_fade').click(function () { - $('#vote_data_panel' + $(this).attr('poll_ID')).show(); - }); - $('.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(); - }) -} - -function account_create(inputEmail, inputPassword){ +/*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; }).complete(function() { }); -} +}*/ function load_openvoteinfo (poll_ID){ var openvoteinfo; @@ -245,6 +155,25 @@ function send_feedback (feedback) { }); } +function register_registerform(){ + //console.log("wegwegwegwegwegweg"); + $("#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(); + } + }); +} + function open_vote (poll_ID) { $('#user_list').load('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID, function(){ $('.btnvote_yes').click(function () { diff --git a/uvote/page/page_uvote.php b/uvote/page/page_uvote.php index 305c647..058b05b 100644 --- a/uvote/page/page_uvote.php +++ b/uvote/page/page_uvote.php @@ -10,11 +10,22 @@ class page_uvote extends \SYSTEM\API\api_default { return (new default_register ())->html();} return (new default_bulletin($poll_ID))->html();} + public static function page_user_main(){ if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ return (new default_register ())->html();} return (new user_main())->html();} + public static function page_user_main_uVote(){ + return (new user_main_uVote())->html();} + + public static function page_user_main_urVote(){ + return (new user_main_urVote())->html();} + + public static function page_user_main_myVote(){ + return (new user_main_myVote())->html();} + + public static function page_user_list(){ return (new user_list())->html();} @@ -23,10 +34,4 @@ class page_uvote extends \SYSTEM\API\api_default { public static function page_user_list_ended(){ return (new user_list_ended())->html();} - - public static function page_user_main_urVote(){ - return (new user_main_urVote())->html();} - - public static function page_user_main_myVote(){ - return (new user_main_myVote())->html();} } \ No newline at end of file diff --git a/uvote/page/user_list/js/user_list.js b/uvote/page/user_list/js/user_list.js new file mode 100644 index 0000000..0baf898 --- /dev/null +++ b/uvote/page/user_list/js/user_list.js @@ -0,0 +1,38 @@ +function init_user_list(){ + $('#tabs_user_list a').click(function (e) { + //e.preventDefault(); + }); + $('.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(); + }); + $('.btn_fade').click(function () { + $('#vote_data_panel' + $(this).attr('poll_ID')).toggle(); + }); +} + +function init_user_list_active(){ + $('.btn_fade').click(function () { + $('#vote_data_panel' + $(this).attr('poll_ID')).show(); + }); + $('.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(); + + }) +} +function init_user_list_ended(){ + $('.btn_fade').click(function () { + $('#vote_data_panel' + $(this).attr('poll_ID')).show(); + }); + $('.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(); + }) +} \ No newline at end of file diff --git a/uvote/page/user_list/user_list.php b/uvote/page/user_list/user_list.php index bb370e4..7a0f62a 100644 --- a/uvote/page/user_list/user_list.php +++ b/uvote/page/user_list/user_list.php @@ -4,6 +4,8 @@ class user_list extends SYSTEM\PAGE\Page { public static function css(){ return array(\SYSTEM\WEBPATH(new PPAGE(),'user_list/css/list_menu.css'));} + public static function js(){ + return array(\SYSTEM\WEBPATH(new PPAGE(),'user_list/js/user_list.js'));} public function html(){ $vars = array(); diff --git a/uvote/page/default_page/css/main_menu.css b/uvote/page/user_main/css/main_menu.css similarity index 100% rename from uvote/page/default_page/css/main_menu.css rename to uvote/page/user_main/css/main_menu.css diff --git a/uvote/page/user_main/js/user_main.js b/uvote/page/user_main/js/user_main.js new file mode 100644 index 0000000..1a0654e --- /dev/null +++ b/uvote/page/user_main/js/user_main.js @@ -0,0 +1,17 @@ +function init_user_main(){ + register_registerform(); + $('#feedback_submit').click(function (data){ + var test = $('textarea#feedback_text').val(); + send_feedback(test); + }); + $('#tabs_user_main a').click(function (e) { + //e.preventDefault(); + }); +} + +function init_myvote(){ + $('.add_data_submit').click(function () { + submit_add_data(); + alert('success'); + }); +} \ No newline at end of file diff --git a/uvote/page/user_main/main_menu.tpl b/uvote/page/user_main/main_menu.tpl index a148e52..f6686ff 100644 --- a/uvote/page/user_main/main_menu.tpl +++ b/uvote/page/user_main/main_menu.tpl @@ -1,13 +1,11 @@