]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
configuration
authorpho <pho@cielonegro.org>
Fri, 11 Jul 2008 06:56:40 +0000 (15:56 +0900)
committerpho <pho@cielonegro.org>
Fri, 11 Jul 2008 06:56:40 +0000 (15:56 +0900)
darcs-hash:20080711065640-62b54-376f38aa9d63c233cd0fc578b369ad295b954190.gz

defaultPages/StyleSheet/CieloNegro.xml
defaultPages/StyleSheet/Default.xml
js/systemConfig.js

index 4e0a2ff57ae7489586d67fe6ab22978928031f86..ca98846c64d394d38f9db25a3c5dbf0449524d26 100644 (file)
@@ -198,6 +198,9 @@ table.pageEditor {
     width: 50%;
     margin-left: 1em;
 }
+.pageEditor textarea {
+    height: 5em;
+}
 .pageEditor textarea.summary {
     height: 5em;
 }
index f67bf2fd20095b2f412da71810c1b8c79d851f68..6b5f536b5da6fa01c6e11c8ce7023c2442f68aac 100644 (file)
@@ -168,6 +168,10 @@ option {
     padding: 1px;
 }
 
+table.configPanel {
+    width: 100%;
+}
+
 table.pageEditor {
     width: 100%;
 }
@@ -198,6 +202,9 @@ table.pageEditor {
     width: 50%;
     margin-left: 1em;
 }
+.pageEditor textarea {
+    height: 5em;
+}
 .pageEditor textarea.summary {
     height: 5em;
 }
index 05a3a5653808277341f7d1ba5d44e2689cdc77c6..e9254e3837d867236cc4645eb0a28ca28917af54 100644 (file)
@@ -1,36 +1,63 @@
 (function () {
 
-    var identityDecoder = function (src) {
-        return src;
-    };
+     var identityDecoder = function (src) {
+         return src;
+     };
 
-    var mapDecoder = function (src) {
-        var map   = {};
-        var lines = src.split(/\n/);
+     var identityEncoder = function (src) {
+         return src;
+     };
 
-        $.each(lines, function () {
-            var m = this.match(/^(\S+)\s+(\S+)$/);
+     var mapDecoder = function (src) {
+         var map   = {};
+         var lines = src.split(/\n/);
 
-            map[ m[1] ] = m[2];
-        });
+         $.each(lines, function () {
+                    var m = this.match(/^(\S+)\s+(\S+)$/);
 
-        return map;
-    };
+                    map[ m[1] ] = m[2];
+                });
 
-    var boolDecoder = function (src) {
-        return src == "*";
-    };
+         return map;
+     };
 
-    var decoder_of = {
-        siteName   : identityDecoder,
-        baseURI    : identityDecoder,
-        defaultPage: identityDecoder,
-        styleSheet : identityDecoder,
-        languages  : mapDecoder,
-        globalLock : boolDecoder
-    };
+     var mapEncoder = function (map) {
+         var lines = [];
+
+         $.each(map, function (key) {
+                    lines.push(key + " " + this);
+                });
+
+         return lines.join("\n");
+     };
+
+     var boolDecoder = function (src) {
+         return src == "*";
+     };
+
+     var boolEncoder = function (bool) {
+         return bool ? "*" : "";
+     };
+
+     var decoder_of = {
+         siteName   : identityDecoder,
+         baseURI    : identityDecoder,
+         defaultPage: identityDecoder,
+         styleSheet : identityDecoder,
+         languages  : mapDecoder,
+         globalLock : boolDecoder
+     };
+
+     var encoder_of = {
+         siteName   : identityEncoder,
+         baseURI    : identityEncoder,
+         defaultPage: identityEncoder,
+         styleSheet : identityEncoder,
+         languages  : mapEncoder,
+         globalLock : boolEncoder
+     };
 
-    var cachedConf = null;
+     var cachedConf = null;
 
     Rakka.getSystemConfig = function () {
         if (cachedConf != null) {
         return conf;
     };
 
+     Rakka.showConfigPanel = function () {
+         var conf  = Rakka.getSystemConfig();
+         var $area = Rakka.switchScreen();
+
+         $area.append($.H1({}, "Configuration"));
+
+         var fldSiteName
+             = $.INPUT({type: "text", value: conf.siteName});
+
+         var fldBaseURI
+             = $.INPUT({type: "text", value: conf.baseURI});
+
+         var fldDefaultPage
+             = $.INPUT({type: "text", value: conf.defaultPage});
+
+         var fldStyleSheet
+             = $.INPUT({type: "text", value: conf.styleSheet});
+
+         var fldLanguages
+             = $.TEXTAREA({value: encoder_of.languages(conf.languages)});
+
+         var chkGlobalLock
+             = $.INPUT({type: "checkbox", checked: conf.globalLock});
+
+         var btnSave
+             = $.INPUT({type: "button", value: "Save"});
+
+         var btnCancel
+             = $.INPUT({type: "button", value: "Cancel"});
+
+         var configPanel
+             = $.TABLE({className: "pageEditor"},
+                       $.TBODY({},
+                               $.TR({},
+                                    $.TH({}, "Site name"),
+                                    $.TD({}, fldSiteName)
+                                   ),
+                               $.TR({},
+                                    $.TH({}, "Base URI"),
+                                    $.TD({}, fldBaseURI)
+                                   ),
+                               $.TR({},
+                                    $.TH({}, "Default page"),
+                                    $.TD({}, fldDefaultPage)
+                                   ),
+                               $.TR({},
+                                    $.TH({}, "Style sheet"),
+                                    $.TD({}, fldStyleSheet)
+                                   ),
+                               $.TR({},
+                                    $.TH({}, "Languages"),
+                                    $.TD({}, fldLanguages)
+                                   ),
+                               $.TR({},
+                                    $.TH({}, "Global lock"),
+                                    $.TD({},
+                                         $.LABEL({},
+                                                 chkGlobalLock,
+                                                 "Disallow guest users to edit pages."))
+                                   ),
+                               $.TR({},
+                                    $.TH({}),
+                                    $.TD({}, btnSave, btnCancel)
+                                   )
+                              )
+                      );
+
+         $area.append(configPanel);
+     };
+
     $(document).ready(function () {
         $("input.configButton")
             .click(function () {