-
Notifications
You must be signed in to change notification settings - Fork 0
/
Home.html
237 lines (193 loc) · 6.36 KB
/
Home.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<style>
body {font-family: Arial, Helvetica, sans-serif;}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
}
div.a {
display: inline; /* the default for span */
width: 100px;
height: 100px;
padding: 5px;
border: 1px solid blue;
background-color: yellow;
}
input[type=submit] {
background-color: #000000;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.8);
}
.container {
border-radius: 5px;
background-color: #f2f2f2;
overflow: hidden;
position: relative;
margin: auto;
padding: 12px 20px;
width: 50%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.8);
}
li{
display: inline-block;
cursor: pointer;
}
.posts_li{
cursor: pointer;
box-shadow: 0 2px 6px 0 rgba(0,0,0,0.8);
}
.form-inline {
display: flex;
flex-flow: row wrap;
align-items: center;
}
.form-inline label {
margin: 5px 10px 5px 0;
}
.form-inline input {
vertical-align: middle;
margin: 5px 10px 5px 0;
padding: 10px;
background-color: #fff;
border: 1px solid #ddd;
}
.form-inline button {
padding: 10px 20px;
background-color: dodgerblue;
border: 1px solid #ddd;
color: white;
cursor: pointer;
}
.form-inline button:hover {
background-color: royalblue;
}
@media (max-width: 800px) {
.form-inline input {
margin: 10px 0;
}
.form-inline {
flex-direction: column;
align-items: stretch;
}
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">IG</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="/">Home</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="/Profile?ViewProfile=True&email={{user}}"><span class="glyphicon glyphicon-user"></span> Profile</a></li>
<li><a href="{{ url }}"><span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
</ul>
<form action="/Profile" class="form-inline">
<input type="hidden" name='ViewProfile' value="True">
<input class="form-control mr-sm-2" id="something" list="somethingelse" name="email" placeholder="Enter username to search" autocomplete="off" required>
<datalist id="somethingelse" >
{% for i in usersinsystem %}
<option style="color:WHITE;" value="{{i}}"></option>
{% endfor %}
</datalist>
<input class="form-control mr-sm-2" type="hidden" name="SearchView" value="True">
<button class="btn btn-light mr-sm-9" type="submit">Search</button>
</form>
</div>
</div>
</nav>
<div class="container" style=" margin-top: -18px;">
<center> <a style="color:Black;">Signed in as {{user}}</a></center>
<img src="{{img}}" width="100%">
<form action="{{ upload_url }}" method="post" enctype="multipart/form-data">
<textarea name="caption" id="caption" rows="4" cols="100" maxlength="200" minlengt="1" placeholder="Enter Your caption here" required></textarea>
<table style="width:100%">
<tr>
<td><input name="image" text="select picture" type="file" id="fileName" accept=".png, .jpg, .jpeg" onchange="CheckFileName()" required />
</td>
<td style="float:right;"><input type="submit" name="uploadpic" id="uploadpic" value="Post"/></td>
</tr>
</table>
</form>
</div>
<br>
<div class="container">
<hr style="color:BLACK;">
<div class="posts_li">
<ul class="list-group" style=";box-shadow: 0 2px 6px 0 rgba(0,0,0,0.8);">
{% for i in finalposts %}
<b ><li class="list-group-item" style="box-shadow: 0 2px 6px 0 rgba(0,0,0,0.8);" >
<a href="/Profile?ViewProfile=True&email={{i.Post_owner}}">Post by: {{i.Post_owner}}</a></br>
<a>Date: {{i.Post_timestamp }}</a></br>
<center>
<img src="{{i.Post_Blob}}" width="100%" style="box-shadow: 0 2px 6px 0 rgba(0,0,0,0.8);" ></br>
</center>
<ul class="list-group" style="cursor: pointer;box-shadow: 0 2px 6px 0 rgba(0,0,0,0.8);">
<div style=" border: 3px solid black;padding: 10px;">
<a style="color:BLACK;">Caption: {{i.Post_Caption}}</a></br>
<div><button onclick="location.href='/Comment?CommentView=True&postid={{i.Post_Uid}}'">comment</button></div></br>
<a>Comments:</a></br>
{% for j in i.Post_comments|reverse %}
{% if loop.index < 6
and j.Comment_owner!='None' %}
<li class="list-group-item"><a href="/Profile?ViewProfile=True&email={{i.Post_owner}}" style="color:BLACK;text-size:14px;">{{j.Comment_owner}}: {{j.Comment_content}}</a>
<a style="float:right;">{{j.comment_time}}</a>
</li>
{% endif %}
{% if loop.index==6 and j.Comment_content!='None' %}
<li class="list-group-item"><a href="/ViewComments?postuid={{i.Post_Uid}}">more.</a></li>
{% endif %}
{% endfor %}
</li>
</ul>
<div>
</br>
{% endfor %}
</div>
</ul>
</div>
<script>
function CheckFileName() {
var fileName = document.getElementById("fileName").value;
var uploadbutton = document.getElementById("uploadpic").value;
var fileName = document.getElementById("fileName").value;
var idxDot = fileName.lastIndexOf(".") + 1;
var extFile = fileName.substr(idxDot, fileName.length).toLowerCase();
if (extFile=="jpg" || extFile=="jpeg" || extFile=="png"){
//TO DO
document.getElementById("uploadpic").disabled = false;
}else{
alert("Only jpg/jpeg and png files are allowed!");
var element = document.getElementById("fileName");
document.getElementById("uploadpic").disabled = true;
element.innerHTML = " ";
}
}
</script>
</body>
</html>