]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - js/editPage.js
implemented page listing
[Rakka.git] / js / editPage.js
index 4e5d25512cb518b79d199b14cb59515cf229e16a..5948d6dc94bfb30fa62c6003ac8e1fcc767fc22e 100644 (file)
             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();