Skip to content

Commit

Permalink
It's over. Pending only review and clean after delivery.
Browse files Browse the repository at this point in the history
  • Loading branch information
jskno committed Sep 10, 2015
1 parent 8db807a commit 59df6a8
Show file tree
Hide file tree
Showing 23 changed files with 774 additions and 36 deletions.
75 changes: 75 additions & 0 deletions WebContent/js/getNoteIdsList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
*
*/

var addThread;
var addThreadValue;
var note;
var noteId;
var companyTelephone;
var companyEmail;

$('#newThreadButton').click(function() {
origin = "Supplier";
addIdsList();

});

function addIdsList() {

var table = document.getElementById("list");
for(var i=0; i<table.rows.length - 1;i++){
//addThread = table.rows[i+1].cells[0].innerHTML.getElementsByTagName('input')[0].checked;
addThreadValue = table.rows[i+1].cells[0].getElementsByTagName('input')[0].checked;
// addThreadValue = table.rows[i+1].cells[0].getElementById("addThread").checked;
if(addThreadValue) {
noteId = table.rows[i+1].cells[1].innerHTML;
createAndFillIds(noteId, i);
}
}
}


function getData(row) {
// addThread = row.getElementsById("addThread");
//companyName = company.getElementsByTagName("companyName")[0];
// addThreadValue = row.getElementsById("noteId");
//companyNameValue = companyName.childNodes[0].nodeValue;
addThread = row.cells[0];
noteId = row.cells[1];
}

function createAndFillIds(noteId, i) {
// get reference to select element
var listNode;
listNode = document.getElementById('noteIdsList');
// create new option element
var input = document.createElement('input');
input.setAttribute("type", "hidden");
input.setAttribute("class", "form-control");
input.setAttribute("name", "IdsList");
input.setAttribute("id", "noteId" + i);
input.setAttribute("value", noteId);
// create text node to add to option element (opt)
//input.appendChild( document.createAttribute("type") );

// set value property of opt
//opt.value = companyIdValue;
// add opt to end of select box (sel)
listNode.appendChild(input);
}

function process(responseXML) {
if (responseXML == null) {
alert("There is no answer from the Server.");
return false;
} else {
companies = responseXML.getElementsByTagName("company");
if (companies.length > 0) {
for (loop = 0; loop < company.length; loop++) {
getData(companies[loop]);
createAndFillInOption(origin);
}
}
}
}
17 changes: 16 additions & 1 deletion WebContent/jsp/businessNotesList.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
<h3>BusinessNotes List</h3>
<p>Table showing all notes chronologically ordered.</p>
</div>
<table class="table table-condensed">
<table id="list" class="table table-condensed">
<thead>
<tr>
<th>Add Thread</th>
<th style="display:none;">noteId</th>
<th>Creation Date</th>
<th>Title</th>
<th>Text</th>
Expand All @@ -45,6 +47,7 @@
Iterator<BusinessNoteVO> iterator = notesList.iterator();
while (iterator.hasNext()) {
BusinessNoteVO note = (BusinessNoteVO) iterator.next();
int noteId = note.getNoteId();
Date creationDate = note.getCreationDate();
String noteTitle = note.getNoteTitle();
String noteText = note.getNoteText();
Expand All @@ -68,6 +71,8 @@
}
%>
<tr>
<td><input id="addThread" type="checkbox"></td>
<td style="display:none;"><%=noteId%></td>
<td><%=creationDate%></td>
<td><%=noteTitle%></td>
<td><%=noteText%></td>
Expand All @@ -82,7 +87,17 @@
%>
</tbody>
</table>
<div class="col-sm-2">
<!-- Trigger the thread creation -->
<button type="button" class="btn btn-info btn-md" data-toggle="modal"
id="newThreadButton" data-target="#NewThreadModalForm">Add Thread</button>
</div>
</div>

<!-- INI MODALS -->
<jsp:include page="modal/NewThreadModalForm.jsp" flush="true" />
<script src="js/getNoteIdsList.js"></script>
<!-- FIN MODALS -->

</body>
</html>
2 changes: 1 addition & 1 deletion WebContent/jsp/modal/NewBusNoteFormProductModal.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Company</h4>
<h4 class="modal-title">New Product</h4>
</div>

<div class="modal-body">
Expand Down
2 changes: 1 addition & 1 deletion WebContent/jsp/modal/NewBusNoteFormSupplierModal.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Company</h4>
<h4 class="modal-title">New Supplier</h4>
</div>

<div class="modal-body">
Expand Down
57 changes: 57 additions & 0 deletions WebContent/jsp/modal/NewThreadModalForm.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<%@page import="java.util.Date"%>
<%@page import="java.util.Iterator"%>
<%@page import="model.BusinessNoteVO"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html >
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script src="bootstrap/jquery/jquery-2.1.3.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<title>Thread Modal</title>
</head>
<body>
<!-- INI MODALS -->

<div id="NewThreadModalForm" class="modal fade" role="dialog">
<div class="modal-dialog">

<!-- Modal content-->
<div class="modal-content">
<form id="newThreadModalForm" class="form-horizontal" role="form" action="notes/addElement" method="POST">
<input type="hidden" name="nextStep" id="nextStep" value="addThread"/>
<input type="hidden" name="screenOrigin" value="notesListForm"/>

<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Thread</h4>
</div>

<div class="modal-body">
<div class="form-group">
<label class="control-label col-sm-4" for="threadTitle">Thread Title:</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="threadTitle" id="threadTitle"
placeholder="Enter title">
</div>
</div>
<div class="form-group">
<div class="col-sm-8" id=noteIdsList>
</div>
</div>
</div>

<div class="modal-footer">
<button type="submit" class="btn btn-default">Submit</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<!-- FIN MODALS -->
</body>
</html>
8 changes: 5 additions & 3 deletions WebContent/jsp/newBusinessNoteForm.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@
data-target="#newProductModal">New Product</button>
</div>
</div>
<!--
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
-->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
Expand All @@ -133,9 +135,9 @@
</div>

<!-- INI MODALS -->
<jsp:include page="modal/NewBusNoteFormCustomerModal.jsp" flush="false" />
<jsp:include page="modal/NewBusNoteFormSupplierModal.jsp" flush="false" />
<jsp:include page="modal/NewBusNoteFormProductModal.jsp" flush="false" />
<jsp:include page="modal/NewBusNoteFormCustomerModal.jsp" flush="true" />
<jsp:include page="modal/NewBusNoteFormSupplierModal.jsp" flush="true" />
<jsp:include page="modal/NewBusNoteFormProductModal.jsp" flush="true" />
<script src="js/getNoRoleCompanies.js"></script>
<!-- FIN MODALS -->

Expand Down
66 changes: 66 additions & 0 deletions WebContent/jsp/threadsList.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<%@page import="model.ThreadVO"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<!DOCTYPE html >
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script src="bootstrap/jquery/jquery-2.1.3.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<title>Threads List</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<jsp:include page="dynamicNavBar.jsp" flush="true" />
</div>
</div>

<div class="well">
<h3>Threads List</h3>
<p>Table showing all threads chronologically ordered.</p>
</div>
<table id="list" class="table table-condensed">
<thead>
<tr>
<th style="display:none;">threadId</th>
<th>Creation Date</th>
<th>Title</th>
<th>Number of Notes</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<%
List<ThreadVO> threadsList = (List<ThreadVO>)request.getAttribute("threadsList");
Iterator<ThreadVO> iterator = threadsList.iterator();
while (iterator.hasNext()) {
ThreadVO thread = (ThreadVO) iterator.next();
int threadId = thread.getThreadId();
Date creationDate = thread.getCreationDate();
String threadTitle = thread.getThreadTitle();
Integer notesNumber = thread.getNotesList().size();
%>
<tr>
<td style="display:none;"><%=threadId%></td>
<td><%=creationDate%></td>
<td><%=threadTitle%></td>
<td><%=notesNumber%></td>
<td><a href="#">View</a></td>
<td><a href="#">Delete</a></td>
</tr>
<%
}
%>
</tbody>
</table>
</div>

</body>
</html>
12 changes: 12 additions & 0 deletions src/controller/BusinessLookUp.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import service.AddPersonalNoteService;
import service.AddProductService;
import service.AddSupplierService;
import service.AddThreadService;
import service.ExportTableService;
import service.GetBusinessNotesListService;
import service.GetCompaniesListService;
Expand All @@ -14,6 +15,7 @@
import service.GetPersonalNotesListService;
import service.GetProductsListService;
import service.GetSuppliersListService;
import service.GetThreadsListService;
import service.ImportTableService;
import service.NewCompanyFormService;
import service.NewCustomerFormService;
Expand All @@ -38,6 +40,7 @@ public class BusinessLookUp {
private final String NOTES_LIST = "notesList";
private final String BUSINESS_NOTES_LIST = "businessNotesList";
private final String PERSONAL_NOTES_LIST = "personalNotesList";
private final String THREADS_LIST = "threadsList";

private final String CUSTOMERS_LIST = "customersList";
private final String SUPPLIERS_LIST = "suppliersList";
Expand All @@ -51,6 +54,7 @@ public class BusinessLookUp {
private final String ADD_COMPANY = "addCompany";
private final String ADD_BUSINESS_NOTE = "addBusinessNote";
private final String ADD_PERSONAL_NOTE = "addPersonalNote";
private final String ADD_THREAD = "addThread";

private final String EXPORT_TABLE = "exportTable";
private final String IMPORT_TABLE = "importTable";
Expand Down Expand Up @@ -90,6 +94,10 @@ public Service getBusinessService(String serviceType) {
case PERSONAL_NOTES_LIST:
serviceClass = new GetPersonalNotesListService();
break;
case THREADS_LIST:
serviceClass = new GetThreadsListService();
break;

case CUSTOMERS_LIST:
serviceClass = new GetCustomerListService();
break;
Expand All @@ -102,6 +110,7 @@ public Service getBusinessService(String serviceType) {
case PRODUCTS_LIST:
serviceClass = new GetProductsListService();
break;

case ADD_CUSTOMER:
serviceClass = new AddCustomerService();
break;
Expand All @@ -120,6 +129,9 @@ public Service getBusinessService(String serviceType) {
case ADD_PERSONAL_NOTE:
serviceClass = new AddPersonalNoteService();
break;
case ADD_THREAD:
serviceClass = new AddThreadService();
break;
case EXPORT_TABLE:
serviceClass = new ExportTableService();
break;
Expand Down
3 changes: 0 additions & 3 deletions src/controller/LoginServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

public class LoginServlet extends HttpServlet {

/**
*
*/
private static final long serialVersionUID = 1L;
private static final UserDAO userDao =
new UserDAOImpl(DBUtil.getConnection(), null);
Expand Down
5 changes: 5 additions & 0 deletions src/dao/BusinessNoteDAO.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import model.BusinessNoteVO;
Expand All @@ -10,5 +12,8 @@ public interface BusinessNoteDAO extends DAO {
List<BusinessNoteVO> getLastBusinessNotes();
List<DDBBBusinessNote> getPersistenceBusinessNotesList();
void insertList(List<BusinessNoteVO> notesList);
List<BusinessNoteVO> getBusinessNotesListFromRs(ResultSet rs) throws SQLException;
BusinessNoteVO getBusinessNoteFromRs(ResultSet rs) throws SQLException;
BusinessNoteVO getBusinessNoteById(int noteId);

}
Loading

0 comments on commit 59df6a8

Please sign in to comment.