From ec2b333a7a7d89a0124b4df58fedee1155a2a418 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 30 Sep 2015 22:57:02 +0200 Subject: [PATCH] show poll --- uvote/api/api_uvote.php | 3 -- uvote/api/votes/votes.php | 6 ---- uvote/page/autoload.inc | 1 + uvote/page/default_page/js/loadtexts.js | 32 ------------------ uvote/page/page_uvote.php | 4 ++- uvote/page/user_list/js/user_list.js | 33 ++++++++++--------- uvote/page/user_main/js/user_main.js | 30 +++++++++++++++++ .../tpl/full_vote.tpl | 0 uvote/page/user_main_poll/user_main_poll.php | 13 ++++++++ uvote/sql/DATA_UVOTE.php | 3 +- uvote/sql/mysql/system.api.sql | 1 + uvote/sql/mysql/system_page.sql | 1 + 12 files changed, 68 insertions(+), 59 deletions(-) rename uvote/page/{default_page => user_main_poll}/tpl/full_vote.tpl (100%) create mode 100644 uvote/page/user_main_poll/user_main_poll.php create mode 100644 uvote/sql/mysql/system.api.sql diff --git a/uvote/api/api_uvote.php b/uvote/api/api_uvote.php index 7af1c13..2bf568c 100644 --- a/uvote/api/api_uvote.php +++ b/uvote/api/api_uvote.php @@ -13,9 +13,6 @@ class api_uvote extends \SYSTEM\API\api_system { public static function call_vote_action_feedback($feedback) { return votes::write_feedback($feedback);} - - public static function call_vote_action_open_vote($poll_ID) { - return votes::open_vote($poll_ID);} public static function call_vote_action_barsperusers($poll_ID){ return votes::get_barsperusers($poll_ID);} diff --git a/uvote/api/votes/votes.php b/uvote/api/votes/votes.php index fdf1966..12b5d70 100644 --- a/uvote/api/votes/votes.php +++ b/uvote/api/votes/votes.php @@ -170,10 +170,4 @@ class votes { new WARNING("feedback was added"); return JsonResult::ok(); } - - public static function open_vote($poll_ID){ - $vote = self::get_voteinfo($poll_ID); //votes::getVoteOfGroup($poll_ID); - $result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/full_vote.tpl'), $vote); - return $result; - } } diff --git a/uvote/page/autoload.inc b/uvote/page/autoload.inc index 56dba6a..fcecc93 100644 --- a/uvote/page/autoload.inc +++ b/uvote/page/autoload.inc @@ -8,6 +8,7 @@ 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__).'/user_main_poll',''); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list',''); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_active',''); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_ended',''); diff --git a/uvote/page/default_page/js/loadtexts.js b/uvote/page/default_page/js/loadtexts.js index 5a08566..79987c8 100644 --- a/uvote/page/default_page/js/loadtexts.js +++ b/uvote/page/default_page/js/loadtexts.js @@ -174,38 +174,6 @@ function register_registerform(){ }); } -function open_vote (poll_ID) { - $('#user_list').load('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID, function(){ - $('.btnvote_yes').click(function () { - vote_click($(this).attr('poll_ID'),1); - }); - $('.btnvote_no').click(function () { - vote_click($(this).attr('poll_ID'),2); - }); - $('.btnvote_off').click(function () { - vote_click($(this).attr('poll_ID'),3); - }); - $('.submit_pro').click(function () { - submit_c_data($(this).attr('poll_ID')); - alert('success'); - }); - $('.c_up').click(function () { - submit_commentrate($(this).attr('c_ID'), 1); - }); - $('.c_down').click(function () { - submit_commentrate($(this).attr('c_ID'), 2); - }); - $('.c_spam').click(function () { - submit_commentrate($(this).attr('c_ID'), 3); - }); - $('#test').click(function(){ - $('#myModal').modal(); - }); - - register_registerform(); - }); -} - function loadAjaxContent(url) { var dataTmp; $.get(url, function (data) { diff --git a/uvote/page/page_uvote.php b/uvote/page/page_uvote.php index 058b05b..495eb1f 100644 --- a/uvote/page/page_uvote.php +++ b/uvote/page/page_uvote.php @@ -24,7 +24,9 @@ class page_uvote extends \SYSTEM\API\api_default { public static function page_user_main_myVote(){ return (new user_main_myVote())->html();} - + + public static function page_user_main_poll($poll_ID) { + return (new user_main_poll($poll_ID))->html();} public static function page_user_list(){ return (new user_list())->html();} diff --git a/uvote/page/user_list/js/user_list.js b/uvote/page/user_list/js/user_list.js index 0baf898..4937c75 100644 --- a/uvote/page/user_list/js/user_list.js +++ b/uvote/page/user_list/js/user_list.js @@ -4,9 +4,9 @@ function init_user_list(){ }); $('.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(); + //$('#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(); @@ -18,21 +18,22 @@ function init_user_list_active(){ $('#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(); - + system.load('start(user_main(poll));poll.'+ $(this).attr('poll_ID')) + //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(); - }) + $('#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(); + system.load('start(user_main(poll));poll.'+ $(this).attr('poll_ID')) + }) } \ No newline at end of file diff --git a/uvote/page/user_main/js/user_main.js b/uvote/page/user_main/js/user_main.js index 1a0654e..99d2afa 100644 --- a/uvote/page/user_main/js/user_main.js +++ b/uvote/page/user_main/js/user_main.js @@ -14,4 +14,34 @@ function init_myvote(){ submit_add_data(); alert('success'); }); +} + +function init_poll(){ + $('.btnvote_yes').click(function () { + vote_click($(this).attr('poll_ID'),1); + }); + $('.btnvote_no').click(function () { + vote_click($(this).attr('poll_ID'),2); + }); + $('.btnvote_off').click(function () { + vote_click($(this).attr('poll_ID'),3); + }); + $('.submit_pro').click(function () { + submit_c_data($(this).attr('poll_ID')); + alert('success'); + }); + $('.c_up').click(function () { + submit_commentrate($(this).attr('c_ID'), 1); + }); + $('.c_down').click(function () { + submit_commentrate($(this).attr('c_ID'), 2); + }); + $('.c_spam').click(function () { + submit_commentrate($(this).attr('c_ID'), 3); + }); + $('#test').click(function(){ + $('#myModal').modal(); + }); + + register_registerform(); } \ No newline at end of file diff --git a/uvote/page/default_page/tpl/full_vote.tpl b/uvote/page/user_main_poll/tpl/full_vote.tpl similarity index 100% rename from uvote/page/default_page/tpl/full_vote.tpl rename to uvote/page/user_main_poll/tpl/full_vote.tpl diff --git a/uvote/page/user_main_poll/user_main_poll.php b/uvote/page/user_main_poll/user_main_poll.php new file mode 100644 index 0000000..b1e80e5 --- /dev/null +++ b/uvote/page/user_main_poll/user_main_poll.php @@ -0,0 +1,13 @@ +poll_ID = $poll_ID; + } + public function html(){ + $vote = votes::get_voteinfo($this->poll_ID); //votes::getVoteOfGroup($poll_ID); + $result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/full_vote.tpl'), $vote); + return $result; + } + +} \ No newline at end of file diff --git a/uvote/sql/DATA_UVOTE.php b/uvote/sql/DATA_UVOTE.php index 0f210cf..31115ef 100644 --- a/uvote/sql/DATA_UVOTE.php +++ b/uvote/sql/DATA_UVOTE.php @@ -8,6 +8,7 @@ class DATA_UVOTE extends \SYSTEM\DB\QI { \SYSTEM\SERVERPATH(new \PSQL(),'/mysql/schema_uvote_votes_per_party.sql'), \SYSTEM\SERVERPATH(new \PSQL(),'/mysql/schema_uvote_user_additional.sql'), \SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_text.sql'), - \SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_page.sql')); + \SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_page.sql'), + \SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_api.sql')); } } \ No newline at end of file diff --git a/uvote/sql/mysql/system.api.sql b/uvote/sql/mysql/system.api.sql new file mode 100644 index 0000000..7be07d0 --- /dev/null +++ b/uvote/sql/mysql/system.api.sql @@ -0,0 +1 @@ +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (130, 1, 2, 1, 'user_main_poll', 'poll_ID', 'UINT'); diff --git a/uvote/sql/mysql/system_page.sql b/uvote/sql/mysql/system_page.sql index 59f6455..f4fa8fa 100644 --- a/uvote/sql/mysql/system_page.sql +++ b/uvote/sql/mysql/system_page.sql @@ -1,2 +1,3 @@ INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (10, 1, 'user_list', 'start', -1, 0, 0, '#user_list', './?page=user_list', 'init_user_list', 'user_list'); INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (11, 1, 'user_main', 'start', -1, 0, 0, '#user_main', './?page=user_main', 'init_user_main', 'user_main'); +INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (25, 1, 'poll', 'start', 11, 0, 1, '#tab_main', './?page=user_main_poll&poll_ID=${poll}', 'init_poll', 'user_main_poll');