Guest User

Untitled

a guest
May 26th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. var currentFunction = "";
  2. jQ("td.BossTemplates #bossUpdate input.formbuttonsLarge[type=submit]").unbind("click").click(function() {
  3. var button = jQuery(this), that = jQuery(this).parents("form")[0], target = jQuery.notify("progress", "Validating...");
  4. button.attr("disabled", "true");
  5. jQuery("#ltIsValidated").val("0");
  6. jQuery.ajax({
  7. url: that.action,
  8. type: "post",
  9. data: jQuery(that).serialize(),
  10. success: function(data) {
  11. //if (data.indexOf("Logged in as: ") < 0)
  12. // bossLogin(function() { callback(); });
  13.  
  14. CheckSession(data, function() {
  15. var now = new Date();
  16. target.empty().append("<span class=\"time\">" + now.toLocaleTimeString().replace(".", "").replace(".", "") + "</span><div class=\"msg\">Testing...</div><div class=\"clear\"></div>");
  17. jQ.ajax({
  18. dataType: "json", type: "GET", url: "/staging" + fileextension,
  19. // success is only fired if staging returns a json object, which will only happen if an exception is caught.
  20. success: function(json) {
  21. var exceptions = { "BossHeadTags": "Design_Head", "BossHeader": "Design_Body", "BossFooter": "Design_Body" }, rel
  22. rel = (json.context in exceptions) ? exceptions[json.context] : json.context;
  23. json.context = (json.context in exceptions) ? exceptions[json.context].split("_")[1] : json.context;
  24. var now = new Date(), msg = "An error occured in " + "<a href=\"#\" class=\"context\" rel=\"" + rel + "\">" + json.context + "</a> - \" " + json.error + "\" ";
  25. button.removeAttr("disabled");
  26. target.empty().removeClass("progress").addClass("negative").append("<span class=\"time\">" + now.toLocaleTimeString().replace(".", "").replace(".", "") + "</span><div class=\"msg\">" + msg + "</div><div class=\"clear\"></div>");
  27. target.find("a.context").click(function() {
  28. showTemplate(jQuery(this).attr("rel"));
  29. return false;
  30. });
  31. },
  32. error: function() {
  33. // despite the name this indicates that NO errors occured during staging.
  34. button.removeAttr("disabled");
  35. target.empty().append("<span class=\"time\">" + now.toLocaleTimeString().replace(".", "").replace(".", "") + "</span><div class=\"msg\">Saving File...</div><div class=\"clear\"></div>");
  36. jQuery("#ltIsValidated").val("1");
  37. jQuery.ajax({ url: that.action, type: "post", data: jQuery(that).serialize(), success: function(data3) {
  38. CheckSession(data3, function() {
  39. target.empty().removeClass("progress").addClass("positive").append("<span class=\"time\">" + now.toLocaleTimeString().replace(".", "").replace(".", "") + "</span><div class=\"msg\">File Saved.</div><div class=\"clear\"></div>");
  40. });
  41. }
  42. });
  43. }
  44. });
  45. });
  46. }
  47. });
  48. return false;
  49. });
Add Comment
Please, Sign In to add comment