diff --git a/400_xowa/src/gplx/xowa/Xoae_app.java b/400_xowa/src/gplx/xowa/Xoae_app.java
index 52d955744..b9b687dcf 100644
--- a/400_xowa/src/gplx/xowa/Xoae_app.java
+++ b/400_xowa/src/gplx/xowa/Xoae_app.java
@@ -172,7 +172,6 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
xwiki_mgr__sitelink_mgr.Init_by_app();
stage = Xoa_stage_.Tid_launch;
user.Cfg_mgr().Setup_mgr().Setup_run_check(this); log_bfr.Add("app.upgrade.done");
- gplx.xowa.users.prefs.Prefs_converter.Instance.Check(this);
user.Wiki().Init_assert(); // NOTE: must assert wiki and load langs first, else will be asserted during Portal_mgr().Init(), which will cause IndexOutOfBounds; DATE:2014-10-04
gplx.xowa.addons.users.wikis.regys.Xou_regy_addon.Init(this);
}
diff --git a/400_xowa/src/gplx/xowa/apps/boots/Xoa_boot_mgr.java b/400_xowa/src/gplx/xowa/apps/boots/Xoa_boot_mgr.java
index 6011c3846..8be509631 100644
--- a/400_xowa/src/gplx/xowa/apps/boots/Xoa_boot_mgr.java
+++ b/400_xowa/src/gplx/xowa/apps/boots/Xoa_boot_mgr.java
@@ -84,8 +84,7 @@ public class Xoa_boot_mgr {
catch (Exception e) {usr_dlg.Warn_many("", "", "app init failed: ~{0}", Err_.Message_gplx_full(e));}
app.Usr_dlg().Log_wkr_(app.Log_wtr()); // NOTE: log_wtr must be set for cmd-line (else process will fail);
- // run gfs
- gplx.xowa.users.prefs.Prefs_rename_mgr.Instance.Check(app.Usere().Fsys_mgr().App_data_cfg_user_fil());
+ // run gfs; prefs.gfs and app.gfs
Io_url cmd_file = arg_mgr.Cmd__file();
try {app.Gfs_mgr().Run_url(cmd_file);}
catch (Exception e) {
diff --git a/400_xowa/src/gplx/xowa/users/Xoue_user.java b/400_xowa/src/gplx/xowa/users/Xoue_user.java
index 73ebda79e..94dbfe73c 100644
--- a/400_xowa/src/gplx/xowa/users/Xoue_user.java
+++ b/400_xowa/src/gplx/xowa/users/Xoue_user.java
@@ -30,7 +30,6 @@ public class Xoue_user implements Xou_user, Gfo_evt_mgr_owner, Gfo_invk {
this.user_db_mgr = new Xou_db_mgr(app);
this.cfg_mgr = new Xou_cfg(this);
this.history_mgr = new Xou_history_mgr(fsys_mgr.App_data_history_fil());
- this.prefs_mgr = new gplx.xowa.users.prefs.Prefs_mgr(app);
}
public Gfo_evt_mgr Evt_mgr() {return ev_mgr;} private final Gfo_evt_mgr ev_mgr;
public String Key() {return key;} private String key;
@@ -49,7 +48,6 @@ public class Xoue_user implements Xou_user, Gfo_evt_mgr_owner, Gfo_invk {
public Xowe_wiki Wiki() {if (wiki == null) wiki = Xou_user_.new_or_create_(this, app); return wiki;} private Xowe_wiki wiki;
public Xou_history_mgr History_mgr() {return history_mgr;} private Xou_history_mgr history_mgr;
public Xou_cfg Cfg_mgr() {return cfg_mgr;} private Xou_cfg cfg_mgr;
- public gplx.xowa.users.prefs.Prefs_mgr Prefs_mgr() {return prefs_mgr;} gplx.xowa.users.prefs.Prefs_mgr prefs_mgr;
public Xow_msg_mgr Msg_mgr() {
if (msg_mgr == null)
msg_mgr = new Xow_msg_mgr(this.Wiki(), this.Lang()); // NOTE: must call this.Lang() not this.lang, else nullRef exception when using "app.shell.fetch_page"; DATE:2013-04-12
@@ -89,14 +87,13 @@ public class Xoue_user implements Xou_user, Gfo_evt_mgr_owner, Gfo_invk {
else if (ctx.Match(k, Invk_wiki)) return this.Wiki(); // NOTE: mass parse relies on this being this.Wiki(), not wiki
else if (ctx.Match(k, Invk_history)) return history_mgr;
else if (ctx.Match(k, Invk_fsys)) return fsys_mgr;
- else if (ctx.Match(k, Invk_prefs)) return prefs_mgr;
else if (ctx.Match(k, Invk_cfg)) return cfg_mgr;
else if (ctx.Match(k, "name")) return key; //throw Err_.new_unhandled(k); // OBSOLETE: used to return key
else return Gfo_invk_.Rv_unhandled;
return this;
}
public static final String Invk_available_from_fsys = "available_from_fsys", Invk_available_from_bulk = "available_from_bulk", Invk_bookmarks_add_fmt_ = "bookmarks_add_fmt_"
- , Invk_wiki = "wiki", Invk_history = "history", Invk_fsys = "fsys", Invk_lang = "lang", Invk_msgs = "msgs", Invk_prefs = "prefs", Invk_cfg = "cfg";
+ , Invk_wiki = "wiki", Invk_history = "history", Invk_fsys = "fsys", Invk_lang = "lang", Invk_msgs = "msgs", Invk_cfg = "cfg";
public static final String Key_xowa_user = "anonymous";
public static final String Evt_lang_changed = "lang_changed";
public void Available_from_fsys() {
diff --git a/400_xowa/src/gplx/xowa/users/prefs/Prefs_converter.java b/400_xowa/src/gplx/xowa/users/prefs/Prefs_converter.java
deleted file mode 100644
index b9b24ec53..000000000
--- a/400_xowa/src/gplx/xowa/users/prefs/Prefs_converter.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-XOWA: the XOWA Offline Wiki Application
-Copyright (C) 2012 gnosygnu@gmail.com
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, either version 3 of the
-License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-*/
-package gplx.xowa.users.prefs; import gplx.*; import gplx.xowa.*; import gplx.xowa.users.*;
-import gplx.xowa.apps.cfgs.*;
-public class Prefs_converter {
- private Bry_bfr bfr = Bry_bfr_.New();
- private List_adp list = List_adp_.New();
- public void Check(Xoae_app app) {
- int options_version = app.Sys_cfg().Options_version();
- if (options_version == 1) {
- Io_url cfg_dir = app.Usere().Fsys_mgr().App_data_cfg_dir();
- Io_url cfg_fil = cfg_dir.GenSubFil("user_system_cfg.gfs");
- Io_url trg_fil = cfg_fil.GenNewNameAndExt(gplx.xowa.apps.cfgs.Xoa_cfg_db_txt.File_name);
- if (!Io_mgr.Instance.ExistsFil(trg_fil)) { // do not overwrite file if it is there (i.e.: it's already converted); needed when running in app_mode = cmd (see HACK in Xob_bldr.Run)
- String old_str = Io_mgr.Instance.LoadFilStr_args(cfg_fil).MissingIgnored_(true).Exec();
- String new_str = Convert(old_str);
- Io_mgr.Instance.SaveFilStr(trg_fil, new_str);
- app.Cfg_mgr().Db_load_txt();
- app.Cfg_mgr().Set_by_app("app.setup.dumps.wiki_storage_type", "sqlite");
- app.Log_wtr().Log_to_session_fmt("converted options to v2");
- }
- }
- }
- public String Convert(String raw) {
- list.Clear();
- GfoMsg root_msg = gplx.langs.gfs.Gfs_msg_bldr.Instance.ParseToMsg(raw);
- int len = root_msg.Subs_count();
- for (int i = 0; i < len; i++) {
- GfoMsg msg = root_msg.Subs_getAt(i);
- Convert_msg(msg, 0);
- }
- return Convert_to_stage2(list);
- }
- public String Convert_to_stage2(List_adp list) {
- bfr.Add_str_a7("app.cfgs.get('app.sys_cfg.options_version', 'app').val = '2';").Add_byte_nl();
- int len = list.Count();
- for (int i = 0; i < len; i++) {
- Prefs_converter_itm itm = (Prefs_converter_itm)list.Get_at(i);
- bfr.Add_str_a7("app.cfgs.get('");
- Write_escaped_str(bfr, itm.Key());
- bfr.Add_str_a7("', '" + Xoa_cfg_grp_tid.Key_app_str + "'");
- bfr.Add_str_a7(").val = '");
- Write_escaped_str(bfr, itm.Val());
- bfr.Add_str_a7("';\n");
- }
- return bfr.To_str_and_clear();
- }
- private void Write_escaped_str(Bry_bfr bfr, String str) {
- byte[] bry = Bry_.new_u8(str);
- int len = bry.length;
- for (int i = 0; i < len; i++) {
- byte b = bry[i];
- if (b == Byte_ascii.Apos)
- bfr.Add_byte_repeat(Byte_ascii.Apos, 2);
- else
- bfr.Add_byte(b);
- }
- }
- private void Convert_msg(GfoMsg m, int depth) {
- int subs_len = m.Subs_count();
- if (subs_len == 0) {
- bfr.Add_byte(Byte_ascii.Dot);
- byte[] prop_set_key = Bry_.new_u8(m.Key());
- int prop_set_key_len = prop_set_key.length;
- if (prop_set_key_len == 0) return; // empty key; return now, else error
- if (prop_set_key[prop_set_key_len - 1] != Byte_ascii.Underline) return; // doesn't end with _
- bfr.Add_mid(prop_set_key, 0, prop_set_key_len - 1);
- Prefs_converter_itm itm = new Prefs_converter_itm();
- itm.Key_(bfr.To_str_and_clear());
- String prop_val = m.Args_getAt(0).Val_to_str_or_empty();
- itm.Val_(prop_val);
- list.Add(itm);
- }
- else {
- if (depth != 0) bfr.Add_byte(Byte_ascii.Dot);
- if (String_.Eq(m.Key(), "scripts")) {bfr.Clear(); return;}
- bfr.Add_str_u8(m.Key());
- int args_count = m.Args_count();
- if (args_count > 0) {
- bfr.Add_byte(Byte_ascii.Paren_bgn);
- for (int i = 0; i < args_count; i++) {
- if (i != 0) bfr.Add_byte(Byte_ascii.Comma);
- Keyval kv = m.Args_getAt(i);
- bfr.Add_byte(Byte_ascii.Quote);
- bfr.Add_str_u8(kv.Val_to_str_or_empty());
- bfr.Add_byte(Byte_ascii.Quote);
- }
- bfr.Add_byte(Byte_ascii.Paren_end);
- }
- Convert_msg(m.Subs_getAt(0), depth + 1);
- }
- }
- public static final Prefs_converter Instance = new Prefs_converter(); Prefs_converter() {}
-}
-class Prefs_converter_itm {
- public String Key() {return key;} public void Key_(String v) {this.key = v;} private String key;
- public String Val() {return val;} public void Val_(String v) {this.val = v;} private String val;
-}
diff --git a/400_xowa/src/gplx/xowa/users/prefs/Prefs_converter_tst.java b/400_xowa/src/gplx/xowa/users/prefs/Prefs_converter_tst.java
deleted file mode 100644
index 5d99700d9..000000000
--- a/400_xowa/src/gplx/xowa/users/prefs/Prefs_converter_tst.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-XOWA: the XOWA Offline Wiki Application
-Copyright (C) 2012 gnosygnu@gmail.com
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, either version 3 of the
-License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-*/
-package gplx.xowa.users.prefs; import gplx.*; import gplx.xowa.*; import gplx.xowa.users.*;
-import org.junit.*;
-public class Prefs_converter_tst {
- @Before public void init() {} Prefs_converter_fxt fxt = new Prefs_converter_fxt();
- @Test public void Basic() {
- fxt.Test_convert(String_.Concat_lines_nl
- ( "app.scripts.txns.get('user.prefs.general').version_('0.7.2.0').bgn();"
- , "a.b.c_('d');"
- , "e.f.g_h_(1);"
- , "i.j('k').l_(2);"
- ), String_.Concat_lines_nl
- ( "app.cfgs.get('app.sys_cfg.options_version', 'app').val = '2';"
- , "app.cfgs.get('a.b.c', 'app').val = 'd';"
- , "app.cfgs.get('e.f.g_h', 'app').val = '1';"
- , "app.cfgs.get('i.j(\"k\").l', 'app').val = '2';"
- ));
- }
-}
-class Prefs_converter_fxt {
- Prefs_converter converter = Prefs_converter.Instance;
- public void Test_convert(String raw, String expd) {
- String actl = converter.Convert(raw);
- Tfds.Eq_str_lines(expd, actl);
- }
- public void Parse(String raw_str) {
- byte[] raw_bry = Bry_.new_u8(raw_str);
- int bgn_pos = Bry_find_.Find_fwd(raw_bry, Byte_ascii.Paren_bgn);
- if (bgn_pos == Bry_find_.Not_found) throw Err_.new_wo_type("unable to find paren_bgn", "raw", raw_str);
- int end_pos = Bry_find_.Find_fwd(raw_bry, Byte_ascii.Paren_end, bgn_pos);
- if (end_pos == Bry_find_.Not_found) throw Err_.new_wo_type("unable to find paren_end", "raw", raw_str);
- raw_bry = Bry_.Mid(raw_bry, bgn_pos, end_pos);
- int len = raw_bry.length;
- for (int i = 0; i < len; i++) {
- byte[] c = gplx.core.intls.Utf8_.Get_char_at_pos_as_bry(raw_bry, i);
- if (c.length == 1) {
- switch (c[0]) {
- case Byte_ascii.Dash:
- break;
- case Byte_ascii.Pipe:
- break;
- }
- }
- }
- }
-}
diff --git a/400_xowa/src/gplx/xowa/users/prefs/Prefs_html_wtr.java b/400_xowa/src/gplx/xowa/users/prefs/Prefs_html_wtr.java
deleted file mode 100644
index ddfaadb35..000000000
--- a/400_xowa/src/gplx/xowa/users/prefs/Prefs_html_wtr.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-XOWA: the XOWA Offline Wiki Application
-Copyright (C) 2012 gnosygnu@gmail.com
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, either version 3 of the
-License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-*/
-package gplx.xowa.users.prefs; import gplx.*; import gplx.xowa.*; import gplx.xowa.users.*;
-import gplx.langs.htmls.*;
-class Prefs_html_wtr {
- public Prefs_html_wtr(Prefs_mgr prefs_mgr) {this.prefs_mgr = prefs_mgr;} Prefs_mgr prefs_mgr; Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
- public void Write(Bry_bfr bfr, byte[] src, Gfh_nde hnde, int prop_idx, byte[] trg_type, byte[] trg_val) {
- Object prop_val = Eval_prop_get(hnde);
- byte elem_type = Prefs_mgr.Elem_tid_tid_of(hnde);
- bfr.Add_mid(src, hnde.Tag_lhs_bgn(), hnde.Tag_lhs_end() - 1);
- switch (elem_type) {
- case Prefs_mgr.Elem_tid_input_text: this.Write_input(bfr, hnde, prop_idx, prop_val); break;
- case Prefs_mgr.Elem_tid_select: this.Write_select(bfr, hnde, prop_idx, prop_val); break;
- case Prefs_mgr.Elem_tid_input_xowa_io: this.Write_io(bfr, hnde, prop_idx, prop_val); return;
- case Prefs_mgr.Elem_tid_input_checkbox: this.Write_checkbox(bfr, hnde, prop_idx, prop_val); break;
- case Prefs_mgr.Elem_tid_textarea: this.Write_textarea(bfr, hnde, prop_idx, prop_val); break;
- }
- bfr.Add_mid(src, hnde.Tag_rhs_bgn(), hnde.Tag_rhs_end());
- }
- private void Write_input(Bry_bfr bfr, Gfh_nde hnde, int prop_idx, Object prop_val) {
- Write__id(bfr, prop_idx); // " id='xowa_prop_123'"
- Write__value_atr(bfr, prop_val); // " value='abc'"
- Write__nde_end(bfr); // ">"
- }
- private void Write_textarea(Bry_bfr bfr, Gfh_nde hnde, int prop_idx, Object prop_val) {
- Write__id(bfr, prop_idx); // " id='xowa_prop_123'"
- Write__nde_end(bfr); // ">"
- bfr.Add(Gfh_utl.Escape_html_as_bry(Bry_.new_u8(Object_.Xto_str_strict_or_empty(prop_val))));
- // "abcde"
- }
- private void Write_checkbox(Bry_bfr bfr, Gfh_nde hnde, int prop_idx, Object prop_val) {
- Write__id(bfr, prop_idx); // " id='xowa_prop_123'"
- boolean prop_val_is_true = String_.Eq((String)prop_val, "y");
- if (prop_val_is_true)
- bfr.Add(Atr_stub_checked); // " checked='checked'"
- Write__nde_end(bfr); // ">"
- }
- private void Write_select(Bry_bfr bfr, Gfh_nde hnde, int prop_idx, Object prop_val) {
- Keyval[] options_list = Get_select_options(hnde);
- Write__id(bfr, prop_idx); // " id='xowa_prop_123'"
- Write__nde_end(bfr); // ">"
- bfr.Add_byte_nl(); // "\n"
- int len = options_list.length;
- for (int i = 0; i < len; i++) {
- Keyval option = options_list[i];
- bfr.Add(Nde_stub_option_bgn); // " \n"
- }
- }
- private void Write_io(Bry_bfr bfr, Gfh_nde hnde, int prop_idx, Object prop_val) {
- Write__id(bfr, prop_idx); // " id='xowa_prop_123'"
- Write__value_atr(bfr, prop_val); // " value='abc'"
- Write__nde_end(bfr); // ">"
- Write__tag_end(bfr, hnde); // ""
- Write_io_btn(bfr, hnde, prop_idx);
- }
- private void Write_io_btn(Bry_bfr bfr, Gfh_nde hnde, int prop_idx) {
- bfr.Add_str_a7("").Add_byte_nl();
- }
- private static final byte[] Atr_key_xowa_prop_list = Bry_.new_a7("xowa_prop_list")
- , Atr_stub_id = Bry_.new_a7(" id='xowa_prop_")
- , Atr_stub_value = Bry_.new_a7(" value='")
- , Atr_stub_checked = Bry_.new_a7(" checked='checked'")
- , Nde_stub_option_bgn = Bry_.new_a7("