]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - js/editPage.js
implemented page listing
[Rakka.git] / js / editPage.js
index f0d3d507021ce012ea140ecd1ec256834726b516..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();
@@ -74,8 +79,8 @@
         $(fldPageName).change(makeDirty);
 
         var chkIsLocked
-            = $.INPUT({type   : "checkbox",
-                       checked: (isLocked ? "checked" : "")});
+            = $.INPUT({type    : "checkbox",
+                       checked : (isLocked ? "checked" : "")});
 
         $(chkIsLocked).change(makeDirty);
 
 
         $area.append(pageEditor);
 
+        if (!Rakka.isLoggedIn() || Rakka.isGlobalLocked) {
+            $(trIsLocked).hide();
+        }
+
         isDirty = false;
     };