Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김재현
/
open-source-project-2017-02
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김정은
2017-12-07 16:14:13 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
803b33aadfba8bb0833e3915196f25c73f4dc386
803b33aa
2 parents
9ad55398
39b4c417
머지 진행
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
10 deletions
public/stylesheets/style.styl
routes/index.js
views/map.ejs
public/stylesheets/style.styl
View file @
803b33a
...
...
@@ -13,7 +13,7 @@ ul.sidenav
width: 15%;
background-color: #f1f1f1;
height: 100%;
position : fixed;
position : fixed;
s
overflow : auto;
ul.sidenav li a
...
...
routes/index.js
View file @
803b33a
...
...
@@ -4,8 +4,8 @@ var router = express.Router();
var
connection
=
mysql
.
createConnection
({
host
:
'localhost'
,
user
:
'
root
'
,
password
:
'
qmfkdnsl
'
,
user
:
'
admin
'
,
password
:
'
admin
'
,
database
:
'ossprojectdb'
});
...
...
@@ -52,23 +52,24 @@ router.post('/map', function(req, res){
console
.
log
(
tempuser
);
var
query
=
connection
.
query
(
'insert into
users
set ?'
,
tempuser
,
function
(
err
,
result
){
var
query
=
connection
.
query
(
'insert into
history
set ?'
,
tempuser
,
function
(
err
,
result
){
if
(
err
)
{
console
.
error
(
err
);
throw
err
;
}
});
console
.
log
(
"success insert!"
);
res
.
redirect
(
'/map'
)
});
router
.
get
(
'/mybook'
,
function
(
req
,
res
,
next
){
var
rows
;
var
query
=
connection
.
query
(
'select * from
users
'
,
function
(
err
,
row
){
var
query
=
connection
.
query
(
'select * from
history h, users u WHERE h.email = u.email
'
,
function
(
err
,
row
){
rows
=
row
;
console
.
log
(
rows
[
1
].
idusers
);
console
.
log
(
rows
.
length
);
//
console.log(rows[1].idusers);
//
console.log(rows.length);
res
.
render
(
'mybook'
,
{
title
:
'견문록 보기'
,
rows
:
rows
});
});
...
...
@@ -76,6 +77,21 @@ router.get('/mybook', function(req, res, next){
});
router
.
get
(
'/history'
,
function
(
req
,
res
,
next
){
var
rows
;
var
query
=
connection
.
query
(
'select contentid from history h, users u WHERE h.email = u.email'
,
function
(
err
,
row
){
rows
=
row
;
//console.log(rows[1].idusers);
//console.log(rows.length);
res
.
send
({
rows
:
rows
});
});
});
router
.
get
(
'/test'
,
function
(
req
,
res
,
next
){
res
.
render
(
'test'
,
{
title
:
'test'
});
...
...
views/map.ejs
View file @
803b33a
...
...
@@ -42,18 +42,40 @@
radius
:
1000
,
type
:
[
'restaurant'
]
},
callback
);
var
resultsSet
=
null
;
$
.
ajax
({
type
:
"GET"
,
url
:
"/history"
,
dataType
:
"json"
,
error
:
function
(){
alert
(
'통신실패!!'
);
},
success
:
function
(
data
){
resultsSet
=
data
;
}
});
function
callback
(
results
,
status
)
{
if
(
status
===
google
.
maps
.
places
.
PlacesServiceStatus
.
OK
)
{
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
)
{
createMarker
(
results
[
i
]);
createMarker
(
results
[
i
]
,
resultsSet
);
}
}
}
function
createMarker
(
place
)
{
function
createMarker
(
place
,
resultsSet
)
{
var
image1
=
'http://localhost:3000/images/restaurant_1.png'
var
image2
=
'http://localhost:3000/images/restaurant_2.png'
var
isMarked
=
false
;
for
(
var
i
=
0
;
i
<
resultsSet
.
rows
.
length
;
i
++
)
{
if
(
resultsSet
.
rows
[
i
].
contentid
==
place
.
id
)
isMarked
=
true
;
}
var
placeLoc
=
place
.
geometry
.
location
;
var
marker1
=
new
google
.
maps
.
Marker
({
map
:
map
,
...
...
@@ -65,7 +87,15 @@
position
:
place
.
geometry
.
location
,
icon
:
image2
});
if
(
isMarked
==
true
){
marker1
.
setMap
(
null
);
}
else
{
marker2
.
setMap
(
null
);
}
var
contentString
=
'<div id="content">'
+
'<div id="siteNotice">'
+
...
...
@@ -79,6 +109,16 @@
'</div>'
+
'</div>'
;
var
contentString2
=
'<div id="content">'
+
'<div id="siteNotice">'
+
'</div>'
+
'<h1 id="firstHeading" class="firstHeading">'
+
place
.
name
+
'</h1>'
+
'<div id="bodyContent">'
+
'<p>주소: '
+
place
.
vicinity
+
'<br/>'
+
'</p>'
+
'</div>'
+
'</div>'
;
google
.
maps
.
event
.
addListener
(
marker1
,
'click'
,
function
(
e
)
{
...
...
@@ -92,7 +132,7 @@
});
google
.
maps
.
event
.
addListener
(
marker2
,
'click'
,
function
()
{
var
infowindow
=
new
google
.
maps
.
InfoWindow
({
content
:
contentString
,
content
:
contentString
2
,
maxWidth
:
300
});
infowindow
.
open
(
map
,
this
);
...
...
Please
register
or
login
to post a comment