]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
started implementing systemConfig
authorpho <pho@cielonegro.org>
Thu, 10 Jul 2008 10:24:33 +0000 (19:24 +0900)
committerpho <pho@cielonegro.org>
Thu, 10 Jul 2008 10:24:33 +0000 (19:24 +0900)
darcs-hash:20080710102433-62b54-49252cbcaec31b310f5a8a415e912eb26b5ff69a.gz

Main.hs
Rakka/Wiki/Interpreter/Base.hs
defaultPages/SideBar/Left.xml
defaultPages/SideBar/Right.xml
js/editPage.js
js/login.js
js/systemConfig.js

diff --git a/Main.hs b/Main.hs
index c4bb0485b13ff28f9d1ac49e51d427de0b4deb47..b6e5d6d489e9bfcd00d3cfca7d2d8eaffa0b9ed9 100644 (file)
--- a/Main.hs
+++ b/Main.hs
@@ -15,7 +15,7 @@ import           Rakka.Resource.Object
 import           Rakka.Resource.Render
 import           Rakka.Resource.Search
 import           Rakka.Resource.SystemConfig
-import           Rakka.Resource.TrackBack
+-- import           Rakka.Resource.TrackBack
 import           Rakka.Storage
 import           Subversion
 import           System.Console.GetOpt
@@ -153,7 +153,7 @@ resTree env
                 , (["search.html" ], resSearch       env)
                 , (["search.xml"  ], resSearch       env)
                 , (["systemConfig"], resSystemConfig env)
-                , (["trackback"   ], resTrackBack    env)
+                -- , (["trackback"   ], resTrackBack    env)
                 ]
 
 
index 2363b9b5da362bdee29c2433f8ff9b3b21a9361e..2f6aade45ac6ba8a86f88d2daa12cb02841ed29e 100644 (file)
@@ -23,6 +23,7 @@ interpreters = [ lineBreakInterp
                , editPageInterp
                , loginInterp
                , searchFieldInterp
+               , configurationInterp
                ]
 
 
@@ -174,3 +175,20 @@ searchFieldInterp
             in
               return (Input attrs)
       }
+
+-- <input type="button"
+--        value="Configuration"
+--        class="configButton" />
+configurationInterp :: Interpreter
+configurationInterp 
+    = InlineCommandInterpreter {
+        iciName = "configuration"
+      , iciInterpret
+          = \ _ _ ->
+            let attrs = [ ("type" , "button")
+                        , ("value", "Configuration")
+                        , ("class", "configButton")
+                        ]
+            in
+              return (Input attrs)
+      }
index 25c87606214bb61a09c46ea5f8f83ad056f12663..90361da9db2bceb0069bcb33ad9a7355c69a9b33 100644 (file)
@@ -9,9 +9,5 @@
 * [[MainPage|Main]]
 * [[Help/Syntax|Syntax Help]]
 
-= Trackbacks =
-<trackbackURL />
-<trackbacks />
-
 ]]></textData>
 </page>
index 982e863537df12d792418fe81c56bbe506bdbcb6..7f8e9c8d36609c9a62db1cf715968c77f7d2ced9 100644 (file)
@@ -6,6 +6,7 @@
 * <login />
 * <newPage />
 * <editPage />
+* <configuration />
 * <searchField />
 
 = In other languages =
index 705f47adbb1f5351a929defeab96f6be25b74af6..5d782de880484ded293528371a31f042cb25d3a9 100644 (file)
@@ -11,7 +11,7 @@
         var $area = Rakka.switchScreen();
 
         Rakka.displayWaitingMessage("Loading... please wait.");
-    
+
         // XML 版のページを取得する。
         $.ajax({
             url    : Rakka.baseURI + pageName + ".xml",
@@ -42,7 +42,7 @@
                         : $page.find("textData").text()
                         ;
                     var summary     = $page.find("summary").text();
-                
+
                     displayPageEditor(pageName, oldRevision, defaultType, lang, isLocked, otherLangs, source, summary);
                 }
                 else {
@@ -51,7 +51,7 @@
             },
             error  : function (req) {
                 Rakka.hideWaitingMessage();
-                
+
                 if (req.status == 404) {
                     displayPageEditor(pageName, null, "rakka", null, false, {}, null, "");
                 }
@@ -82,7 +82,7 @@
         var makeDirty = function () {
             isDirty = true;
         };
-    
+
         var fldPageName
             = $.INPUT({type : "text", value: pageName});
 
                         $.LABEL({},
                                 chkIsLocked,
                                 "Disallow anonymous users to edit or delete this page")));
-        
+
         var btnTypeRakka
             = $.INPUT({type   : "radio",
                        name   : "type",
                        $.OPTION({value: ""}, "(unspecified)"),
                        (function () {
                            var options = [];
-                           
+
                            $.each(Rakka.getSystemConfig().languages, function (tag, name) {
                                options.push(
                                    $.OPTION({value: tag}, name));
 
                 var lang     = $(selLang).val();
                 var pageName = $(this).val();
-                
+
                 if (pageName == "") {
                     delete otherLangs[lang];
                 }
         $(fldRedirect).change(makeDirty);
 
         var trContent
-            = $.TR({}, 
+            = $.TR({},
                    $.TH({}),
                    $.TD({})
                   );
 
         var btnPreview
             = $.INPUT({type: "button", value: "Preview page"});
-        
+
         $(btnPreview).click(function () {
             if (btnTypeRakka.checked) {
                 previewRakkaPage(
 
         var btnSubmit
             = $.INPUT({type: "button", value: "Submit page"});
-        
+
         $(btnSubmit).click(function () {
             if (btnTypeRakka.checked) {
                 submitTextPage(
 
         var btnDelete
             = $.INPUT({type: "button", value: "Delete this page"});
-        
+
         $(btnDelete).click(function () {
             if (window.confirm("Do you really want to delete this page?")) {
                 deletePage(pageName);
 
     var previewRakkaPage = function (pageName, source) {
         Rakka.displayWaitingMessage("Loading... please wait.");
-        
+
         var url = Rakka.baseURI + "render/" + encodeURI(pageName);
         $.ajax({
             type       : "POST",
 
     var showPreview = function (doc) {
         $previewArea.empty();
-        
+
         $previewHeader.show();
         $previewArea.show();
-        
+
         var root  = doc.documentElement;
         var child = root.firstChild;
         do {
         Rakka.scrollToTopLeft();
     };
 
-    var submitTextPage = function (pageName, oldRevision, givenPageName, isLocked, mimeType, lang, otherLangs, summary, text) {
-        var doc = document.implementation.createDocument(
-            "http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
-
-        var page = doc.documentElement;
+    var submitTextPage
+      = function (pageName, oldRevision, givenPageName, isLocked, mimeType, lang, otherLangs, summary, text) {
+         var NS   = "http://cielonegro.org/schema/Rakka/Page/1.0";
+         var doc  = document.implementation.createDocument(NS, "page", null);
+         var page = doc.documentElement;
 
         if (oldRevision != null) {
             // ページ書換時
-            var updateInfo = doc.createElement("updateInfo");
+            var updateInfo = doc.createElementNS(NS, "updateInfo");
             updateInfo.setAttribute("oldRevision", oldRevision);
 
             if (pageName != givenPageName) {
-                var move = doc.createElement("move");
+                var move = doc.createElementNS(NS, "move");
                 move.setAttribute("from", pageName);
                 updateInfo.appendChild(move);
             }
         }
 
         if (summary != null && summary != "") {
-            var s = doc.createElement("summary");
+            var s = doc.createElementNS(NS, "summary");
             s.appendChild(
                 doc.createTextNode(summary));
             page.appendChild(s);
         }
 
-        var oLang = doc.createElement("otherLang");
+        var oLang = doc.createElementNS(NS, "otherLang");
         for (var tag in otherLangs) {
-            var link = doc.createElement("link");
+            var link = doc.createElementNS(NS, "link");
             link.setAttribute("lang", tag);
             link.setAttribute("page", otherLangs[tag]);
             oLang.appendChild(link);
         }
         page.appendChild(oLang);
 
-        var textData = doc.createElement("textData");
+        var textData = doc.createElementNS(NS, "textData");
         textData.appendChild(
             doc.createTextNode(text));
 
             },
             error      : function (req) {
                 Rakka.hideWaitingMessage();
-                
+
                 var $area = Rakka.switchScreen();
                 $area.text("Error: " + req.status + " " + req.statusText);
             }
     };
 
     var submitBinaryPage = function (pageName, oldRevision, givenPageName, isLocked, lang, otherLangs, summary, path) {
-        var doc = document.implementation.createDocument(
-            "http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
-
+        var NS   = "http://cielonegro.org/schema/Rakka/Page/1.0";
+        var doc  = document.implementation.createDocument(NS, "page", null);
         var page = doc.documentElement;
 
         if (oldRevision != null) {
             // ページ書換時
-            var updateInfo = doc.createElement("updateInfo");
+            var updateInfo = doc.createElementNS(NS, "updateInfo");
             updateInfo.setAttribute("oldRevision", oldRevision);
 
             if (pageName != givenPageName) {
-                var move = doc.createElement("move");
+                var move = doc.createElementNS(NS, "move");
                 move.setAttribute("from", pageName);
                 updateInfo.appendChild(move);
             }
         }
 
         if (summary != null) {
-            var s = doc.createElement("summary");
+            var s = doc.createElementNS(NS, "summary");
             s.appendChild(
                 doc.createTextNode(summary));
             page.appendChild(s);
         }
 
-        var oLang = doc.createElement("otherLang");
+        var oLang = doc.createElementNS(NS, "otherLang");
         for (var tag in otherLangs) {
-            var link = doc.createElement("link");
+            var link = doc.createElementNS(NS, "link");
             link.setAttribute("lang", tag);
             link.setAttribute("page", otherLangs[tag]);
             oLang.appendChild(link);
         var bin = Rakka.loadLocalBinaryFile(path);
         var b64 = Rakka.encodeBase64(bin);
 
-        var binaryData = doc.createElement("binaryData");
+        var binaryData = doc.createElementNS(NS, "binaryData");
         binaryData.appendChild(
             doc.createTextNode(b64));
 
             },
             error      : function (req) {
                 Rakka.hideWaitingMessage();
-                
+
                 var $area = Rakka.switchScreen();
                 $area.text("Error: " + req.status + " " + req.statusText);
             }
     };
 
     var submitRedirection = function (pageName, oldRevision, givenPageName, isLocked, destination) {
-        var doc = document.implementation.createDocument(
-            "http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
-
+        var NS   = "http://cielonegro.org/schema/Rakka/Page/1.0";
+        var doc  = document.implementation.createDocument(NS, "page", null);
         var page = doc.documentElement;
 
         if (oldRevision != null) {
             // ページ書換時
-            var updateInfo = doc.createElement("updateInfo");
+            var updateInfo = doc.createElementNS(NS, "updateInfo");
             updateInfo.setAttribute("oldRevision", oldRevision);
 
             if (pageName != givenPageName) {
-                var move = doc.createElement("move");
+                var move = doc.createElementNS(NS, "move");
                 move.setAttribute("from", pageName);
                 updateInfo.appendChild(move);
             }
             },
             error      : function (req) {
                 Rakka.hideWaitingMessage();
-                
+
                 var $area = Rakka.switchScreen();
                 $area.text("Error: " + req.status + " " + req.statusText);
             }
             },
             error      : function (req) {
                 Rakka.hideWaitingMessage();
-                
+
                 var $area = Rakka.switchScreen();
                 $area.text("Error: " + req.status + " " + req.statusText);
             }
index 291fa2987d8897f82dcea1051ac953359e0ccefb..3223bcf2b9466a65307d1b0b007acee1e26418e5 100644 (file)
@@ -1,5 +1,5 @@
 (function () {
-    
+
     Rakka.showLoginPanel = function () {
         var $area = Rakka.switchScreen();
 
         var btnLogin
             = $.INPUT({type: "button", value: "Login"});
 
-        $(btnLogin).click(function () {
-            login(fldUserID.value, fldPassword.value);
-        });
+        $(btnLogin)
+            .click(function () {
+                       login(fldUserID.value, fldPassword.value);
+                   });
+
+        var fldHandler = function (ev) {
+                             if (ev.keyCode == 27) { // ESC
+                                 Rakka.restoreScreen();
+                                 return false;
+                             }
+                             else if (ev.keyCode == 13) { // CR
+                                 login(fldUserID.value, fldPassword.value);
+                                 return false;
+                             }
+                             else {
+                                 return true;
+                             }
+        };
+        $(fldUserID).keypress(fldHandler);
+        $(fldPassword).keypress(fldHandler);
 
         var btnCancel
             = $.INPUT({type: "button", value: "Cancel"});
@@ -44,6 +61,7 @@
                      );
 
         $area.append(loginPanel);
+        $(fldUserID).focus();
     };
 
     var login = function (userID, password) {
     var updateLoginState = function () {
         currentUserID   = null;
         currentPassword = null;
-        
+
         var cookies = document.cookie.split(/;\s*/);
         $.each(cookies, function () {
             var m = this.match(/^([^=]*)=(.*)$/);
                 });
 
             $("input.newButton").attr({disabled: ""});
-            
+
             $("input.editButton").attr({
                 disabled: (Rakka.isSpecialPage ? "disabled" : "")
             });
+
+            $("input.configButton").attr({
+              disabled: ""
+            });
         }
         else {
             /* ログインしてゐない */
             $("input.newButton").attr({
                 disabled: (Rakka.isGlobalLocked ? "disabled" : "")
             });
-            
+
             $("input.editButton").attr({
                 disabled: (Rakka.isLocked || Rakka.isGlobalLocked || Rakka.isSpecialPage ? "disabled" : "")
             });
+
+            $("input.configButton").attr({
+                disabled: "disabled"
+            });
         }
     };
 
index 9dd7f9c280507c1da619c1693d4de43b66905f88..05a3a5653808277341f7d1ba5d44e2689cdc77c6 100644 (file)
@@ -7,7 +7,7 @@
     var mapDecoder = function (src) {
         var map   = {};
         var lines = src.split(/\n/);
-        
+
         $.each(lines, function () {
             var m = this.match(/^(\S+)\s+(\S+)$/);
 
         if (cachedConf != null) {
             return cachedConf;
         }
-        
+
         var conf = {};
         cachedConf = conf;
-        
+
         $.ajax({
             type   : "GET",
             url    : Rakka.baseURI + "systemConfig",
         return conf;
     };
 
+    $(document).ready(function () {
+        $("input.configButton")
+            .click(function () {
+                       Rakka.showConfigPanel();
+                   });
+    });
+
 })();
\ No newline at end of file