diff --git a/SD-image/www/reprap.htm b/SD-image/www/reprap.htm index 20a602a..3375d38 100644 --- a/SD-image/www/reprap.htm +++ b/SD-image/www/reprap.htm @@ -114,6 +114,10 @@ function jogRowHTML(axis) return result; } + + + + function heatRowHTML(heater, hNumber) { var result = ""; @@ -139,8 +143,11 @@ function heatRowHTML(heater, hNumber) return result; } + + + RepRapPro logo @@ -295,7 +302,49 @@ Click a file to

+ + + + + + + MESSAGES PAGE
Messages
+--> -
+
Password: @@ -375,7 +428,8 @@ function viewModel() { var self = this; - self.pages = ['Control', 'Print', 'Help', 'Settings', 'Messages', 'Logout']; + //self.pages = ['Control', 'Print', 'Help', 'Settings', 'Messages', 'Logout']; + self.pages = ['Control', 'Print', 'Help', 'Logout']; self.chosenPageId = ko.observable(''); self.chosenFileId = ko.observable(''); self.machineName = ko.observable(); @@ -484,7 +538,7 @@ function viewModel() self.fanButton('Fan off'); } else { - $.get('/rr_gcode', {gcode: "M107"}, self.dummy); + $.get('/rr_gcode', {gcode: "M106 S0"}, self.dummy); self.fanButton('Fan on'); } }; @@ -569,6 +623,7 @@ function viewModel() $.get('/rr_gcode', {gcode: self.gcode()}, self.dummy); }; + self.setTemperature = function(heater, data, event) { if(dontInterruptFilePrint()) @@ -589,7 +644,7 @@ function viewModel() self.fileAction('print it'); self.deleteButton('Delete a file'); }; - +/* self.goToPage = function(page) { if(page == self.pages[5]) @@ -612,7 +667,45 @@ function viewModel() } onControlPage = (page == self.pages[0]); - self.chosenPageId(page); + self.chosenPageId(page); + + if(page == self.pages[1]) + { + try + { + //alert("attaching"); + document.getElementById('fileinput').addEventListener('change', uploadGCode, false); + } + catch(e) + { + alert(e); + } + } +*/ + + self.goToPage = function(page) + { + if(page == self.pages[3]) + self.gotPassword(JSON.parse('{"password":"wrong"}')); + + if(page == self.pages[1]) + self.resetFileAction(); + + if(page == self.pages[2]) + { + var win=window.open("http://www.reprappro.com/documentation/RepRapPro_Firmware", '_blank'); + win.focus(); + return; + } + + if(self.gotPassword().password != "right") + { + self.chosenPageId(self.pages[3]); + return; + } + + onControlPage = (page == self.pages[0]); + self.chosenPageId(page); }; self.checkFileName = function(uploadForm) @@ -631,14 +724,18 @@ function viewModel() return true; }; - self.uploadGCode = function(uploadForm, event) + + + if (window.File && window.FileReader && window.FileList && window.Blob) { - if(self.checkFileName(uploadForm)) - { - alert('upload ' + uploadForm.datafile.value); - // TODO put post upload here - } - }; + setTimeout(function() { + onControlPage = false; + }, 1000); + //AttachEventListener(); + } else + { + alert('The File APIs are not fully supported by your browser. GCode upload may not work.'); + } onControlPage = false; self.getName(); @@ -655,7 +752,7 @@ function viewModel() onControlPage = false; }, 300); printingAFile = false; - self.goToPage(self.pages[5]); + self.goToPage(self.pages[3]); //self.gotPassword(JSON.parse('{"password":"wrong"}')); } @@ -668,6 +765,8 @@ function poll() }, 3000) } + + printingAFile = false; window.vm = new viewModel(); ko.applyBindings(vm); @@ -675,4 +774,6 @@ poll(); + + diff --git a/Webserver.cpp b/Webserver.cpp index 9fd6b41..4d2c7ea 100644 --- a/Webserver.cpp +++ b/Webserver.cpp @@ -701,7 +701,7 @@ void Webserver::Init() // Reinitialise the message file - platform->GetMassStorage()->Delete(platform->GetWebDir(), MESSAGE_FILE); + //platform->GetMassStorage()->Delete(platform->GetWebDir(), MESSAGE_FILE); } void Webserver::Exit()