Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrew D'Abbraccio
PLUC Inventory - Senior Design
Commits
38cfdbfb
Commit
38cfdbfb
authored
Mar 22, 2015
by
Alex Moore
Browse files
Updated workspace, project is now in folder WAMI
parent
f608973e
Changes
387
Hide whitespace changes
Inline
Side-by-side
ARCHIVE/headlessbrower_test1/headlessbrower_test1/Info.plist
0 → 100644
View file @
38cfdbfb
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
CFBundleDevelopmentRegion
</key>
<string>
en
</string>
<key>
CFBundleExecutable
</key>
<string>
$(EXECUTABLE_NAME)
</string>
<key>
CFBundleIdentifier
</key>
<string>
PLUC.$(PRODUCT_NAME:rfc1034identifier)
</string>
<key>
CFBundleInfoDictionaryVersion
</key>
<string>
6.0
</string>
<key>
CFBundleName
</key>
<string>
$(PRODUCT_NAME)
</string>
<key>
CFBundlePackageType
</key>
<string>
APPL
</string>
<key>
CFBundleShortVersionString
</key>
<string>
1.0
</string>
<key>
CFBundleSignature
</key>
<string>
????
</string>
<key>
CFBundleVersion
</key>
<string>
1
</string>
<key>
LSRequiresIPhoneOS
</key>
<true/>
<key>
UILaunchStoryboardName
</key>
<string>
LaunchScreen
</string>
<key>
UIMainStoryboardFile
</key>
<string>
Main
</string>
<key>
UIRequiredDeviceCapabilities
</key>
<array>
<string>
armv7
</string>
</array>
<key>
UISupportedInterfaceOrientations
</key>
<array>
<string>
UIInterfaceOrientationPortrait
</string>
<string>
UIInterfaceOrientationLandscapeLeft
</string>
<string>
UIInterfaceOrientationLandscapeRight
</string>
</array>
<key>
UISupportedInterfaceOrientations~ipad
</key>
<array>
<string>
UIInterfaceOrientationPortrait
</string>
<string>
UIInterfaceOrientationPortraitUpsideDown
</string>
<string>
UIInterfaceOrientationLandscapeLeft
</string>
<string>
UIInterfaceOrientationLandscapeRight
</string>
</array>
</dict>
</plist>
ARCHIVE/headlessbrower_test1/headlessbrower_test1/Login.js
0 → 100755
View file @
38cfdbfb
(
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
ARCHIVE/headlessbrower_test1/headlessbrower_test1/RemoveCollection.js
0 → 100755
View file @
38cfdbfb
(
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
ARCHIVE/headlessbrower_test1/headlessbrower_test1/SaveSetup.js
0 → 100755
View file @
38cfdbfb
(
function
()
{
var
overdue
=
document
.
getElementById
(
"
IgnoreOverdueFines
"
);
var
okBtn
=
document
.
getElementById
(
"
OkBtn
"
);
overdue
.
checked
=
true
;
okBtn
.
click
();
})();
\ No newline at end of file
ARCHIVE/headlessbrower_test1/headlessbrower_test1/ScanBarcode.js
0 → 100755
View file @
38cfdbfb
(
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
ARCHIVE/headlessbrower_test1/headlessbrower_test1/ViewController.h
0 → 100644
View file @
38cfdbfb
//
// ViewController.h
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface
ViewController
:
UIViewController
<
UIWebViewDelegate
>
//@property (weak, nonatomic) IBOutlet UIWebView *test_view;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
btnLogin
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
barcodeField
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
scanButton
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
continueBtn
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
finishButton
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
setupButton
;
@property
(
weak
,
nonatomic
)
IBOutlet
UILabel
*
bookLog
;
@end
ARCHIVE/headlessbrower_test1/headlessbrower_test1/ViewController.m
0 → 100644
View file @
38cfdbfb
//
// ViewController.m
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import "ViewController.h"
#import "GlobalWebController.h"
@interface
ViewController
()
@property
UIWebView
*
webview
;
@end
@implementation
ViewController
bool
webview_loaded
;
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
GlobalWebController
*
globalWeb
=
[
GlobalWebController
getInstance
];
if
(
!
globalWeb
.
isInitialized
)
{
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/"]]];
// Test collection page on mac mini desktop
[
self
.
webview
loadRequest
:[
NSURLRequest
requestWithURL
:
[
NSURL
URLWithString:
@"file:///Users/plucseniordesign/Desktop/RTISetup.html"
]]];
[
self
.
webview
setDelegate
:
self
];
}
}
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
self
.
view
addSubview
:
self
.
webview
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
-
(
void
)
webViewDidFinishLoad
:(
UIWebView
*
)
webView
{
// Strictly for debugging purposes
[
webView
stringByEvaluatingJavaScriptFromString
:
@"var test1 = 'Hello Pluto'"
];
NSString
*
newHtml
=
[
webView
stringByEvaluatingJavaScriptFromString
:
@"test1"
];
NSLog
(
@"%@
\n
"
,
newHtml
);
NSString
*
path
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"WhatPage"
ofType
:
@"js"
];
NSString
*
content
=
[
NSString
stringWithContentsOfFile
:
path
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
page
=
[
webView
stringByEvaluatingJavaScriptFromString
:
content
];
NSLog
(
@"PAGE NUMBER IS: %@
\n
"
,
page
);
if
([
page
isEqual
:
@"1"
])
{
// Setup Page
// Get collections available - Testing GetAvailableCollections
NSString
*
getAvailablePath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"GetAvailableCollections"
ofType:
@"js"
];
NSString
*
getAvailable
=
[
NSString
stringWithContentsOfFile
:
getAvailablePath
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
available
=
[
webView
stringByEvaluatingJavaScriptFromString
:
getAvailable
];
UIAlertView
*
collectionAlert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Collections Available"
message:
available
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
collectionAlert
show
];
// Get selected collections
NSString
*
selectedPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"GetSelectedCollections"
ofType:
@"js"
];
NSString
*
selectedFunc
=
[
NSString
stringWithContentsOfFile
:
selectedPath
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
selected
=
[
webView
stringByEvaluatingJavaScriptFromString
:
selectedFunc
];
UIAlertView
*
selectedAlert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Collections Selected"
message:
selected
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
selectedAlert
show
];
}
else
if
([
page
isEqual
:
@"2"
])
{
// Scan Page
// 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
;
UIAlertView
*
previousScan
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Previous Scans"
message:
scanned
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
previousScan
show
];
}
else
if
([
page
isEqual
:
@"3"
])
{
// Error/Action Page
// Get the error - Testing GetError
NSString
*
getErrorPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"GetError"
ofType
:
@"js"
];
NSString
*
getError
=
[
NSString
stringWithContentsOfFile
:
getErrorPath
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
error
=
[
webView
stringByEvaluatingJavaScriptFromString
:
getError
];
// Continue - Testing GoToScan
NSString
*
goToScanPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"GoToScan"
ofType
:
@"js"
];
NSString
*
goToScan
=
[
NSString
stringWithContentsOfFile
:
goToScanPath
encoding:
NSUTF8StringEncoding
error:
nil
];
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
goToScan
];
UIAlertView
*
errorAlert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Error Encountered"
message:
error
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
errorAlert
show
];
}
}
-
(
IBAction
)
loginBtnPressed
:(
id
)
sender
{
NSString
*
path
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"WhatPage"
ofType
:
@"js"
];
NSString
*
content
=
[
NSString
stringWithContentsOfFile
:
path
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
page
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
content
];
NSLog
(
@"PAGE NUMBER IS: %@
\n
"
,
page
);
if
([
page
isEqual
:
@"0"
])
{
// Login Page
NSString
*
loginPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"Login"
ofType
:
@"js"
];
NSString
*
login
=
[
NSString
stringWithContentsOfFile
:
loginPath
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
success
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
login
];
UIAlertView
*
loginAlert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Logged In!"
message:
success
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
loginAlert
show
];
}
}
-
(
IBAction
)
scanBtnPressed
:(
id
)
sender
{
NSString
*
path
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"WhatPage"
ofType
:
@"js"
];
NSString
*
content
=
[
NSString
stringWithContentsOfFile
:
path
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
page
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
content
];
NSLog
(
@"PAGE NUMBER IS: %@
\n
"
,
page
);
if
([
page
isEqual
:
@"2"
])
{
// Scan Page
// Get scanned codes - Testing GetScanned
NSString
*
barcode
=
self
.
barcodeField
.
text
;
if
(
barcode
.
length
!=
14
)
{
UIAlertView
*
noBarcode
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Invalid Barcode"
message:
@"Barcode ain't 14 characters"
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
noBarcode
show
];
}
else
{
NSString
*
stringStart
=
@"var code = '"
;
NSString
*
stringEnd
=
@"';"
;
NSString
*
newString
=
[
stringStart
stringByAppendingString
:
barcode
];
NSString
*
inputCode
=
[
newString
stringByAppendingString
:
stringEnd
];
NSString
*
scanPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"ScanBarcode"
ofType
:
@"js"
];
NSString
*
scan
=
[
NSString
stringWithContentsOfFile
:
scanPath
encoding:
NSUTF8StringEncoding
error:
nil
];
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
inputCode
];
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
scan
];
// 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
;
UIAlertView
*
previousScan
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Previous Scans"
message:
scanned
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
previousScan
show
];
}
}
}
-
(
IBAction
)
continueOnError
:(
id
)
sender
{
NSString
*
path
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"WhatPage"
ofType
:
@"js"
];
NSString
*
content
=
[
NSString
stringWithContentsOfFile
:
path
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
page
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
content
];
NSLog
(
@"PAGE NUMBER IS: %@
\n
"
,
page
);
if
([
page
isEqual
:
@"3"
])
{
// Error/Action Page
// Continue - Testing GoToScan
NSString
*
goToScanPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"GoToScan"
ofType
:
@"js"
];
NSString
*
goToScan
=
[
NSString
stringWithContentsOfFile
:
goToScanPath
encoding:
NSUTF8StringEncoding
error:
nil
];
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
goToScan
];
}
}
-
(
IBAction
)
clickedFinish
:(
id
)
sender
{
NSString
*
path
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"WhatPage"
ofType
:
@"js"
];
NSString
*
content
=
[
NSString
stringWithContentsOfFile
:
path
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
page
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
content
];
NSLog
(
@"PAGE NUMBER IS: %@
\n
"
,
page
);
// Test FinishScan
if
([
page
isEqual
:
@"2"
])
{
// Scan Page
NSString
*
finishPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"FinishScan"
ofType
:
@"js"
];
NSString
*
finish
=
[
NSString
stringWithContentsOfFile
:
finishPath
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
isFinished
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
finish
];
if
([
isFinished
isEqual
:
@"-1"
])
{
}
else
{
NSLog
(
@"FINISHED NOT FAILED
\n
"
);
}
}
}
-
(
IBAction
)
clickedSetup
:(
id
)
sender
{
NSString
*
path
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"WhatPage"
ofType
:
@"js"
];
NSString
*
content
=
[
NSString
stringWithContentsOfFile
:
path
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
page
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
content
];
NSLog
(
@"PAGE NUMBER IS: %@
\n
"
,
page
);
if
([
page
isEqual
:
@"1"
])
{
// Get selected collections
NSString
*
selectedPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"GetSelectedCollections"
ofType:
@"js"
];
NSString
*
selectedFunc
=
[
NSString
stringWithContentsOfFile
:
selectedPath
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
selected
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
selectedFunc
];
UIAlertView
*
selectedAlert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Collections Selected"
message:
selected
delegate:
self
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
selectedAlert
show
];
// Testing AddCollection
// NSString *addSelectedPath =
// [[NSBundle mainBundle] pathForResource:@"AddCollection"
// ofType:@"js"];
// NSString *addSelected =
// [NSString stringWithContentsOfFile:addSelectedPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.webview
// stringByEvaluatingJavaScriptFromString:@"var selectedAdd = 49;"];
// NSString *add =
// [self.webview
// stringByEvaluatingJavaScriptFromString:addSelected];
//
// if ([add isEqual:nil]) {
// NSLog(@"nil failed");
// } else {
// NSLog(@"NOT NILL UNFAILED");
// }
// Testing RemoveCollection
// NSString *removeSelectedPath =
// [[NSBundle mainBundle] pathForResource:@"RemoveCollection"
// ofType:@"js"];
// NSString *removeSelected =
// [NSString stringWithContentsOfFile:removeSelectedPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.webview
// stringByEvaluatingJavaScriptFromString:@"var selectedRemove =
// 0;"];
// NSString *remove =
// [self.webview
// stringByEvaluatingJavaScriptFromString:removeSelected];
// // Testing Save SetUp
// NSString *saveSetupPath =
// [[NSBundle mainBundle] pathForResource:@"SaveSetup" ofType:@"js"];
// NSString *saveSetup =
// [NSString stringWithContentsOfFile:saveSetupPath
// encoding:NSUTF8StringEncoding
// error:nil];
//
// [self.webview stringByEvaluatingJavaScriptFromString:saveSetup];
}
}
@end
ARCHIVE/headlessbrower_test1/headlessbrower_test1/WhatPage.js
0 → 100755
View file @
38cfdbfb
(
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
ARCHIVE/headlessbrower_test1/headlessbrower_test1/main.m
0 → 100644
View file @
38cfdbfb
//
// main.m
// headlessbrower_test1
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import
<UIKit
/
UIKit.h
>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
ARCHIVE/headlessbrower_test1/headlessbrower_test1Tests/Info.plist
0 → 100644
View file @
38cfdbfb
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
CFBundleDevelopmentRegion
</key>
<string>
en
</string>
<key>
CFBundleExecutable
</key>
<string>
$(EXECUTABLE_NAME)
</string>
<key>
CFBundleIdentifier
</key>
<string>
PLUC.$(PRODUCT_NAME:rfc1034identifier)
</string>
<key>
CFBundleInfoDictionaryVersion
</key>
<string>
6.0
</string>
<key>
CFBundleName
</key>
<string>
$(PRODUCT_NAME)
</string>
<key>
CFBundlePackageType
</key>
<string>
BNDL
</string>
<key>
CFBundleShortVersionString
</key>
<string>
1.0
</string>
<key>
CFBundleSignature
</key>
<string>
????
</string>
<key>
CFBundleVersion
</key>
<string>
1
</string>
</dict>
</plist>
ARCHIVE/headlessbrower_test1/headlessbrower_test1Tests/headlessbrower_test1Tests.m
0 → 100644
View file @
38cfdbfb
//
// headlessbrower_test1Tests.m
// headlessbrower_test1Tests
//
// Created by PLUC SeniorDesign on 2/23/15.
// Copyright (c) 2015 PLUC SeniorDesign. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@interface
headlessbrower_test1Tests
:
XCTestCase
@end
@implementation
headlessbrower_test1Tests
-
(
void
)
setUp
{
[
super
setUp
];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
-
(
void
)
tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[
super
tearDown
];
}