mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Remove other old cfg classes
This commit is contained in:
@@ -1,31 +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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.users; import gplx.*; import gplx.xowa.*;
|
||||
public class Xou_cfg implements Gfo_invk {
|
||||
public Xou_cfg(Xoue_user user) {
|
||||
pages_mgr = new Xouc_pages_mgr(this);
|
||||
}
|
||||
public Xouc_pages_mgr Pages_mgr() {return pages_mgr;} private Xouc_pages_mgr pages_mgr;
|
||||
public Xou_log_mgr Log_mgr() {return log_mgr;} private final Xou_log_mgr log_mgr = new Xou_log_mgr();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_pages)) return pages_mgr;
|
||||
else if (ctx.Match(k, Invk_log)) return log_mgr;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_pages = "pages", Invk_log = "log";
|
||||
}
|
||||
@@ -1,29 +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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.users; import gplx.*; import gplx.xowa.*;
|
||||
public class Xou_log_mgr implements Gfo_invk {
|
||||
public boolean Log_redlinks() {return log_redlinks;} private boolean log_redlinks;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_log_redlinks)) return Yn.To_str(log_redlinks);
|
||||
else if (ctx.Match(k, Invk_log_redlinks_)) log_redlinks = m.ReadYn("v");
|
||||
return this;
|
||||
}
|
||||
public static final String
|
||||
Invk_log_redlinks = "log_redlinks", Invk_log_redlinks_ = "log_redlinks_"
|
||||
;
|
||||
}
|
||||
@@ -17,10 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.users; import gplx.*; import gplx.xowa.*;
|
||||
public class Xou_user_mgr implements Gfo_invk {
|
||||
public Xou_user_mgr(Xoae_app app, Xoue_user user) {this.app = app; this.Add(user);} private Xoae_app app;
|
||||
private final Ordered_hash regy = Ordered_hash_.New();
|
||||
private final Xoae_app app;
|
||||
public Xou_user_mgr(Xoae_app app, Xoue_user user) {this.app = app; this.Add(user);}
|
||||
public void Add(Xoue_user itm) {regy.Add(itm.Key(), itm);}
|
||||
Xoue_user GetByKey(String key) {return (Xoue_user)regy.Get_by(key);}
|
||||
Ordered_hash regy = Ordered_hash_.New();
|
||||
private Xoue_user GetByKey(String key) {return (Xoue_user)regy.Get_by(key);}
|
||||
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_get)) {
|
||||
@@ -33,6 +34,5 @@ public class Xou_user_mgr implements Gfo_invk {
|
||||
return user;
|
||||
}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
// return this;
|
||||
} private static final String Invk_get = "get";
|
||||
}
|
||||
|
||||
@@ -18,16 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.users; import gplx.*; import gplx.xowa.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.xwikis.*;
|
||||
public class Xou_user_tst {
|
||||
private Xou_user_fxt fxt = new Xou_user_fxt();
|
||||
@Test public void Run() {
|
||||
Io_url user_system_cfg_url = Io_url_.mem_fil_("mem/xowa/user/test_user/app/data/cfg/user_system_cfg.gfs");
|
||||
fxt.Test_fil(user_system_cfg_url, ""); // check that it is blank
|
||||
fxt.App().Init_by_app(); // run Init_by_app
|
||||
fxt.Test_fil(user_system_cfg_url, Xou_user_.User_system_cfg_text); // check that it is created
|
||||
Io_mgr.Instance.SaveFilStr(user_system_cfg_url, ""); // simulate edit by blanking out file
|
||||
fxt.App().Init_by_app(); // run Init_by_app again
|
||||
fxt.Test_fil(user_system_cfg_url, ""); // check that it is still blank
|
||||
}
|
||||
private final Xou_user_fxt fxt = new Xou_user_fxt();
|
||||
@Test public void Available_from_fsys() {
|
||||
Io_mgr.Instance.CreateDir(fxt.App().Fsys_mgr().Wiki_dir().GenSubDir("en.wikipedia.org"));
|
||||
fxt.App().Usere().Available_from_fsys();
|
||||
@@ -40,9 +31,6 @@ public class Xou_user_tst {
|
||||
class Xou_user_fxt {
|
||||
public Xoae_app App() {return app;} private Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
public String Make_xwiki(boolean offline, String name) {return String_.Concat_with_str("|", Yn.To_str(offline), name);}
|
||||
public void Test_fil(Io_url url, String expd) {
|
||||
Tfds.Eq_str_lines(expd, Io_mgr.Instance.LoadFilStr(url));
|
||||
}
|
||||
public void Test_xwikis(String... expd) {
|
||||
Xow_xwiki_mgr xwiki_mgr = app.Usere().Wiki().Xwiki_mgr();
|
||||
int len = xwiki_mgr.Len();
|
||||
|
||||
@@ -1,28 +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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.users; import gplx.*; import gplx.xowa.*;
|
||||
public class Xouc_pages_mgr implements Gfo_invk {
|
||||
public Xouc_pages_mgr(Xou_cfg config) {}
|
||||
public String Home() {return home;} public Xouc_pages_mgr Home_(String v) {home = v; return this;} private String home = Page_xowa;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_home)) return home;
|
||||
else if (ctx.Match(k, Invk_home_)) home = m.ReadStr("v");
|
||||
return this;
|
||||
} public static final String Invk_home = "home", Invk_home_ = "home_";
|
||||
public static final String Page_xowa = "home/wiki/Main_Page";
|
||||
}
|
||||
@@ -28,7 +28,6 @@ public class Xoue_user implements Xou_user, Gfo_evt_mgr_owner, Gfo_invk {
|
||||
this.ev_mgr = new Gfo_evt_mgr(this);
|
||||
this.fsys_mgr = new Xou_fsys_mgr(user_dir);
|
||||
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());
|
||||
}
|
||||
public Gfo_evt_mgr Evt_mgr() {return ev_mgr;} private final Gfo_evt_mgr ev_mgr;
|
||||
@@ -47,7 +46,6 @@ public class Xoue_user implements Xou_user, Gfo_evt_mgr_owner, Gfo_invk {
|
||||
public Xou_fsys_mgr Fsys_mgr() {return fsys_mgr;} private Xou_fsys_mgr fsys_mgr;
|
||||
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 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
|
||||
@@ -87,13 +85,12 @@ 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_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_cfg = "cfg";
|
||||
, Invk_wiki = "wiki", Invk_history = "history", Invk_fsys = "fsys", Invk_lang = "lang", Invk_msgs = "msgs";
|
||||
public static final String Key_xowa_user = "anonymous";
|
||||
public static final String Evt_lang_changed = "lang_changed";
|
||||
public void Available_from_fsys() {
|
||||
|
||||
@@ -1,24 +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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.users; import gplx.*; import gplx.xowa.*;
|
||||
public class Xouv_cfg_keys {
|
||||
public static final String
|
||||
Key_history_stack = "xowa.gui.history_stack"
|
||||
, Key_history_idx = "xowa.gui.history.idx"
|
||||
;
|
||||
}
|
||||
Reference in New Issue
Block a user