diff --git a/JS/ajax.js b/JS/ajax.js
index 5ac39cb..ac16b33 100644
--- a/JS/ajax.js
+++ b/JS/ajax.js
@@ -3,10 +3,11 @@ $(function() {
$("#form").submit(function(){
var values = $("form").serialize();
var comment = $("#comment").val();
+
console.log(values);
$.ajax({
type: "POST",
- url: "handlerAjax.php",
+ url: "handler.php",
data: values,
success: function() {
$("#comments tbody").prepend("
" +
diff --git a/api_functions.php b/api_functions.php
new file mode 100644
index 0000000..ab908c1
--- /dev/null
+++ b/api_functions.php
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/api_getter.php b/api_getter.php
new file mode 100644
index 0000000..33bcaa3
--- /dev/null
+++ b/api_getter.php
@@ -0,0 +1,20 @@
+url_base
+ $key = $this->api_key
+ $url = $url_base . 'bills/' . $bill_id . $key;
+ $bill_json = file_get_contents($url);
+ $bill_detail = json_decode($bill_json, true);
+ return $bill_detail[action_dates][last];
+}
+
+}
+?>
\ No newline at end of file
diff --git a/dao.php b/dao.php
index 611b2c1..3237896 100644
--- a/dao.php
+++ b/dao.php
@@ -1,5 +1,5 @@
getConnection();
$saveQuery =
"INSERT INTO comments
- (comment)
+ (username, comment, bill_id, comment_type)
VALUES
- (:comment)";
+ (:username, :comment, :bill, :comment_type)";
$q = $conn->prepare($saveQuery);
+ $q->bindParam(":username", $username);
$q->bindParam(":comment", $comment);
- $q->execute();
+ $q->bindParam(":bill", $bill);
+ $q->bindParam(":comment_type", $comment_type);
+ return $q->execute();
}
- public function getComments () {
+ public function getComments ($bill, $comment_type) {
$conn = $this->getConnection();
- return $conn->query("SELECT * FROM comments");
+ return $conn->query("SELECT username, comment, date FROM comments WHERE bill_id = '$bill' AND comment_type = '$comment_type'");
}
public function newUser ($username, $password, $email) {
@@ -92,7 +95,7 @@ public function saveBills ($bill_id, $year, $title, $bill_name, $connection) {
public function getBills () {
$conn = $this->getConnection();
- return $conn->query("SELECT bill_name, title, (votes_for + votes_against) AS total
+ return $conn->query("SELECT bill_name, bill_id, title, (votes_for + votes_against) AS total
FROM bills
ORDER BY total
LIMIT 5");
diff --git a/dash.php b/dash.php
index 6efbb46..024d144 100644
--- a/dash.php
+++ b/dash.php
@@ -17,7 +17,6 @@
You are logged in as = $_SESSION["name"] ?>.
-
+
diff --git a/nhoffman.sql b/nhoffman.sql
index e6c5fc5..b792ed9 100644
--- a/nhoffman.sql
+++ b/nhoffman.sql
@@ -17,13 +17,13 @@ comment_id BIGINT(20) NOT NULL PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(64),
comment MEDIUMBLOB,
comment_link VARCHAR(200),
-type VARCHAR(9),
+comment_type VARCHAR(9),
votes_for TINYINT,
votes_against TINYINT,
flags TINYINT,
-bill_id BIGINT(20),
+bill_id VARCHAR(20),
comment_ip VARCHAR(100),
-date DATETIME,
+comment TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
comment_parent BIGINT(20),
approved BOOL
);
diff --git a/styles.css b/styles.css
index 0ef417b..abc8e10 100644
--- a/styles.css
+++ b/styles.css
@@ -302,11 +302,19 @@ div {
height: 100%;
padding: 5px 0px 5px 5px;
}
+.pro, .neutral, .anti, h3 {
+ color: black;
+ text-transform: uppercase;
+ font-size: 1.2em;
+ line-height: 1.5em;
+ text-align: center;
+}
.pro {
float: left;
width: 32%;
border-right: 1px dashed black;
padding-right: 5px;
+ min-height: 1px;
line-height: 1.2em;
}
.neutral {
@@ -315,12 +323,14 @@ div {
border-right: 1px dashed black;
padding-left: 5px;
padding-right: 5px;
+ min-height: 1px;
line-height: 1.2em;
}
.anti {
float: left;
width: 31%;
padding-left: 5px;
+ min-height: 1px;
line-height: 1.2em;
}
.commentbox input[type=radio] {
|