3 var identityDecoder = function (src) {
7 var mapDecoder = function (src) {
9 var lines = src.split(/\n/);
11 $.each(lines, function () {
12 var m = this.match(/^(\S+)\s+(\S+)$/);
20 var boolDecoder = function (src) {
25 siteName : identityDecoder,
26 baseURI : identityDecoder,
27 defaultPage: identityDecoder,
28 styleSheet : identityDecoder,
29 languages : mapDecoder,
30 globalLock : boolDecoder
33 var cachedConf = null;
35 Rakka.getSystemConfig = function () {
36 if (cachedConf != null) {
45 url : Rakka.baseURI + "systemConfig",
47 success: function (xml) {
48 $(xml).find("value").each(function () {
49 var path = this.getAttribute("path");
50 var decoder = decoder_of[path];
52 if (decoder == null) {
53 throw new Error("unknown config path: " + path);
56 conf[path] = decoder($(this).text());
60 error : function (req) {
61 throw new Error(req.status + " " + req.statusText);