Download EpilepsyApp - development of smart phone app for young people
Transcript
EpilepsyApp - development of smart phone app for young people with therapy-resistent epilepsy
* FROM THE BACKUP FILE STORED ON DEVICES SDCARD.
*/
var data = new Array();
var dir = "EpilepsyApp/Backups/";
var filename;
var fs;
var files;
/**
* Function runs on the activity load and gets a root directory on a memory
card.
*/
function onDeviceReady() {
addScroller();
addNavButton(getString(’btn-back’), ’back’, ’settings.html’);
addNavButton(getString(’btn-home’), ’home’, ’index.html’);
addNavButton(getString(’btn-delete’), ’recycle’, "javascript:
deleteBackUpsAll();");
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
onFileSystemSuccess, fail);
}
/**
* Get the backup directory.
*/
function onFileSystemSuccess(fileSystem) {
fs = fileSystem;
fileSystem.root.getDirectory("EpilepsyApp/Backups", {create: false,
exclusive: false}, getDirSuccess, fail);
}
/**
* Read entries from the directory.
*/
function getDirSuccess(dirEntry) {
// Get a directory reader
var directoryReader = dirEntry.createReader();
// Get a list of all the entries in the directory
directoryReader.readEntries(readerSuccess,fail);
}
function getThis(el){
var eid = el.getAttribute("id", 1);
filename=eid;
startRetrieve();
}
/**
* Display direcotry content.
*/
function readerSuccess(entries) {
files = entries;
var i;
var ul = document.getElementById("backup");
var li;
var a;
for (i=0; i<entries.length; i++) {
li = document.createElement("LI");
li.innerHTML = entries[i].name;
b = document.createElement("button");
b.setAttribute("onclick","doDeleteFile(this);");
b.id = entries[i].name;
b.style.float="right";
b.style.width="10%";
b.style.height="20%";
b.style.backgroundImage="url(’../images/icons/mdpi/recycle.png’)";
a = document.createElement("A");
129