-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMangePosts.html
More file actions
308 lines (228 loc) · 13.9 KB
/
MangePosts.html
File metadata and controls
308 lines (228 loc) · 13.9 KB
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<html>
<html class="fontawesome-i2svg-active fontawesome-i2svg-complete">
<!-- Bootstrap core CSS -->
<link href="bootstrap.min.css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Delete Auth</title>
<!-- Bootstrap CSS CDN -->
<style type="text/css">svg:not(:root).svg-inline--fa{overflow:visible}.svg-inline--fa{display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em}.svg-inline--fa.fa-lg{vertical-align:-.225em}.svg-inline--fa.fa-w-1{width:.0625em}.svg-inline--fa.fa-w-2{width:.125em}.svg-inline--fa.fa-w-3{width:.1875em}.svg-inline--fa.fa-w-4{width:.25em}.svg-inline--fa.fa-w-5{width:.3125em}.svg-inline--fa.fa-w-6{width:.375em}.svg-inline--fa.fa-w-7{width:.4375em}.svg-inline--fa.fa-w-8{width:.5em}.svg-inline--fa.fa-w-9{width:.5625em}.svg-inline--fa.fa-w-10{width:.625em}.svg-inline--fa.fa-w-11{width:.6875em}.svg-inline--fa.fa-w-12{width:.75em}.svg-inline--fa.fa-w-13{width:.8125em}.svg-inline--fa.fa-w-14{width:.875em}.svg-inline--fa.fa-w-15{width:.9375em}.svg-inline--fa.fa-w-16{width:1em}.svg-inline--fa.fa-w-17{width:1.0625em}.svg-inline--fa.fa-w-18{width:1.125em}.svg-inline--fa.fa-w-19{width:1.1875em}.svg-inline--fa.fa-w-20{width:1.25em}.svg-inline--fa.fa-pull-left{margin-right:.3em;width:auto}.svg-inline--fa.fa-pull-right{margin-left:.3em;width:auto}.svg-inline--fa.fa-border{height:1.5em}.svg-inline--fa.fa-li{width:2em}.svg-inline--fa.fa-fw{width:1.25em}.fa-layers svg.svg-inline--fa{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.fa-layers{display:inline-block;height:1em;position:relative;text-align:center;vertical-align:-.125em;width:1em}.fa-layers svg.svg-inline--fa{-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.fa-layers-text{left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter{background-color:#ff253a;border-radius:1em;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff;height:1.5em;line-height:1;max-width:5em;min-width:1.5em;overflow:hidden;padding:.25em;right:0;text-overflow:ellipsis;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-bottom-right{bottom:0;right:0;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom right;transform-origin:bottom right}.fa-layers-bottom-left{bottom:0;left:0;right:auto;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom left;transform-origin:bottom left}.fa-layers-top-right{right:0;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-top-left{left:0;right:auto;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top left;transform-origin:top left}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;position:relative;width:2em}.fa-stack-1x,.fa-stack-2x{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.svg-inline--fa.fa-stack-1x{height:1em;width:1em}.svg-inline--fa.fa-stack-2x{height:2em;width:2em}.fa-inverse{color:#fff}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}</style><link rel="stylesheet" href="./Collapsible sidebar using Bootstrap 4_files/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<!-- Our Custom CSS -->
<!-- Font Awesome JS -->
<script defer="" src="solid.js.download" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
<script defer="" src="fontawesome.js.download" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<link href="Dashbord.css" rel="stylesheet">
<link rel="stylesheet" href="bootstrap.min.css">
<script src="jquery.min.js"></script>
<script src="popper.min.js"></script>
<script src="bootstrap.min.js"></script>
<link href="bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="floating-labels.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap" rel="stylesheet">
</head>
<style>
.content{
background: #fff;
max-width: 960px;
margin: 30px auto;
padding: 20px 55px;
border-radius: 10px 10px 10px 10px;
box-shadow: 1px 3px 5px rgba(0,0,0,0.4)
}
table {
width:100%;
}
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: left;
}
table tr:nth-child(even) {
background-color: rgb(250, 239, 255);
}
table tr:nth-child(odd) {
background-color: #fff;
}
table th {
background-color: black;
color: white;
}
#uploader{
-webkit-appearance:none ;
appearance: none;
width: 50%;
}
</style>
<body class="bg-DrarkRed">
<div class="wrapper" >
<!-- Sidebar Holder -->
<nav style="background-color:#9A12B3; position: fixed; height: 1080px; top:0px;" id="sidebar" class="">
<div style="background-color: #9A12B3; margin-top:0px;" class="sidebar-header ">
<img src="logo.png" width="60px" style="margin-left: -15px; margin-top: -14px; position: fixed;" alt="logo" />
<h3 style="margin-left: 60px;">AXILEARN </h3>
</div>
<ul class="list-unstyled components">
<p></p>
<li >
<a style="color: white;" href="DASHBROD.html"><i class="fa fa-home"></i> Home</a>
</li>
<li>
<a style="color: white;" href="AboutX.html"><i class="fa fa-users" aria-hidden="true"></i> About</a>
</li>
<li>
<a style="color: white;" href="NetWorkReport.html"><i class="fa fa-rss-square" aria-hidden="true"></i> Network report</a>
</li>
<li>
<a style="color: white;" href="ContactX.html"><i class="fa fa-phone-square" aria-hidden="true"></i> Contact</a>
</li>
</ul>
<ul class="list-unstyled CTAs">
<li>
<a style="color: black;" href="index.html" class="download">Sign out</a>
</li>
</ul>
</nav>
<!-- Page Content Holder -->
<div id="content" style="background-color: #DADFE1;">
<div style="margin-left: 250px; top: 100px; position: fixed;" >
<form class="form-signin" id="signup-form">
<div class="text-center mb-4">
<h1 style="color: black !important;" class="h3 mb-3 font-weight-normal">Delete Post </h1>
<p style="color: black;">Delete post with clear storage opition must have to enter image title.Delete post only need post ID.</p></div>
<div class="form-label-group">
<input type="text" id="userid" class="form-control" >
<label for="inputEmail">Enter post ID</label>
</div>
<div class="form-label-group">
<input type="text" id="postID" class="form-control" >
<label for="postID">Image titile</label>
</div>
<button class="btn btn-lg btn-primary btn-block" id="removeBtn" >Delete Post only</button>
<button class="btn btn-lg btn-primary btn-block" style="background-color: #ff253a;" id="removeBtnAll" >Delete Post and clear storage</button>
</form>
<div style="margin-left: 50px;">
<p style="color: black;"><b>Select Image to add database directly</b></p>
<progress value="0" max="100" id="uploader">0%</progress><br><br>
<input type="file" value="upload" id="fileButton" />
</div>
</div>
<form id="add-cafe-form">
</form>
<div style=" margin-left: 700px;" class="content">
<table id="tbl_users_list" >
<tr>
<td><b>Post ID</b></td>
<td><b>Image Titile</b></td>
</tr>
</table>
</div>
</div>
<script src="https://www.gstatic.com/firebasejs/3.0.3/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.15.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.15.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.15.0/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.15.0/firebase-storage.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.15.0/firebase-database.js"></script>
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyD6xHZL-JydpDai1TiwJGALEmb7BcZh-fc",
authDomain: "axilearnv1.firebaseapp.com",
databaseURL: "https://axilearnv1.firebaseio.com",
projectId: "axilearnv1",
storageBucket: "axilearnv1.appspot.com",
messagingSenderId: "102666534508",
appId: "1:102666534508:web:0f4e8eed826ad98b48a249"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const auth = firebase.auth();
const db = firebase.firestore();
var database = firebase.database();
const rootRef = database.ref('posts');
removeBtnAll.addEventListener('click',e =>{
if(userid.value==""){
window.alert("Please enter Post id");
}
else if(postID.value==""){
window.alert("Please enter image title");
}
e.preventDefault();
rootRef.child(userid.value).remove()
var desertRef ='images/'+postID.value;
// Delete the file
desertRef.delete(),
location.reload()
.then(() =>{
window.alert('Database will update soon.');
})
.catch(function(error) {
// Uh-oh, an error occurred!
})
});
removeBtn.addEventListener('click',e =>{
e.preventDefault();
if(userid.value==""){
window.alert("Please enter Post id");
}
rootRef.child(userid.value).remove()
.then(() =>{
window.alert('Database will update soon.');
location.reload();
})
.catch(error => {
console.error(error);
});
});
var tblUsers=document.getElementById('tbl_users_list');
var rowIndex = 1;
rootRef.once('value', function(snapshot) {
snapshot.forEach(function(childSnapshot) {
var childKey = childSnapshot.key;
var childData = childSnapshot.val();
var row = tblUsers.insertRow(rowIndex);
var cellID = row.insertCell(0);
var cellName = row.insertCell(1);
cellID.appendChild(document.createTextNode(childKey));
cellName.appendChild(document.createTextNode(childData.imageTitle));
rowIndex= rowIndex + 1;
});
});
//get elements
var uploader =document.getElementById('uploader');
var fileButton = document.getElementById('fileButton');
//lisent file selection
fileButton.addEventListener('change', function(e){
//get file
var file = e.target.files[0];
//create storage ref
var storageRef = firebase.storage().ref('images/'+file.name);
//upload file
var task = storageRef.put(file);
//upload progress bar
task.on('state_changed',
function progress(snapshot){
var perecentage = (snapshot.bytesTransferred /
snapshot.totalBytes)*100;
uploader.value = perecentage;
},
function errror(err){
},
function fileComplete(){
window.alert("updated database complete");
location.reload();
}
);
});
</script>
</body>
</html>