Commit fe9b4f3f authored by Alex Moore's avatar Alex Moore

uploading and pulling - it's been a bit

parent 78de6781
(function() {
var el = document.getElementById("CollectionList1");
var btn = document.getElementById("singleRight");
el.selctedIndex = selectedAdd; // Selected add is the index of selected collection
el.value = el.options[selectedAdd].value;
doTransfer1();
})();
\ No newline at end of file
(function() {
finishedScanning();
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList1");
var opts = el.options;
var str = '{ "options" : [';
for (var i = 0; i < opts.length; i++) {
str += '{"value":"' + opts[i].value + '", '
+ '"text":"' + opts[i].innerHTML.trim() + '"}'
if (i + 1 != opts.length)
str += ",";
}
str += "]}";
return str;
})();
\ No newline at end of file
(function() {
var div = document.getElementById("ActionMessage");
var msg = div.getElementsByTagName("td")[0].innerHTML.trim().replace(",", "-");
return msg.replace(/<br>/g, ",");
})();
\ No newline at end of file
(function() {
var scannedDiv = document.getElementById("ScannedListDiv");
var scannedTB = scannedDiv.children[0].children[0];
var allRows = scannedTB.children;
var scannedRows = []; // Array of tr elements
var scannedBooks = '{ "books" : [';
// Go through all rows, except header, to get all scanned rows
for (var i = 1; i < allRows.length; i++) {
if (allRows[i].childElementCount !== 0) { // Ignore empty spacing rows
scannedRows[scannedRows.length] = allRows[i];
}
}
// Go through scanned rows
for (var j = 0; j < scannedRows.length; j++) {
if (scannedRows[j].children.length !== 0) {
// Scanned rows is a tr element with td children
var rowChildren = scannedRows[j].children; // Array of tds
// Go through each td element in a row
for (var k = 0; k < rowChildren.length; k++) { // k is col num
if (rowChildren[k].childElementCount !== 0) { // If the td has children (font)
var bookProp = rowChildren[k].children[0]; // font element
// If the col isn't empty
var a = bookProp.innerHTML;
if (bookProp.innerHTML != "&nbsp;" && bookProp.innerHTML !== "") {
switch(k) {
case 1: // ID Prop
scannedBooks += '{"id":"' + bookProp.innerHTML.trim() + '", ';
break;
case 2: // Call Num
scannedBooks += '"callnum":"' + bookProp.innerHTML.trim() + '", ';
break;
case 3: // Title
scannedBooks += '"title":"' + bookProp.innerHTML.trim() + '"},';
break;
}
}
}
}
}
}
scannedBooks = scannedBooks.substring(0, scannedBooks.length-1);
return scannedBooks + ']}';
})();
\ No newline at end of file
(function() {
var el = document.getElementById("CollectionList2");
var opts = el.options;
var str = '{ "options" : [';
for (var i = 0; i < opts.length; i++) {
str += '{"value":"' + opts[i].value + '", '
+ '"text":"' + opts[i].innerHTML.trim() + '"}'
if (i + 1 != opts.length)
str += ",";
}
str += "]}";
return str;
})();
\ No newline at end of file
(function() {
// TODO: Believe this is what the continue button does
onContinue();
})();
\ No newline at end of file
(function() {
var user = document.getElementById("UserID"); // User ID input
var pword = document.getElementById("Password"); // Password input
var type = document.getElementsByName("ScanType"); // Scan or Identify missing Radiobuttons
var inventory = document.getElementById("InventoryRadioBtn");
var missing = document.getElementById("IDMissingRadioBtn");
user.value = "circ_admin";
pword.value = "silver";
GetLocation();
var loc = document.getElementById("LocationSelCtl"); // Location select
loc.selectedIndex = 2; // Make sure this is the Lewisburg branch
loc.value = loc.options[2].value;
inventory.checked = true;
doLogin();
})();
\ No newline at end of file
......@@ -26,6 +26,18 @@
EF22332C1A9FA2FC005F0FFC /* CaptuvoOptionsController.m in Sources */ = {isa = PBXBuildFile; fileRef = EF22332B1A9FA2FC005F0FFC /* CaptuvoOptionsController.m */; };
EF22332F1A9FA320005F0FFC /* libCaptuvoSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EF22332E1A9FA320005F0FFC /* libCaptuvoSDK.a */; };
EF5D7C151A93E7F7005FD90F /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EF5D7C141A93E7F7005FD90F /* SettingsViewController.m */; };
EF620A211ABA4BFD009E7B46 /* AddCollection.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A151ABA4BFD009E7B46 /* AddCollection.js */; };
EF620A221ABA4BFD009E7B46 /* FinishScan.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A161ABA4BFD009E7B46 /* FinishScan.js */; };
EF620A231ABA4BFD009E7B46 /* GetAvailableCollections.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A171ABA4BFD009E7B46 /* GetAvailableCollections.js */; };
EF620A241ABA4BFD009E7B46 /* GetError.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A181ABA4BFD009E7B46 /* GetError.js */; };
EF620A251ABA4BFD009E7B46 /* GetScanned.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A191ABA4BFD009E7B46 /* GetScanned.js */; };
EF620A261ABA4BFD009E7B46 /* GetSelectedCollections.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A1A1ABA4BFD009E7B46 /* GetSelectedCollections.js */; };
EF620A271ABA4BFD009E7B46 /* GoToScan.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A1B1ABA4BFD009E7B46 /* GoToScan.js */; };
EF620A281ABA4BFD009E7B46 /* Login.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A1C1ABA4BFD009E7B46 /* Login.js */; };
EF620A291ABA4BFD009E7B46 /* RemoveCollection.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A1D1ABA4BFD009E7B46 /* RemoveCollection.js */; };
EF620A2A1ABA4BFD009E7B46 /* SaveSetup.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A1E1ABA4BFD009E7B46 /* SaveSetup.js */; };
EF620A2B1ABA4BFD009E7B46 /* ScanBarcode.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A1F1ABA4BFD009E7B46 /* ScanBarcode.js */; };
EF620A2C1ABA4BFD009E7B46 /* WhatPage.js in Resources */ = {isa = PBXBuildFile; fileRef = EF620A201ABA4BFD009E7B46 /* WhatPage.js */; };
EF80050A1AB9E1E200A10D56 /* SectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EF8005091AB9E1E200A10D56 /* SectionViewController.m */; };
EF80050D1ABA122E00A10D56 /* GlobalWebController.m in Sources */ = {isa = PBXBuildFile; fileRef = EF80050C1ABA122E00A10D56 /* GlobalWebController.m */; };
EFF4A0F31AB9110800FA82F3 /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0F21AB9110800FA82F3 /* WebViewController.m */; };
......@@ -74,6 +86,18 @@
EF22332E1A9FA320005F0FFC /* libCaptuvoSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libCaptuvoSDK.a; sourceTree = "<group>"; };
EF5D7C131A93E7F7005FD90F /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = "<group>"; };
EF5D7C141A93E7F7005FD90F /* SettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsViewController.m; sourceTree = "<group>"; };
EF620A151ABA4BFD009E7B46 /* AddCollection.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AddCollection.js; sourceTree = "<group>"; };
EF620A161ABA4BFD009E7B46 /* FinishScan.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FinishScan.js; sourceTree = "<group>"; };
EF620A171ABA4BFD009E7B46 /* GetAvailableCollections.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GetAvailableCollections.js; sourceTree = "<group>"; };
EF620A181ABA4BFD009E7B46 /* GetError.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GetError.js; sourceTree = "<group>"; };
EF620A191ABA4BFD009E7B46 /* GetScanned.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GetScanned.js; sourceTree = "<group>"; };
EF620A1A1ABA4BFD009E7B46 /* GetSelectedCollections.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GetSelectedCollections.js; sourceTree = "<group>"; };
EF620A1B1ABA4BFD009E7B46 /* GoToScan.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = GoToScan.js; sourceTree = "<group>"; };
EF620A1C1ABA4BFD009E7B46 /* Login.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Login.js; sourceTree = "<group>"; };
EF620A1D1ABA4BFD009E7B46 /* RemoveCollection.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RemoveCollection.js; sourceTree = "<group>"; };
EF620A1E1ABA4BFD009E7B46 /* SaveSetup.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = SaveSetup.js; sourceTree = "<group>"; };
EF620A1F1ABA4BFD009E7B46 /* ScanBarcode.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = ScanBarcode.js; sourceTree = "<group>"; };
EF620A201ABA4BFD009E7B46 /* WhatPage.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = WhatPage.js; sourceTree = "<group>"; };
EF8005081AB9E1E200A10D56 /* SectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SectionViewController.h; sourceTree = "<group>"; };
EF8005091AB9E1E200A10D56 /* SectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SectionViewController.m; sourceTree = "<group>"; };
EF80050B1ABA122E00A10D56 /* GlobalWebController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalWebController.h; sourceTree = "<group>"; };
......@@ -127,6 +151,7 @@
7866F5F01A9D23B4006CEFEB /* Main.storyboard */,
EF2233301A9FA327005F0FFC /* Include */,
EF2233321A9FA349005F0FFC /* Source */,
EF620A141ABA4BBD009E7B46 /* Javascript Resources */,
EF2233311A9FA32B005F0FFC /* Libraries */,
EF2233331A9FA358005F0FFC /* Resources */,
78FD6B0B1A81713A00D48A92 /* Supporting Files */,
......@@ -218,6 +243,26 @@
name = Resources;
sourceTree = "<group>";
};
EF620A141ABA4BBD009E7B46 /* Javascript Resources */ = {
isa = PBXGroup;
children = (
EF620A151ABA4BFD009E7B46 /* AddCollection.js */,
EF620A161ABA4BFD009E7B46 /* FinishScan.js */,
EF620A171ABA4BFD009E7B46 /* GetAvailableCollections.js */,
EF620A181ABA4BFD009E7B46 /* GetError.js */,
EF620A191ABA4BFD009E7B46 /* GetScanned.js */,
EF620A1A1ABA4BFD009E7B46 /* GetSelectedCollections.js */,
EF620A1B1ABA4BFD009E7B46 /* GoToScan.js */,
EF620A1C1ABA4BFD009E7B46 /* Login.js */,
EF620A1D1ABA4BFD009E7B46 /* RemoveCollection.js */,
EF620A1E1ABA4BFD009E7B46 /* SaveSetup.js */,
EF620A1F1ABA4BFD009E7B46 /* ScanBarcode.js */,
EF620A201ABA4BFD009E7B46 /* WhatPage.js */,
);
name = "Javascript Resources";
path = ..;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -298,12 +343,24 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EF620A251ABA4BFD009E7B46 /* GetScanned.js in Resources */,
EF620A211ABA4BFD009E7B46 /* AddCollection.js in Resources */,
EF620A271ABA4BFD009E7B46 /* GoToScan.js in Resources */,
EF620A221ABA4BFD009E7B46 /* FinishScan.js in Resources */,
7866F5F11A9D23B4006CEFEB /* Main.storyboard in Resources */,
784F46F11A83CF7700EAC872 /* greycheck2.png in Resources */,
EF620A2C1ABA4BFD009E7B46 /* WhatPage.js in Resources */,
EF620A281ABA4BFD009E7B46 /* Login.js in Resources */,
78FD6B381A817F4500D48A92 /* greencheck.png in Resources */,
EF620A291ABA4BFD009E7B46 /* RemoveCollection.js in Resources */,
78FD6B3A1A817F4D00D48A92 /* redx.png in Resources */,
EF620A261ABA4BFD009E7B46 /* GetSelectedCollections.js in Resources */,
78FD6B1C1A81713A00D48A92 /* LaunchScreen.xib in Resources */,
EF620A231ABA4BFD009E7B46 /* GetAvailableCollections.js in Resources */,
784F46F31A83CF7D00EAC872 /* greyx2.png in Resources */,
EF620A2A1ABA4BFD009E7B46 /* SaveSetup.js in Resources */,
EF620A241ABA4BFD009E7B46 /* GetError.js in Resources */,
EF620A2B1ABA4BFD009E7B46 /* ScanBarcode.js in Resources */,
78FD6B191A81713A00D48A92 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
......
......@@ -13,9 +13,11 @@
@interface GlobalWebController : NSObject
{
UIWebView *web;
bool isInitialized;
}
@property(nonatomic, retain) UIWebView *web;
@property(nonatomic, assign) bool isInitialized;
+(GlobalWebController*) getInstance;
@end
......@@ -10,6 +10,7 @@
@implementation GlobalWebController
@synthesize web;
@synthesize isInitialized;
static GlobalWebController *instance = nil;
......@@ -19,6 +20,7 @@ static GlobalWebController *instance = nil;
{
if (instance==nil) {
instance = [GlobalWebController new];
instance.isInitialized = false;
}
}
return instance;
......
......@@ -63,13 +63,22 @@ static NSString *PASSWORD = @"";//@"what";
*/
- (IBAction)btnLogInTouch:(id)sender {
if([txtUsername.text isEqualToString: USERNAME] && [txtPassword.text isEqualToString:PASSWORD]) {//check username and password
[self performSegueWithIdentifier:@"segueLogIn" sender:nil];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incorrect login" message:@"Username or password incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
NSString *loginPath =
[[NSBundle mainBundle] pathForResource:@"Login" ofType:@"js"];
NSString *login = [NSString stringWithContentsOfFile:loginPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *success =
[self.webview stringByEvaluatingJavaScriptFromString:login];
// if([txtUsername.text isEqualToString: USERNAME] && [txtPassword.text isEqualToString:PASSWORD]) {//check username and password
// [self performSegueWithIdentifier:@"segueLogIn" sender:nil];
// } else {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incorrect login" message:@"Username or password incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
// [alert show];
//
// }
}
@end
......@@ -36,20 +36,20 @@ bool firstLoad = true;
[self.tableView reloadData];
//set up uiwebview
if (firstLoad) {
self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
GlobalWebController *globalWeb = [GlobalWebController getInstance];
globalWeb.web = self.webview;
self.webview.delegate = self;
NSString *fullURL = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:fullURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
//self.webview.scalesPageToFit = YES;
[self.webview loadRequest:request];
[self.view addSubview:self.webview];
firstLoad = false;
}
// if (firstLoad) {
// self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
// GlobalWebController *globalWeb = [GlobalWebController getInstance];
// globalWeb.web = self.webview;
//
// self.webview.delegate = self;
// NSString *fullURL = @"http://www.google.com";
// NSURL *url = [NSURL URLWithString:fullURL];
// NSURLRequest *request = [NSURLRequest requestWithURL:url];
// //self.webview.scalesPageToFit = YES;
// [self.webview loadRequest:request];
// [self.view addSubview:self.webview];
// firstLoad = false;
// }
}
- (void)viewDidAppear:(BOOL)animated {
......
......@@ -8,8 +8,9 @@
#import <UIKit/UIKit.h>
@interface WebViewController : UIViewController
@interface WebViewController : UIViewController<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UITextField *txtBookID;
@property UIWebView *webview;
@end
(function() {
var el = document.getElementById("CollectionList2");
var btn = document.getElementById("singleLeft");
el.selctedIndex = selectedRemove;
el.value = el.options[selectedRemove].value;
doTransfer2();
})();
\ No newline at end of file
(function() {
var overdue = document.getElementById("IgnoreOverdueFines");
var okBtn = document.getElementById("OkBtn");
overdue.checked = true;
okBtn.click();
})();
\ No newline at end of file
(function() {
var barcode = document.getElementById("BarcodeInput");
barcode.value = code;
// TODO: Think this is good enough to call function present
recordBarcode();
})();
\ No newline at end of file
(function() {
var url = document.URL;
if (url.search("Login") != -1)
return 0;
else if (url.search("Setup") != -1)
return 1;
else if (url.search("Scan") != -1)
return 2;
else if (url.search("Action") != -1)
return 3;
else
return -1;
})();
\ No newline at end of file
......@@ -9,11 +9,13 @@
/* Begin PBXBuildFile section */
EFF4A0BF1AB7678F00FA82F3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0BE1AB7678F00FA82F3 /* main.m */; };
EFF4A0C21AB7678F00FA82F3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0C11AB7678F00FA82F3 /* AppDelegate.m */; };
EFF4A0C51AB7678F00FA82F3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0C41AB7678F00FA82F3 /* ViewController.m */; };
EFF4A0C81AB7678F00FA82F3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EFF4A0C61AB7678F00FA82F3 /* Main.storyboard */; };
EFF4A0CA1AB7678F00FA82F3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EFF4A0C91AB7678F00FA82F3 /* Images.xcassets */; };
EFF4A0CD1AB7678F00FA82F3 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = EFF4A0CB1AB7678F00FA82F3 /* LaunchScreen.xib */; };
EFF4A0D91AB7679000FA82F3 /* WebviewStuffTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0D81AB7679000FA82F3 /* WebviewStuffTests.m */; };
EFF4A0E41AB767C100FA82F3 /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0E31AB767C100FA82F3 /* FirstViewController.m */; };
EFF4A0E71AB767CD00FA82F3 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0E61AB767CD00FA82F3 /* SecondViewController.m */; };
EFF4A0EA1AB8B90600FA82F3 /* GlobalWebController.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF4A0E91AB8B90600FA82F3 /* GlobalWebController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -32,14 +34,18 @@
EFF4A0BE1AB7678F00FA82F3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
EFF4A0C01AB7678F00FA82F3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
EFF4A0C11AB7678F00FA82F3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
EFF4A0C31AB7678F00FA82F3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
EFF4A0C41AB7678F00FA82F3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
EFF4A0C71AB7678F00FA82F3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
EFF4A0C91AB7678F00FA82F3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
EFF4A0CC1AB7678F00FA82F3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
EFF4A0D21AB7678F00FA82F3 /* WebviewStuffTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebviewStuffTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
EFF4A0D71AB7678F00FA82F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
EFF4A0D81AB7679000FA82F3 /* WebviewStuffTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WebviewStuffTests.m; sourceTree = "<group>"; };
EFF4A0E21AB767C100FA82F3 /* FirstViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = "<group>"; };
EFF4A0E31AB767C100FA82F3 /* FirstViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = "<group>"; };
EFF4A0E51AB767CD00FA82F3 /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = "<group>"; };
EFF4A0E61AB767CD00FA82F3 /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = "<group>"; };
EFF4A0E81AB8B90600FA82F3 /* GlobalWebController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalWebController.h; sourceTree = "<group>"; };
EFF4A0E91AB8B90600FA82F3 /* GlobalWebController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GlobalWebController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -83,12 +89,16 @@
children = (
EFF4A0C01AB7678F00FA82F3 /* AppDelegate.h */,
EFF4A0C11AB7678F00FA82F3 /* AppDelegate.m */,
EFF4A0C31AB7678F00FA82F3 /* ViewController.h */,
EFF4A0C41AB7678F00FA82F3 /* ViewController.m */,
EFF4A0C61AB7678F00FA82F3 /* Main.storyboard */,
EFF4A0E21AB767C100FA82F3 /* FirstViewController.h */,
EFF4A0E31AB767C100FA82F3 /* FirstViewController.m */,
EFF4A0E51AB767CD00FA82F3 /* SecondViewController.h */,
EFF4A0E61AB767CD00FA82F3 /* SecondViewController.m */,
EFF4A0C91AB7678F00FA82F3 /* Images.xcassets */,
EFF4A0CB1AB7678F00FA82F3 /* LaunchScreen.xib */,
EFF4A0BC1AB7678F00FA82F3 /* Supporting Files */,
EFF4A0E81AB8B90600FA82F3 /* GlobalWebController.h */,
EFF4A0E91AB8B90600FA82F3 /* GlobalWebController.m */,
);
path = WebviewStuff;
sourceTree = "<group>";
......@@ -219,9 +229,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EFF4A0C51AB7678F00FA82F3 /* ViewController.m in Sources */,
EFF4A0E71AB767CD00FA82F3 /* SecondViewController.m in Sources */,
EFF4A0EA1AB8B90600FA82F3 /* GlobalWebController.m in Sources */,
EFF4A0C21AB7678F00FA82F3 /* AppDelegate.m in Sources */,
EFF4A0BF1AB7678F00FA82F3 /* main.m in Sources */,
EFF4A0E41AB767C100FA82F3 /* FirstViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="A2L-36-4oy">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--First View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="FirstViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
......@@ -17,9 +17,53 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="NNH-Nz-APn">
<barButtonItem key="rightBarButtonItem" title="Item" id="W4p-oG-5xF">
<connections>
<segue destination="a4y-ck-Py6" kind="show" id="TFU-Cj-JcZ"/>
</connections>
</barButtonItem>
</navigationItem>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1252" y="418"/>
</scene>
<!--Second View Controller-->
<scene sceneID="jDW-KL-5PG">
<objects>
<viewController id="a4y-ck-Py6" customClass="SecondViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="OUa-zN-UpP"/>
<viewControllerLayoutGuide type="bottom" id="uY7-Xa-F80"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="enE-Z0-Rkm">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="G7t-Z3-0nt" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1924" y="418"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="23p-rU-xcb">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="A2L-36-4oy" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="nqE-YY-bMM">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="x9L-hL-R0A"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Oo3-XD-Re4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="580" y="418"/>
</scene>
</scenes>
</document>
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import "ViewController.h"
#import <UIKit/UIKit.h>
@interface FirstViewController : ViewController
@interface FirstViewController : UIViewController <UIWebViewDelegate>
@end
......@@ -7,16 +7,48 @@
//
#import "FirstViewController.h"
#import "SecondViewController.h"
#import "GlobalWebController.h"
@interface FirstViewController ()
@property UIWebView *webview; //(weak, nonatomic) IBOutlet UIWebView *webview;
@end
@implementation FirstViewController
//UIWebView *webview;
bool firstLoad = true;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
if (firstLoad) {
self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)];
GlobalWebController *globalWeb = [GlobalWebController getInstance];
globalWeb.web = self.webview;
self.webview.delegate = self;
NSString *fullURL = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:fullURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
//self.webview.scalesPageToFit = YES;
[self.webview loadRequest:request];
[self.view addSubview:self.webview];
firstLoad = false;
}
NSLog(@"viewDidLoad");
}
- (void)viewWillDisappear:(BOOL)animated {
}
- (void)viewDidAppear:(BOOL)animated {
NSLog(@"viewDidAppear");
//GlobalWebController *globalWeb = [GlobalWebController getInstance];
//self.webview = globalWeb.web;
[self.view addSubview:self.webview];
}
- (void)didReceiveMemoryWarning {
......@@ -24,14 +56,27 @@
// Dispose of any resources that can be recreated.
}
/*
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSURLRequest *currentRequest = [webView request];
NSURL *currentURL = [currentRequest URL];
NSLog(@"1: Current URL is %@", currentURL.absoluteString);
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
//SecondViewController *dest = [segue destinationViewController];
//dest.webview = self.webview;
//NSURLRequest *currentRequest = [self.webview request];
//dest.url = [currentRequest URL];
}
*/
@end
......@@ -8,6 +8,12 @@
#import <UIKit/UIKit.h>
@interface GlobalWebController : ViewController
@interface GlobalWebController : NSObject
{
UIWebView *web;
}
@property(nonatomic, retain) UIWebView *web;
+(GlobalWebController*) getInstance;
@end
......@@ -9,5 +9,20 @@
#import "GlobalWebController.h"
@implementation GlobalWebController
@synthesize web;
static GlobalWebController *instance = nil;
+(GlobalWebController*) getInstance
{
@synchronized(self)
{
if (instance==nil) {
instance = [GlobalWebController new];
}
}
return instance;
}
@end
......@@ -6,8 +6,10 @@
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.