Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
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/UI-Iteration3/PLUCdraft/PLUCdraft/SectionViewController.h
0 → 100644
View file @
38cfdbfb
//
// SectionViewController.h
// PLUCdraft
//
// Created by PLUC SeniorDesign on 3/18/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Session.h"
#import "ScanBookViewController.h"
@interface
SectionViewController
:
WebViewController
<
UITableViewDataSource
,
UITableViewDelegate
>
//, UIWebViewDelegate>
@property
(
weak
,
nonatomic
)
IBOutlet
UITableView
*
tableView
;
@end
ARCHIVE/UI-Iteration3/PLUCdraft/PLUCdraft/SectionViewController.m
0 → 100644
View file @
38cfdbfb
//
// SectionTableViewController.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/3/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "SectionViewController.h"
#import "GlobalWebController.h"
@interface
SectionViewController
()
@property
NSMutableArray
*
sections
;
@property
NSMutableDictionary
*
availableCollections
;
//@property UIWebView *webview;
@end
@implementation
SectionViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
self
.
sections
=
[[
NSMutableArray
alloc
]
init
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
tableView
reloadData
];
//For testing
//[self.webview loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"file:///Users/plucseniordesign/Desktop/RTISetup.html"]]];
}
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
{
NSLog
(
@"viewDidAppear"
);
[
self
.
view
addSubview
:
self
.
webview
];
}
-
(
void
)
webViewDidFinishLoad
:(
UIWebView
*
)
webView
{
[
super
webViewDidFinishLoad
:
webView
];
NSLog
(
@"got to collections"
);
// Get collections available - Testing GetAvailableCollections
NSString
*
getAvailablePath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"GetAvailableCollections"
ofType:
@"js"
];
NSString
*
getAvailable
=
[
NSString
stringWithContentsOfFile
:
getAvailablePath
encoding:
NSUTF8StringEncoding
error:
nil
];
NSString
*
available
=
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
getAvailable
];
// UIAlertView *collectionAlert =
// [[UIAlertView alloc] initWithTitle:@"Collections Available"
// message:available
// delegate:self
// cancelButtonTitle:@"OK"
// otherButtonTitles:nil];
// [collectionAlert show];
NSRegularExpression
*
regex
=
[
NSRegularExpression
regularExpressionWithPattern
:
@"
\"
text
\"
:
\"
([a-zA-Z
\\
s]*)
\"
"
options
:
0
error
:
Nil
];
NSArray
*
rangeList
=
[
regex
matchesInString
:
available
options
:
0
range
:
NSMakeRange
(
0
,
[
available
length
])];
NSMutableArray
*
sectionList
=
[[
NSMutableArray
alloc
]
init
];
for
(
NSTextCheckingResult
*
range
in
rangeList
)
{
[
sectionList
addObject
:[
available
substringWithRange
:[
range
rangeAtIndex
:
1
]]];
}
for
(
NSString
*
section
in
sectionList
)
{
[
self
.
sections
addObject
:
section
];
}
[
self
.
tableView
reloadData
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
//allow app to flip to upside down
-
(
BOOL
)
shouldAutorotateToInterfaceOrientation
:(
UIInterfaceOrientation
)
toInterfaceOrientation
{
if
(
toInterfaceOrientation
==
UIInterfaceOrientationPortrait
)
return
YES
;
if
(
toInterfaceOrientation
==
UIInterfaceOrientationPortraitUpsideDown
)
return
YES
;
if
(
toInterfaceOrientation
==
UIInterfaceOrientationLandscapeLeft
)
return
NO
;
if
(
toInterfaceOrientation
==
UIInterfaceOrientationLandscapeRight
)
return
NO
;
return
NO
;
// Unknown value
}
#pragma mark - Table view data source
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
// Return the number of sections.
return
1
;
}
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
{
// Return the number of rows in the section.
return
[
self
.
sections
count
];
}
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"ListPrototypeCell"
forIndexPath
:
indexPath
];
// Configure the cell...
NSString
*
section
=
[
self
.
sections
objectAtIndex
:
indexPath
.
row
];
cell
.
textLabel
.
text
=
section
;
return
cell
;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
#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.
NSIndexPath
*
path
=
[
self
.
tableView
indexPathForSelectedRow
];
Session
*
session
=
[[
Session
alloc
]
init
];
session
.
section
=
[
self
.
sections
objectAtIndex
:
path
.
row
];
ScanBookViewController
*
destViewController
=
[
segue
destinationViewController
];
destViewController
.
session
=
session
;
//need to call AddCollection, then GetSelectedCollections
//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"
);
}
//GetSelectedCollections
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];
NSString
*
saveSetupPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"SaveSetup"
ofType
:
@"js"
];
NSString
*
saveSetup
=
[
NSString
stringWithContentsOfFile
:
saveSetupPath
encoding:
NSUTF8StringEncoding
error:
nil
];
[
self
.
webview
stringByEvaluatingJavaScriptFromString
:
saveSetup
];
}
@end
ARCHIVE/UI-Iteration3/PLUCdraft/PLUCdraft/Session.h
0 → 100755
View file @
38cfdbfb
//
// Session.h
// PLUCdraft
//
// Created by Alexander W. Moore on 2/5/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface
Session
:
NSObject
@property
NSString
*
section
;
@property
int
numScanned
;
-
(
void
)
incrementNumScanned
;
@end
ARCHIVE/UI-Iteration3/PLUCdraft/PLUCdraft/Session.m
0 → 100755
View file @
38cfdbfb
//
// Session.m
// PLUCdraft
//
// Created by Alexander W. Moore on 2/5/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "Session.h"
@implementation
Session
-
(
void
)
incrementNumScanned
{
self
.
numScanned
++
;
}
@end
ARCHIVE/UI-Iteration3/PLUCdraft/PLUCdraft/SettingsViewController.h
0 → 100644
View file @
38cfdbfb
//
// SettingsViewController.h
// PLUCdraft
//
// Created by PLUC SeniorDesign on 2/17/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
#include
"CaptuvoOptionsController.h"
@interface
SettingsViewController
:
CaptuvoOptionsController
@end
ARCHIVE/UI-Iteration3/PLUCdraft/PLUCdraft/SettingsViewController.m
0 → 100644
View file @
38cfdbfb
//
// SettingsViewController.m
// PLUCdraft
//
// Created by PLUC SeniorDesign on 2/17/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "SettingsViewController.h"
#import "ScanBookViewController.h"
@interface
SettingsViewController
()
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
switchContScan
;
-
(
IBAction
)
switchContScanChange
:(
id
)
sender
;
@property
BOOL
contScan
;
@property
int
volume
;
@end
@implementation
SettingsViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
}
//allow app to flip to upside down
-
(
BOOL
)
shouldAutorotateToInterfaceOrientation
:(
UIInterfaceOrientation
)
toInterfaceOrientation
{
if
(
toInterfaceOrientation
==
UIInterfaceOrientationPortrait
)
return
YES
;
if
(
toInterfaceOrientation
==
UIInterfaceOrientationPortraitUpsideDown
)
return
YES
;
if
(
toInterfaceOrientation
==
UIInterfaceOrientationLandscapeLeft
)
return
NO
;
if
(
toInterfaceOrientation
==
UIInterfaceOrientationLandscapeRight
)
return
NO
;
return
NO
;
// Unknown value
}
#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.
ScanBookViewController
*
dest
=
[
segue
destinationViewController
];
dest
.
contScan
=
_contScan
;
}
-
(
IBAction
)
switchContScanChange
:(
id
)
sender
{
_contScan
=
_switchContScan
.
on
;
}
@end
ARCHIVE/UI-Iteration3/PLUCdraft/PLUCdraft/WebViewController.h
0 → 100644
View file @
38cfdbfb
//
// WebViewController.h
// PLUCdraft
//
// Created by PLUC SeniorDesign on 3/17/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface
WebViewController
:
UIViewController
<
UIWebViewDelegate
>
//@property (weak, nonatomic, readwrite) IBOutlet UITextField *txtUsername;
//@property (weak, nonatomic, readwrite) IBOutlet UITextField *txtPassword;
@property
UIWebView
*
webview
;
@end
ARCHIVE/UI-Iteration3/PLUCdraft/PLUCdraft/WebViewController.m
0 → 100644
View file @
38cfdbfb
//
// WebViewController.m
// PLUCdraft
//
// Created by PLUC SeniorDesign on 3/17/15.
// Copyright (c) 2015 Alexander W. Moore. All rights reserved.
//
#import "WebViewController.h"
#import "GlobalWebController.h"
@interface
WebViewController
()
@property
NSString
*
page
;
@property
NSString
*
prevPage
;
@end
@implementation
WebViewController
//@synthesize txtUsername;
//@synthesize txtPassword;
@synthesize
page
;
@synthesize
prevPage
;
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
GlobalWebController
*
globalWeb
=
[
GlobalWebController
getInstance
];
if
(
!
globalWeb
.
isInitialized
)
{
self
.
webview
=
[[
UIWebView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
0
,
0
)];
globalWeb
.
web
=
self
.
webview
;
globalWeb
.
isInitialized
=
true
;
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
setDelegate
:
self
];
}
else
{
self
.
webview
=
[
GlobalWebController
getInstance
].
web
;
[
self
.
view
addSubview
:
self
.
webview
];
[
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
];
//prevPage = page;
page
=
[
webView
stringByEvaluatingJavaScriptFromString
:
content
];
NSLog
(
@"PAGE NUMBER IS: %@
\n
"
,
page
);
//NSLog(@"PREV PAGE NUMBER IS: %@", prevPage);
if
([
page
isEqual
:
@"0"
])
{
//Login Page
NSLog
(
@"Login"
);
}
else
if
([
page
isEqual
:
@"1"
])
{
// Setup Page
NSLog
(
@"Setup"
);
}
else
if
([
page
isEqual
:
@"2"
])
{
// Scan Page
NSLog
(
@"Scan"
);
}
else
if
([
page
isEqual
:
@"3"
])
{
// Error/Action Page
NSLog
(
@"Error"
);
// 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
];
self
.
view
.
backgroundColor
=
[
UIColor
redColor
];
[
UIView
animateWithDuration
:
1
.
0
animations
:
^
{
self
.
view
.
backgroundColor
=
[
UIColor
whiteColor
];
}];
// 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
)
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];
}
}
/*
#pragma mark - Navigation