projects.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. function manageProject(id){
  2. window.location.href = "/projects/edit.php?p=" + id;
  3. }
  4. function deleteProject(id, title){
  5. dialog("confirm", "Delete project", "Do you really want to delete the project '" + title + "'?<br/><br/>There is no way to undo this action. You can also unpublish the project instead of deleting it.", function (confirmed) {
  6. if (confirmed) {
  7. var xmlhttp;
  8. if (window.XMLHttpRequest){
  9. xmlhttp = new XMLHttpRequest();
  10. }
  11. xmlhttp.onreadystatechange=function(){
  12. if (xmlhttp.readyState == 4){
  13. if (xmlhttp.status == 200){
  14. location.reload();
  15. }
  16. else{
  17. dialog("alert", "ERROR", "Error deleting the project '" + title + "'.", null);
  18. }
  19. }
  20. }
  21. xmlhttp.open("GET","/projects/delete.php?p=" + id, true);
  22. xmlhttp.send();
  23. }
  24. });
  25. }
  26. function visibleProject(id, title, visible){
  27. var xmlhttp;
  28. if (window.XMLHttpRequest){
  29. xmlhttp = new XMLHttpRequest();
  30. }
  31. xmlhttp.onreadystatechange=function(){
  32. if (xmlhttp.readyState == 4){
  33. if (xmlhttp.status == 200){
  34. location.reload();
  35. }
  36. else{
  37. dialog("alert", "ERROR", "Error changing visibility of the project '" + title + "'.", null);
  38. }
  39. }
  40. }
  41. xmlhttp.open("GET","/projects/visible.php?p=" + id + "&v=" + visible, true);
  42. xmlhttp.send();
  43. }