diff --git a/WebContent/html/css/stylesheet.css b/WebContent/html/css/stylesheet.css index f063542..0d323da 100644 --- a/WebContent/html/css/stylesheet.css +++ b/WebContent/html/css/stylesheet.css @@ -14,7 +14,6 @@ div.sidebar{ border-right-style: solid; height: 100vh; background-color: #E9EAEB; - width: 300px; position: fixed; } @@ -59,7 +58,7 @@ div.modal-content{ padding: 10px; border: 1px solid #888; width: 80%; - max-height: 80%; + max-height: 100%; text-align: center; vertical-align: center; align-items: center; @@ -70,21 +69,6 @@ div.modal-body{ overflow: auto; } -input[type=text]{ - margin: 0 auto; - width: 60%; -} - -input[type=tel]{ - margin: 0 auto; - width: 60%; -} - -input[type=number]{ - margin: 0 auto; - width: 60%; -} - textarea{ margin: 0 auto; } diff --git a/WebContent/html/javascript/profileIcon.js b/WebContent/html/javascript/profileIcon.js deleted file mode 100644 index 1b127b2..0000000 --- a/WebContent/html/javascript/profileIcon.js +++ /dev/null @@ -1,37 +0,0 @@ -var iconSelect; - - window.onload = function(){ - - iconSelect = new IconSelect("my-icon-select", - {'selectedIconWidth':23, - 'selectedIconHeight':23, - 'selectedBoxPadding':3, - 'iconsWidth':48, - 'iconsHeight':48, - 'boxIconSpace':5, - 'vectoralIconNumber':2, - 'horizontalIconNumber':8}); - - var icons = []; - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/1.png', 'iconValue':'1'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/2.png', 'iconValue':'2'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/3.png', 'iconValue':'3'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/4.png', 'iconValue':'4'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/5.png', 'iconValue':'5'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/6.png', 'iconValue':'6'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/7.png', 'iconValue':'7'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/8.png', 'iconValue':'8'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/9.png', 'iconValue':'9'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/10.png', 'iconValue':'10'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/11.png', 'iconValue':'11'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/12.png', 'iconValue':'12'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/13.png', 'iconValue':'13'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/14.png', 'iconValue':'14'}); - icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/15.png', 'iconValue':'15'}); - - iconSelect.refresh(icons); - - //around here is where you'll have to define the current image, then this will update as the user selects new ones! - $('#profimg').attr("src","../imgs/my-icons-collection-128px/png/11.png"); - - }; \ No newline at end of file diff --git a/WebContent/html/javascript/profileSettings.js b/WebContent/html/javascript/profileSettings.js deleted file mode 100644 index 907c3b1..0000000 --- a/WebContent/html/javascript/profileSettings.js +++ /dev/null @@ -1,86 +0,0 @@ -//event listener on the apply changes button -document.getElementById('apply').addEventListener('click',applyChanges); -document.getElementById('inputName').addEventListener('keyup',checkEmpty); -document.getElementById('inputSSO').addEventListener('keyup',checkEmpty); -document.getElementById('closeBttn').addEventListener('click',function(){document.getElementById('missingcontent').style.display = "none";}); - -var typeTimer; -var doneTypingInterval = 2000 //ms - -$('#inputSSO').keyup(function(){clearTimeout(typeTimer); typeTimer = setTimeout(querySSO,doneTypingInterval);}); - -var flag = 0; -var name; -var SSO; -var telephone; -var email; - -//populates the fields -populate(); - -//sends applied changes to DB -function applyChanges(){ - if(flag == 0){ - name = $('#inputName').val(); - SSO = $('#inputSSO').val(); - telephone = $('#inputTelephone').val(); - email = $('#inputEmail').val(); - - //send these values to DB for updates to be made - //EX - //if(name != "") - //send to database - } - - else - $('#missingcontent').css('display','block'); -} - -//populates form fields if info exists in db already -function populate(){ - //get values from database - - //$('#inputName').val(name); - //$('#inputSSO').val(SSO); - //$('#inputTelephone').val(telephone); - //$('#inputEmail').val(email); -} - -function checkEmpty(){ - var id = this.getAttribute('id'); - if($('#' + id).val() == ""){ - $('#' + id).parent().attr('class','form-group has-error'); - $('#' + id).siblings('span').text(warningtext(id)) - } - else{ - $('#' + id).parent().attr('class','form-group'); - $('#' + id).siblings('span').text('') - } - -} - -function warningtext(id){ - if(id == "inputName") - return "This is a required field."; - else if (id == "inputSSO") - return "This is a required field."; -} - -function querySSO(){ - //query to see if SSO is in database already - - //if so... && val() != "" - //$('#' + id).parent().attr('class','form-group has-error'); - //$('#inputSSO').siblings('span').text('SSO is currently in use.'); - //flag = 1; - - //if not... && val() != "" - //$('#' + id).parent().attr('class','form-group'); - //$('#' + id).siblings('span').text(''); -} - -window.onclick = function(event) { - var modal = document.getElementById('missingcontent'); - if(event.target == modal) - modal.style.display = "none"; -} \ No newline at end of file diff --git a/WebContent/html/javascript/request.jsp b/WebContent/html/javascript/request.jsp index 68ffb65..dd78f9a 100644 --- a/WebContent/html/javascript/request.jsp +++ b/WebContent/html/javascript/request.jsp @@ -8,7 +8,7 @@ <% -Device[] mydevices = DeviceQueries.getAllDevices(); +Device[] mydevices = DeviceQueries.getAvailableDevices(); //string representation of array. String deviceString = Device.arrayToString(mydevices); //out.println(description); @@ -21,35 +21,6 @@ var devices = makeDeviceArray(); //get all the option buttons var hardwareOptions = document.getElementsByClassName('hw-data-type'); var softwareOptions = document.getElementsByClassName('sw-data-type'); -function ajaxFunction(){ - var request; - try { - request = new XMLHttpRequest(); - } - catch(e){ - try { - request = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch(e){ - try { - request = new ActiveXObject(Microsoft.XMLHTTP); - } catch(e) { - alert("Something is wrong with your browser"); - return false; - } - - } - } - - - request.onreadystatechange = function(){ - if(request.readyState == 4){ - var display = document.getElementById('ajaxDiv'); - display.innerHTML = request.responseText; - } - } - -} //add event listeners to the options in the left sidebar for(var a = 0; a < hardwareOptions.length; a++){ hardwareOptions[a].addEventListener('click', refresh); @@ -179,7 +150,8 @@ function addToCart(){ if(!inCart(id)){ //if not in the cart var cart = getCartItems(); //this is an array id = parseInt(id,10); //this gets just the numerical value from the id! - cart.push(devices[id - 1]); //push to bottom of cart + var device = getDevice(id); + cart.push(device); //push to bottom of cart localStorage.setItem('cart', JSON.stringify(cart)); $('#added').fadeIn(1000); $('#added').fadeIn(1000); @@ -218,6 +190,12 @@ function makeDeviceArray(){ window.json = '<%=deviceString%>'; return JSON.parse(window.json); } +function getDevice(id){ + for(var i = 0; i < devices.length; i++){ + if(id == devices[i].id) + return devices[i]; + } +} //this code allows a message to appear that indicates that the item was successfully placed in the shopping cart. diff --git a/WebContent/html/webpages/admin.jsp b/WebContent/html/webpages/admin.jsp index afdf899..ba9df85 100644 --- a/WebContent/html/webpages/admin.jsp +++ b/WebContent/html/webpages/admin.jsp @@ -67,7 +67,7 @@ div.approveConfirm { @@ -117,10 +120,122 @@ + - - + window.onload = function(){ + + iconSelect = new IconSelect("my-icon-select", + {'selectedIconWidth':23, + 'selectedIconHeight':23, + 'selectedBoxPadding':3, + 'iconsWidth':48, + 'iconsHeight':48, + 'boxIconSpace':5, + 'vectoralIconNumber':2, + 'horizontalIconNumber':8}); + + var icons = []; + icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/' + <%=self.getIcon()%> + '.png', 'iconValue':' + <%=self.getIcon()%> + '}); + for(var i = 1; i <= 15; i++){ + if( i != <%=self.getIcon()%>) + icons.push({'iconFilePath':'../imgs/my-icons-collection-32px/png/' + i + '.png', 'iconValue': i }); + } + + iconSelect.refresh(icons); + + //around here is where you'll have to define the current image, then this will update as the user selects new ones! + $('#profimg').attr("src","../imgs/my-icons-collection-128px/png/" + '<%=self.getIcon()%>' + ".png"); + }; + + //event listener on the apply changes button + document.getElementById('apply').addEventListener('click',applyChanges); + document.getElementById('inputName').addEventListener('keyup',checkEmpty); + document.getElementById('inputSSO').addEventListener('keyup',checkEmpty); + document.getElementById('closeBttn').addEventListener('click',function(){document.getElementById('missingcontent').style.display = "none";}); + + var typeTimer; + var doneTypingInterval = 2000 //ms + + $('#inputSSO').keyup(function(){clearTimeout(typeTimer); typeTimer = setTimeout(querySSO,doneTypingInterval);}); + + var flag = 0; + var name; + var SSO; + var telephone; + var email; + + //populates the fields + populate(); + + //sends applied changes to DB + function applyChanges(){ + if(flag == 0){ + name = $('#inputName').val(); + SSO = $('#inputSSO').val(); + telephone = $('#inputTelephone').val(); + email = $('#inputEmail').val(); + + //send these values to DB for updates to be made + //EX + //if(name != "") + //send to database + } + + else + $('#missingcontent').css('display','block'); + } + + //populates form fields if info exists in db already + function populate(){ + //get values from database + + $('#inputName').val('<%=navname%>'); + $('#inputSSO').val('<%=self.getID()%>'); + $('#inputTelephone').val('<%=self.getPhone()%>'); + $('#inputEmail').val('<%=self.getEmail()%>'); + } + + function checkEmpty(){ + var id = this.getAttribute('id'); + if($('#' + id).val() == ""){ + $('#' + id).parent().attr('class','form-group has-error'); + $('#' + id).siblings('span').text(warningtext(id)) + } + else{ + $('#' + id).parent().attr('class','form-group'); + $('#' + id).siblings('span').text('') + } + + } + + function warningtext(id){ + if(id == "inputName") + return "This is a required field."; + else if (id == "inputSSO") + return "This is a required field."; + } + + function querySSO(){ + //query to see if SSO is in database already + + //if so... && val() != "" + //$('#' + id).parent().attr('class','form-group has-error'); + //$('#inputSSO').siblings('span').text('SSO is currently in use.'); + //flag = 1; + + //if not... && val() != "" + //$('#' + id).parent().attr('class','form-group'); + //$('#' + id).siblings('span').text(''); + } + + window.onclick = function(event) { + var modal = document.getElementById('missingcontent'); + if(event.target == modal) + modal.style.display = "none"; + } + \ No newline at end of file diff --git a/WebContent/html/webpages/requestPage.jsp b/WebContent/html/webpages/requestPage.jsp index 47b3aa9..6f8ec7b 100644 --- a/WebContent/html/webpages/requestPage.jsp +++ b/WebContent/html/webpages/requestPage.jsp @@ -62,7 +62,7 @@ @@ -109,12 +109,9 @@
@@ -122,15 +119,22 @@
-
<% -//String userID = cookie implementation exists here. -//19 is just for testing purposes. Replaced by userID later. -RentedDevice[] mydevices = DeviceQueries.getUserDevices("19"); +//get user information +Cookie[] cookies = request.getCookies(); +String sso = ""; +for(Cookie c : cookies){ + if(c.getName().equals("ssoNum")){ + sso = c.getValue(); + break; + } +} + +Device[] mydevices = DeviceQueries.getUserDevices(sso); //string representation of array. -String deviceString = RentedDevice.arrayToString(mydevices); +String deviceString = Device.arrayToString(mydevices); %>