mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Convert rest of pages
This commit is contained in:
65
400_xowa/src/gplx/xowa/bldrs/Xobldr_cfg.java
Normal file
65
400_xowa/src/gplx/xowa/bldrs/Xobldr_cfg.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
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.bldrs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.xowa.wikis.data.*;
|
||||
public class Xobldr_cfg {
|
||||
private static long layout_all_max = 0; // disable by default; may set to 200 MB in future
|
||||
private static long layout_text_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
|
||||
private static long layout_html_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
|
||||
private static long layout_file_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
|
||||
private static boolean hzip_enabled = Bool_.Y;
|
||||
private static boolean hzip_mode_is_b256 = Bool_.Y;
|
||||
|
||||
public static byte Zip_mode__text(Xoa_app app) {return Zip_mode(app, Cfg__zip_mode__text);}
|
||||
public static byte Zip_mode__html(Xoa_app app) {return Zip_mode(app, Cfg__zip_mode__html);}
|
||||
private static byte Zip_mode(Xoa_app app, String key) {
|
||||
String val = app.Cfg().Get_str_app_or(key, "gzip");
|
||||
return gplx.core.ios.streams.Io_stream_tid_.To_tid(val);
|
||||
}
|
||||
public static long Max_size__text(Xoa_app app) {return Max_size(app, Cfg__max_size__text);}
|
||||
public static long Max_size__html(Xoa_app app) {return Max_size(app, Cfg__max_size__html);}
|
||||
public static long Max_size__file(Xoa_app app) {return Max_size(app, Cfg__max_size__file);}
|
||||
private static long Max_size(Xoa_app app, String key) {
|
||||
return app.Cfg().Get_long_app_or(key, Io_size_.To_long_by_int_mb(1500));
|
||||
}
|
||||
public static byte[] New_ns_file_map(long dump_file_size) {
|
||||
return dump_file_size < layout_text_max
|
||||
? gplx.xowa.bldrs.cmds.Xob_ns_file_itm_parser.Ns_file_map__few
|
||||
: gplx.xowa.bldrs.cmds.Xob_ns_file_itm_parser.Ns_file_map__each; // DB.FEW: DATE:2016-06-07
|
||||
}
|
||||
public static Xowd_core_db_props New_props(Xoa_app app, String domain_str, long dump_file_size) {
|
||||
Xow_db_layout layout_text, layout_html, layout_file;
|
||||
if (dump_file_size < layout_all_max)
|
||||
layout_text = layout_html = layout_file = Xow_db_layout.Itm_all;
|
||||
else {
|
||||
layout_text = dump_file_size < layout_text_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
|
||||
layout_html = dump_file_size < layout_html_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
|
||||
layout_file = dump_file_size < layout_file_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
|
||||
}
|
||||
return new Xowd_core_db_props(2, layout_text, layout_html, layout_file, Zip_mode__text(app), Zip_mode__html(app), hzip_enabled, hzip_mode_is_b256);
|
||||
}
|
||||
private static final String
|
||||
Cfg__zip_mode__text = "xowa.wiki.database.zip_mode.text"
|
||||
, Cfg__zip_mode__html = "xowa.wiki.database.zip_mode.html"
|
||||
, Cfg__max_size__text = "xowa.wiki.database.max_size.text"
|
||||
, Cfg__max_size__html = "xowa.wiki.database.max_size.html"
|
||||
, Cfg__max_size__file = "xowa.wiki.database.max_size.file"
|
||||
;
|
||||
public static final byte[] Ns_file_map__each = Bry_.new_a7("<each>");
|
||||
}
|
||||
@@ -31,12 +31,12 @@ public class Xob_page_cmd extends Xob_itm_basic_base implements Xob_page_wkr, Gf
|
||||
public String Page_wkr__key() {return Xob_cmd_keys.Key_text_page;}
|
||||
public void Page_wkr__bgn() {
|
||||
Xoae_app app = wiki.Appe();
|
||||
Xoapi_import import_cfg = app.Api_root().Bldr().Wiki().Import();
|
||||
this.redirect_mgr = wiki.Redirect_mgr();
|
||||
this.db_mgr = wiki.Db_mgr_as_sql().Core_data_mgr();
|
||||
this.page_core_tbl = db_mgr.Tbl__page();
|
||||
this.text_zip_mgr = wiki.Utl__zip_mgr(); text_zip_tid = import_cfg.Zip_tid_text();
|
||||
this.ns_to_db_mgr = new Xob_ns_to_db_mgr(new Xob_ns_to_db_wkr__text(), db_mgr, import_cfg.Text_db_max());
|
||||
this.text_zip_mgr = wiki.Utl__zip_mgr();
|
||||
text_zip_tid = Xobldr_cfg.Zip_mode__text(app);
|
||||
this.ns_to_db_mgr = new Xob_ns_to_db_mgr(new Xob_ns_to_db_wkr__text(), db_mgr, Xobldr_cfg.Max_size__text(app));
|
||||
this.dg_match_mgr = Dg_match_mgr.New_mgr(app, wiki);
|
||||
if (dg_match_mgr != null) redirect_id_enabled = true; // always enable redirect_id if dg_match_mgr enabled; DATE:2016-01-04
|
||||
if (redirect_id_enabled) {
|
||||
@@ -44,7 +44,7 @@ public class Xob_page_cmd extends Xob_itm_basic_base implements Xob_page_wkr, Gf
|
||||
redirect_tbl.Conn().Txn_bgn("bldr__page__redirect");
|
||||
}
|
||||
app.Bldr().Dump_parser().Trie_tab_del_(); // disable swapping 	 for \t
|
||||
byte[] ns_file_map = import_cfg.New_ns_file_map(wiki.Import_cfg().Src_rdr_len());
|
||||
byte[] ns_file_map = Xobldr_cfg.New_ns_file_map(wiki.Import_cfg().Src_rdr_len());
|
||||
Xob_ns_file_itm.Init_ns_bldr_data(Xow_db_file_.Tid__text, wiki.Ns_mgr(), ns_file_map);
|
||||
if (idx_mode.Tid_is_bgn()) page_core_tbl.Create_idx();
|
||||
page_core_tbl.Insert_bgn();
|
||||
|
||||
@@ -1,37 +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.bldrs.cmds.texts.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*; import gplx.xowa.bldrs.cmds.texts.*;
|
||||
import org.junit.*; import gplx.dbs.*; import gplx.xowa.bldrs.*; import gplx.xowa.addons.wikis.ctgs.bldrs.*; import gplx.xowa.wikis.nss.*;
|
||||
public class Xob_page_cmd_tst {
|
||||
@Before public void init() {if (Xoa_test_.Db_skip()) return; fxt.Ctor_fsys();} Db_mgr_fxt fxt = new Db_mgr_fxt();
|
||||
@After public void term() {if (Xoa_test_.Db_skip()) return; fxt.Rls();}
|
||||
@Test public void Basic() {
|
||||
if (Xoa_test_.Db_skip()) return;
|
||||
fxt.Init_db_sqlite();
|
||||
fxt.Bldr().App().Api_root().Bldr().Wiki().Import().Zip_tid_text_raw_();
|
||||
fxt.doc_ary_
|
||||
( fxt.doc_(2, "2013-06-03 01:23", "A", "text_a")
|
||||
, fxt.doc_(1, "2013-06-03 12:34", "B", "#REDIRECT [[A]]")
|
||||
)
|
||||
.Exec_run(new Xob_page_cmd(fxt.Bldr(), fxt.Wiki()))
|
||||
;
|
||||
fxt.Test_load_ttl(Xow_ns_.Tid__main, "A", fxt.page_(2, "2013-06-03 01:23", false, 6));
|
||||
fxt.Test_load_page(Xow_ns_.Tid__main, 2, "text_a");
|
||||
fxt.Test_load_ttl(Xow_ns_.Tid__main, "B", fxt.page_(1, "2013-06-03 12:34", true, 15));
|
||||
}
|
||||
}
|
||||
@@ -93,10 +93,8 @@ class Xoi_cmd_search2_build extends Xoi_cmd_base {
|
||||
public Xoi_cmd_search2_build(Xoi_setup_mgr install_mgr, String wiki_key) {this.Ctor(install_mgr, wiki_key);}
|
||||
@Override public String Async_key() {return KEY;} public static final String KEY = "wiki.search2.build";
|
||||
@Override public void Process_async_init(Xoae_app app, Xowe_wiki wiki, Xob_bldr bldr) {
|
||||
if (app.Setup_mgr().Dump_mgr().Wiki_storage_type_is_sql()) {
|
||||
wiki.Db_mgr_as_sql().Category_version_update(false);
|
||||
gplx.xowa.addons.wikis.searchs.bldrs.Srch_bldr_mgr_.Setup(wiki);
|
||||
}
|
||||
wiki.Db_mgr_as_sql().Category_version_update(false);
|
||||
gplx.xowa.addons.wikis.searchs.bldrs.Srch_bldr_mgr_.Setup(wiki);
|
||||
}
|
||||
@Override public void Process_async_done(Xoae_app app, Xowe_wiki wiki, Xob_bldr bldr) {
|
||||
app.Usr_dlg().Prog_many("", "", "search2 setup done");
|
||||
|
||||
@@ -20,24 +20,34 @@ import gplx.core.ios.*; import gplx.core.ios.streams.*;
|
||||
import gplx.xowa.bldrs.wms.dumps.*;
|
||||
public class Xoi_dump_mgr implements Gfo_invk {
|
||||
public String[] Server_urls() {return server_urls;} private String[] server_urls = String_.Ary(Xowm_dump_file_.Server_your_org, Xowm_dump_file_.Server_wmf_https, Xowm_dump_file_.Server_c3sl, Xowm_dump_file_.Server_masaryk); // promote your.org to primary url; DATE:2016-08-07
|
||||
public boolean Import_bz2_by_stdout() {return import_bz2_by_stdout;} private boolean import_bz2_by_stdout = true;
|
||||
|
||||
public String[] Custom_cmds() {return custom_cmds;} private String[] custom_cmds = String_.Ary(Xoi_cmd_wiki_download.Key_wiki_download, Xoi_cmd_wiki_import.KEY);
|
||||
public byte Data_storage_format() {return data_storage_format;} public Xoi_dump_mgr Data_storage_format_(byte v) {data_storage_format = v; return this;} private byte data_storage_format = gplx.core.ios.streams.Io_stream_tid_.Tid__gzip;
|
||||
public long Db_text_max() {return db_text_max;} private long db_text_max = (long)3000 * Io_mgr.Len_mb;
|
||||
public long Db_categorylinks_max() {return db_categorylinks_max;} private long db_categorylinks_max = (long)3600 * Io_mgr.Len_mb;
|
||||
public long Db_wikidata_max() {return db_wikidata_max;} private long db_wikidata_max = (long)3600 * Io_mgr.Len_mb;
|
||||
public byte Wiki_storage_type() {return wiki_storage_type;} private byte wiki_storage_type = Wiki_storage_type_sqlite;
|
||||
public boolean Wiki_storage_type_is_sql() {return wiki_storage_type == Wiki_storage_type_sqlite;}
|
||||
public String Db_ns_map() {return db_ns_map;} private String db_ns_map = "Template~Module";
|
||||
public boolean Css_wiki_update() {return css_wiki_update;} private boolean css_wiki_update = true;
|
||||
public boolean Css_commons_download() {return css_commons_download;} private boolean css_commons_download = true; // changed from false to true; DATE:2014-10-19
|
||||
public boolean Delete_xml_file() {return delete_xml_file;} private boolean delete_xml_file = true;
|
||||
public byte Search_version() {return search_version;} private byte search_version = gplx.xowa.addons.wikis.searchs.specials.Srch_special_page.Version_2;
|
||||
public boolean Import_bz2_by_stdout() {return import_bz2_by_stdout;} private boolean import_bz2_by_stdout = true;
|
||||
public int Page_rank_iterations() {return page_rank_iteration_max;} private int page_rank_iteration_max = 0;
|
||||
public void Init_by_wiki(Xow_wiki wiki) {
|
||||
wiki.App().Cfg().Bind_many_app(this
|
||||
, Cfg__server_urls, Cfg__download_xowa_commons, Cfg__delete_xml_file
|
||||
, Cfg__custom_wiki_commands, Cfg__bz2__stdout_enabled
|
||||
, Cfg__page_rank__iteration_max
|
||||
);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_server_urls)) return String_.Concat_with_str(",\n", server_urls);
|
||||
else if (ctx.Match(k, Invk_server_urls_)) server_urls = m.ReadStrAryIgnore("v", ",", "\n");
|
||||
else if (ctx.Match(k, Invk_custom_cmds)) return String_.Concat_with_str(",", custom_cmds);
|
||||
else if (ctx.Match(k, Invk_custom_cmds_)) custom_cmds = String_.Ary_filter(m.ReadStrAry("v", ","), Xoi_cmd_mgr.Wiki_cmds_valid);
|
||||
if (ctx.Match(k, Cfg__server_urls)) server_urls = m.ReadStrAryIgnore("v", ",", "\n");
|
||||
else if (ctx.Match(k, Cfg__download_xowa_commons)) css_commons_download = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Cfg__delete_xml_file)) delete_xml_file = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Cfg__custom_wiki_commands)) custom_cmds = String_.Ary_filter(m.ReadStrAry("v", ","), Xoi_cmd_mgr.Wiki_cmds_valid);
|
||||
else if (ctx.Match(k, Cfg__bz2__stdout_enabled)) import_bz2_by_stdout = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Cfg__page_rank__iteration_max)) page_rank_iteration_max = m.ReadInt("v");
|
||||
|
||||
else if (ctx.Match(k, Invk_data_storage_format)) return Io_stream_tid_.Obsolete_to_str(data_storage_format);
|
||||
else if (ctx.Match(k, Invk_data_storage_format_)) data_storage_format = Io_stream_tid_.Obsolete_to_tid(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_data_storage_format_list)) return Options_data_storage_format_list;
|
||||
@@ -49,50 +59,32 @@ public class Xoi_dump_mgr implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_db_wikidata_max_)) db_wikidata_max = m.ReadLong("v") * Io_mgr.Len_mb;
|
||||
else if (ctx.Match(k, Invk_db_ns_map)) return db_ns_map;
|
||||
else if (ctx.Match(k, Invk_db_ns_map_)) db_ns_map = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_wiki_storage_type)) return Wiki_storage_type_str(wiki_storage_type);
|
||||
else if (ctx.Match(k, Invk_wiki_storage_type_)) wiki_storage_type = Wiki_storage_type_parse(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_wiki_storage_type_list)) return Options_storage_type_list;
|
||||
else if (ctx.Match(k, Invk_css_wiki_update)) return Yn.To_str(css_wiki_update);
|
||||
else if (ctx.Match(k, Invk_css_wiki_update_)) css_wiki_update = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_css_commons_download)) return Yn.To_str(css_commons_download);
|
||||
else if (ctx.Match(k, Invk_css_commons_download_)) css_commons_download = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_delete_xml_file)) return Yn.To_str(delete_xml_file);
|
||||
else if (ctx.Match(k, Invk_delete_xml_file_)) delete_xml_file = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_search_version)) return Options_search_version_str(search_version);
|
||||
else if (ctx.Match(k, Invk_search_version_)) search_version = Options_search_version_parse(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_search_version_list)) return Options_search_version_list;
|
||||
else if (ctx.Match(k, Invk_import_bz2_by_stdout)) return Yn.To_str(import_bz2_by_stdout);
|
||||
else if (ctx.Match(k, Invk_import_bz2_by_stdout_)) import_bz2_by_stdout = m.ReadYn("v");
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_server_urls = "server_urls", Invk_server_urls_ = "server_urls_", Invk_custom_cmds = "custom_cmds", Invk_custom_cmds_ = "custom_cmds_"
|
||||
, Invk_data_storage_format = "data_storage_format", Invk_data_storage_format_ = "data_storage_format_", Invk_data_storage_format_list = "data_storage_format_list"
|
||||
private static final String Invk_data_storage_format = "data_storage_format", Invk_data_storage_format_ = "data_storage_format_", Invk_data_storage_format_list = "data_storage_format_list"
|
||||
, Invk_db_text_max = "db_text_max", Invk_db_text_max_ = "db_text_max_", Invk_db_categorylinks_max = "db_categorylinks_max", Invk_db_categorylinks_max_ = "db_categorylinks_max_", Invk_db_wikidata_max = "db_wikidata_max", Invk_db_wikidata_max_ = "db_wikidata_max_"
|
||||
, Invk_db_ns_map = "db_ns_map", Invk_db_ns_map_ = "db_ns_map_"
|
||||
, Invk_wiki_storage_type = "wiki_storage_type", Invk_wiki_storage_type_ = "wiki_storage_type_", Invk_wiki_storage_type_list = "wiki_storage_type_list"
|
||||
, Invk_css_wiki_update = "css_wiki_update", Invk_css_wiki_update_ = "css_wiki_update_"
|
||||
, Invk_css_commons_download = "css_commons_download", Invk_css_commons_download_ = "css_commons_download_"
|
||||
, Invk_delete_xml_file = "delete_xml_file", Invk_delete_xml_file_ = "delete_xml_file_"
|
||||
, Invk_search_version = "search_version", Invk_search_version_ = "search_version_", Invk_search_version_list = "search_version_list"
|
||||
, Invk_import_bz2_by_stdout = "import_bz2_by_stdout", Invk_import_bz2_by_stdout_ = "import_bz2_by_stdout_"
|
||||
, Invk_search_version = "search_version", Invk_search_version_ = "search_version_", Invk_search_version_list = "search_version_list"
|
||||
;
|
||||
private static Keyval[] Options_data_storage_format_list = Keyval_.Ary(Keyval_.new_(".xdat", "text"), Keyval_.new_(".gz", "gzip"), Keyval_.new_(".bz2", "bzip2")); // removed .zip; DATE:2014-05-13; updated aliases; DATE:2014-06-20
|
||||
static final byte Wiki_storage_type_xdat = 1, Wiki_storage_type_sqlite = 2;
|
||||
private static final Keyval[] Options_storage_type_list = Keyval_.Ary(Keyval_.new_("sqlite"), Keyval_.new_("xdat")); // DEPRECATED: Keyval_.new_("xdat"); DATE:2015-03-30
|
||||
public static String Wiki_storage_type_str(byte v) {
|
||||
switch (v) {
|
||||
case Xoi_dump_mgr.Wiki_storage_type_xdat : return "xdat";
|
||||
case Xoi_dump_mgr.Wiki_storage_type_sqlite : return "sqlite";
|
||||
default : throw Err_.new_unhandled(v);
|
||||
}
|
||||
}
|
||||
public static byte Wiki_storage_type_parse(String v) {
|
||||
if (String_.Eq(v, "xdat")) return Xoi_dump_mgr.Wiki_storage_type_xdat;
|
||||
else if (String_.Eq(v, "sqlite")) return Xoi_dump_mgr.Wiki_storage_type_sqlite;
|
||||
else throw Err_.new_unhandled(v);
|
||||
}
|
||||
|
||||
private static final Keyval[] Options_search_version_list = Keyval_.Ary(Keyval_.new_("1"), Keyval_.new_("2"));
|
||||
public static String Options_search_version_str(byte v) {return Byte_.To_str(v);}
|
||||
public static byte Options_search_version_parse(String v) {return Byte_.parse(v);}
|
||||
|
||||
private static final String
|
||||
Cfg__server_urls = "xowa.wiki.import.general.dump_servers"
|
||||
, Cfg__download_xowa_commons = "xowa.wiki.import.general.download_xowa_common"
|
||||
, Cfg__delete_xml_file = "xowa.wiki.import.general.delete_xml_file"
|
||||
, Cfg__custom_wiki_commands = "xowa.wiki.import.general.custom_wiki_commands"
|
||||
, Cfg__bz2__stdout_enabled = "xowa.wiki.import.bz2.stdout_enabled"
|
||||
, Cfg__page_rank__iteration_max = "xowa.wiki.import.page_rank.iteration_max"
|
||||
;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.setups.addons; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.setups.*;
|
||||
public class Xoi_addon_mgr implements Gfo_invk {
|
||||
public Xoi_firefox_installer Firefox() {return firefox;} private Xoi_firefox_installer firefox = new Xoi_firefox_installer();
|
||||
Xoi_firefox_installer Firefox() {return firefox;} private Xoi_firefox_installer firefox = new Xoi_firefox_installer();
|
||||
public void Init_by_app(Xoae_app app) {
|
||||
firefox.Init_by_app(app);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class Xoi_firefox_installer implements Gfo_invk {
|
||||
trg_xpi_package = trg_xpi.OwnerDir().GenSubDir("package");
|
||||
Xoa_fsys_eval cmd_eval = app.Url_cmd_eval();
|
||||
Process_adp.ini_(this, app.Usr_dlg(), program, cmd_eval, Process_adp.Run_mode_async, 0, "firefox", "\"~{url}\"", "url");
|
||||
app.Cfg().Bind_many_app(this, Cfg__firefox_cmd);
|
||||
}
|
||||
public void Install_via_process() {
|
||||
Generate();
|
||||
@@ -57,9 +58,11 @@ public class Xoi_firefox_installer implements Gfo_invk {
|
||||
+ String_.Mid(src, end);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_program)) return program;
|
||||
if (ctx.Match(k, Invk_install)) Install_via_process();
|
||||
else if (ctx.Match(k, Cfg__firefox_cmd)) gplx.xowa.apps.progs.Xoa_prog_mgr.Init_cmd(m.ReadStr("v"), program);
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_program = "program", Invk_install = "install";
|
||||
} private static final String Invk_install = "install";
|
||||
private static final String Cfg__firefox_cmd = "xowa.addon.xowa_viewer.firefox";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +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.bldrs.wms; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.xowa.apps.wms.apis.*; import gplx.xowa.wikis.*;
|
||||
public class Xoa_wmf_mgr implements Gfo_invk {
|
||||
private final Xoae_wiki_mgr wiki_mgr;
|
||||
public Xoa_wmf_mgr(Gfo_usr_dlg usr_dlg, Xoae_wiki_mgr wiki_mgr) {
|
||||
this.wiki_mgr = wiki_mgr;
|
||||
}
|
||||
public boolean Enabled() {return enabled;} private boolean enabled = true; // default to true; DATE:2015-01-05
|
||||
public void Enabled_(boolean v) {
|
||||
enabled = v;
|
||||
int len = wiki_mgr.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xowe_wiki wiki = wiki_mgr.Get_at_or_null(i);
|
||||
wiki.File_mgr().Cfg_download().Enabled_(v);
|
||||
}
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk_enabled_)) Enabled_(m.ReadYn("v"));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_enabled = "enabled", Invk_enabled_ = "enabled_";
|
||||
}
|
||||
Reference in New Issue
Block a user