Cfg: Load defaults through gfs file not json file

pull/620/head
gnosygnu 8 years ago
parent 8db63bbbce
commit 345402b393

@ -120,16 +120,18 @@ public class Xocfg_mgr implements Gfo_invk {
cache_mgr.Del(ctx, key); cache_mgr.Del(ctx, key);
} }
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) { public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk__set_temp)) cache_mgr.Set_wo_save((String)m.ReadValAt(0), (String)m.ReadValAt(1), (String)m.ReadValAt(2)); if (ctx.Match(k, "set")) cache_mgr.Set ((String)m.ReadValAt(0), (String)m.ReadValAt(1), (String)m.ReadValAt(2));
else if (ctx.Match(k, "set_temp")) cache_mgr.Set_wo_save ((String)m.ReadValAt(0), (String)m.ReadValAt(1), (String)m.ReadValAt(2));
else if (ctx.Match(k, "set_dflt")) dflt_mgr.Add ((String)m.ReadValAt(0), (String)m.ReadValAt(1));
else return Gfo_invk_.Rv_unhandled; else return Gfo_invk_.Rv_unhandled;
return this; return this;
} private static final String Invk__set_temp = "set_temp"; }
public static String Ctx__app = "app"; public static String Ctx__app = "app";
public static String[] Parse_io_cmd(String raw) { public static String[] Parse_io_cmd(String raw) {
String[] rv = new String[2]; String[] rv = new String[2];
rv[0] = ""; rv[0] = "";
rv[1] = ""; rv[1] = "";
int pos = String_.FindFwd(raw, "\n"); int pos = String_.FindFwd(raw, "|");
if (pos != Bry_find_.Not_found) { if (pos != Bry_find_.Not_found) {
rv[0] = String_.Mid(raw, 0, pos); rv[0] = String_.Mid(raw, 0, pos);
rv[1] = String_.Mid(raw, pos + 1); rv[1] = String_.Mid(raw, pos + 1);

@ -24,8 +24,9 @@ public class Xocfg_dflt_mgr {
this.cache_mgr = cache_mgr; this.cache_mgr = cache_mgr;
} }
public void Init_by_app(Xoa_app app) { public void Init_by_app(Xoa_app app) {
Xocfg_dflt_loader loader = new Xocfg_dflt_loader(); app.Gfs_mgr().Run_url(app.Fsys_mgr().Bin_plat_dir().GenSubFil_nest("xowa", "cfg", "xo.cfg.dflt.gfs"));
loader.Load_by_file(this, app.Fsys_mgr().Bin_plat_dir().GenSubFil_nest("xowa", "cfg", "xo.cfg.dflt.json")); // Xocfg_dflt_loader loader = new Xocfg_dflt_loader();
// loader.Load_by_file(this, );
} }
public String Get_or(String key, String or) { public String Get_or(String key, String or) {
Gfo_invk itm = (Gfo_invk)hash.Get_by(key); Gfo_invk itm = (Gfo_invk)hash.Get_by(key);

@ -66,7 +66,7 @@ public class Xoedit_itm_html {
, gui_type_key, gui_args, key, lines[0]); , gui_type_key, gui_args, key, lines[0]);
bfr.Add_str_u8_fmt bfr.Add_str_u8_fmt
( "<input class=\"xocfg__io_cmd__arg__txt\" id=\"{2}-arg\" data-xocfg-key=\"{2}\" data-xocfg-gui=\"{0}-arg\" accesskey=\"d\" type=\"text\"{1} value=\"{3}\">\n" ( "<input class=\"xocfg__io_cmd__arg__txt\" id=\"{2}-arg\" data-xocfg-key=\"{2}\" data-xocfg-gui=\"{0}-arg\" accesskey=\"d\" type=\"text\"{1} value=\"{3}\">\n"
, gui_type_key, gui_args, key, lines[1]); , gui_type_key, gui_args, key, String_.Replace(lines[1], "\"", "&quot;"));
break; break;
case Xoitm_gui_tid.Tid__gui_binding: case Xoitm_gui_tid.Tid__gui_binding:
String[] flds = Xoitm_gui_binding.To_gui(val); String[] flds = Xoitm_gui_binding.To_gui(val);

Loading…
Cancel
Save