Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hmead
Assignment Two
Commits
7ecea34d
Commit
7ecea34d
authored
Oct 09, 2019
by
hmead
Browse files
modified a few things
parent
ed55dc41
Pipeline
#3106
failed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.idea/inspectionProfiles/Project_Default.xml
0 → 100644
View file @
7ecea34d
<component
name=
"InspectionProjectProfileManager"
>
<profile
version=
"1.0"
>
<option
name=
"myName"
value=
"Project Default"
/>
<inspection_tool
class=
"JSHint"
enabled=
"true"
level=
"ERROR"
enabled_by_default=
"true"
/>
</profile>
</component>
\ No newline at end of file
.idea/jsLinters/jshint.xml
0 → 100644
View file @
7ecea34d
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"JSHintConfiguration"
version=
"2.10.2"
use-config-file=
"false"
>
<option
asi=
"false"
/>
<option
bitwise=
"true"
/>
<option
boss=
"false"
/>
<option
browser=
"true"
/>
<option
browserify=
"false"
/>
<option
camelcase=
"false"
/>
<option
couch=
"false"
/>
<option
curly=
"true"
/>
<option
debug=
"false"
/>
<option
devel=
"false"
/>
<option
dojo=
"false"
/>
<option
elision=
"false"
/>
<option
enforceall=
"false"
/>
<option
eqeqeq=
"true"
/>
<option
eqnull=
"false"
/>
<option
es3=
"false"
/>
<option
es5=
"false"
/>
<option
esnext=
"false"
/>
<option
evil=
"false"
/>
<option
expr=
"false"
/>
<option
forin=
"true"
/>
<option
freeze=
"false"
/>
<option
funcscope=
"false"
/>
<option
futurehostile=
"false"
/>
<option
gcl=
"false"
/>
<option
globalstrict=
"false"
/>
<option
immed=
"false"
/>
<option
iterator=
"false"
/>
<option
jasmine=
"false"
/>
<option
jquery=
"true"
/>
<option
lastsemic=
"false"
/>
<option
latedef=
"false"
/>
<option
laxbreak=
"false"
/>
<option
laxcomma=
"false"
/>
<option
loopfunc=
"false"
/>
<option
maxerr=
"50"
/>
<option
mocha=
"false"
/>
<option
module=
"false"
/>
<option
mootools=
"false"
/>
<option
moz=
"false"
/>
<option
multistr=
"false"
/>
<option
newcap=
"false"
/>
<option
noarg=
"true"
/>
<option
nocomma=
"false"
/>
<option
node=
"false"
/>
<option
noempty=
"true"
/>
<option
nomen=
"false"
/>
<option
nonbsp=
"false"
/>
<option
nonew=
"true"
/>
<option
nonstandard=
"false"
/>
<option
notypeof=
"false"
/>
<option
noyield=
"false"
/>
<option
onevar=
"false"
/>
<option
passfail=
"false"
/>
<option
phantom=
"false"
/>
<option
plusplus=
"false"
/>
<option
proto=
"false"
/>
<option
prototypejs=
"false"
/>
<option
qunit=
"false"
/>
<option
quotmark=
"false"
/>
<option
rhino=
"false"
/>
<option
scripturl=
"false"
/>
<option
shadow=
"false"
/>
<option
shelljs=
"false"
/>
<option
singleGroups=
"false"
/>
<option
smarttabs=
"false"
/>
<option
strict=
"true"
/>
<option
sub=
"false"
/>
<option
supernew=
"false"
/>
<option
trailing=
"false"
/>
<option
typed=
"false"
/>
<option
undef=
"true"
/>
<option
unused=
"false"
/>
<option
validthis=
"false"
/>
<option
varstmt=
"false"
/>
<option
white=
"false"
/>
<option
withstmt=
"false"
/>
<option
worker=
"false"
/>
<option
wsh=
"false"
/>
<option
yui=
"false"
/>
</component>
</project>
\ No newline at end of file
bookings.php
View file @
7ecea34d
<?php
$scriptList
=
array
(
'./scripts/jquery-3.4.1.js'
,
'./scripts/campsites.js'
,
'./scripts/scrollTop.js'
,
'scripts/leaflet.js'
);
$scriptList
=
array
(
'./scripts/jquery-3.4.1.js'
,
'./scripts/campsites.js'
,
'scripts/leaflet.js'
);
$styleList
=
array
(
'./styles/jquery-ui.css'
,
'styles/style-booking.css'
,
'./styles/leaflet.css'
);
include
(
"htaccess/header.php"
)
?>
...
...
scripts/admin.js
View file @
7ecea34d
var
admin
=
(
function
()
{
"
use strict
"
;
var
pub
=
{};
//Display all completed bookings
...
...
@@ -38,7 +38,7 @@ var admin = (function() {
url
:
"
./htaccess/cancelBooking.php
"
,
//the page containing php script
type
:
"
POST
"
,
//request type
data
:
bookingInfo
,
success
:
function
(
result
){
success
:
function
(){
//If the booking was succesfully removed, hide it from the USER. This is done as a temporary measure until the user has refreshed the page
wholeElement
.
hide
();
}
...
...
@@ -99,7 +99,7 @@ var admin = (function() {
showBookings
();
showCampsiteOptions
();
editableValues
();
}
}
;
return
pub
;
...
...
scripts/campinfo.js
View file @
7ecea34d
function
showHideContent
()
{
// Hide all other content from the div and only show cabin
$
(
"
#campsite-options-content-campervans
"
).
hide
();
$
(
"
#campsite-options-content-tents
"
).
hide
();
$
(
"
#campsite-options-content-cabin
"
).
show
();
$
(
'
#cabin-info
'
).
css
({
'
opacity
'
:
0.7
});
// Show cabin, hide others
$
(
"
#cabin-info
"
).
click
(
function
()
{
var
CampInfo
=
(
function
()
{
"
use strict
"
;
var
pub
=
{};
function
showHideContent
()
{
// Hide all other content from the div and only show cabin
$
(
"
#campsite-options-content-campervans
"
).
hide
();
$
(
"
#campsite-options-content-tents
"
).
hide
();
$
(
"
#campsite-options-content-cabin
"
).
show
();
$
(
'
#cabin-info
'
).
css
({
'
opacity
'
:
0.7
});
$
(
'
#campervan-info, #tent-info
'
).
css
({
'
opacity
'
:
1
});
});
// Show tent, hide others
$
(
"
#tent-info
"
).
click
(
function
()
{
$
(
"
#campsite-options-content-campervans
"
).
hide
();
$
(
"
#campsite-options-content-tents
"
).
show
();
$
(
'
#tent-info
'
).
css
({
'
opacity
'
:
0.7
});
$
(
'
#campervan-info, #cabin-info
'
).
css
({
'
opacity
'
:
1
});
$
(
"
#campsite-options-content-cabin
"
).
hide
();
});
// Show campervans, hide others
$
(
"
#campervan-info
"
).
click
(
function
()
{
$
(
"
#campsite-options-content-campervans
"
).
show
();
$
(
'
#campervan-info
'
).
css
({
'
opacity
'
:
0.7
});
$
(
'
#tent-info, #cabin-info
'
).
css
({
'
opacity
'
:
1
});
$
(
"
#campsite-options-content-tents
"
).
hide
();
$
(
"
#campsite-options-content-cabin
"
).
hide
();
});
}
// Show cabin, hide others
$
(
"
#cabin-info
"
).
click
(
function
()
{
$
(
"
#campsite-options-content-campervans
"
).
hide
();
$
(
"
#campsite-options-content-tents
"
).
hide
();
$
(
"
#campsite-options-content-cabin
"
).
show
();
$
(
'
#cabin-info
'
).
css
({
'
opacity
'
:
0.7
});
$
(
'
#campervan-info, #tent-info
'
).
css
({
'
opacity
'
:
1
});
});
// Show tent, hide others
$
(
"
#tent-info
"
).
click
(
function
()
{
$
(
"
#campsite-options-content-campervans
"
).
hide
();
$
(
"
#campsite-options-content-tents
"
).
show
();
$
(
'
#tent-info
'
).
css
({
'
opacity
'
:
0.7
});
$
(
'
#campervan-info, #cabin-info
'
).
css
({
'
opacity
'
:
1
});
$
(
"
#campsite-options-content-cabin
"
).
hide
();
});
// Show campervans, hide others
$
(
"
#campervan-info
"
).
click
(
function
()
{
$
(
"
#campsite-options-content-campervans
"
).
show
();
$
(
'
#campervan-info
'
).
css
({
'
opacity
'
:
0.7
});
$
(
'
#tent-info, #cabin-info
'
).
css
({
'
opacity
'
:
1
});
$
(
"
#campsite-options-content-tents
"
).
hide
();
$
(
"
#campsite-options-content-cabin
"
).
hide
();
});
}
//Display the reviews
function
showReviews
()
{
//Load reviews from JSON file
$
.
ajax
({
url
:
'
./reviews.json
'
,
type
:
'
GET
'
,
cache
:
false
,
success
:
function
(
data
){
//Loop through each review and build an <article> for the given review
$
(
data
).
each
(
function
()
{
$
(
"
#reviews
"
).
append
(
'
<article> "
'
+
this
.
reviewcontent
+
'
" -
'
+
this
.
author
+
'
</article>
'
);
});
}
});
}
function
setup
()
{
//Load the show/hide different types of campsites
showHideContent
();
//Load the jQueryUI date pickers
$
(
"
#check-in
"
).
datepicker
();
$
(
"
#check-out
"
).
datepicker
();
showReviews
();
}
$
(
document
).
ready
(
setup
);
function
showReviews
()
{
//Load reviews from JSON file
$
.
ajax
({
url
:
'
./reviews.json
'
,
type
:
'
GET
'
,
cache
:
false
,
success
:
function
(
data
){
//Loop through each review and build an <article> for the given review
$
(
data
).
each
(
function
()
{
$
(
"
#reviews
"
).
append
(
'
<article> "
'
+
this
.
reviewcontent
+
'
" -
'
+
this
.
author
+
'
</article>
'
);
});
}
});
}
pub
.
setup
=
function
()
{
//Load the show/hide different types of campsites
showHideContent
();
//Load the jQueryUI date pickers
$
(
"
#check-in
"
).
datepicker
();
$
(
"
#check-out
"
).
datepicker
();
showReviews
();
};
return
pub
;
}());
$
(
document
).
ready
(
CampInfo
.
setup
);
scripts/campsites.js
View file @
7ecea34d
var
campsites
=
(
function
()
{
"
use strict
"
;
var
pub
=
{};
//Access the URL paramaters
...
...
@@ -26,11 +26,11 @@ var campsites = (function() {
var
name
=
searchParams
.
get
(
'
name
'
);
//Send this data the addBooking php script
window
.
location
.
href
=
"
./htaccess/addBooking.php?name=
"
+
name
+
"
&number=
"
+
buttonNumber
+
"
&check-in-day=
"
+
checkinday
+
"
&check-in-month=
"
+
checkinmonth
+
"
&check-in-year=
"
+
checkinyear
+
"
&check-out-day=
"
+
checkoutday
+
"
&check-out-month=
"
+
checkoutmonth
+
"
&check-out-year=
"
+
checkoutyear
;
window
.
location
.
href
=
"
./htaccess/addBooking.php?name=
"
+
name
+
"
&number=
"
+
buttonNumber
+
"
&check-in-day=
"
+
checkinday
+
"
&check-in-month=
"
+
checkinmonth
+
"
&check-in-year=
"
+
checkinyear
+
"
&check-out-day=
"
+
checkoutday
+
"
&check-out-month=
"
+
checkoutmonth
+
"
&check-out-year=
"
+
checkoutyear
;
}
else
{
alert
(
"
Cant make a booking without entering your name and booking dates
"
);
window
.
alert
(
"
Cant make a booking without entering your name and booking dates
"
);
}
});
}
...
...
@@ -79,7 +79,7 @@ var campsites = (function() {
}
});
//Check bookings for conflicting dates
if
(
bookings
.
length
!=
0
)
{
if
(
bookings
.
length
!=
=
0
)
{
var
overlapFound
=
false
;
$
(
bookings
).
each
(
function
()
{
var
startA
,
endA
,
startB
,
endB
;
...
...
@@ -91,11 +91,11 @@ var campsites = (function() {
//Build array of campsites without a date overlap
if
(
!
noDateOverlap
(
startA
,
endA
,
startB
,
endB
))
{
overlapFound
=
true
;
}
;
}
});
if
(
overlapFound
===
false
)
{
campsites
.
push
(
campsite
);
}
;
}
}
else
{
campsites
.
push
(
campsite
);
}
...
...
@@ -166,7 +166,7 @@ var campsites = (function() {
//Call starting functions
getDates
();
buildMap
();
}
}
;
return
pub
;
...
...
Write
Preview
Supports
Markdown
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