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
d4ef9e41
Commit
d4ef9e41
authored
Mar 19, 2015
by
Alex Moore
Browse files
integration moving along, completed login and part of section pages
parent
fe9b4f3f
Changes
4
Hide whitespace changes
Inline
Side-by-side
UI-Iteration3/PLUCdraft/PLUCdraft/LogInViewController.m
View file @
d4ef9e41
...
...
@@ -63,22 +63,30 @@ static NSString *PASSWORD = @"";//@"what";
*/
-
(
IBAction
)
btnLogInTouch
:(
id
)
sender
{
NSString
*
loginPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"Login"
ofType
:
@"js"
];
NSString
*
login
=
[
NSString
stringWithContentsOfFile
:
loginPath
encoding:
NSUTF8StringEncoding
error:
nil
];
//Login to page when button is pressed
// 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];
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];
//
// }
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
UI-Iteration3/PLUCdraft/PLUCdraft/Main.storyboard
View file @
d4ef9e41
<?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=
"6254"
systemVersion=
"14C109"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
initialViewController=
"
Feu-98-wZh
"
>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"6247"
/>
<capability
name=
"Aspect ratio constraints"
minToolsVersion=
"5.1"
/>
...
...
UI-Iteration3/PLUCdraft/PLUCdraft/SectionViewController.m
View file @
d4ef9e41
...
...
@@ -13,7 +13,8 @@
@interface
SectionViewController
()
@property
NSMutableArray
*
sections
;
@property
UIWebView
*
webview
;
@property
NSMutableDictionary
*
availableCollections
;
//@property UIWebView *webview;
@end
...
...
@@ -32,7 +33,8 @@ bool firstLoad = true;
self
.
sections
=
[[
NSMutableArray
alloc
]
init
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
loadInitialData
];
//[self loadInitialData];
[
self
getCollections
];
[
self
.
tableView
reloadData
];
//set up uiwebview
...
...
@@ -59,22 +61,48 @@ bool firstLoad = true;
[
self
.
view
addSubview
:
self
.
webview
];
}
-
(
void
)
webViewDidFinishLoad
:(
UIWebView
*
)
webView
{
[
super
webViewDidFinishLoad
:
webView
];
NSLog
(
@"webViewDidFinishLoad"
);
[
self
getCollections
];
[
self
.
tableView
reloadData
];
}
-
(
void
)
loadData
:(
NSMutableArray
*
)
sectionList
{
for
(
NSString
*
section
in
sectionList
)
{
[
self
.
sections
addObject
:
section
];
}
}
-
(
void
)
loadInitialData
{
[
self
.
sections
addObject
:
@"Adult Non-Fiction"
];
[
self
.
sections
addObject
:
@"Adult Fiction"
];
[
self
.
sections
addObject
:
@"Adult Semi-Fiction"
];
[
self
.
sections
addObject
:
@"Children Non-Fiction"
];
[
self
.
sections
addObject
:
@"Children Fiction"
];
[
self
.
sections
addObject
:
@"CD"
];
[
self
.
sections
addObject
:
@"DVD"
];
[
self
.
sections
addObject
:
@"Blu-Ray"
];
[
self
.
sections
addObject
:
@"VHS"
];
[
self
.
sections
addObject
:
@"Game of Thrones"
];
[
self
.
sections
addObject
:
@"Poetry"
];
[
self
.
sections
addObject
:
@"Encyclopedias"
];
[
self
.
sections
addObject
:
@"Stuff"
];
[
self
.
sections
addObject
:
@"Other"
];
-
(
void
)
getCollections
{
// 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
]]];
}
//NSLog(@"%@", sectionList);
[
self
loadData
:
sectionList
];
}
-
(
void
)
didReceiveMemoryWarning
{
...
...
@@ -167,6 +195,8 @@ bool firstLoad = true;
session
.
section
=
[
self
.
sections
objectAtIndex
:
path
.
row
];
ScanBookViewController
*
destViewController
=
[
segue
destinationViewController
];
destViewController
.
session
=
session
;
//need to call AddCollection, then GetSelectedCollections
}
...
...
UI-Iteration3/PLUCdraft/PLUCdraft/WebViewController.m
View file @
d4ef9e41
...
...
@@ -59,46 +59,47 @@
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
// 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"
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment