Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IF3110-2018-K03-Petjah
TugasBesar1_2018
Commits
5a68acfe
Commit
5a68acfe
authored
Oct 26, 2018
by
Wildan Dicky Alnatara
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.informatika.org/IF3110-2018-K03-Petjah/tugasbesar1_2018
parents
51123760
b4591d73
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
176 additions
and
18 deletions
+176
-18
web/css/registration.css
web/css/registration.css
+25
-0
web/css/review.css
web/css/review.css
+1
-0
web/javascript/edit_profile.js
web/javascript/edit_profile.js
+1
-1
web/javascript/validation.js
web/javascript/validation.js
+140
-9
web/registration/view.php
web/registration/view.php
+8
-7
web/review/controller.php
web/review/controller.php
+1
-1
web/uploads/DSN_cC1UIAAslsq.jpg
web/uploads/DSN_cC1UIAAslsq.jpg
+0
-0
web/uploads/gul.png
web/uploads/gul.png
+0
-0
web/uploads/internet-usage-1.png
web/uploads/internet-usage-1.png
+0
-0
No files found.
web/css/registration.css
View file @
5a68acfe
...
...
@@ -14,4 +14,29 @@ td {
textarea
{
width
:
100%
;
}
/*Tooltip*/
.tooltiptext
{
width
:
120px
;
background-color
:
black
;
color
:
#fff
;
text-align
:
center
;
border-radius
:
6px
;
padding
:
5px
0
;
position
:
absolute
;
z-index
:
1
;
top
:
-5px
;
left
:
110%
;
}
.tooltiptext
::after
{
content
:
""
;
position
:
absolute
;
top
:
50%
;
right
:
100%
;
margin-top
:
-5px
;
border-width
:
5px
;
border-style
:
solid
;
border-color
:
transparent
black
transparent
transparent
;
}
\ No newline at end of file
web/css/review.css
View file @
5a68acfe
...
...
@@ -4,6 +4,7 @@
font-size
:
28px
;
font-family
:
'Nunito'
,
sans-serif
;
padding
:
5px
;
margin-block-end
:
30px
;
}
.fivestar-rating
{
...
...
web/javascript/edit_profile.js
View file @
5a68acfe
function
validateForm
(){
//
alert('Here 2');
//alert('Here 2');
pp
=
document
.
getElementById
(
"
profpict
"
).
value
;
name
=
document
.
getElementById
(
"
name
"
).
value
;
address
=
document
.
getElementById
(
"
address
"
).
value
;
...
...
web/javascript/validation.js
View file @
5a68acfe
const
BLANK_FIELD
=
"
field must be filled.
"
;
const
INVALID_EMAIL_FORMAT
=
"
invalid email format.
"
;
const
INVALID_NAME_LENGTH
=
"
name exceeded 20 characters.
"
;
const
INVALID_PHONENUMBER_FORMAT
=
"
please enter numbers only.
"
;
const
INVALID_PHONENUMBER_LENGTH
=
"
please enter valid phone number (9 - 12 digits).
"
;
const
UNMATCHED_PASSWORD
=
"
unmatched password and confirmed password.
"
;
const
EMAIL_REGEX
=
/^
[
a-zA-Z0-9.!#$%&'*+
/
=?^_`{|}~-
]
+@
[
a-zA-Z0-9
](?:[
a-zA-Z0-9-
]{0,61}[
a-zA-Z0-9
])?(?:\.[
a-zA-Z0-9
](?:[
a-zA-Z0-9-
]{0,61}[
a-zA-Z0-9
])?)
*$/
;
const
BLANK_SPACE_REGEX
=
/^
\s
*$/
const
NUMBER_REGEX
=
/^
[
0-9
]
*$/
function
getFieldValue
(
inputID
)
{
return
document
.
getElementById
(
inputID
).
value
;
}
function
validateBlankInput
(
inputID
)
{
var
value
=
getFieldValue
(
inputID
);
if
(
value
==
""
||
BLANK_SPACE_REGEX
.
test
(
value
))
{
showInvalidInput
(
inputID
+
BLANK_FIELD
,
inputID
);
return
false
;
}
else
{
hideInvalidInput
(
inputID
);
return
true
;
}
}
function
validateBlankPassword
()
{
var
validation
=
true
;
validation
&=
validateBlankInput
(
"
password-input
"
);
validation
&=
validateBlankInput
(
"
confpassword-input
"
);
return
validation
==
1
;
}
//Match password and confirmed password
function
validatePassword
()
{
function
validate
All
Password
s
()
{
var
pass
=
document
.
forms
[
"
registrationform
"
][
"
password
"
].
value
;
var
conf_pass
=
document
.
forms
[
"
registrationform
"
][
"
conf_password
"
].
value
;
if
(
pass
!=
conf_pass
)
{
alert
(
"
Unmatched password and confirmed password
"
);
if
(
validateBlankPassword
())
{
if
(
pass
!=
conf_pass
)
{
alert
(
UNMATCHED_PASSWORD
);
highlightInvalidInput
(
"
password-input
"
);
highlightInvalidInput
(
"
confpassword-input
"
);
return
false
;
}
else
{
hideInvalidInput
(
"
password-input
"
);
hideInvalidInput
(
"
confpassword-input
"
);
return
true
;
}
}
else
{
return
false
;
}
}
function
validateName
()
{
if
(
validateBlankInput
(
"
name-input
"
))
{
if
(
getFieldValue
(
"
name-input
"
).
length
>
20
)
{
showInvalidInput
(
INVALID_NAME_LENGTH
,
"
name-input
"
);
return
false
;
}
else
{
hideInvalidInput
(
"
name-input
"
);
return
true
;
}
}
else
{
return
false
;
}
}
function
validatePhoneNumber
()
{
if
(
validateBlankInput
(
"
phonenumber-input
"
))
{
if
(
NUMBER_REGEX
.
test
(
getFieldValue
(
"
phonenumber-input
"
)))
{
var
getLength
=
getFieldValue
(
"
phonenumber-input
"
).
length
;
if
(
getLength
>=
9
&&
getLength
<=
12
)
{
hideInvalidInput
(
"
phonenumber-input
"
);
return
true
;
}
else
{
showInvalidInput
(
INVALID_PHONENUMBER_LENGTH
,
"
phonenumber-input
"
);
return
false
;
}
}
else
{
showInvalidInput
(
INVALID_PHONENUMBER_FORMAT
,
"
phonenumber-input
"
)
}
}
else
{
return
false
;
}
}
function
validateUsername
()
{
if
(
validateBlankInput
(
"
username-input
"
))
{
return
validateAvailability
(
"
username
"
);
}
else
{
return
false
;
}
}
function
validateEmail
()
{
if
(
validateBlankInput
(
"
email-input
"
))
{
re
=
EMAIL_REGEX
;
var
checkFormat
=
re
.
test
(
String
(
getFieldValue
(
"
email-input
"
)).
toLowerCase
());
if
(
!
checkFormat
)
{
showInvalidInput
(
INVALID_EMAIL_FORMAT
,
"
email-input
"
);
return
false
;
}
else
{
return
validateAvailability
(
"
email
"
);
}
}
else
{
return
false
;
}
}
function
validateAddress
()
{
if
(
validateBlankInput
(
"
address-input
"
))
{
return
true
;
}
else
{
return
false
;
}
}
function
validateA
ccount
(
$
input
)
{
var
checkTick
=
document
.
getElementById
(
"
validate_
"
+
$
input
).
innerHTML
;
function
validateA
vailability
(
input
)
{
var
checkTick
=
document
.
getElementById
(
"
validate_
"
+
input
).
innerHTML
;
if
(
checkTick
==
""
)
{
aler
t
(
$
input
+
"
is unavailable!
"
);
showInvalidInpu
t
(
input
+
"
is unavailable!
"
,
input
+
"
-input
"
);
return
false
;
}
else
{
hideInvalidInput
(
input
+
"
-input
"
);
return
true
;
}
}
function
submitValidation
()
{
var
validation
=
true
;
validation
&=
validateAccount
(
"
username
"
);
validation
&=
validateAccount
(
"
email
"
);
validation
&=
validatePassword
();
validation
&=
validateName
();
validation
&=
validateUsername
();
validation
&=
validateEmail
();
validation
&=
validateAllPasswords
();
validation
&=
validateAddress
();
validation
&=
validatePhoneNumber
();
return
validation
==
1
;
}
...
...
@@ -45,4 +154,26 @@ function checkUserAvailability(input, str) {
xmlhttp
.
open
(
"
GET
"
,
"
registration/checkaccount.php?type=
"
+
input
+
"
&q=
"
+
str
,
true
);
xmlhttp
.
send
();
}
}
function
showInvalidInput
(
message
,
inputID
)
{
var
message
=
message
.
replace
(
/-input/
,
"
"
);
var
message
=
message
.
replace
(
/conf/
,
"
confirmed
"
);
alert
(
message
);
highlightInvalidInput
(
inputID
);
}
function
highlightInvalidInput
(
inputID
)
{
var
border
=
document
.
getElementById
(
inputID
).
style
.
border
;
if
(
border
==
""
)
{
document
.
getElementById
(
inputID
).
style
.
border
=
"
2px solid red
"
;
}
}
function
hideInvalidInput
(
inputID
)
{
//document.getElementById("address-input").style.visibility = "hidden";
var
border
=
document
.
getElementById
(
inputID
).
style
.
border
;
if
(
border
==
"
2px solid red
"
)
{
document
.
getElementById
(
inputID
).
style
.
border
=
""
;
}
}
\ No newline at end of file
web/registration/view.php
View file @
5a68acfe
...
...
@@ -48,12 +48,12 @@
return
'<table align="center">
<tr>
<td>Name</td>
<td><input type="text" size="25" name="name"
required
></td>
<td><input
id="name-input"
type="text" size="25" name="name"></td>
</tr>
<tr>
<td>Username</td>
<td>
<div id="validate_form"><input type="text" size="21" name="username" onkeyup="checkUserAvailability(\'username\', this.value)"
required
> </div>
<div id="validate_form"><input
id="username-input"
type="text" size="21" name="username" onkeyup="checkUserAvailability(\'username\', this.value)"> </div>
<!--<div id="validate_icon"><img src="../svgIcon/tick.png"></div>-->
<span id="validate_username"></div>
</td>
...
...
@@ -61,25 +61,26 @@
<tr>
<td>Email</td>
<td>
<div id="validate_form"><input
type
="email" size="21" name="email" onkeyup="checkUserAvailability(\'email\', this.value)"
required
></div>
<div id="validate_form"><input
id
="email
-input" type="text
" size="21" name="email" onkeyup="checkUserAvailability(\'email\', this.value)"></div>
<span id="validate_email"></div>
</td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" size="25" maxlength="16" name="password" required ></td>
<td><input id="password-input" type="password" size="25" maxlength="16" name="password">
</td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" size="25" maxlength="16" name="conf_password"
required
></td>
<td><input
id="confpassword-input"
type="password" size="25" maxlength="16" name="conf_password"></td>
</tr>
<tr>
<td>Address</td>
<td><textarea name="address" rows="3" cols="28"
required
></textarea></td>
<td><textarea
id="address-input"
name="address" rows="3" cols="28"></textarea></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input type="text" size="25" name="phonenumber"
required
></td>
<td><input
id="phonenumber-input"
type="text" size="25" name="phonenumber"></td>
</tr>
</table>'
;
}
\ No newline at end of file
web/review/controller.php
View file @
5a68acfe
...
...
@@ -41,7 +41,7 @@
}
public
static
function
validateOrderHistory
(
$order_id
,
$user_id
)
{
$listOfHistoryID
=
selectFromWhere
(
'Nomor_Order'
,
'book_order'
,
'user_id='
.
$user_id
.
' AND has_reviewed=0'
);
$listOfHistoryID
=
selectFromWhere
(
'Nomor_Order'
,
'book_order'
,
'user_id='
.
$user_id
);
foreach
(
$listOfHistoryID
as
$hist
)
{
if
(
$hist
==
$order_id
)
{
return
TRUE
;
...
...
web/uploads/DSN_cC1UIAAslsq.jpg
0 → 100644
View file @
5a68acfe
379 KB
web/uploads/gul.png
0 → 100644
View file @
5a68acfe
158 KB
web/uploads/internet-usage-1.png
0 → 100644
View file @
5a68acfe
137 KB
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