aboutsummaryrefslogtreecommitdiffstats
path: root/csci4131/hw6/strap012_hw6/public
diff options
context:
space:
mode:
Diffstat (limited to 'csci4131/hw6/strap012_hw6/public')
-rw-r--r--csci4131/hw6/strap012_hw6/public/addContact.html21
-rw-r--r--csci4131/hw6/strap012_hw6/public/contacts.html25
-rw-r--r--csci4131/hw6/strap012_hw6/public/stock.html9
-rw-r--r--csci4131/hw6/strap012_hw6/public/welcome.html1
4 files changed, 27 insertions, 29 deletions
diff --git a/csci4131/hw6/strap012_hw6/public/addContact.html b/csci4131/hw6/strap012_hw6/public/addContact.html
index 12bfaa2..629f9b2 100644
--- a/csci4131/hw6/strap012_hw6/public/addContact.html
+++ b/csci4131/hw6/strap012_hw6/public/addContact.html
@@ -13,10 +13,11 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
- <li><a href="index.html"><b>Home</b></a></li>
- <li><a href="contacts.html"><b>Contacts</b></a></li>
- <li><a href="addContact.html"><b>Add Contact</b></a></li>
- <li><a href="stock.html"><b>Stock Page</b></a></li>
+ <li><a href="/"><b>Home</b></a></li>
+ <li><a href="contacts"><b>Contacts</b></a></li>
+ <li><a href="addContact"><b>Add Contact</b></a></li>
+ <li><a href="stock"><b>Stock Page</b></a></li>
+ <li><a href="logout"><b>Logout</b></a></li>
</ul>
</div>
</nav>
@@ -31,7 +32,7 @@
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="panel panel-default">
- <form name="addContact" method="post" action="/postContactEntry">
+ <form name="addContact" method="post" action="/api/addContact">
<p></p>
<table class="table table-bordered table-hover">
<tbody>
@@ -83,15 +84,7 @@
<td class="col-md-6">Website Name</td>
<td class="col-md-6">
<div class="form-group">
- <input type="text" class="form-control" name="website_name" required maxlength="100">
- </div>
- </td>
- </tr>
- <tr>
- <td class="col-md-6">Website URL</td>
- <td class="col-md-6">
- <div class="form-group">
- <input type="url" class="form-control" name="website_url" required maxlength="200">
+ <input type="url" class="form-control" name="website_name" required maxlength="100">
</div>
</td>
</tr>
diff --git a/csci4131/hw6/strap012_hw6/public/contacts.html b/csci4131/hw6/strap012_hw6/public/contacts.html
index 15e4032..5cd2907 100644
--- a/csci4131/hw6/strap012_hw6/public/contacts.html
+++ b/csci4131/hw6/strap012_hw6/public/contacts.html
@@ -8,7 +8,7 @@
<script type="text/javascript" defer>
//Get JSON
var xmlhttp = new XMLHttpRequest();
- var url = "contacts.json";
+ var url = "api/contacts";
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var parse = JSON.parse(xmlhttp.responseText);
@@ -20,17 +20,21 @@
function process(a) {
var table = document.getElementsByTagName("tbody")[0];
- var contacts = a.contacts;
+ var contacts = a;
for (let i = 0; i < contacts.length; i++) {
var contact = contacts[i];
var row = table.insertRow();
for (var j in contact) {
- if (j != "website_url") {
- var value = row.insertCell();
- value.innerHTML = contact[j];
- } else {
+ if (j === "contact_id") continue;
+ if (j === "website_url") {
var url = row.insertCell();
url.innerHTML = "<a href =" + contact[j] + ">" + contact[j] + "</a>";
+ } else if (j === "email") {
+ var email = row.insertCell();
+ email.innerHTML = "<a href =mailto://" + contact[j] + ">" + contact[j] + "</a>";
+ } else {
+ var value = row.insertCell();
+ value.innerHTML = contact[j];
}
}
}
@@ -42,10 +46,11 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
- <li><a href="index.html"><b>Home</b></a></li>
- <li><a href="contacts.html"><b>Contacts</b></a></li>
- <li><a href="addContact.html"><b>Add Contact</b></a></li>
- <li><a href="stock.html"><b>Stock Page</b></a></li>
+ <li><a href="/"><b>Home</b></a></li>
+ <li><a href="contacts"><b>Contacts</b></a></li>
+ <li><a href="addContact"><b>Add Contact</b></a></li>
+ <li><a href="stock"><b>Stock Page</b></a></li>
+ <li><a href="logout"><b>Logout</b></a></li>
</ul>
</div>
</nav>
diff --git a/csci4131/hw6/strap012_hw6/public/stock.html b/csci4131/hw6/strap012_hw6/public/stock.html
index b55ffcb..d63b233 100644
--- a/csci4131/hw6/strap012_hw6/public/stock.html
+++ b/csci4131/hw6/strap012_hw6/public/stock.html
@@ -26,10 +26,11 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
- <li><a href="index.html"><b>Home</b></a></li>
- <li><a href="contacts.html"><b>Contacts</b></a></li>
- <li><a href="addContact.html"><b>Add Contact</b></a></li>
- <li><a href="stock.html"><b>Stock Page</b></a></li>
+ <li><a href="/"><b>Home</b></a></li>
+ <li><a href="contacts"><b>Contacts</b></a></li>
+ <li><a href="addContact"><b>Add Contact</b></a></li>
+ <li><a href="stock"><b>Stock Page</b></a></li>
+ <li><a href="logout"><b>Logout</b></a></li>
</ul>
</div>
</nav>
diff --git a/csci4131/hw6/strap012_hw6/public/welcome.html b/csci4131/hw6/strap012_hw6/public/welcome.html
index 50ae883..095023e 100644
--- a/csci4131/hw6/strap012_hw6/public/welcome.html
+++ b/csci4131/hw6/strap012_hw6/public/welcome.html
@@ -6,7 +6,6 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <link rel="stylesheet" type="text/css" href="/css/style.css">
<title>Welcome to Node.js</title>
<style type="text/css">
.jumbotron {