Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var currentFunction = "";
- jQ("td.BossTemplates #bossUpdate input.formbuttonsLarge[type=submit]").unbind("click").click(function() {
- var button = jQuery(this), that = jQuery(this).parents("form")[0], target = jQuery.notify("progress", "Validating...");
- button.attr("disabled", "true");
- jQuery("#ltIsValidated").val("0");
- jQuery.ajax({
- url: that.action,
- type: "post",
- data: jQuery(that).serialize(),
- success: function(data) {
- //if (data.indexOf("Logged in as: ") < 0)
- // bossLogin(function() { callback(); });
- CheckSession(data, function() {
- var now = new Date();
- target.empty().append("<span class=\"time\">" + now.toLocaleTimeString().replace(".", "").replace(".", "") + "</span><div class=\"msg\">Testing...</div><div class=\"clear\"></div>");
- jQ.ajax({
- dataType: "json", type: "GET", url: "/staging" + fileextension,
- // success is only fired if staging returns a json object, which will only happen if an exception is caught.
- success: function(json) {
- var exceptions = { "BossHeadTags": "Design_Head", "BossHeader": "Design_Body", "BossFooter": "Design_Body" }, rel
- rel = (json.context in exceptions) ? exceptions[json.context] : json.context;
- json.context = (json.context in exceptions) ? exceptions[json.context].split("_")[1] : json.context;
- var now = new Date(), msg = "An error occured in " + "<a href=\"#\" class=\"context\" rel=\"" + rel + "\">" + json.context + "</a> - \" " + json.error + "\" ";
- button.removeAttr("disabled");
- target.empty().removeClass("progress").addClass("negative").append("<span class=\"time\">" + now.toLocaleTimeString().replace(".", "").replace(".", "") + "</span><div class=\"msg\">" + msg + "</div><div class=\"clear\"></div>");
- target.find("a.context").click(function() {
- showTemplate(jQuery(this).attr("rel"));
- return false;
- });
- },
- error: function() {
- // despite the name this indicates that NO errors occured during staging.
- button.removeAttr("disabled");
- target.empty().append("<span class=\"time\">" + now.toLocaleTimeString().replace(".", "").replace(".", "") + "</span><div class=\"msg\">Saving File...</div><div class=\"clear\"></div>");
- jQuery("#ltIsValidated").val("1");
- jQuery.ajax({ url: that.action, type: "post", data: jQuery(that).serialize(), success: function(data3) {
- CheckSession(data3, function() {
- 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>");
- });
- }
- });
- }
- });
- });
- }
- });
- return false;
- });
Add Comment
Please, Sign In to add comment