X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=js%2FeditPage.js;h=5948d6dc94bfb30fa62c6003ac8e1fcc767fc22e;hb=b101c0a9aad609704eaa9157fe809be80d2aacf7;hp=f0d3d507021ce012ea140ecd1ec256834726b516;hpb=0447be1b59496ca4266226ed52d264009cf41899;p=Rakka.git diff --git a/js/editPage.js b/js/editPage.js index f0d3d50..5948d6d 100644 --- a/js/editPage.js +++ b/js/editPage.js @@ -15,24 +15,29 @@ url : Rakka.baseURI + pageName + ".xml", success: function (pageXml) { Rakka.hideWaitingMessage(); - - var $page = $(pageXml).find("page"); - var oldRevision = $page.attr("revision"); - var defaultType - = $page.attr("isBinary") == "yes" ? "binary" - : $page.attr("type") == "text/x-rakka" ? "rakka" - : $page.attr("type") == "text/css" ? "css" - : $page.attr("redirect") != null ? "redirect" - : "unknown" - ; - var isLocked = $page.attr("isLocked") == "yes"; - var source - = $page.attr("redirect") != null ? $page.attr("redirect") - : $page.find("textData").text() - ; - var summary = $page.find("summary").text(); + + if (pageXml.documentElement.tagName == "page") { + var $page = $(pageXml).find("page"); + var oldRevision = $page.attr("revision"); + var defaultType + = $page.attr("isBinary") == "yes" ? "binary" + : $page.attr("type") == "text/x-rakka" ? "rakka" + : $page.attr("type") == "text/css" ? "css" + : $page.attr("redirect") != null ? "redirect" + : "unknown" + ; + var isLocked = $page.attr("isLocked") == "yes"; + var source + = $page.attr("redirect") != null ? $page.attr("redirect") + : $page.find("textData").text() + ; + var summary = $page.find("summary").text(); - displayPageEditor(pageName, oldRevision, defaultType, isLocked, source, summary); + displayPageEditor(pageName, oldRevision, defaultType, isLocked, source, summary); + } + else { + displayPageEditor(pageName, null, "rakka", false, null, ""); + } }, error : function (req) { Rakka.hideWaitingMessage(); @@ -74,8 +79,8 @@ $(fldPageName).change(makeDirty); var chkIsLocked - = $.INPUT({type : "checkbox", - checked: (isLocked ? "checked" : "")}); + = $.INPUT({type : "checkbox", + checked : (isLocked ? "checked" : "")}); $(chkIsLocked).change(makeDirty); @@ -320,6 +325,10 @@ $area.append(pageEditor); + if (!Rakka.isLoggedIn() || Rakka.isGlobalLocked) { + $(trIsLocked).hide(); + } + isDirty = false; };