|
| 1 | +<<<<<<< HEAD |
1 | 2 | <!DOCTYPE html>
|
2 | 3 | <html>
|
3 | 4 | <head>
|
|
306 | 307 | width: 21vw;
|
307 | 308 | height: 35vh;
|
308 | 309 | resize: none;
|
| 310 | +======= |
| 311 | +<!DOCTYPE html> |
| 312 | +<html> |
| 313 | +<head> |
| 314 | + <meta charset="utf-8" /> |
| 315 | + <title>Virtual Suggestion Box</title> |
| 316 | + <!--DO NOT FORGET THIS SCRIPT TAG SO YOU CAN USE JQUERY!!!!!--> |
| 317 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
| 318 | + |
| 319 | + <!--YOUR OWN JAVASCRIPT CAN GO RIGHT HERE--> |
| 320 | + <script type="text/javascript">//passes account info to the server, to create an account request |
| 321 | + function NewSuggestion(title, desc, category) { |
| 322 | + var webMethod = "ProjectServices.asmx/NewSuggestion"; |
| 323 | + var parameters = "{\"title\":\"" + encodeURI(title) + "\",\"desc\":\"" + encodeURI(desc) + "\",\"category\":\"" + encodeURI(category) + "\"}"; |
| 324 | + |
| 325 | + $.ajax({ |
| 326 | + type: "POST", |
| 327 | + url: webMethod, |
| 328 | + data: parameters, |
| 329 | + contentType: "application/json; charset=utf-8", |
| 330 | + dataType: "json", |
| 331 | + success: function (msg) { |
| 332 | + //showPanel('logonPanel'); |
| 333 | + alert("Suggestion pending approval by admins. You'll receive a notification when it has been reviewed. "); |
| 334 | + }, |
| 335 | + error: function (e) { |
| 336 | + alert("boo..."); |
| 337 | + } |
| 338 | + }); |
| 339 | + } |
| 340 | + |
| 341 | + //an ajax to delete a suggestion post |
| 342 | + function DeleteSuggestion(id) { |
| 343 | + var webMethod = "ProjectServices.asmx/DeleteSuggestion"; |
| 344 | + var parameters = "{\"id\":\"" + encodeURI(id) + "\"}"; |
| 345 | + |
| 346 | + $.ajax({ |
| 347 | + type: "POST", |
| 348 | + url: webMethod, |
| 349 | + data: parameters, |
| 350 | + contentType: "application/json; charset=utf-8", |
| 351 | + dataType: "json", |
| 352 | + success: function (msg) { |
| 353 | + LoadUnapprovedSuggestions() |
| 354 | + }, |
| 355 | + error: function (e) { |
| 356 | + alert("boo..."); |
| 357 | + } |
| 358 | + }); |
| 359 | + } |
| 360 | + |
| 361 | + //an ajax to approve a suggestion |
| 362 | + function ApproveSuggestion(id) { |
| 363 | + var webMethod = "ProjectServices.asmx/ApproveSuggestion"; |
| 364 | + var parameters = "{\"id\":\"" + encodeURI(id) + "\"}"; |
| 365 | + |
| 366 | + $.ajax({ |
| 367 | + type: "POST", |
| 368 | + url: webMethod, |
| 369 | + data: parameters, |
| 370 | + contentType: "application/json; charset=utf-8", |
| 371 | + dataType: "json", |
| 372 | + success: function (msg) { |
| 373 | + LoadUnapprovedSuggestions(); |
| 374 | + LoadSuggestions(); |
| 375 | + }, |
| 376 | + error: function (e) { |
| 377 | + alert("boo..."); |
| 378 | + } |
| 379 | + }); |
| 380 | + } |
| 381 | + |
| 382 | + //an ajax to approve a suggestion |
| 383 | + function CheckAdmin() { |
| 384 | + var webMethod = "ProjectServices.asmx/IsAdmin"; |
| 385 | + $.ajax({ |
| 386 | + type: "POST", |
| 387 | + url: webMethod, |
| 388 | + contentType: "application/json; charset=utf-8", |
| 389 | + dataType: "json", |
| 390 | + success: function (msg) { |
| 391 | + if (msg.d) { |
| 392 | + ShowMenu(); |
| 393 | + alert("Admin"); |
| 394 | + } |
| 395 | + else { |
| 396 | + alert("Not an Admin"); |
| 397 | + } |
| 398 | + |
| 399 | + }, |
| 400 | + }); |
| 401 | + } |
| 402 | + |
| 403 | + //this function grabs all the unapproved suggestions and displays them |
| 404 | + function LoadUnapprovedSuggestions() { |
| 405 | + var webMethod = "ProjectServices.asmx/GetUnapprovedSuggestions"; |
| 406 | + $.ajax({ |
| 407 | + type: "POST", |
| 408 | + url: webMethod, |
| 409 | + contentType: "application/json; charset=utf-8", |
| 410 | + dataType: "json", |
| 411 | + success: function (msg) { |
| 412 | + if (msg.d.length > 0) { |
| 413 | + suggestionsArray = msg.d; |
| 414 | + //this clears out the div that will hold our suggestion info. Not sure if this is in use any more. |
| 415 | + $("#unapprovedSuggestionsBox").empty(); |
| 416 | + admin = false; |
| 417 | + for (var i = 0; i < suggestionsArray.length; i++) { |
| 418 | + var suggestion; |
| 419 | + |
| 420 | + suggestion = "<div class='suggestionRow' id='suggestion'><button onclick=\"ApproveSuggestion(" + suggestionsArray[i].id + ")\">Approve</button><button onclick=\"DenySuggestion(" + |
| 421 | + suggestionsArray[i].id + ")\">Deny</button> <b>Category: </b> " + suggestionsArray[i].category + " <b>Title:</b> " + |
| 422 | + suggestionsArray[i].title + " <b> Details:</b> " + suggestionsArray[i].desc + "</div><br><br>" |
| 423 | + $("#unapprovedSuggestionsBox").append( |
| 424 | + suggestion |
| 425 | + ); |
| 426 | + } |
| 427 | + } |
| 428 | + }, |
| 429 | + error: function (e) { |
| 430 | + alert("Something unexpected happened.You've been eaten by a grue."); |
| 431 | + } |
| 432 | + }); |
| 433 | + } |
| 434 | + |
| 435 | + //this function grabs all the approved suggestions and displays them |
| 436 | + function LoadSuggestions() { |
| 437 | + var webMethod = "ProjectServices.asmx/LoadSuggestions"; |
| 438 | + $.ajax({ |
| 439 | + type: "POST", |
| 440 | + url: webMethod, |
| 441 | + contentType: "application/json; charset=utf-8", |
| 442 | + dataType: "json", |
| 443 | + success: function (msg) { |
| 444 | + if (msg.d.length > 0) { |
| 445 | + suggestionsArray = msg.d; |
| 446 | + //this clears out the div that will hold our suggestion info. Not sure if this is in use any more. |
| 447 | + $("#suggestionsBox").empty(); |
| 448 | + admin = false; |
| 449 | + for (var i = 0; i < suggestionsArray.length; i++) { |
| 450 | + var suggestion; |
| 451 | + |
| 452 | + suggestion = "<div class='suggestionRow' id='suggestion'><b>Category: </b> " + suggestionsArray[i].category + " <b>Title:</b> " + |
| 453 | + suggestionsArray[i].title + " <b> Details:</b> " + suggestionsArray[i].desc + "</div><br><br>" |
| 454 | + $("#suggestionsBox").append( |
| 455 | + suggestion |
| 456 | + ); |
| 457 | + } |
| 458 | + |
| 459 | + } |
| 460 | + }, |
| 461 | + error: function (e) { |
| 462 | + alert("Something unexpected happened.You've been eaten by a grue."); |
| 463 | + } |
| 464 | + }); |
| 465 | + } |
| 466 | + |
| 467 | + //this function grabs all the unapproved accounts and displays them |
| 468 | + function LoadUnapprovedAccounts() { |
| 469 | + var webMethod = "ProjectServices.asmx/GetUnapprovedAccounts"; |
| 470 | + $.ajax({ |
| 471 | + type: "POST", |
| 472 | + url: webMethod, |
| 473 | + contentType: "application/json; charset=utf-8", |
| 474 | + dataType: "json", |
| 475 | + success: function (msg) { |
| 476 | + if (msg.d.length > 0) { |
| 477 | + accountsArray = msg.d; |
| 478 | + //this clears out the div that will hold our suggestion info. Not sure if this is in use any more. |
| 479 | + $("#unapprovedSuggestionsBox").empty(); |
| 480 | + admin = false; |
| 481 | + for (var i = 0; i < accountsArray.length; i++) { |
| 482 | + var account; |
| 483 | + |
| 484 | + account = "<div class='accountRow' id='account'><button onclick=\"ApproveAccount(" + accountsArray[i].id + ")\">Approve</button><button onclick=\"DenyAccount(" + |
| 485 | + accountsArray[i].id + ")\">Deny</button> <b>First Name </b> " + accountsArray[i].firstName + " <b>Last Name:</b> " + |
| 486 | + accountsArray[i].lastName + " <b> Username: </b> " + accountsArray[i].userName + "</div><br><br>" |
| 487 | + $("#unapprovedSuggestionsBox").append( |
| 488 | + account |
| 489 | + ); |
| 490 | + } |
| 491 | + } |
| 492 | + }, |
| 493 | + error: function (e) { |
| 494 | + alert("Something unexpected happened.You've been eaten by a grue."); |
| 495 | + } |
| 496 | + }); |
| 497 | + } |
| 498 | + |
| 499 | + |
| 500 | + //an ajax to delete a suggestion post |
| 501 | + function DenyAccount(id) { |
| 502 | + var webMethod = "ProjectServices.asmx/DenyAccount"; |
| 503 | + var parameters = "{\"id\":\"" + encodeURI(id) + "\"}"; |
| 504 | + |
| 505 | + $.ajax({ |
| 506 | + type: "POST", |
| 507 | + url: webMethod, |
| 508 | + data: parameters, |
| 509 | + contentType: "application/json; charset=utf-8", |
| 510 | + dataType: "json", |
| 511 | + success: function (msg) { |
| 512 | + LoadUnapprovedAccounts() |
| 513 | + }, |
| 514 | + error: function (e) { |
| 515 | + alert("boo..."); |
| 516 | + } |
| 517 | + }); |
| 518 | + } |
| 519 | + |
| 520 | + //an ajax to approve a suggestion |
| 521 | + function ApproveAccount(id) { |
| 522 | + var webMethod = "ProjectServices.asmx/ApproveAccount"; |
| 523 | + var parameters = "{\"id\":\"" + encodeURI(id) + "\"}"; |
| 524 | + |
| 525 | + $.ajax({ |
| 526 | + type: "POST", |
| 527 | + url: webMethod, |
| 528 | + data: parameters, |
| 529 | + contentType: "application/json; charset=utf-8", |
| 530 | + dataType: "json", |
| 531 | + success: function (msg) { |
| 532 | + LoadUnapprovedAccounts(); |
| 533 | + }, |
| 534 | + error: function (e) { |
| 535 | + alert("boo..."); |
| 536 | + } |
| 537 | + }); |
| 538 | + } |
| 539 | + |
| 540 | + |
| 541 | + //This function shows the admin menu |
| 542 | + function ShowMenu() { |
| 543 | + |
| 544 | + $("#adminPanel").css("visibility", "visible"); |
| 545 | + } |
| 546 | + |
| 547 | + |
| 548 | + //just hides the menu |
| 549 | + function HideMenu() { |
| 550 | + |
| 551 | + $("#adminPanel").css("visibility", "hidden"); |
| 552 | + $("#adminLink").text(""); |
| 553 | + }</script> |
| 554 | + |
| 555 | + |
| 556 | + |
| 557 | + <!--END OF YOUR OWN JAVASCRIPT--> |
| 558 | + |
| 559 | + <style> |
| 560 | + * { |
| 561 | + box-sizing: border-box; |
| 562 | + margin: 0; |
| 563 | + font-family: Arial; |
| 564 | + } |
| 565 | + |
| 566 | + body { |
| 567 | + height: 100vh; |
| 568 | + width: 100vw; |
| 569 | + background-color: #8C1D40; |
| 570 | + } |
| 571 | + |
| 572 | + .homeBar { |
| 573 | + background: #FFC627; |
| 574 | + padding: 0; |
| 575 | + font-size: 26px; |
| 576 | + height: 15vh; |
| 577 | + width: 100vw; |
| 578 | + text-align: center; |
| 579 | + } |
| 580 | + |
| 581 | + .container { |
| 582 | + display: grid; |
| 583 | + grid-template-columns: 25vw 50vw 25vw; |
| 584 | + text-align: left; |
| 585 | + } |
| 586 | + |
| 587 | + h2 { |
| 588 | + text-align: left; |
| 589 | + font-weight: bold; |
| 590 | + } |
| 591 | + |
| 592 | + .SubmitPanel, .adminContainer { |
| 593 | + padding: 5px; |
| 594 | + height: fit-content; |
| 595 | + margin: 5px; |
| 596 | + background-color: #FFC627; |
| 597 | + } |
| 598 | + |
| 599 | + .contentPanel { |
| 600 | + padding: 10px; |
| 601 | + margin: 5px; |
| 602 | + height: fit-content; |
| 603 | + background-color: #FFC627; |
| 604 | + } |
| 605 | + |
| 606 | + form { |
| 607 | + padding: 10px; |
| 608 | + background: #FFC627; |
| 609 | + |
| 610 | + } |
| 611 | + |
| 612 | + #category { |
| 613 | + width: 21vw; |
| 614 | + } |
| 615 | + |
| 616 | + #desc { |
| 617 | + width: 21vw; |
| 618 | + height: 35vh; |
| 619 | + resize: none; |
| 620 | +>>>>>>> dcEdits |
309 | 621 | }
|
310 | 622 |
|
311 | 623 | .label {
|
|
0 commit comments