Commit b1b13488 authored by Drewdabb's avatar Drewdabb
Browse files

first system lib test

parent 690104ba
No preview for this file type
......@@ -122,12 +122,12 @@
// [loginAlert show];
//For testing
if([self.txtUsername.text isEqualToString:@"circ_admin"] && [self.txtPassword.text isEqualToString:@"silver"]) {//check username and password
// if([self.txtUsername.text isEqualToString:@"circ_admin"] && [self.txtPassword.text isEqualToString:@"silver"]) {//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];
}
// } else {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incorrect login" message:@"Username or password incorrect" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
// [alert show];
// }
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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="juL-Mo-vpA">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="juL-Mo-vpA">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
......@@ -20,13 +20,13 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1dA-Bp-AXg">
<rect key="frame" x="16" y="160" width="79" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tJE-yf-FhY">
<rect key="frame" x="16" y="221" width="76" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="rFc-Xp-Oik">
......@@ -140,7 +140,7 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Continuous scanning" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NbJ-uH-v6R">
<rect key="frame" x="16" y="72" width="162" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6gf-v9-uSr">
......@@ -161,13 +161,13 @@
<constraint firstAttribute="width" constant="104" id="e8n-Qu-mNH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Volume Level" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QRZ-Sy-r8t">
<rect key="frame" x="16" y="138" width="162" height="58"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
......@@ -212,7 +212,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="H7S-u0-5kF">
<rect key="frame" x="16" y="145" width="568" height="30"/>
<rect key="frame" x="16" y="144" width="568" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
......@@ -220,7 +220,7 @@
</connections>
</textField>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="HXe-Ct-PRX">
<rect key="frame" x="16" y="226" width="568" height="284"/>
<rect key="frame" x="16" y="182" width="568" height="398"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ListPrototypeCell" id="R2Y-bl-AZc">
......@@ -232,35 +232,27 @@
</tableViewCell>
</prototypes>
</tableView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gwd-yc-1oH">
<rect key="frame" x="280" y="550" width="41" height="30"/>
<state key="normal" title="Finish">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="clickedFinish:" destination="chc-VY-Gqa" eventType="touchUpInside" id="Fll-P4-lsd"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="28C-Wr-Ey7">
<rect key="frame" x="279" y="92" width="42" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="lTg-c0-gcL"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="gwd-yc-1oH" secondAttribute="bottom" constant="20" symbolic="YES" id="2lE-Ot-r7f"/>
<constraint firstItem="HXe-Ct-PRX" firstAttribute="leading" secondItem="H7S-u0-5kF" secondAttribute="leading" id="5Go-g1-L1t"/>
<constraint firstItem="HXe-Ct-PRX" firstAttribute="top" secondItem="H7S-u0-5kF" secondAttribute="bottom" constant="51" id="GMk-lU-G2y"/>
<constraint firstItem="28C-Wr-Ey7" firstAttribute="top" secondItem="RKt-M1-hEG" secondAttribute="bottom" constant="28" id="Qbt-tQ-6A9"/>
<constraint firstItem="H7S-u0-5kF" firstAttribute="trailing" secondItem="STn-V1-lxQ" secondAttribute="trailingMargin" id="UsF-us-vpu"/>
<constraint firstItem="H7S-u0-5kF" firstAttribute="top" secondItem="28C-Wr-Ey7" secondAttribute="bottom" constant="32" id="XMR-K5-eQR"/>
<constraint firstItem="gwd-yc-1oH" firstAttribute="top" secondItem="HXe-Ct-PRX" secondAttribute="bottom" constant="40" id="hm0-Ot-mlm"/>
<constraint firstItem="HXe-Ct-PRX" firstAttribute="trailing" secondItem="H7S-u0-5kF" secondAttribute="trailing" id="pWz-7j-ZX0"/>
<constraint firstItem="28C-Wr-Ey7" firstAttribute="trailing" secondItem="gwd-yc-1oH" secondAttribute="trailing" id="uL9-yB-jnS"/>
<constraint firstItem="H7S-u0-5kF" firstAttribute="leading" secondItem="STn-V1-lxQ" secondAttribute="leadingMargin" id="wV8-Zy-euO"/>
<constraint firstItem="28C-Wr-Ey7" firstAttribute="centerX" secondItem="H7S-u0-5kF" secondAttribute="centerX" id="zQc-Zb-gYd"/>
<constraint firstItem="H7S-u0-5kF" firstAttribute="top" secondItem="28C-Wr-Ey7" secondAttribute="bottom" constant="31" id="4q3-Cs-7Ss"/>
<constraint firstItem="HXe-Ct-PRX" firstAttribute="leading" secondItem="STn-V1-lxQ" secondAttribute="leadingMargin" id="R6R-Td-9zI"/>
<constraint firstItem="HXe-Ct-PRX" firstAttribute="top" secondItem="H7S-u0-5kF" secondAttribute="bottom" constant="8" symbolic="YES" id="bib-A1-rhf"/>
<constraint firstItem="28C-Wr-Ey7" firstAttribute="top" secondItem="RKt-M1-hEG" secondAttribute="bottom" constant="28" id="hDt-RY-OfT"/>
<constraint firstItem="H7S-u0-5kF" firstAttribute="trailing" secondItem="HXe-Ct-PRX" secondAttribute="trailing" id="kC8-0Q-GnW"/>
<constraint firstItem="H7S-u0-5kF" firstAttribute="centerX" secondItem="28C-Wr-Ey7" secondAttribute="centerX" id="kOC-7E-Hyf"/>
<constraint firstAttribute="bottom" secondItem="HXe-Ct-PRX" secondAttribute="bottom" constant="20" symbolic="YES" id="p1J-V5-Qyi"/>
<constraint firstItem="HXe-Ct-PRX" firstAttribute="leading" secondItem="H7S-u0-5kF" secondAttribute="leading" id="pRn-zi-jQp"/>
<constraint firstItem="HXe-Ct-PRX" firstAttribute="trailing" secondItem="STn-V1-lxQ" secondAttribute="trailingMargin" id="qdO-iw-CRp"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Scan Book ID" id="3KX-LL-wsG">
......@@ -271,7 +263,6 @@
</barButtonItem>
</navigationItem>
<connections>
<outlet property="finishBtn" destination="gwd-yc-1oH" id="m9n-0A-U6G"/>
<outlet property="lblSection" destination="28C-Wr-Ey7" id="xrK-eJ-KDa"/>
<outlet property="scannedBookTableView" destination="HXe-Ct-PRX" id="PAx-2H-PL6"/>
<outlet property="txtBookID" destination="H7S-u0-5kF" id="B86-dX-yWV"/>
......
......@@ -19,5 +19,6 @@
@property (weak, nonatomic) IBOutlet UITableView *scannedBookTableView;
//@property (weak, nonatomic) IBOutlet UITextField *txtBookID;
@property (weak, nonatomic) IBOutlet UIButton *finishBtn;
@property (weak, nonatomic) IBOutlet UIWebView *test_view;
@end
......@@ -57,15 +57,20 @@ static int BOOK_ID_LENGTH = 14;
//For testing
[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL
URLWithString:@"file:///Users/plucseniordesign/Desktop/RTIScan2/RTIScan2.html"]]];
//[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL
// URLWithString:@"file:///Users/plucseniordesign/Desktop/RTIScan2/RTIScan2.html"]]];
}
-(void) viewDidAppear:(BOOL)animated {
NSLog(@"viewDidAppear, 2nd view controller");
GlobalWebController *globalWeb = [GlobalWebController getInstance];
self.webview = globalWeb.web;
[self.view addSubview:self.webview];
//NSLog(@"viewDidAppear, 2nd view controller");
//GlobalWebController *globalWeb = [GlobalWebController getInstance];
//self.webview = globalWeb.web;
//[self.test_view setDelegate:self];
//self.test_view = globalWeb.web;
//[self.view addSubview:self.webview];
//[self.view addSubview:self.test_view];
//[self.test_view setScalesPageToFit:YES];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
......@@ -73,26 +78,7 @@ static int BOOK_ID_LENGTH = 14;
NSURLRequest *currentRequest = [webView request];
NSURL *currentURL = [currentRequest URL];
NSLog(@"2: Current URL is %@", currentURL.absoluteString);
// Get scanned codes - Testing GetScanned
NSString *getScanPath =
[[NSBundle mainBundle] pathForResource:@"GetScanned" ofType:@"js"];
NSString *getScan = [NSString stringWithContentsOfFile:getScanPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *scanned =
[webView stringByEvaluatingJavaScriptFromString:getScan];
//self.bookLog.text = scanned;
NSLog(@"%@", scanned);
// UIAlertView *previousScan =
// [[UIAlertView alloc] initWithTitle:@"Previous Scans"
// message:scanned
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
//
// [previousScan show];
[self extractInformation:scanned];
}
......@@ -102,35 +88,44 @@ static int BOOK_ID_LENGTH = 14;
[self.idList removeAllObjects];
[self.callNumList removeAllObjects];
[self.titleList removeAllObjects];
[self.scannedBookList removeAllObjects];
//Extract book ID
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\"id\"\\:\"([0-9]*)\"" options:0 error: Nil];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\"id\"\\:\"([0-9]*)\"\\," options:0 error: Nil];
NSArray *rangeList = [regex matchesInString:scannedBooks options:0 range:NSMakeRange(0, [scannedBooks length])];
NSString *idNum;
for(NSTextCheckingResult *range in rangeList) {
[self.idList addObject:[scannedBooks substringWithRange:[range rangeAtIndex:1]]];
idNum = [scannedBooks substringWithRange:[range rangeAtIndex:1]];
NSLog(idNum);
[self.idList addObject:idNum];
}
//Extract book call number
regex = [NSRegularExpression regularExpressionWithPattern:@"\"callnum\"\\:\"([0-9a-zA-Z\\.]*)\"" options:0 error: Nil];
regex = [NSRegularExpression regularExpressionWithPattern:@"\"callnum\"\\:\"([0-9a-zA-Z\\.]*)\"\\," options:0 error: Nil];
rangeList = [regex matchesInString:scannedBooks options:0 range:NSMakeRange(0, [scannedBooks length])];
NSString *callNum;
for(NSTextCheckingResult *range in rangeList) {
[self.callNumList addObject:[scannedBooks substringWithRange:[range rangeAtIndex:1]]];
callNum = [scannedBooks substringWithRange:[range rangeAtIndex:1]];
NSLog(callNum);
[self.callNumList addObject:callNum];
}
//Extract book title
regex = [NSRegularExpression regularExpressionWithPattern:@"\"title\"\\:\"([0-9a-zA-Z\\.\\&\\;]*)\"" options:0 error: Nil];
regex = [NSRegularExpression regularExpressionWithPattern:@"\"title\"\\:\"(.*)\"\\}" options:0 error: Nil];
rangeList = [regex matchesInString:scannedBooks options:0 range:NSMakeRange(0, [scannedBooks length])];
NSString *title;
for(NSTextCheckingResult *range in rangeList) {
title = [scannedBooks substringWithRange:[range rangeAtIndex:1]];
NSLog(title);
[self.titleList addObject:[scannedBooks substringWithRange:[range rangeAtIndex:1]]];
}
//NSLog(@"%@, %@, %@", [self.idList objectAtIndex:0], [self.callNumList objectAtIndex:0], [self.titleList objectAtIndex:0]);
//Populate table view
NSLog(@"num scanned books = %d", [self.idList count]);
//NSLog(@"num scanned books = %lu", (unsigned long)[self.idList count]);
for(int i = 0; i < [self.idList count]; i++) {
NSLog(@"%@, %@, %@", [self.idList objectAtIndex:i], [self.callNumList objectAtIndex:i], [self.titleList objectAtIndex:i]);
//NSLog(@"%@, %@, %@", [self.idList objectAtIndex:i], [self.callNumList objectAtIndex:i], [self.titleList objectAtIndex:i]);
[self.scannedBookList addObject:[self.idList objectAtIndex:i]];
}
//NSLog(@"Got here");
[self.scannedBookTableView reloadData];
......@@ -233,7 +228,7 @@ static int BOOK_ID_LENGTH = 14;
});
});
}
//31172001492867
- (IBAction)txtChange:(id)sender {
NSCharacterSet* notDigits = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
if(self.txtBookID.text.length == BOOK_ID_LENGTH) { //string is proper length
......@@ -270,7 +265,26 @@ static int BOOK_ID_LENGTH = 14;
self.view.backgroundColor = [UIColor whiteColor];
}];
[self.txtBookID setText:@""];
// Get scanned codes - Testing GetScanned
NSString *getScanPath =
[[NSBundle mainBundle] pathForResource:@"GetScanned" ofType:@"js"];
NSString *getScan = [NSString stringWithContentsOfFile:getScanPath
encoding:NSUTF8StringEncoding
error:nil];
NSString *scanned =
[self.webview stringByEvaluatingJavaScriptFromString:getScan];
//self.bookLog.text = scanned;
NSLog(@"%@", scanned);
// UIAlertView *previousScan =
// [[UIAlertView alloc] initWithTitle:@"Previous Scans"
// message:scanned
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
//
// [previousScan show];
[self extractInformation:scanned];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid Book ID" message:@"Book ID must be numeric" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
......
......@@ -34,8 +34,7 @@
[self.tableView reloadData];
//For testing
[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL
URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
//[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
}
- (void)viewDidAppear:(BOOL)animated {
......@@ -45,6 +44,7 @@
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[super webViewDidFinishLoad:webView];
NSLog(@"got to collections");
// Get collections available - Testing GetAvailableCollections
NSString *getAvailablePath =
......@@ -201,13 +201,22 @@
NSString *selected =
[self.webview stringByEvaluatingJavaScriptFromString:selectedFunc];
// UIAlertView *selectedAlert =
// [[UIAlertView alloc] initWithTitle:@"Collections Selected"
// message:selected
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
// [selectedAlert show];
//UIAlertView *selectedAlert =
//[[UIAlertView alloc] initWithTitle:@"Collections Selected"
// message:selected
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
//[selectedAlert show];
NSString *saveSetupPath =
[[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
NSString *saveSetup =
[NSString stringWithContentsOfFile:saveSetupPath
encoding:NSUTF8StringEncoding
error:nil];
[self.webview stringByEvaluatingJavaScriptFromString:saveSetup];
}
......
......@@ -28,14 +28,18 @@
self.webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
globalWeb.web = self.webview;
globalWeb.isInitialized = true;
//[self.webview
// loadRequest:[NSURLRequest
// requestWithURL:
// [NSURL URLWithString:@"http://192.168.1.131/rti/"]]];
NSURLRequest *rti = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.1.131/rti/"]];
[[NSURLCache sharedURLCache] removeCachedResponseForRequest:rti];
//Clean the cookie jar
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];
[self.webview loadRequest:rti];
// Test collection page on mac mini desktop
[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL
URLWithString:@"file:///Users/plucseniordesign/Desktop/response.html"]]];//RTISetup.html"]]];
//[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL
// URLWithString:@"file:///Users/plucseniordesign/Desktop/response.html"]]];//RTISetup.html"]]];
[self.webview setDelegate:self];
}
else {
......
(function() {
var url = document.URL;
if (url.search("response") != -1)
if (url.search("Login") != -1)
return 0;
else if (url.search("Setup") != -1)
return 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment