mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.10.3.1
This commit is contained in:
@@ -17,20 +17,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.ios.*; import gplx.core.net.*;
|
||||
import gplx.langs.jsons.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.metas.*; import gplx.xowa.apis.*;
|
||||
import gplx.langs.jsons.*; import gplx.langs.htmls.encoders.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.site_cfgs.*; import gplx.xowa.apps.metas.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.gfs.*;
|
||||
import gplx.xowa.bldrs.css.*;
|
||||
import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.langs.htmls.encoders.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wms.*;
|
||||
import gplx.xowa.html.hrefs.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.html.js.*; import gplx.xowa.html.bridges.*;
|
||||
import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.htmls.js.*; import gplx.xowa.htmls.bridges.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.xwikis.parsers.*; import gplx.xowa.wikis.xwikis.sitelinks.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.bldrs.wms.*;
|
||||
import gplx.xowa.users.*;
|
||||
public interface Xoa_app {
|
||||
Xoa_app_type App_type();
|
||||
public interface Xoa_app extends GfoInvkAble {
|
||||
boolean Tid_is_edit();
|
||||
Xoa_app_mode Mode();
|
||||
Xoapi_root Api_root();
|
||||
Xoa_fsys_mgr Fsys_mgr();
|
||||
Xoa_wiki_mgr Wiki_mgri();
|
||||
Xoa_lang_mgr Lang_mgr();
|
||||
Xoa_gfs_mgr Gfs_mgr();
|
||||
Xof_cache_mgr File__cache_mgr();
|
||||
Xof_img_mgr File__img_mgr();
|
||||
Io_download_fmt File__download_fmt();
|
||||
@@ -39,14 +43,17 @@ public interface Xoa_app {
|
||||
Xoh_lnki_bldr Html__lnki_bldr();
|
||||
Xoa_css_extractor Html__css_installer();
|
||||
Xoh_bridge_mgr Html__bridge_mgr();
|
||||
Xoa_meta_mgr Meta_mgr();
|
||||
Xou_user User();
|
||||
Xowmf_mgr Wmf_mgr();
|
||||
boolean Xwiki_mgr__missing(byte[] domain);
|
||||
Xoa_sitelink_mgr Xwiki_mgr__sitelink_mgr();
|
||||
Xow_xwiki_itm_parser Xwiki_mgr__itm_parser();
|
||||
boolean Bldr__running(); void Bldr__running_(boolean v);
|
||||
Gfo_usr_dlg Usr_dlg();
|
||||
Bry_bfr_mkr Utl__bfr_mkr();
|
||||
Url_encoder_mgr Utl__encoder_mgr();
|
||||
Json_parser Utl__json_parser();
|
||||
Gfo_inet_conn Utl__inet_conn();
|
||||
Xoa_meta_mgr Meta_mgr();
|
||||
Xoa_site_cfg_mgr Site_cfg_mgr();
|
||||
}
|
||||
|
||||
@@ -16,232 +16,37 @@ 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; import gplx.*;
|
||||
import gplx.core.consoles.*; import gplx.dbs.*; import gplx.ios.*; import gplx.gfui.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.gfss.*; import gplx.xowa.langs.*; import gplx.xowa.users.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.html.hdumps.*; import gplx.xowa.html.hdumps.core.*;
|
||||
import gplx.xowa.gui.views.boots.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.langs.htmls.encoders.*;
|
||||
import gplx.xowa.guis.views.boots.*;
|
||||
import gplx.xowa.apps.boots.*; import gplx.xowa.apps.gfs.*;
|
||||
public class Xoa_app_ {
|
||||
public static void Run(String... args) {
|
||||
Xoa_cmd_arg_mgr arg_mgr = Xoa_cmd_arg_mgr.new_();
|
||||
try {
|
||||
Xoa_app_boot_mgr boot_mgr = new Xoa_app_boot_mgr();
|
||||
boot_mgr.Run(args);
|
||||
Xoa_boot_mgr boot_mgr = new Xoa_boot_mgr();
|
||||
boot_mgr.Run(args, arg_mgr);
|
||||
} catch (Error e) {
|
||||
String err_text = e.toString();
|
||||
String err_details = String_.Concat_lines_nl_skip_last
|
||||
( "OS: " + Op_sys.Cur().Os_name()
|
||||
, "Java: " + Env_.Env_prop__java_version() + " (" + Op_sys.Cur().Bitness_str() + " bit)"
|
||||
, "Java path: " + Env_.Env_prop("java.home")
|
||||
, "XOWA: " + Version
|
||||
, "XOWA path: " + Env_.AppUrl().Raw()
|
||||
, ""
|
||||
, "Error: " + err_text
|
||||
, "Stack: " + Err_.Trace_lang(e)
|
||||
);
|
||||
String full_msg = String_.Concat_lines_nl_skip_last
|
||||
( "Sorry! XOWA failed to run!"
|
||||
, ""
|
||||
, "Please check the TROUBLESHOOTING section in the readme.txt for known issues."
|
||||
, ""
|
||||
, "You can also open an issue or send an email with the data below."
|
||||
, ""
|
||||
, "Thanks!"
|
||||
, ""
|
||||
, "----"
|
||||
, err_details
|
||||
);
|
||||
if (Op_sys.Cur().Tid_is_osx())
|
||||
Console_adp__sys.I.Write_str(err_text);
|
||||
if (arg_mgr.App_type().Tid_is_gui())
|
||||
Xog_error_win.Run(Err_.Message_lang_error(e), Err_.Trace_lang(e));
|
||||
else
|
||||
new Xog_error_win(new Xog_error_data(full_msg, err_details, err_text));
|
||||
Gfo_usr_dlg_.I.Log_many("", "", err_details);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final String Version = "2.9.4.1";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Op_sys_str;
|
||||
public static String User_agent = "";
|
||||
public static final String Name = "xowa";
|
||||
public static final String Version = "2.10.3.1";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Op_sys_str;
|
||||
public static String User_agent = "";
|
||||
public static final Gfo_msg_grp Nde = Gfo_msg_grp_.prj_(Name);
|
||||
public static Gfo_usr_dlg Usr_dlg() {return usr_dlg;} public static void Usr_dlg_(Gfo_usr_dlg v) {usr_dlg = v;} private static Gfo_usr_dlg usr_dlg;
|
||||
public static Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private static final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public static Url_encoder_mgr Utl__encoder_mgr() {return utl__encoder_mgr;} private static final Url_encoder_mgr utl__encoder_mgr = new Url_encoder_mgr();
|
||||
public static Io_stream_zip_mgr Utl__zip_mgr() {return utl__zip_mgr;} private static final Io_stream_zip_mgr utl__zip_mgr = new Io_stream_zip_mgr();
|
||||
public static Xoa_gfs_mgr Gfs_mgr() {return gfs_mgr;} public static void Gfs_mgr_(Xoa_gfs_mgr v) {gfs_mgr = v;} private static Xoa_gfs_mgr gfs_mgr;
|
||||
public static Gfo_usr_dlg usr_dlg_console_() {
|
||||
Gfo_usr_dlg rv = new Gfo_usr_dlg_base(new Gfo_usr_dlg__log_base(), Gfo_usr_dlg__gui_.Console);
|
||||
rv.Log_wkr().Queue_enabled_(true);
|
||||
return rv;
|
||||
}
|
||||
public static Gfo_usr_dlg Usr_dlg() {return usr_dlg;} public static void Usr_dlg_(Gfo_usr_dlg v) {usr_dlg = v;} private static Gfo_usr_dlg usr_dlg;
|
||||
public static Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private static final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public static Url_encoder_mgr Utl__encoder_mgr() {return utl__encoder_mgr;} private static final Url_encoder_mgr utl__encoder_mgr = new Url_encoder_mgr();
|
||||
public static Io_stream_zip_mgr Utl__zip_mgr() {return utl__zip_mgr;} private static final Io_stream_zip_mgr utl__zip_mgr = new Io_stream_zip_mgr();
|
||||
public static Xoa_gfs_mgr Gfs_mgr() {return gfs_mgr;} public static void Gfs_mgr_(Xoa_gfs_mgr v) {gfs_mgr = v;} private static Xoa_gfs_mgr gfs_mgr;
|
||||
}
|
||||
class Xoa_app_boot_mgr {
|
||||
private Gfo_usr_dlg usr_dlg; private Gfo_usr_dlg__log log_wtr; private String chkpoint = "null";
|
||||
public void Run(String[] args) {
|
||||
try {
|
||||
if (!Init_env(args)) return;
|
||||
App_cmd_mgr args_mgr = Init_args_mgr(args); if (args_mgr == null) return;
|
||||
Run_app(args_mgr);
|
||||
}
|
||||
catch (Exception e) {
|
||||
String err_str = Err_.Message_gplx_full(e);
|
||||
log_wtr.Log_to_err(err_str);
|
||||
Console_adp__sys.I.Write_str_w_nl(err_str);
|
||||
if (log_wtr.Log_dir() == null) log_wtr.Log_dir_(Env_.AppUrl().OwnerDir().GenSubFil("xowa.log"));
|
||||
log_wtr.Queue_enabled_(false);
|
||||
}
|
||||
}
|
||||
private boolean Init_env(String[] args) {
|
||||
Gfo_usr_dlg_.I = usr_dlg = Xoa_app_.usr_dlg_console_();
|
||||
log_wtr = usr_dlg.Log_wkr(); log_wtr.Log_to_session_fmt("env.init: version=~{0}", Xoa_app_.Version);
|
||||
GfuiEnv_.Init_swt(args, Xoa_app_.class);
|
||||
Io_url jar_url = Env_.AppUrl();
|
||||
Xoa_app_.Build_date = Io_mgr.I.QueryFil(jar_url).ModifiedTime().XtoUtc().XtoStr_fmt("yyyy-MM-dd HH:mm");
|
||||
log_wtr.Log_to_session_fmt("env.init: jar_url=~{0}; build_date=~{1}", jar_url.NameAndExt(), Xoa_app_.Build_date);
|
||||
log_wtr.Log_to_session_fmt("env.init: op_sys=~{0}", Op_sys.Cur().To_str());
|
||||
chkpoint = "init_env";
|
||||
return true;
|
||||
}
|
||||
private App_cmd_mgr Init_args_mgr(String[] args) {
|
||||
App_cmd_mgr rv = new App_cmd_mgr();
|
||||
try {
|
||||
String hdr = String_.Concat_lines_nl_skip_last
|
||||
( Env_.GenHdr(false, "XOWA", "XOWA: the XOWA Offline Wiki Application\n", "")
|
||||
, String_.Repeat("-", 80)
|
||||
, ""
|
||||
, "version: " + Xoa_app_.Version + "; build date: " + Xoa_app_.Build_date
|
||||
);
|
||||
rv
|
||||
.Fmt_hdr_(hdr)
|
||||
.Expd_add_many
|
||||
( App_cmd_arg.opt_("root_dir").Example_url_("C:\\xowa").Note_("root directory for xowa; defaults to current directory of xowa.jar")
|
||||
, App_cmd_arg.opt_("user_dir").Example_url_("C:\\xowa\\user\\" + Xoue_user.Key_xowa_user).Note_("directory for user_data; defaults to '/xowa/user/" + Xoue_user.Key_xowa_user + "'")
|
||||
, App_cmd_arg.opt_("wiki_dir").Example_url_("C:\\xowa\\wiki\\").Note_("directory for wikis; defaults to '/xowa/wiki/'")
|
||||
, App_cmd_arg.opt_("bin_dir_name").Example_("windows").Note_("platform-dependent directory name inside /xowa/bin/; valid values are 'linux', 'macosx', 'windows', 'linux_64', 'macosx_64', 'windows_64'; defaults to detected version")
|
||||
, App_cmd_arg.opt_("app_mode").Example_("gui").Note_("type of app to run; valid values are 'gui', 'cmd', 'server', 'http_server'; defaults to 'gui'")
|
||||
, App_cmd_arg.opt_("cmd_file").Example_url_("C:\\xowa\\bin\\any\\xowa\\cfg\\app\\xowa.gfs").Note_("file_path of script to execute; defaults to 'xowa.gfs'")
|
||||
, App_cmd_arg.opt_("cmd_text").Example_("\"app.shell.fetch_page('en.wikipedia.org/wiki/Earth', 'html');\"").Note_("script to run; runs after cmd_file; does nothing if empty; default is empty.\nCurrently a useful cmd is to do 'java -jar xowa_your_platform.jar --app_mode cmd --show_license n --show_args n --cmd_text \"app.shell.fetch_page('en.wikipedia.org/wiki/Earth' 'html');\"'. This will output the page's html to the console. You can also change 'html' to 'wiki' to get the wikitext.")
|
||||
, App_cmd_arg.opt_("url").Example_("en.wikipedia.org/wiki/Earth").Note_("url to be shown when xowa first launches; default is home/wiki/Main_Page")
|
||||
, App_cmd_arg.opt_("server_port_recv").Example_("55000").Note_("applies to --app_mode server; port where xowa server will receive messages; clients should send messages to this port")
|
||||
, App_cmd_arg.opt_("server_port_send").Example_("55001").Note_("applies to --app_mode server; port where xowa server will send messages; clients should listen for messages from this port")
|
||||
, App_cmd_arg.opt_("http_server_port").Example_("8080").Note_("applies to --app_mode http_server; port used by http_server; default is 8080")
|
||||
, App_cmd_arg.opt_("http_server_home").Example_("home/wiki/Main_Page").Note_("applies to --app_mode http_server; default home page for root address. EX: navigating to localhost:8080 will navigate to localhost:8080/home/wiki/Main_Page")
|
||||
, App_cmd_arg.opt_("http_server.max_clients").Example_("15").Note_("applies to --app_mode http_server; limits maximum number of concurrent connections; default is 0 (no limit)")
|
||||
, App_cmd_arg.opt_("http_server.max_clients_timeout").Example_("50").Note_("applies to --app_mode http_server; time in milliseconds to wait before checking again to see if a connection is free; default is 50 (wait 50 ms)")
|
||||
, App_cmd_arg.sys_header_("show_license").Dflt_(true)
|
||||
, App_cmd_arg.sys_args_("show_args").Dflt_(true)
|
||||
, App_cmd_arg.sys_help_()
|
||||
)
|
||||
; chkpoint = "fmt_hdr";
|
||||
boolean pass = rv.Args_process(args); chkpoint = "args_process";
|
||||
rv.Print_header(usr_dlg); // always call print_header
|
||||
if (!pass) {
|
||||
rv.Print_args(usr_dlg);
|
||||
rv.Print_fail(usr_dlg);
|
||||
rv.Print_help(usr_dlg, Xoa_app_.Name);
|
||||
return null;
|
||||
}
|
||||
if (rv.Args_has_help()) {
|
||||
rv.Print_help(usr_dlg, Xoa_app_.Name);
|
||||
return null;
|
||||
}
|
||||
if (rv.Args_get("show_args").Val_as_bool())
|
||||
rv.Print_args(usr_dlg);
|
||||
} catch (Exception e) {usr_dlg.Warn_many("", "", "args failed: ~{0} ~{1}", chkpoint, Err_.Message_gplx_full(e)); return null;}
|
||||
return rv;
|
||||
}
|
||||
private void Run_app(App_cmd_mgr args_mgr) {
|
||||
boolean app_type_is_gui = false;
|
||||
Xoae_app app = null;
|
||||
try {
|
||||
// init vars
|
||||
Io_url jar_dir = Env_.AppUrl().OwnerDir();
|
||||
Io_url root_dir = args_mgr.Args_get("root_dir").Val_as_url_rel_dir_or(jar_dir, jar_dir);
|
||||
Io_url user_dir = args_mgr.Args_get("user_dir").Val_as_url_rel_dir_or(root_dir.GenSubDir("user"), root_dir.GenSubDir_nest("user", Xoue_user.Key_xowa_user));
|
||||
Io_url wiki_dir = args_mgr.Args_get("wiki_dir").Val_as_url_rel_dir_or(root_dir.GenSubDir("wiki"), root_dir.GenSubDir("wiki"));
|
||||
Io_url cmd_file = args_mgr.Args_get("cmd_file").Val_as_url_rel_fil_or(jar_dir, root_dir.GenSubFil_nest("bin", "any", "xowa", "cfg" ,"app", "xowa.gfs"));
|
||||
String app_mode = args_mgr.Args_get("app_mode").Val_as_str_or("gui");
|
||||
String launch_url = args_mgr.Args_get("url").Val_as_str_or(null);
|
||||
int server_port_recv = args_mgr.Args_get("server_port_recv").Val_as_int_or(55000);
|
||||
int server_port_send = args_mgr.Args_get("server_port_send").Val_as_int_or(55001);
|
||||
int http_server_port = args_mgr.Args_get("http_server_port").Val_as_int_or(8080);
|
||||
String http_server_home = args_mgr.Args_get("http_server_home").Val_as_str_or("home/wiki/Main_Page");
|
||||
int http_server_max_clients = args_mgr.Args_get("http_server.max_clients").Val_as_int_or(0);
|
||||
int http_server_max_clients_timeout = args_mgr.Args_get("http_server.max_clients_timeout").Val_as_int_or(50);
|
||||
Xoa_app_.Op_sys_str = args_mgr.Args_get("bin_dir_name").Val_as_str_or(Bin_dir_name());
|
||||
Xoa_app_.User_agent = String_.Format("XOWA/{0} ({1}) [gnosygnu@gmail.com]", Xoa_app_.Version, Xoa_app_.Op_sys_str);
|
||||
String cmd_text = args_mgr.Args_get("cmd_text").Val_as_str_or(null);
|
||||
Xoa_app_type app_type = Xoa_app_type.parse(app_mode);
|
||||
app_type_is_gui = app_type.Uid_is_gui();
|
||||
Xog_splash_win splash_win = new Xog_splash_win(app_type_is_gui);
|
||||
|
||||
// init app
|
||||
Db_conn_bldr.I.Reg_default_sqlite();
|
||||
app = new Xoae_app(usr_dlg, app_type, root_dir, wiki_dir, root_dir.GenSubDir("file"), user_dir, root_dir.GenSubDir_nest("user", "anonymous", "wiki"), Xoa_app_.Op_sys_str);
|
||||
usr_dlg.Log_wkr().Queue_enabled_(false); log_wtr.Log_to_session_fmt("app.init");
|
||||
try {
|
||||
app.Sys_cfg().Lang_(System_lang());
|
||||
if (launch_url != null)
|
||||
app.Api_root().App().Startup().Tabs().Manual_(launch_url);
|
||||
app.Tcp_server().Rdr_port_(server_port_recv).Wtr_port_(server_port_send);
|
||||
gplx.xowa.servers.http.Http_server_mgr server_mgr = app.Http_server();
|
||||
server_mgr.Port_(http_server_port);
|
||||
server_mgr.Home_(http_server_home);
|
||||
server_mgr.Wkr_pool().Init(http_server_max_clients, http_server_max_clients_timeout);
|
||||
app.Init_by_app(); chkpoint = "init_gfs";
|
||||
}
|
||||
catch (Exception e) {usr_dlg.Warn_many("", "", "app init failed: ~{0} ~{1}", chkpoint, 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._.Check(app.Usere().Fsys_mgr().App_data_cfg_user_fil());
|
||||
try {app.Gfs_mgr().Run_url(cmd_file); chkpoint = "run_url";}
|
||||
catch (Exception e) {
|
||||
usr_dlg.Warn_many("", "", "script file failed: ~{0} ~{1} ~{2}", chkpoint, cmd_file.Raw(), Err_.Message_gplx_full(e));
|
||||
if (app_type_is_gui)
|
||||
GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));
|
||||
}
|
||||
gplx.xowa.apps.setups.Xoa_setup_mgr.Delete_old_files(app);
|
||||
|
||||
// launch
|
||||
app.Launch(); chkpoint = "launch";
|
||||
if (app_type.Uid_is_tcp())
|
||||
app.Tcp_server().Run();
|
||||
else if (app_type.Uid_is_http())
|
||||
app.Http_server().Run();
|
||||
else {
|
||||
if (cmd_text != null) {
|
||||
gplx.xowa.servers.Gxw_html_server.Init_gui_for_server(app, null); // NOTE: must init kit else "app.shell.fetch_page" will fail; DATE:2015-04-30
|
||||
Console_adp__sys.I.Write_str_w_nl_utf8(Object_.Xto_str_strict_or_empty(app.Gfs_mgr().Run_str(cmd_text)));
|
||||
}
|
||||
if (app_type_is_gui) {
|
||||
app.Gui_mgr().Run(splash_win); chkpoint = "run";
|
||||
}
|
||||
else // teardown app, else lua will keep process running
|
||||
if (gplx.xowa.xtns.scribunto.Scrib_core.Core() != null) gplx.xowa.xtns.scribunto.Scrib_core.Core().Term();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {usr_dlg.Warn_many("", "", "app launch failed: ~{0} ~{1}", chkpoint, Err_.Message_gplx_full(e));}
|
||||
finally {
|
||||
if (app != null && app_type_is_gui) // only cancel if app_type_is_gui is true; (force cmd_line to end process)
|
||||
app.Setup_mgr().Cmd_mgr().Canceled_y_();
|
||||
}
|
||||
}
|
||||
private static String Bin_dir_name() {
|
||||
String rv = "";
|
||||
Op_sys op_sys = Op_sys.Cur();
|
||||
switch (op_sys.Tid()) {
|
||||
case Op_sys.Tid_lnx: rv = "linux"; break;
|
||||
case Op_sys.Tid_wnt: rv = "windows"; break;
|
||||
case Op_sys.Tid_osx: rv = "macosx"; break;
|
||||
default: throw Err_.new_unhandled("unknown platform " + Op_sys.Cur());
|
||||
}
|
||||
if (op_sys.Bitness() == Op_sys.Bitness_64) rv += "_64";
|
||||
return rv;
|
||||
}
|
||||
private static byte[] System_lang() {
|
||||
String lang_code = Env_.Env_prop__user_language();
|
||||
byte[] lang_code_bry = Bry_.new_a7(lang_code);
|
||||
Xol_lang_itm lang_itm = Xol_lang_itm_.Get_by_key(lang_code_bry);
|
||||
return lang_itm == null ? Xol_lang_.Key_en : lang_itm.Key();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,33 +19,33 @@ package gplx.xowa; import gplx.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.bldrs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.files.exts.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_app_fxt {
|
||||
public static Xoae_app app_() {
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
Db_conn_bldr.I.Reg_default_mem();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
Db_conn_bldr.Instance.Reg_default_mem();
|
||||
return app_("linux", Io_url_.mem_dir_("mem/xowa/"));
|
||||
}
|
||||
public static Xoae_app app_(String op_sys, Io_url root_dir) {
|
||||
Io_url user_dir = root_dir.GenSubDir_nest("user", "test_user");
|
||||
Gfo_usr_dlg__log_base._.Log_dir_(user_dir.GenSubDir_nest("tmp", "current"));
|
||||
Xoae_app app = new Xoae_app(Gfo_usr_dlg_.Test(), Xoa_app_type.Itm_cmd, root_dir, root_dir.GenSubDir("wiki"), root_dir.GenSubDir("file"), user_dir, root_dir.GenSubDir_nest("user", "anonymous", "wiki"), op_sys);
|
||||
Gfo_usr_dlg__log_base.Instance.Log_dir_(user_dir.GenSubDir_nest("tmp", "current"));
|
||||
Xoae_app app = new Xoae_app(Gfo_usr_dlg_.Test(), Xoa_app_mode.Itm_cmd, root_dir, root_dir.GenSubDir("wiki"), root_dir.GenSubDir("file"), user_dir, root_dir.GenSubDir_nest("user", "anonymous", "wiki"), op_sys);
|
||||
app.Setup_mgr().Dump_mgr().Data_storage_format_(gplx.ios.Io_stream_.Tid_raw); // TEST: set data_storage_format to file, else bldr tests will fails (expects plain text)
|
||||
GfsCore._.Clear(); // NOTE: must clear
|
||||
GfsCore._.AddCmd(app, Xoae_app.Invk_app); // NOTE: must add app to GfsCore; app.Gfs_mgr() always adds current app to GfsCore; note this causes old test to leave behind GfsCore for new test
|
||||
GfsCore._.AddCmd(app, Xoae_app.Invk_xowa); // add alias for app; DATE:2014-06-09
|
||||
GfsCore.Instance.Clear(); // NOTE: must clear
|
||||
GfsCore.Instance.AddCmd(app, Xoae_app.Invk_app); // NOTE: must add app to GfsCore; app.Gfs_mgr() always adds current app to GfsCore; note this causes old test to leave behind GfsCore for new test
|
||||
GfsCore.Instance.AddCmd(app, Xoae_app.Invk_xowa); // add alias for app; DATE:2014-06-09
|
||||
return app;
|
||||
}
|
||||
public static Xowe_wiki wiki_nonwmf(Xoae_app app, String key) {
|
||||
Xol_lang lang = new Xol_lang(app.Lang_mgr(), Xol_lang_.Key_en).Kwd_mgr__strx_(true);
|
||||
Xol_lang_.Lang_init(lang);
|
||||
Xol_lang_itm lang = new Xol_lang_itm(app.Lang_mgr(), Xol_lang_itm_.Key_en).Kwd_mgr__strx_(true);
|
||||
Xol_lang_itm_.Lang_init(lang);
|
||||
return wiki_(app, key, lang);
|
||||
}
|
||||
public static Xowe_wiki wiki_tst_(Xoae_app app) {return wiki_(app, "en.wikipedia.org");}
|
||||
public static Xowe_wiki wiki_(Xoae_app app, String key) {return wiki_(app, key, app.Lang_mgr().Lang_en());}
|
||||
public static Xowe_wiki wiki_(Xoae_app app, String key, Xol_lang lang) {
|
||||
public static Xowe_wiki wiki_(Xoae_app app, String key, Xol_lang_itm lang) {
|
||||
Io_url wiki_dir = app.Fsys_mgr().Wiki_dir().GenSubDir(key);
|
||||
Xowe_wiki rv = new Xowe_wiki(app, lang, Xow_ns_mgr_.default_(lang.Case_mgr()), Xow_domain_itm_.parse(Bry_.new_u8(key)), wiki_dir);
|
||||
rv.File_mgr().Meta_mgr().Depth_(2); // TEST: written for 2 depth
|
||||
@@ -71,7 +71,7 @@ public class Xoa_app_fxt {
|
||||
wiki.File_mgr().Repo_mgr().Add_repo(Bry_.new_a7("src:comm"), Bry_.new_a7("trg:comm"));
|
||||
}
|
||||
public static void Init_gui(Xoae_app app, Xowe_wiki wiki) {
|
||||
app.Gui_mgr().Browser_win().Init_by_kit(gplx.gfui.Mem_kit._);
|
||||
app.Gui_mgr().Browser_win().Init_by_kit(gplx.gfui.Mem_kit.Instance);
|
||||
app.Gui_mgr().Browser_win().Tab_mgr().Tabs_new_init(wiki, Xoae_page.Empty);
|
||||
}
|
||||
public static Xob_bldr bldr_(Xoae_app app) {
|
||||
|
||||
@@ -1,30 +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; import gplx.*;
|
||||
public class Xoa_consts {
|
||||
public static final byte[]
|
||||
Nl_bry = new byte[] {Byte_ascii.Nl}
|
||||
, Slash_bry = new byte[] {Byte_ascii.Slash}
|
||||
, Pipe_bry = new byte[] {Byte_ascii.Pipe}
|
||||
, Invk_bgn = new byte[] {Byte_ascii.Curly_bgn, Byte_ascii.Curly_bgn} // "{{"
|
||||
, Invk_end = new byte[] {Byte_ascii.Curly_end, Byte_ascii.Curly_end} // "}}"
|
||||
, Transclude_bgn = new byte[] {Byte_ascii.Curly_bgn, Byte_ascii.Curly_bgn, Byte_ascii.Colon} // "{{:"
|
||||
, Url_relative_prefix = new byte[] {Byte_ascii.Slash, Byte_ascii.Slash} // "//"
|
||||
, Url_wiki_intermediary = Bry_.new_a7("/wiki/")
|
||||
;
|
||||
}
|
||||
@@ -16,7 +16,7 @@ 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; import gplx.*;
|
||||
import gplx.xowa.pages.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
public interface Xoa_page {
|
||||
Xow_wiki Wiki();
|
||||
Xoa_url Url();
|
||||
|
||||
@@ -17,20 +17,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.core.net.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.bldrs.infos.*;
|
||||
public class Xoa_test_ {
|
||||
public static boolean Db_skip() {return Bool_.N;}
|
||||
public static boolean Db_is_mem_dflt() {return Bool_.Y;}
|
||||
public static void Db_init(Io_url sqlite_url) {Db_init(Db_is_mem_dflt(), sqlite_url);}
|
||||
public static void Db__init__mem(Xowe_wiki wiki) {
|
||||
Db__init__mem();
|
||||
wiki.Db_mgr_create_as_sql();
|
||||
wiki.Data__core_mgr().Init_by_make(Xowd_core_db_props.Test, Xob_info_session.Test);
|
||||
}
|
||||
public static void Db__init__mem() {
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
Db_conn_bldr.Instance.Reg_default_mem();
|
||||
}
|
||||
public static void Db_init(boolean db_is_mem, Io_url sqlite_url) {
|
||||
if (db_is_mem) {
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
Db_conn_bldr.I.Reg_default_mem();
|
||||
}
|
||||
if (db_is_mem)
|
||||
Db__init__mem();
|
||||
else {
|
||||
Io_mgr.I.DeleteDirDeep(sqlite_url);
|
||||
Db_conn_bldr.I.Reg_default_sqlite();
|
||||
Io_mgr.Instance.DeleteDirDeep(sqlite_url);
|
||||
Db_conn_bldr.Instance.Reg_default_sqlite();
|
||||
}
|
||||
}
|
||||
public static void Inet__init() {
|
||||
Gfo_inet_conn_.new_prototype_(Gfo_inet_conn_.Tid__mem__hash);
|
||||
}
|
||||
public static Io_url Url_root() {return Io_url_.Usr().GenSubDir_nest("xowa", "dev", "tst", "400_xowa");}
|
||||
public static Io_url Url_wiki_enwiki() {return Url_root().GenSubDir_nest("root", "wiki", "en.wikipedia.org");}
|
||||
public static Io_url Url_file_enwiki() {return Url_root().GenSubDir_nest("root", "file", "en.wikipedia.org");}
|
||||
|
||||
@@ -17,8 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.langs.htmls.encoders.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.miscs.*; import gplx.xowa.wikis.ttls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.MW: Ttl.php|secureAndSplit;
|
||||
public Xow_ns Ns() {return ns;} private Xow_ns ns;
|
||||
public boolean ForceLiteralLink() {return forceLiteralLink;} private boolean forceLiteralLink;
|
||||
@@ -51,16 +52,16 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
public byte[] Anch_txt() {return anch_bgn == -1 ? Bry_.Empty : Bry_.Mid(full_txt, anch_bgn, full_txt.length);}
|
||||
public byte[] Talk_txt() {return ns.Id_talk() ? Full_txt() : Bry_.Add(tors_txt, Page_txt());}
|
||||
public byte[] Subj_txt() {return ns.Id_subj() ? Full_txt() : Bry_.Add(tors_txt, Page_txt());}
|
||||
public byte[] Full_url() {return Xoa_url_encoder._.Encode(full_txt);}
|
||||
public byte[] Full_url() {return Xoa_url_encoder.Instance.Encode(full_txt);}
|
||||
public String Full_db_as_str() {return String_.new_u8(Full_db());}
|
||||
public byte[] Full_db() {return ns.Gen_ttl(this.Page_db());}
|
||||
public byte[] Page_url() {return Xoa_url_encoder._.Encode(this.Page_txt());}
|
||||
public byte[] Leaf_url() {return Xoa_url_encoder._.Encode(this.Leaf_txt());}
|
||||
public byte[] Base_url() {return Xoa_url_encoder._.Encode(this.Base_txt());}
|
||||
public byte[] Page_url() {return Xoa_url_encoder.Instance.Encode(this.Page_txt());}
|
||||
public byte[] Leaf_url() {return Xoa_url_encoder.Instance.Encode(this.Leaf_txt());}
|
||||
public byte[] Base_url() {return Xoa_url_encoder.Instance.Encode(this.Base_txt());}
|
||||
public byte[] Root_txt() {return root_bgn == -1 ? Page_txt() : Bry_.Mid(full_txt, page_bgn, root_bgn - 1);}
|
||||
public byte[] Rest_txt() {return root_bgn == -1 ? Page_txt() : Bry_.Mid(full_txt, root_bgn, anch_bgn == -1 ? full_txt.length : anch_bgn - 1);}
|
||||
public byte[] Talk_url() {return Xoa_url_encoder._.Encode(this.Talk_txt());}
|
||||
public byte[] Subj_url() {return Xoa_url_encoder._.Encode(this.Subj_txt());}
|
||||
public byte[] Talk_url() {return Xoa_url_encoder.Instance.Encode(this.Talk_txt());}
|
||||
public byte[] Subj_url() {return Xoa_url_encoder.Instance.Encode(this.Subj_txt());}
|
||||
public int Qarg_bgn() {return qarg_bgn;} private int qarg_bgn = -1;
|
||||
public byte[] Qarg_txt() {return this.Qarg_bgn() == -1 ? null : Bry_.Mid(full_txt, this.Qarg_bgn(), full_txt.length);}
|
||||
public byte[] Base_txt_wo_qarg() {
|
||||
@@ -281,7 +282,7 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
anchor_encoder_bfr = Bry_bfr.reset_(32);
|
||||
}
|
||||
anchor_encoder.Encode(anchor_encoder_bfr, src, cur, cur + 1);
|
||||
b_ary = anchor_encoder_bfr.Xto_bry_and_clear();
|
||||
b_ary = anchor_encoder_bfr.To_bry_and_clear();
|
||||
match_pos = cur + 1;
|
||||
}
|
||||
break;
|
||||
@@ -294,7 +295,7 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
anchor_encoder_bfr = Bry_bfr.reset_(32);
|
||||
}
|
||||
anchor_encoder.Encode(anchor_encoder_bfr, src, cur, cur + 1);
|
||||
b_ary = anchor_encoder_bfr.Xto_bry_and_clear();
|
||||
b_ary = anchor_encoder_bfr.To_bry_and_clear();
|
||||
match_pos = cur + 1;
|
||||
}
|
||||
else {
|
||||
@@ -338,7 +339,7 @@ public class Xoa_ttl { // PAGE:en.w:http://en.wikipedia.org/wiki/Help:Link; REF.
|
||||
msg_log.Add_itm_none(Xop_ttl_log.Ttl_is_ns_only, src, bgn, end);
|
||||
return false;
|
||||
}
|
||||
full_txt = bfr.Xto_bry_and_clear();
|
||||
full_txt = bfr.To_bry_and_clear();
|
||||
if ( ns.Case_match() == Xow_ns_case_.Id_1st
|
||||
&& wik_bgn == -1 ) { // do not check case if xwiki; EX: "fr:" would have a wik_bgn of 0 (and a wik_end of 3); "A" (and any non-xwiki ttl) would have a wik_bgn == -1
|
||||
byte char_1st = full_txt[page_bgn];
|
||||
|
||||
@@ -16,8 +16,8 @@ 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; import gplx.*;
|
||||
import gplx.core.net.*; import gplx.xowa.urls.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
import gplx.core.net.*; import gplx.xowa.apps.urls.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
public class Xoa_url {
|
||||
public int Tid() {return tid;} private int tid;
|
||||
public byte[] Raw() {return raw;} private byte[] raw = Bry_.Empty;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Xoa_url_ {
|
||||
}
|
||||
}
|
||||
public static void Invalid_warn(String url) {Xoa_app_.Usr_dlg().Plog_many("", "", "invalid url; url=~{0}", url);}
|
||||
public static String Main_page__home_str = gplx.xowa.wikis.domains.Xow_domain_itm_.Str__home + gplx.xowa.html.hrefs.Xoh_href_.Str__wiki + gplx.xowa.Xoa_page_.Main_page_str; // EX:home/wiki/Main_Page
|
||||
public static String Main_page__home_str = gplx.xowa.wikis.domains.Xow_domain_itm_.Str__home + gplx.xowa.htmls.hrefs.Xoh_href_.Str__wiki + gplx.xowa.Xoa_page_.Main_page_str; // EX:home/wiki/Main_Page
|
||||
public static final byte[]
|
||||
Qarg__redirect = Bry_.new_a7("redirect")
|
||||
, Qarg__redirect__yes = Bry_.new_a7("yes")
|
||||
|
||||
@@ -17,21 +17,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.core.btries.*; import gplx.core.flds.*; import gplx.ios.*; import gplx.core.threads.*; import gplx.langs.jsons.*; import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.caches.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apis.*; import gplx.xowa.apps.metas.*; import gplx.langs.htmls.encoders.*; import gplx.xowa.apps.progs.*; import gplx.xowa.apps.gfss.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.specials.*; import gplx.xowa.cfgs2.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.site_cfgs.*; import gplx.xowa.apps.caches.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.metas.*; import gplx.langs.htmls.encoders.*; import gplx.xowa.apps.progs.*; import gplx.xowa.apps.gfs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.specials.*; import gplx.xowa.apps.cfgs.old.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.css.*; import gplx.xowa.bldrs.installs.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.users.*; import gplx.xowa.gui.*; import gplx.xowa.cfgs.*; import gplx.xowa.ctgs.*; import gplx.xowa.html.tocs.*; import gplx.xowa.apps.fmtrs.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.html.hrefs.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.html.ns_files.*; import gplx.xowa.html.bridges.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.users.*; import gplx.xowa.guis.*; import gplx.xowa.apps.cfgs.*; import gplx.xowa.wikis.ctgs.*; import gplx.xowa.htmls.tocs.*; import gplx.xowa.apps.fmtrs.*; import gplx.xowa.htmls.*; import gplx.xowa.wikis.xwikis.sitelinks.*; import gplx.xowa.wikis.xwikis.parsers.*;
|
||||
import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.htmls.ns_files.*; import gplx.xowa.htmls.bridges.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.xndes.*;
|
||||
import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.math.*;
|
||||
import gplx.xowa.parsers.utils.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.servers.tcp.*; import gplx.xowa.servers.http.*;
|
||||
import gplx.xowa.wms.*;
|
||||
import gplx.xowa.tdbs.*; import gplx.xowa.tdbs.hives.*;
|
||||
import gplx.xowa.parsers.utils.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.apps.servers.tcp.*; import gplx.xowa.apps.servers.http.*;
|
||||
import gplx.xowa.bldrs.wms.*;
|
||||
import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.tdbs.hives.*; import gplx.xowa.wikis.xwikis.*;
|
||||
public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
public Xoae_app(Gfo_usr_dlg usr_dlg, Xoa_app_type app_type, Io_url root_dir, Io_url wiki_dir, Io_url file_dir, Io_url user_dir, Io_url css_dir, String bin_dir_name) {
|
||||
public Xoae_app(Gfo_usr_dlg usr_dlg, Xoa_app_mode mode, Io_url root_dir, Io_url wiki_dir, Io_url file_dir, Io_url user_dir, Io_url css_dir, String bin_dir_name) {
|
||||
Xoa_app_.Usr_dlg_(usr_dlg);
|
||||
this.app_type = app_type;
|
||||
this.mode = mode;
|
||||
Io_url.Http_file_str_encoder = Xoa_app_.Utl__encoder_mgr().Fsys();
|
||||
fsys_mgr = new Xoa_fsys_mgr(bin_dir_name, root_dir, wiki_dir, file_dir, css_dir);
|
||||
log_wtr = usr_dlg.Log_wkr();
|
||||
@@ -64,8 +64,10 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
html_mgr = new Xoh_html_mgr(this);
|
||||
this.html__lnki_bldr = new Xoh_lnki_bldr(this, html__href_wtr);
|
||||
this.html__bridge_mgr = new Xoh_bridge_mgr(utl__json_parser);
|
||||
this.site_cfg_mgr = new Xoa_site_cfg_mgr(this);
|
||||
}
|
||||
public Xoa_app_type App_type() {return app_type;} private final Xoa_app_type app_type;
|
||||
public boolean Tid_is_edit() {return Bool_.Y;}
|
||||
public Xoa_app_mode Mode() {return mode;} private final Xoa_app_mode mode;
|
||||
public Xoa_fsys_mgr Fsys_mgr() {return fsys_mgr;} private final Xoa_fsys_mgr fsys_mgr;
|
||||
public Xof_cache_mgr File__cache_mgr() {return file_mgr.Cache_mgr();}
|
||||
public Xof_img_mgr File__img_mgr() {return file_mgr.Img_mgr();}
|
||||
@@ -79,10 +81,16 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return Xoa_app_.Utl__bfr_mkr();}
|
||||
public Url_encoder_mgr Utl__encoder_mgr() {return Xoa_app_.Utl__encoder_mgr();}
|
||||
public Json_parser Utl__json_parser() {return utl__json_parser;} private final Json_parser utl__json_parser = new Json_parser();
|
||||
public Gfo_inet_conn Utl__inet_conn() {return inet_conn;} public void Utl__inet_conn_(Gfo_inet_conn v) {this.inet_conn = v;} private Gfo_inet_conn inet_conn = Gfo_inet_conn_.new_http();
|
||||
public Gfo_inet_conn Utl__inet_conn() {return inet_conn;} private final Gfo_inet_conn inet_conn = Gfo_inet_conn_.new_();
|
||||
public Xoa_meta_mgr Meta_mgr() {return meta_mgr;} private final Xoa_meta_mgr meta_mgr;
|
||||
public boolean Bldr__running() {return bldr__running;} public void Bldr__running_(boolean v) {this.bldr__running = v;} private boolean bldr__running;
|
||||
public Xoa_parser_mgr Parser_mgr() {return parser_mgr;} private final Xoa_parser_mgr parser_mgr = new Xoa_parser_mgr();
|
||||
public Xoa_site_cfg_mgr Site_cfg_mgr() {return site_cfg_mgr;} private final Xoa_site_cfg_mgr site_cfg_mgr;
|
||||
public Xoa_sitelink_mgr Xwiki_mgr__sitelink_mgr() {return xwiki_mgr__sitelink_mgr;} private final Xoa_sitelink_mgr xwiki_mgr__sitelink_mgr = new Xoa_sitelink_mgr();
|
||||
public boolean Xwiki_mgr__missing(byte[] wiki_key) {return user.Wiki().Xwiki_mgr().Get_by_key(wiki_key) == null;} // NOTE: only the user_wiki has a full list of all wikis b/c it has xwiki objects; wiki_mgr does not, b/c it has heavier wiki objects which are loaded dynamically;
|
||||
public boolean Xwiki_mgr__exists(byte[] wiki_key) {return user.Wiki().Xwiki_mgr().Get_by_key(wiki_key) != null;}
|
||||
public Xow_xwiki_itm_parser Xwiki_mgr__itm_parser() {return xwiki_mgr__itm_parser;} private final Xow_xwiki_itm_parser xwiki_mgr__itm_parser = new Xow_xwiki_itm_parser();
|
||||
|
||||
|
||||
public Xoae_wiki_mgr Wiki_mgr() {return wiki_mgr;} private Xoae_wiki_mgr wiki_mgr;
|
||||
public Xoa_wiki_mgr Wiki_mgri() {return wiki_mgr;}
|
||||
@@ -105,7 +113,6 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
public Xoa_thread_mgr Thread_mgr() {return thread_mgr;} private Xoa_thread_mgr thread_mgr = new Xoa_thread_mgr();
|
||||
public Xoa_hive_mgr Hive_mgr() {return hive_mgr;} private Xoa_hive_mgr hive_mgr;
|
||||
public Xop_sanitizer Sanitizer() {return sanitizer;} private Xop_sanitizer sanitizer;
|
||||
public Xop_xatr_parser Xatr_parser() {return xatr_parser;} private Xop_xatr_parser xatr_parser = new Xop_xatr_parser();
|
||||
public Xof_math_subst_regy Math_subst_regy() {return math_subst_regy;} private Xof_math_subst_regy math_subst_regy = new Xof_math_subst_regy();
|
||||
public Xoa_prog_mgr Prog_mgr() {return prog_mgr;} private final Xoa_prog_mgr prog_mgr = new Xoa_prog_mgr();
|
||||
public Gfo_async_mgr Async_mgr() {return async_mgr;} private Gfo_async_mgr async_mgr = new Gfo_async_mgr();
|
||||
@@ -120,8 +127,6 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
public Gfo_log_bfr Log_bfr() {return log_bfr;} private Gfo_log_bfr log_bfr = new Gfo_log_bfr();
|
||||
public Xoa_sys_cfg Sys_cfg() {return sys_cfg;} private Xoa_sys_cfg sys_cfg;
|
||||
public Bry_fmtr Tmp_fmtr() {return tmp_fmtr;} Bry_fmtr tmp_fmtr = Bry_fmtr.new_("");
|
||||
public boolean Xwiki_mgr__missing(byte[] wiki_key) {return user.Wiki().Xwiki_mgr().Get_by_key(wiki_key) == null;} // NOTE: only the user_wiki has a full list of all wikis b/c it has xwiki objects; wiki_mgr does not, b/c it has heavier wiki objects which are loaded dynamically;
|
||||
public boolean Xwiki_mgr__exists(byte[] wiki_key) {return user.Wiki().Xwiki_mgr().Get_by_key(wiki_key) != null;}
|
||||
public Xoa_ctg_mgr Ctg_mgr() {return ctg_mgr;} private Xoa_ctg_mgr ctg_mgr = new Xoa_ctg_mgr();
|
||||
public Xoa_fsys_eval Url_cmd_eval() {return url_cmd_eval;} Xoa_fsys_eval url_cmd_eval;
|
||||
public Xoa_cur Cur_redirect() {return cur_redirect;} private Xoa_cur cur_redirect;
|
||||
@@ -132,7 +137,7 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
|
||||
public Xosrv_server Tcp_server() {return tcp_server;} private Xosrv_server tcp_server = new Xosrv_server();
|
||||
public Http_server_mgr Http_server() {return http_server;} private Http_server_mgr http_server;
|
||||
public Xop_amp_mgr Parser_amp_mgr() {return parser_amp_mgr;} private Xop_amp_mgr parser_amp_mgr = Xop_amp_mgr.I;
|
||||
public Xop_amp_mgr Parser_amp_mgr() {return parser_amp_mgr;} private Xop_amp_mgr parser_amp_mgr = Xop_amp_mgr.Instance;
|
||||
|
||||
private Xoa_fmtr_mgr fmtr_mgr;
|
||||
public Number_parser Utl_num_parser() {return utl_num_parser;} private Number_parser utl_num_parser = new Number_parser();
|
||||
@@ -144,7 +149,7 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
gui_mgr.Init_by_app();
|
||||
html__css_installer.Init_by_app(this);
|
||||
wiki_mgr.Init_by_app();
|
||||
gplx.xowa.utls.upgrades.Xoa_upgrade_mgr.Check(this);
|
||||
gplx.xowa.bldrs.setups.upgrades.Xoa_upgrade_mgr.Check(this);
|
||||
ctg_mgr.Init_by_app(this);
|
||||
setup_mgr.Init_by_app(this);
|
||||
thread_mgr.Usr_dlg_(Xoa_app_.Usr_dlg());
|
||||
@@ -155,9 +160,10 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
public boolean Launch_done() {return stage == Xoa_stage_.Tid_launch;}
|
||||
public void Launch() {
|
||||
if (Launch_done()) return;
|
||||
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._.Check(this);
|
||||
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
|
||||
}
|
||||
public byte Stage() {return stage;} public Xoae_app Stage_(byte v) {stage = v; return this;} private byte stage = Xoa_stage_.Tid_ctor;
|
||||
@@ -215,7 +221,9 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_xowa)) return this;
|
||||
else if (ctx.Match(k, Invk_fmtrs)) return fmtr_mgr;
|
||||
else if (ctx.Match(k, Invk_cfg)) return cfg_regy;
|
||||
else if (ctx.Match(k, Invk_xwiki_langs_load)) xwiki_mgr__sitelink_mgr.Parse(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_gui = "gui", Invk_bldr = "bldr", Invk_wikis = "wikis", Invk_files = "files", Invk_langs = "langs", Invk_users = "users"
|
||||
, Invk_sys_cfg = "sys_cfg", Invk_fsys = "fsys", Invk_cur = "cur", Invk_shell = "shell", Invk_log = "log"
|
||||
@@ -225,6 +233,7 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
, Invk_fmtrs = "fmtrs"
|
||||
, Invk_cfg = "cfg"
|
||||
, Invk_api = "api"
|
||||
, Invk_xwiki_langs_load = "xwiki_langs_load"
|
||||
;
|
||||
public static final String Invk_term_cbk = "term_cbk";
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.gui.*; import gplx.xowa.gui.views.*; import gplx.xowa.html.*; import gplx.xowa.pages.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.xfers.*; import gplx.xowa.xtns.cite.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.html.tocs.*;
|
||||
import gplx.xowa.html.modules.popups.*; import gplx.xowa.html.hdumps.pages.*; import gplx.xowa.xtns.wdatas.pfuncs.*;
|
||||
import gplx.xowa.guis.*; import gplx.xowa.guis.views.*; import gplx.xowa.htmls.*; import gplx.xowa.wikis.pages.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.xfers.*; import gplx.xowa.xtns.cite.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.htmls.tocs.*;
|
||||
import gplx.xowa.htmls.modules.popups.*; import gplx.xowa.htmls.hdumps.pages.*; import gplx.xowa.xtns.wdatas.pfuncs.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
public class Xoae_page implements Xoa_page {
|
||||
Xoae_page(Xowe_wiki wiki, Xoa_ttl ttl) {
|
||||
@@ -40,7 +40,7 @@ public class Xoae_page implements Xoa_page {
|
||||
public Xopg_revision_data Revision_data() {return revision_data;} private Xopg_revision_data revision_data = new Xopg_revision_data();
|
||||
public Xowe_wiki Wikie() {return wiki;} private Xowe_wiki wiki;
|
||||
public Xopg_redlink_lnki_list Redlink_lnki_list() {return redlink_lnki_list;} private Xopg_redlink_lnki_list redlink_lnki_list;
|
||||
public Xol_lang Lang() {return lang;} public Xoae_page Lang_(Xol_lang v) {lang = v; return this;} private Xol_lang lang;
|
||||
public Xol_lang_itm Lang() {return lang;} public Xoae_page Lang_(Xol_lang_itm v) {lang = v; return this;} private Xol_lang_itm lang;
|
||||
public Xopg_html_data Html_data() {return html_data;} private Xopg_html_data html_data = new Xopg_html_data();
|
||||
public Xopg_tab_data Tab_data() {return tab_data;} private final Xopg_tab_data tab_data = new Xopg_tab_data();
|
||||
public Xopg_hdump_data Hdump_data() {return hdump_data;} private final Xopg_hdump_data hdump_data = new Xopg_hdump_data();
|
||||
|
||||
@@ -17,12 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.core.tests.*;
|
||||
import gplx.xowa.cfgs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.apps.cfgs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.apos.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.lists.*; import gplx.xowa.parsers.paras.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.tmpls.*; import gplx.xowa.parsers.miscs.*; import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.parsers.lnkis.*;
|
||||
import gplx.xowa.files.exts.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.tdbs.hives.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.tdbs.hives.*;
|
||||
public class Xop_fxt {
|
||||
public Xop_fxt() {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
@@ -57,7 +57,7 @@ public class Xop_fxt {
|
||||
public Xop_ctx Ctx() {return ctx;} private Xop_ctx ctx;
|
||||
public Xop_parser Parser() {return parser;} private Xop_parser parser;
|
||||
public Xoae_page Page() {return ctx.Cur_page();}
|
||||
public void Lang_by_id_(int id) {ctx.Cur_page().Lang_(wiki.Appe().Lang_mgr().Get_by_key_or_new(Xol_lang_itm_.Get_by_id(id).Key()));}
|
||||
public void Lang_by_id_(int id) {ctx.Cur_page().Lang_(wiki.Appe().Lang_mgr().Get_by_or_new(Xol_lang_stub_.Get_by_id(id).Key()));}
|
||||
public Xoh_html_wtr_cfg Wtr_cfg() {return hdom_wtr.Cfg();} private Xoh_html_wtr hdom_wtr;
|
||||
public Xop_fxt Reset() {
|
||||
ctx.Clear();
|
||||
@@ -65,12 +65,12 @@ public class Xop_fxt {
|
||||
ctx.Cur_page().Clear();
|
||||
wiki.Db_mgr().Load_mgr().Clear();
|
||||
app.Wiki_mgr().Clear();
|
||||
Io_mgr.I.InitEngine_mem(); // clear created pages
|
||||
Io_mgr.Instance.InitEngine_mem(); // clear created pages
|
||||
wiki.Cfg_parser().Display_title_restrict_(false); // default to false, as a small number of tests assume restrict = false;
|
||||
return this;
|
||||
}
|
||||
public Xop_fxt Reset_for_msgs() {
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
wiki.Lang().Msg_mgr().Clear(); // need to clear out lang
|
||||
wiki.Msg_mgr().Clear(); // need to clear out wiki.Msgs
|
||||
this.Reset();
|
||||
@@ -198,13 +198,13 @@ public class Xop_fxt {
|
||||
return this;
|
||||
}
|
||||
public Xop_fxt Init_xwiki_add_wiki_and_user_(String alias, String domain) {
|
||||
wiki.Xwiki_mgr().Add_full(alias, domain);
|
||||
app.Usere().Wiki().Xwiki_mgr().Add_full(domain, domain);
|
||||
wiki.Xwiki_mgr().Add_by_atrs(alias, domain);
|
||||
app.Usere().Wiki().Xwiki_mgr().Add_by_atrs(domain, domain);
|
||||
return this;
|
||||
}
|
||||
public Xop_fxt Init_xwiki_add_user_(String domain) {return Init_xwiki_add_user_(domain, domain);}
|
||||
public Xop_fxt Init_xwiki_add_user_(String alias, String domain) {
|
||||
app.Usere().Wiki().Xwiki_mgr().Add_full(alias, domain);
|
||||
app.Usere().Wiki().Xwiki_mgr().Add_by_atrs(alias, domain);
|
||||
return this;
|
||||
}
|
||||
public void Test_parse_template(String tmpl_raw, String expd) {Test_parse_tmpl_str_test(tmpl_raw, "{{test}}", expd);}
|
||||
@@ -282,7 +282,7 @@ public class Xop_fxt {
|
||||
Xop_root_tkn root = Exec_parse_page_all_as_root(Bry_.new_u8(raw));
|
||||
Bry_bfr actl_bfr = Bry_bfr.new_();
|
||||
hdom_wtr.Write_all(actl_bfr, ctx, root.Root_src(), root);
|
||||
return actl_bfr.Xto_str_and_clear();
|
||||
return actl_bfr.To_str_and_clear();
|
||||
}
|
||||
public String Exec_parse_page_wiki_as_str(String raw) {
|
||||
byte[] raw_bry = Bry_.new_u8(raw);
|
||||
@@ -290,7 +290,7 @@ public class Xop_fxt {
|
||||
parser.Parse_wtxt_to_wdom(root, ctx, tkn_mkr, raw_bry, Xop_parser_.Doc_bgn_bos);
|
||||
Bry_bfr actl_bfr = Bry_bfr.new_();
|
||||
hdom_wtr.Write_all(actl_bfr, ctx, raw_bry, root);
|
||||
return actl_bfr.Xto_str_and_clear();
|
||||
return actl_bfr.To_str_and_clear();
|
||||
}
|
||||
private void Parse_chk(byte[] raw_bry, Xop_root_tkn root, Tst_chkr[] expd_ary) {
|
||||
int subs_len = root.Subs_len();
|
||||
@@ -350,8 +350,8 @@ public class Xop_fxt {
|
||||
}
|
||||
public static void Reg_xwiki_alias(Xowe_wiki wiki, String alias, String domain) {
|
||||
byte[] domain_bry = Bry_.new_a7(domain);
|
||||
wiki.Xwiki_mgr().Add_full(Bry_.new_a7(alias), domain_bry, Bry_.Add(domain_bry, Bry_.new_a7("/wiki/~{0}")));
|
||||
wiki.Appe().Usere().Wiki().Xwiki_mgr().Add_full(domain_bry, domain_bry);
|
||||
wiki.Xwiki_mgr().Add_by_atrs(Bry_.new_a7(alias), domain_bry, Bry_.Add(domain_bry, Bry_.new_a7("/wiki/~{0}")));
|
||||
wiki.Appe().Usere().Wiki().Xwiki_mgr().Add_by_atrs(domain_bry, domain_bry);
|
||||
}
|
||||
public static String html_img_none(String trg, String alt, String src, String ttl) {
|
||||
return String_.Format(String_.Concat_lines_nl_skip_last("<a href=\"/wiki/{0}\" class=\"image\" xowa_title=\"{3}\"><img id=\"xowa_file_img_0\" alt=\"{1}\" src=\"{2}\" width=\"9\" height=\"8\" /></a>"), trg, alt, src, ttl);
|
||||
@@ -386,16 +386,16 @@ public class Xop_fxt {
|
||||
public void Test_html_modules_js(String expd) {
|
||||
Bry_bfr bfr = app.Utl__bfr_mkr().Get_k004();
|
||||
this.Page().Html_data().Head_mgr().Init(app, wiki, this.Page());
|
||||
this.Page().Html_data().Head_mgr().XferAry(bfr, 0);
|
||||
this.Page().Html_data().Head_mgr().Fmt__do(bfr);
|
||||
bfr.Mkr_rls();
|
||||
Tfds.Eq_str_lines(expd, bfr.Xto_str_and_clear());
|
||||
Tfds.Eq_str_lines(expd, bfr.To_str_and_clear());
|
||||
}
|
||||
|
||||
private Tst_mgr tst_mgr = new Tst_mgr(); private Xop_tkn_mkr tkn_mkr;
|
||||
public static final String Ttl_str = "Test page";
|
||||
public Xop_fxt Init_lang_numbers_separators_en() {return Init_lang_numbers_separators(",", ".");}
|
||||
public Xop_fxt Init_lang_numbers_separators(String grp_spr, String dec_spr) {return Init_lang_numbers_separators(wiki.Lang(), grp_spr, dec_spr);}
|
||||
public Xop_fxt Init_lang_numbers_separators(Xol_lang lang, String grp_spr, String dec_spr) {
|
||||
public Xop_fxt Init_lang_numbers_separators(Xol_lang_itm lang, String grp_spr, String dec_spr) {
|
||||
gplx.xowa.langs.numbers.Xol_transform_mgr separator_mgr = lang.Num_mgr().Separators_mgr();
|
||||
separator_mgr.Clear();
|
||||
separator_mgr.Set(gplx.xowa.langs.numbers.Xol_num_mgr.Separators_key__grp, Bry_.new_u8(grp_spr));
|
||||
@@ -403,13 +403,13 @@ public class Xop_fxt {
|
||||
return this;
|
||||
}
|
||||
public void Init_lang_kwds(int kwd_id, boolean case_match, String... kwds) {Init_lang_kwds(wiki.Lang(), kwd_id, case_match, kwds);}
|
||||
public void Init_lang_kwds(Xol_lang lang, int kwd_id, boolean case_match, String... kwds) {
|
||||
public void Init_lang_kwds(Xol_lang_itm lang, int kwd_id, boolean case_match, String... kwds) {
|
||||
Xol_kwd_mgr kwd_mgr = lang.Kwd_mgr();
|
||||
Xol_kwd_grp kwd_grp = kwd_mgr.Get_or_new(kwd_id);
|
||||
kwd_grp.Srl_load(case_match, Bry_.Ary(kwds));
|
||||
}
|
||||
public void Init_xtn_pages() {
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
wiki.Xtn_mgr().Xtn_proofread().Enabled_y_();
|
||||
wiki.Db_mgr().Load_mgr().Clear(); // must clear; otherwise fails b/c files get deleted, but wiki.data_mgr caches the Xowd_regy_mgr (the .reg file) in memory;
|
||||
wiki.Ns_mgr().Add_new(Xowc_xtn_pages.Ns_page_id_default, "Page").Add_new(Xowc_xtn_pages.Ns_index_id_default, "Index").Init();
|
||||
|
||||
@@ -20,16 +20,16 @@ import gplx.core.primitives.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.ttls.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.fsdb.meta.*; import gplx.fsdb.*;
|
||||
import gplx.xowa.html.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.html.hzips.*; import gplx.xowa.html.hdumps.*; import gplx.xowa.html.bridges.dbuis.tbls.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.htmls.hzips.*; import gplx.xowa.htmls.hdumps.*; import gplx.xowa.htmls.bridges.dbuis.tbls.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.urls.*;
|
||||
public interface Xow_wiki extends Xow_ttl_parser {
|
||||
import gplx.xowa.apps.urls.*;
|
||||
public interface Xow_wiki extends Xow_ttl_parser, GfoInvkAble {
|
||||
boolean Type_is_edit();
|
||||
Xoa_app App();
|
||||
Xol_lang Lang();
|
||||
Xol_lang_itm Lang();
|
||||
byte[] Domain_bry(); // EX: en.wikipedia.org
|
||||
String Domain_str();
|
||||
int Domain_tid(); // Xow_domain_type_.Int__wikipedia
|
||||
int Domain_tid(); // Xow_domain_tid_.Int__wikipedia
|
||||
byte[] Domain_abrv(); // enwiki
|
||||
Xow_domain_itm Domain_itm();
|
||||
Xow_fsys_mgr Fsys_mgr();
|
||||
@@ -43,7 +43,7 @@ public interface Xow_wiki extends Xow_ttl_parser {
|
||||
boolean Html__hdump_enabled();
|
||||
Xow_hzip_mgr Html__hzip_mgr();
|
||||
Xohd_hdump_rdr Html__hdump_rdr();
|
||||
Xoh_page_wtr_mgr_base Html__page_wtr_mgr();
|
||||
Xoh_page_wtr_mgr Html__wtr_mgr();
|
||||
boolean Html__css_installing(); void Html__css_installing_(boolean v);
|
||||
Xow_mw_parser_mgr Mw_parser_mgr();
|
||||
Xow_xwiki_mgr Xwiki_mgr();
|
||||
|
||||
@@ -17,26 +17,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.cfgs.*; import gplx.xowa.cfgs.gui.*; import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.cfgs.*; import gplx.xowa.apps.cfgs.gui.*; import gplx.xowa.apps.urls.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.nss.*; import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.ttls.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.caches.*;
|
||||
import gplx.xowa.users.*; import gplx.xowa.html.*; import gplx.xowa.users.history.*; import gplx.xowa.specials.*; import gplx.xowa.xtns.*; import gplx.xowa.dbs.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.metas.*; import gplx.xowa.wikis.ttls.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.wikis.caches.*;
|
||||
import gplx.xowa.users.*; import gplx.xowa.htmls.*; import gplx.xowa.users.history.*; import gplx.xowa.specials.*; import gplx.xowa.xtns.*; import gplx.xowa.wikis.dbs.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.fsdb.*; import gplx.fsdb.meta.*; import gplx.xowa.files.exts.*;
|
||||
import gplx.xowa.html.heads.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.html.hzips.*; import gplx.xowa.html.hdumps.*; import gplx.xowa.html.css.*; import gplx.xowa.html.ns_files.*; import gplx.xowa.html.bridges.dbuis.tbls.*;
|
||||
import gplx.xowa.bldrs.xmls.*; import gplx.xowa.bldrs.installs.*; import gplx.xowa.setup.maints.*;
|
||||
import gplx.xowa.htmls.heads.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.htmls.hzips.*; import gplx.xowa.htmls.hdumps.*; import gplx.xowa.htmls.css.*; import gplx.xowa.htmls.ns_files.*; import gplx.xowa.htmls.bridges.dbuis.tbls.*;
|
||||
import gplx.xowa.bldrs.xmls.*; import gplx.xowa.bldrs.installs.*; import gplx.xowa.bldrs.setups.maints.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.utils.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.xtns.gallery.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.tdbs.*; import gplx.xowa.tdbs.hives.*;
|
||||
import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.tdbs.hives.*;
|
||||
public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
private boolean init_in_process = false;
|
||||
public Xowe_wiki(Xoae_app app, Xol_lang lang, Xow_ns_mgr ns_mgr, Xow_domain_itm domain_itm, Io_url wiki_dir) {
|
||||
public Xowe_wiki(Xoae_app app, Xol_lang_itm lang, Xow_ns_mgr ns_mgr, Xow_domain_itm domain_itm, Io_url wiki_dir) {
|
||||
this.ev_mgr = GfoEvMgr.new_(this);
|
||||
this.app = app; this.lang = lang; this.ns_mgr = ns_mgr;
|
||||
this.domain_itm = domain_itm; this.domain_str = domain_itm.Domain_str(); this.domain_bry = domain_itm.Domain_bry(); this.domain_tid = domain_itm.Domain_type_id(); this.domain_abrv = Xow_abrv_wm_.To_abrv(domain_itm);
|
||||
this.fsys_mgr = new Xow_fsys_mgr(wiki_dir, app.Fsys_mgr().File_dir().GenSubDir(domain_str));
|
||||
this.url__parser = new Xoa_url_parser(this);
|
||||
this.xwiki_mgr = new Xow_xwiki_mgr(this, url__parser.Url_parser());
|
||||
this.xwiki_mgr = new Xow_xwiki_mgr(this);
|
||||
this.html_mgr = new Xow_html_mgr(this);
|
||||
this.html_mgr__hdump_rdr = new Xohd_hdump_rdr(app, this);
|
||||
this.html_mgr__hdump_wtr = new Xohd_hdump_wtr(app, this);
|
||||
@@ -61,19 +61,19 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
eval_mgr = new Bfmtr_eval_wiki(this);
|
||||
fragment_mgr = new Xow_fragment_mgr(this);
|
||||
xtn_mgr = new Xow_xtn_mgr().Ctor_by_wiki(this);
|
||||
if (domain_tid == Xow_domain_type_.Int__home) {
|
||||
wdata_wiki_tid = Xow_domain_type_.Int__wikipedia;
|
||||
wdata_wiki_lang = Xol_lang_.Key_en;
|
||||
if (domain_tid == Xow_domain_tid_.Int__home) {
|
||||
wdata_wiki_tid = Xow_domain_tid_.Int__wikipedia;
|
||||
wdata_wiki_lang = Xol_lang_itm_.Key_en;
|
||||
}
|
||||
else {
|
||||
wdata_wiki_tid = domain_tid;
|
||||
wdata_wiki_lang = domain_itm.Lang_orig_key(); // NOTE: must use orig_key for nowiki; "no" not "nb" DATE:2014-10-07
|
||||
}
|
||||
Wdata_wiki_abrv_();
|
||||
db_mgr = new gplx.xowa.dbs.Xodb_mgr_txt(this, data_mgr);
|
||||
db_mgr = new gplx.xowa.wikis.dbs.Xodb_mgr_txt(this, data_mgr);
|
||||
maint_mgr = new Xow_maint_mgr(this);
|
||||
cache_mgr = new Xow_cache_mgr(this);
|
||||
/*if (Bry_.Eq(domain_bry, Xow_domain_itm_.Bry__home))*/ xwiki_mgr.Add_full(domain_bry, domain_bry); // add full name to xwiki_mgr; needed for lookup in home ns; EX: [[home:Help/Contents]]
|
||||
/*if (Bry_.Eq(domain_bry, Xow_domain_itm_.Bry__home))*/ xwiki_mgr.Add_by_atrs(domain_bry, domain_bry); // add full name to xwiki_mgr; needed for lookup in home ns; EX: [[home:Help/Contents]]
|
||||
}
|
||||
public GfoEvMgr EvMgr() {return ev_mgr;} private final GfoEvMgr ev_mgr;
|
||||
public Xow_ns_mgr Ns_mgr() {return ns_mgr;} private final Xow_ns_mgr ns_mgr;
|
||||
@@ -81,7 +81,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
public Xoa_ttl Ttl_parse(int ns_id, byte[] ttl) {return Xoa_ttl.parse(this, ns_id, ttl);}
|
||||
public boolean Type_is_edit() {return Bool_.Y;}
|
||||
public Xoa_app App() {return app;}
|
||||
public Xol_lang Lang() {return lang;} private final Xol_lang lang;
|
||||
public Xol_lang_itm Lang() {return lang;} private final Xol_lang_itm lang;
|
||||
public byte[] Domain_bry() {return domain_bry;} private final byte[] domain_bry;
|
||||
public String Domain_str() {return domain_str;} private final String domain_str;
|
||||
public int Domain_tid() {return domain_tid;} private final int domain_tid;
|
||||
@@ -98,7 +98,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
public boolean Html__hdump_enabled() {return html_mgr__hdump_enabled;} private boolean html_mgr__hdump_enabled = Bool_.N;
|
||||
public Xow_hzip_mgr Html__hzip_mgr() {return html_mgr.Hzip_mgr();}
|
||||
public Xohd_hdump_rdr Html__hdump_rdr() {return html_mgr__hdump_rdr;} private final Xohd_hdump_rdr html_mgr__hdump_rdr;
|
||||
public Xoh_page_wtr_mgr_base Html__page_wtr_mgr() {return html_mgr.Page_wtr_mgr();}
|
||||
public Xoh_page_wtr_mgr Html__wtr_mgr() {return html_mgr.Page_wtr_mgr();}
|
||||
public boolean Html__css_installing() {return html__css_installing;} public void Html__css_installing_(boolean v) {html__css_installing = v;} private boolean html__css_installing;
|
||||
public Xoa_url_parser Utl__url_parser() {return url__parser;} private final Xoa_url_parser url__parser;
|
||||
public Xow_mw_parser_mgr Mw_parser_mgr() {return mw_parser_mgr;} private final Xow_mw_parser_mgr mw_parser_mgr = new Xow_mw_parser_mgr();
|
||||
@@ -182,10 +182,10 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
if (!app.Bldr().Import_marker().Chk(this)) {app.Wiki_mgr().Del(domain_bry); init_needed = false; return;} // NOTE: must call after Db_mgr_create_as_sql(); also, must delete wiki from mgr; DATE:2014-08-24
|
||||
db_mgr.Load_mgr().Load_init(this);
|
||||
app.Gfs_mgr().Run_url_for(this, tdb_fsys_mgr.Cfg_wiki_core_fil());
|
||||
gplx.xowa.utls.upgrades.Xoa_upgrade_mgr.Check(this);
|
||||
gplx.xowa.bldrs.setups.upgrades.Xoa_upgrade_mgr.Check(this);
|
||||
// init ns_mgr
|
||||
if (lang.Init_by_load()) {
|
||||
if (domain_tid == Xow_domain_type_.Int__wikipedia) // NOTE: if type is wikipedia, add "Wikipedia" as an alias; PAGE:en.w:pt.wikipedia.org/wiki/Página principal which redirects to Wikipedia:Página principal
|
||||
if (domain_tid == Xow_domain_tid_.Int__wikipedia) // NOTE: if type is wikipedia, add "Wikipedia" as an alias; PAGE:en.w:pt.wikipedia.org/wiki/Página principal which redirects to Wikipedia:Página principal
|
||||
ns_mgr.Aliases_add(Xow_ns_.Id_project, Xow_ns_.Ns_name_wikipedia);
|
||||
}
|
||||
app.Gfs_mgr().Run_url_for(this, app.Fsys_mgr().Cfg_wiki_core_dir().GenSubFil(domain_str + ".gfs")); // NOTE: must be run after lang.Init_by_load b/c lang will reload ns_mgr; DATE:2015-04-17run cfg for wiki by user ; EX: /xowa/user/anonymous/wiki/en.wikipedia.org/cfg/user_wiki.gfs
|
||||
@@ -195,7 +195,6 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
fragment_mgr.Evt_lang_changed(lang);
|
||||
parser_mgr.Main().Init_by_lang(lang);
|
||||
html_mgr.Init_by_lang(lang);
|
||||
lang.Vnt_mgr().Init_by_wiki(this);
|
||||
// other init
|
||||
Bry_fmtr.Null.Eval_mgr().Enabled_(false); app.Wiki_mgr().Scripts().Exec(this); Bry_fmtr.Null.Eval_mgr().Enabled_(true);
|
||||
app.Html__css_installer().Install(this, Xowd_css_core_mgr.Key_default);
|
||||
@@ -208,7 +207,7 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
app.Log_wtr().Log_to_session_direct(log_bfr.Xto_str());
|
||||
init_in_process = false;
|
||||
app.Api_root().Wikis().Get(domain_bry).Subscribe(this);
|
||||
app.Meta_mgr().Init_by_wiki(this);
|
||||
app.Site_cfg_mgr().Load(this);
|
||||
}
|
||||
private void Html__hdump_enabled_(boolean v) {
|
||||
this.html_mgr__hdump_enabled = v;
|
||||
@@ -229,7 +228,6 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
private void Copy_cfg(Xowe_wiki wiki) {html_mgr.Copy_cfg(wiki.Html_mgr());}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_files)) return file_mgr;
|
||||
else if (ctx.Match(k, Invk_xwikis)) return xwiki_mgr;
|
||||
else if (ctx.Match(k, Invk_stats)) return stats;
|
||||
else if (ctx.Match(k, Invk_props)) return props;
|
||||
else if (ctx.Match(k, Invk_cfg_gallery_)) return cfg_gallery;
|
||||
@@ -255,12 +253,12 @@ public class Xowe_wiki implements Xow_wiki, GfoInvkAble, GfoEvObj {
|
||||
else if (ctx.Match(k, Invk_domain)) return domain_str;
|
||||
else if (ctx.Match(k, Invk_xtns)) return xtn_mgr;
|
||||
else if (ctx.Match(k, Invk_hdump_enabled_)) this.html_mgr__hdump_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, gplx.xowa.apis.xowa.wikis.langs.Xoap_lang_variants.Evt_current_changed)) lang.Vnt_mgr().Cur_vnt_(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, gplx.xowa.apps.apis.xowa.wikis.langs.Xoap_lang_variants.Evt_current_changed)) lang.Vnt_mgr().Cur_itm_(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String
|
||||
Invk_ZipDirs = "zip_dirs_", Invk_files = "files", Invk_xwikis = "xwikis", Invk_cfg_gallery_ = "cfg_gallery_", Invk_commons_wiki_ = "commons_wiki_", Invk_stats = "stats"
|
||||
Invk_files = "files", Invk_cfg_gallery_ = "cfg_gallery_", Invk_commons_wiki_ = "commons_wiki_", Invk_stats = "stats"
|
||||
, Invk_lang = "lang", Invk_html = "html", Invk_gui = "gui", Invk_cfg_history = "cfg_history", Invk_user = "user", Invk_data_mgr = "data_mgr", Invk_sys_cfg = "sys_cfg", Invk_ns_mgr = "ns_mgr"
|
||||
, Invk_special = "special"
|
||||
, Invk_props = "props", Invk_parser = "parser"
|
||||
|
||||
@@ -16,7 +16,7 @@ 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; import gplx.*;
|
||||
import gplx.xowa.apis.xowa.bldrs.imports.*; import gplx.xowa.wikis.data.*; import gplx.xowa.bldrs.infos.*;
|
||||
import gplx.xowa.apps.apis.xowa.bldrs.imports.*; import gplx.xowa.wikis.data.*; import gplx.xowa.bldrs.infos.*;
|
||||
public class Xowe_wiki_ {
|
||||
public static void Create(Xowe_wiki wiki, long src_fil_len, String src_fil_name) {
|
||||
wiki.Db_mgr_create_as_sql(); // create db_mgr as sql
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.apps; import gplx.*; import gplx.xowa.*;
|
||||
public class Xoa_app_eval implements Bry_fmtr_eval_mgr {
|
||||
public boolean Enabled() {return enabled;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled = true;
|
||||
public byte[] Eval(byte[] cmd) {
|
||||
Object rslt = GfsCore._.Exec_bry(cmd);
|
||||
Object rslt = GfsCore.Instance.Exec_bry(cmd);
|
||||
return Bry_.new_u8(Object_.Xto_str_strict_or_null_mark(rslt));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.apps; import gplx.*; import gplx.xowa.*;
|
||||
import org.junit.*;
|
||||
import gplx.xowa.apps.gfss.*;
|
||||
import gplx.xowa.apps.gfs.*;
|
||||
public class Xoa_app_eval_tst {
|
||||
Xoa_app_eval_fxt fxt = new Xoa_app_eval_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
|
||||
65
400_xowa/src/gplx/xowa/apps/Xoa_app_mode.java
Normal file
65
400_xowa/src/gplx/xowa/apps/Xoa_app_mode.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.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Xoa_app_mode {
|
||||
Xoa_app_mode(int tid) {this.tid = tid;}
|
||||
public int Tid() {return tid;} private final int tid;
|
||||
public boolean Tid_is_gui() {return tid == Tid_gui;}
|
||||
public boolean Tid_is_tcp() {return tid == Tid_tcp;}
|
||||
public boolean Tid_is_http() {return tid == Tid_http;}
|
||||
public boolean Tid_supports_js() {
|
||||
switch (tid) {
|
||||
case Tid_gui:
|
||||
case Tid_tcp: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
public byte[] Name() {
|
||||
switch (tid) {
|
||||
case Tid_cmd: return Key_cmd;
|
||||
case Tid_gui: return Key_gui;
|
||||
case Tid_http: return Key_http;
|
||||
case Tid_tcp: return Key_tcp;
|
||||
case Tid_file: return Key_file;
|
||||
default: return Key_cmd; // see parse
|
||||
}
|
||||
}
|
||||
private static final int Tid_cmd = 1, Tid_gui = 2, Tid_tcp = 3, Tid_http = 4, Tid_file = 5;
|
||||
private static final byte[] Key_cmd = Bry_.new_a7("cmd"), Key_gui = Bry_.new_a7("gui"), Key_tcp = Bry_.new_a7("server"), Key_http = Bry_.new_a7("http_server"), Key_file = Bry_.new_a7("file");
|
||||
public static final Xoa_app_mode Itm_cmd = new Xoa_app_mode(Tid_cmd), Itm_gui = new Xoa_app_mode(Tid_gui), Itm_tcp = new Xoa_app_mode(Tid_tcp), Itm_http = new Xoa_app_mode(Tid_http), Itm_file = new Xoa_app_mode(Tid_file);
|
||||
private static final Hash_adp_bry type_hash = Hash_adp_bry.cs()
|
||||
.Add_bry_int(Key_cmd , Tid_cmd)
|
||||
.Add_bry_int(Key_gui , Tid_gui)
|
||||
.Add_bry_int(Key_http , Tid_http)
|
||||
.Add_bry_int(Key_tcp , Tid_tcp)
|
||||
.Add_bry_int(Key_file , Tid_file)
|
||||
;
|
||||
public static Xoa_app_mode parse(String s) {
|
||||
Object o = type_hash.Get_by(Bry_.new_u8(s)); if (o == null) return Itm_cmd; // default to cmd as per early behaviour; handles mistaken "--app_mode wrong"
|
||||
int tid = ((Int_obj_val)o).Val();
|
||||
switch (tid) {
|
||||
case Tid_cmd: return Itm_cmd;
|
||||
case Tid_gui: return Itm_gui;
|
||||
case Tid_http: return Itm_http;
|
||||
case Tid_tcp: return Itm_tcp;
|
||||
case Tid_file: return Itm_file;
|
||||
default: throw Err_.new_unhandled(tid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +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.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Xoa_app_type {
|
||||
Xoa_app_type(int uid) {this.uid = uid;}
|
||||
public int Uid() {return uid;} private final int uid;
|
||||
public boolean Uid_is_gui() {return uid == Uid_gui;}
|
||||
public boolean Uid_is_tcp() {return uid == Uid_tcp;}
|
||||
public boolean Uid_is_http() {return uid == Uid_http;}
|
||||
public boolean Uid_supports_js() {
|
||||
switch (uid) {
|
||||
case Uid_gui:
|
||||
case Uid_tcp: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
public byte[] Name() {
|
||||
switch (uid) {
|
||||
case Uid_cmd: return Key_cmd;
|
||||
case Uid_gui: return Key_gui;
|
||||
case Uid_http: return Key_http;
|
||||
case Uid_tcp: return Key_tcp;
|
||||
case Uid_file: return Key_file;
|
||||
default: return Key_cmd; // see parse
|
||||
}
|
||||
}
|
||||
private static final int Uid_cmd = 1, Uid_gui = 2, Uid_tcp = 3, Uid_http = 4, Uid_file = 5;
|
||||
private static final byte[] Key_cmd = Bry_.new_a7("cmd"), Key_gui = Bry_.new_a7("gui"), Key_tcp = Bry_.new_a7("server"), Key_http = Bry_.new_a7("http_server"), Key_file = Bry_.new_a7("file");
|
||||
private static final Hash_adp_bry type_hash = Hash_adp_bry.cs()
|
||||
.Add_bry_int(Key_cmd , Uid_cmd)
|
||||
.Add_bry_int(Key_gui , Uid_gui)
|
||||
.Add_bry_int(Key_http , Uid_http)
|
||||
.Add_bry_int(Key_tcp , Uid_tcp)
|
||||
.Add_bry_int(Key_file , Uid_file)
|
||||
;
|
||||
public static final Xoa_app_type Itm_cmd = new Xoa_app_type(Uid_cmd), Itm_gui = new Xoa_app_type(Uid_gui), Itm_tcp = new Xoa_app_type(Uid_tcp), Itm_http = new Xoa_app_type(Uid_http), Itm_file = new Xoa_app_type(Uid_file);
|
||||
public static Xoa_app_type parse(String s) {
|
||||
Object o = type_hash.Get_by(Bry_.new_u8(s)); if (o == null) return Itm_cmd; // default to cmd as per early behaviour; handles mistaken "--app_mode wrong"
|
||||
int uid = ((Int_obj_val)o).Val();
|
||||
switch (uid) {
|
||||
case Uid_cmd: return Itm_cmd;
|
||||
case Uid_gui: return Itm_gui;
|
||||
case Uid_http: return Itm_http;
|
||||
case Uid_tcp: return Itm_tcp;
|
||||
case Uid_file: return Itm_file;
|
||||
default: throw Err_.new_unhandled(uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ 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.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
public class Xoa_cur implements GfoInvkAble {
|
||||
public Xoa_cur(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
|
||||
@@ -18,14 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.consoles.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
public class Xoa_shell implements GfoInvkAble {
|
||||
public Xoa_shell(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
public boolean Fetch_page_exec_async() {return fetch_page_exec_async;} private boolean fetch_page_exec_async = true;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_fetch_page)) return Fetch_page(m);
|
||||
else if (ctx.Match(k, Invk_chars_per_line_max_)) Console_adp__sys.I.Chars_per_line_max_(m.ReadInt("v"));
|
||||
else if (ctx.Match(k, Invk_backspace_by_bytes_)) Console_adp__sys.I.Backspace_by_bytes_(m.ReadYn("v"));
|
||||
else if (ctx.Match(k, Invk_chars_per_line_max_)) Console_adp__sys.Instance.Chars_per_line_max_(m.ReadInt("v"));
|
||||
else if (ctx.Match(k, Invk_backspace_by_bytes_)) Console_adp__sys.Instance.Backspace_by_bytes_(m.ReadYn("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.apps; import gplx.*; import gplx.xowa.*;
|
||||
import org.junit.*; import gplx.xowa.apps.gfss.*;
|
||||
import org.junit.*; import gplx.xowa.apps.gfs.*;
|
||||
public class Xoa_shell_tst {
|
||||
@Test public void Fetch_page() { // PURPOSE.fix: fetch_page failed with nullRef; DATE:2013-04-12
|
||||
Xop_fxt parser_fxt = new Xop_fxt();
|
||||
|
||||
@@ -22,14 +22,14 @@ public class Xoa_sys_cfg implements GfoInvkAble {
|
||||
public Xoa_sys_cfg(Xoae_app app) {this.app = app;}
|
||||
public byte[] Lang() {return lang_key;}
|
||||
public Xoa_sys_cfg Lang_(byte[] v) {
|
||||
lang_key = Xol_lang_itm_.Get_by_key_or_en(v).Key();
|
||||
lang_key = Xol_lang_stub_.Get_by_key_or_en(v).Key();
|
||||
if (app.Stage() == gplx.xowa.apps.Xoa_stage_.Tid_launch) { // do not update user lang unless launched; DATE:2014-05-26
|
||||
Xol_lang lang = app.Lang_mgr().Get_by_key_or_load(lang_key);
|
||||
Xol_lang_itm lang = app.Lang_mgr().Get_by_or_load(lang_key);
|
||||
app.Usere().Lang_(lang);
|
||||
app.Usere().Wiki().Html_mgr().Portal_mgr().Init();
|
||||
}
|
||||
return this;
|
||||
} private byte[] lang_key = Xol_lang_.Key_en;
|
||||
} private byte[] lang_key = Xol_lang_itm_.Key_en;
|
||||
public int Options_version() {return options_version;} public Xoa_sys_cfg Options_version_(int v) {options_version = v; return this;} private int options_version = 1;
|
||||
public KeyVal[] Options_lang_list() {if (options_lang_list == null) options_lang_list = Options_list_lang_.new_(); return options_lang_list;} private KeyVal[] options_lang_list;
|
||||
public long Free_mem_when() {return free_mem_when;} long free_mem_when;
|
||||
@@ -50,35 +50,35 @@ public class Xoa_sys_cfg implements GfoInvkAble {
|
||||
}
|
||||
class Options_list_lang_ {
|
||||
public static KeyVal[] new_() {
|
||||
Ordered_hash translated = Ordered_hash_.new_bry_();
|
||||
Ordered_hash translated = Ordered_hash_.New_bry();
|
||||
List_adp untranslated = List_adp_.new_();
|
||||
Add_itm_many(translated, Xol_lang_itm_.Id_en, Xol_lang_itm_.Id_de, Xol_lang_itm_.Id_pl, Xol_lang_itm_.Id_zh_hans, Xol_lang_itm_.Id_zh_hant); // add langs with translations first, so they alphabetize to top of list
|
||||
int len = Xol_lang_itm_.Id__max;
|
||||
Add_itm_many(translated, Xol_lang_stub_.Id_en, Xol_lang_stub_.Id_de, Xol_lang_stub_.Id_pl, Xol_lang_stub_.Id_zh_hans, Xol_lang_stub_.Id_zh_hant); // add langs with translations first, so they alphabetize to top of list
|
||||
int len = Xol_lang_stub_.Id__max;
|
||||
for (int i = 0; i < len; i++) { // add rest of langs, but sort by code
|
||||
Xol_lang_itm itm = Xol_lang_itm_.Get_by_id(i);
|
||||
Xol_lang_stub itm = Xol_lang_stub_.Get_by_id(i);
|
||||
if (translated.Has(itm.Key())) continue;
|
||||
untranslated.Add(itm);
|
||||
}
|
||||
untranslated.Sort_by(Xol_lang_itm_.Comparer_key);
|
||||
untranslated.Sort_by(Xol_lang_stub_.Comparer_key);
|
||||
|
||||
KeyVal[] rv = new KeyVal[len];
|
||||
int translated_max = translated.Count();
|
||||
for (int i = 0; i < translated_max; i++)
|
||||
rv[i] = new_itm((Xol_lang_itm)translated.Get_at(i));
|
||||
rv[i] = new_itm((Xol_lang_stub)translated.Get_at(i));
|
||||
|
||||
for (int i = translated_max; i < len; i++)
|
||||
rv[i] = new_itm((Xol_lang_itm)untranslated.Get_at(i - translated_max));
|
||||
rv[i] = new_itm((Xol_lang_stub)untranslated.Get_at(i - translated_max));
|
||||
return rv;
|
||||
}
|
||||
private static KeyVal new_itm(Xol_lang_itm itm) {
|
||||
private static KeyVal new_itm(Xol_lang_stub itm) {
|
||||
String key_str = String_.new_u8(itm.Key());
|
||||
String name_str = String_.new_u8(itm.Localized_name());
|
||||
String name_str = String_.new_u8(itm.Canonical_name());
|
||||
return KeyVal_.new_(key_str, name_str + " [" + key_str + "]");
|
||||
}
|
||||
private static void Add_itm_many(Ordered_hash translated, int... langs) {
|
||||
int langs_len = langs.length;
|
||||
for (int i = 0; i < langs_len; i++) {
|
||||
Xol_lang_itm itm = Xol_lang_itm_.Get_by_id(langs[i]);
|
||||
Xol_lang_stub itm = Xol_lang_stub_.Get_by_id(langs[i]);
|
||||
translated.Add_if_dupe_use_nth(itm.Key(), itm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,19 +18,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.net.*; import gplx.langs.jsons.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.dbs.*; import gplx.xowa.apis.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.metas.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.langs.cases.*; import gplx.core.intls.*; import gplx.xowa.users.data.*;
|
||||
import gplx.xowa.apps.urls.*; import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.dbs.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.metas.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.langs.cases.*; import gplx.core.intls.*; import gplx.xowa.users.data.*;
|
||||
import gplx.xowa.apps.site_cfgs.*; import gplx.xowa.apps.urls.*; import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.xowa.bldrs.css.*;
|
||||
import gplx.xowa.html.hrefs.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.html.bridges.*;
|
||||
import gplx.xowa.apps.gfs.*;
|
||||
import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.htmls.bridges.*;
|
||||
import gplx.xowa.users.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wms.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*; import gplx.xowa.wikis.xwikis.parsers.*; import gplx.xowa.wikis.xwikis.sitelinks.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.bldrs.wms.*;
|
||||
import gplx.langs.htmls.encoders.*;
|
||||
public class Xoav_app implements Xoa_app {
|
||||
public Xoav_app(Gfo_usr_dlg usr_dlg, Xoa_app_type app_type, String plat_name, Io_url root_dir, Io_url file_dir, Io_url css_dir) {
|
||||
Xoa_app_.Usr_dlg_(usr_dlg); this.usr_dlg = usr_dlg; this.app_type = app_type;
|
||||
public class Xoav_app implements Xoa_app, GfoInvkAble {
|
||||
public Xoav_app(Gfo_usr_dlg usr_dlg, Xoa_app_mode mode, String plat_name, Io_url root_dir, Io_url file_dir, Io_url css_dir) {
|
||||
Xoa_app_.Usr_dlg_(usr_dlg); this.usr_dlg = usr_dlg; this.mode = mode;
|
||||
this.fsys_mgr = new Xoa_fsys_mgr(plat_name, root_dir, root_dir.GenSubDir("wiki"), file_dir, css_dir);
|
||||
this.lang_mgr = new Xoa_lang_mgr(this);
|
||||
this.meta_mgr = new Xoa_meta_mgr(this);
|
||||
this.gfs_mgr = new Xoa_gfs_mgr(this, fsys_mgr, null);
|
||||
this.file__cache_mgr = new Xof_cache_mgr(usr_dlg, null, null);
|
||||
this.file__img_mgr = new Xof_img_mgr();
|
||||
this.wiki_mgr = new Xoav_wiki_mgr(this, utl_case_mgr);
|
||||
@@ -39,13 +43,17 @@ public class Xoav_app implements Xoa_app {
|
||||
this.html__bridge_mgr = new Xoh_bridge_mgr(utl__json_parser);
|
||||
this.user = new Xouv_user("anonymous");
|
||||
this.api_root = null;
|
||||
this.site_cfg_mgr = new Xoa_site_cfg_mgr(this);
|
||||
}
|
||||
public boolean Tid_is_edit() {return Bool_.N;}
|
||||
public Xoa_app_mode Mode() {return mode;} private final Xoa_app_mode mode;
|
||||
public Xou_user User() {return user;} private final Xouv_user user;
|
||||
public Xoapi_root Api_root() {return api_root;} private final Xoapi_root api_root;
|
||||
public Xoa_app_type App_type() {return app_type;} private final Xoa_app_type app_type;
|
||||
public Xoa_fsys_mgr Fsys_mgr() {return fsys_mgr;} private final Xoa_fsys_mgr fsys_mgr;
|
||||
public Xoav_wiki_mgr Wiki_mgr() {return wiki_mgr;} private final Xoav_wiki_mgr wiki_mgr;
|
||||
public Xoa_wiki_mgr Wiki_mgri() {return wiki_mgr;}
|
||||
public Xoa_lang_mgr Lang_mgr() {return lang_mgr;} private final Xoa_lang_mgr lang_mgr;
|
||||
public Xoa_gfs_mgr Gfs_mgr() {return gfs_mgr;} private final Xoa_gfs_mgr gfs_mgr;
|
||||
public Xof_cache_mgr File__cache_mgr() {return file__cache_mgr;} private final Xof_cache_mgr file__cache_mgr;
|
||||
public Xof_img_mgr File__img_mgr() {return file__img_mgr;} private final Xof_img_mgr file__img_mgr;
|
||||
public Io_download_fmt File__download_fmt() {return file__download_fmt;} private final Io_download_fmt file__download_fmt = new Io_download_fmt();
|
||||
@@ -55,9 +63,12 @@ public class Xoav_app implements Xoa_app {
|
||||
public Xoa_css_extractor Html__css_installer() {return html__css_installer;} private final Xoa_css_extractor html__css_installer = new Xoa_css_extractor();
|
||||
public Xoh_bridge_mgr Html__bridge_mgr() {return html__bridge_mgr;} private final Xoh_bridge_mgr html__bridge_mgr;
|
||||
public Xoa_meta_mgr Meta_mgr() {return meta_mgr;} private final Xoa_meta_mgr meta_mgr;
|
||||
public Gfo_inet_conn Utl__inet_conn() {return inet_conn;} public void Utl__inet_conn_(Gfo_inet_conn v) {this.inet_conn = v;} private Gfo_inet_conn inet_conn;
|
||||
|
||||
public Gfo_inet_conn Utl__inet_conn() {return inet_conn;} private final Gfo_inet_conn inet_conn = Gfo_inet_conn_.new_();
|
||||
public Xoa_site_cfg_mgr Site_cfg_mgr() {return site_cfg_mgr;} private final Xoa_site_cfg_mgr site_cfg_mgr;
|
||||
public boolean Xwiki_mgr__missing(byte[] domain) {return wiki_mgr.Get_by_domain(domain) == null;}
|
||||
public Xoa_sitelink_mgr Xwiki_mgr__sitelink_mgr() {return xwiki_mgr__sitelink_mgr;} private final Xoa_sitelink_mgr xwiki_mgr__sitelink_mgr = new Xoa_sitelink_mgr();
|
||||
public Xow_xwiki_itm_parser Xwiki_mgr__itm_parser() {return xwiki_mgr__itm_parser;} private final Xow_xwiki_itm_parser xwiki_mgr__itm_parser = new Xow_xwiki_itm_parser();
|
||||
|
||||
public Xowmf_mgr Wmf_mgr() {return wmf_mgr;} private final Xowmf_mgr wmf_mgr = new Xowmf_mgr();
|
||||
public Gfo_usr_dlg Usr_dlg() {return usr_dlg;} public void Usr_dlg_(Gfo_usr_dlg v) {usr_dlg = v; Xoa_app_.Usr_dlg_(usr_dlg);} private Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Noop;
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return Xoa_app_.Utl__bfr_mkr();}
|
||||
@@ -65,13 +76,13 @@ public class Xoav_app implements Xoa_app {
|
||||
public Json_parser Utl__json_parser() {return utl__json_parser;} private final Json_parser utl__json_parser = new Json_parser();
|
||||
public boolean Bldr__running() {return bldr__running;} public void Bldr__running_(boolean v) {this.bldr__running = v;} private boolean bldr__running;
|
||||
|
||||
public Xop_amp_mgr Utl_amp_mgr() {return utl_amp_mgr;} private Xop_amp_mgr utl_amp_mgr = Xop_amp_mgr.I;
|
||||
public Xop_amp_mgr Utl_amp_mgr() {return utl_amp_mgr;} private Xop_amp_mgr utl_amp_mgr = Xop_amp_mgr.Instance;
|
||||
public Xol_case_mgr Utl_case_mgr() {return utl_case_mgr;} private Xol_case_mgr utl_case_mgr = Xol_case_mgr_.U8();
|
||||
public Url_encoder Utl_encoder_fsys() {return utl_encoder_fsys;} private Url_encoder utl_encoder_fsys = Url_encoder.new_fsys_lnx_();
|
||||
public Gfo_msg_log Utl_msg_log() {return utl_msg_log;} private Gfo_msg_log utl_msg_log;
|
||||
public Xoav_url_parser Utl_url_parser_xo() {return utl_url_parser_xo;} private Xoav_url_parser utl_url_parser_xo = new Xoav_url_parser();
|
||||
public Gfo_url_parser Utl_url_parser_gfo() {return utl_url_parser_gfo;} private final Gfo_url_parser utl_url_parser_gfo = new Gfo_url_parser();
|
||||
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {throw Err_.new_unimplemented_w_msg("implemented for Xoa_cfg_mgr");}
|
||||
public void Init_by_app(Io_url user_db_url) {
|
||||
user.Init_db(this, wiki_mgr, user_db_url);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,10 @@ package gplx.xowa.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.*; import gplx.xowa.langs.cases.*; import gplx.xowa.users.data.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
public class Xoav_wiki_mgr implements Xoa_wiki_mgr, GfoInvkAble {
|
||||
private final Xoav_app app; private final Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private final Xoav_app app; private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public Xoav_wiki_mgr(Xoav_app app, Xol_case_mgr case_mgr) {this.app = app;}
|
||||
public int Count() {return hash.Count();}
|
||||
public Xow_wiki Get_at_i(int i) {return (Xow_wiki)hash.Get_at(i);}
|
||||
public Xowv_wiki Get_by_domain(byte[] domain) {return (Xowv_wiki)hash.Get_by(domain);}
|
||||
public Xowv_wiki Import_by_fil(Io_url fil) {
|
||||
Io_url wiki_dir = fil.OwnerDir();
|
||||
@@ -40,6 +42,7 @@ public class Xoav_wiki_mgr implements Xoa_wiki_mgr, GfoInvkAble {
|
||||
return Load(Gen_domain_str(fil.NameOnly()), fil.OwnerDir());
|
||||
}
|
||||
public boolean Has(byte[] key) {return hash.Has(key);}
|
||||
public Xow_wiki Get_by_key_or_null_i(byte[] key) {return (Xowv_wiki)hash.Get_by(key);}
|
||||
public Xow_wiki Get_by_key_or_make_init_y(byte[] key) {
|
||||
Xow_wiki rv = this.Get_by_domain(key);
|
||||
// if (rv == null) rv = New_wiki(key); // TODO: must init wiki, but need wiki_url; DATE:2015-05-23
|
||||
@@ -47,7 +50,7 @@ public class Xoav_wiki_mgr implements Xoa_wiki_mgr, GfoInvkAble {
|
||||
}
|
||||
public Xow_wiki Get_by_key_or_make_init_n(byte[] key) {return Get_by_key_or_make_init_y(key);}
|
||||
public void Load_by_dir(Io_url wiki_root_dir) {
|
||||
Io_url[] wiki_dirs = Io_mgr.I.QueryDir_args(wiki_root_dir).DirOnly_().ExecAsUrlAry();
|
||||
Io_url[] wiki_dirs = Io_mgr.Instance.QueryDir_args(wiki_root_dir).DirOnly_().ExecAsUrlAry();
|
||||
for (Io_url wiki_dir : wiki_dirs) {
|
||||
String wiki_dir_url = wiki_dir.Raw();
|
||||
if (String_.Has_at_bgn(wiki_dir_url, "#")) continue;
|
||||
|
||||
@@ -15,7 +15,7 @@ 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.apis; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.apis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
class Xoapi_doc {}
|
||||
/*
|
||||
xowa {
|
||||
@@ -15,8 +15,8 @@ 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.apis; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.apis.xowa.*; import gplx.xowa.gui.cmds.*;
|
||||
package gplx.xowa.apps.apis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.guis.cmds.*;
|
||||
public class Xoapi_root implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
public Xoapi_root(Xoae_app app) {
|
||||
@@ -15,9 +15,9 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.apis.xowa.apps.*; import gplx.xowa.apis.xowa.envs.*; import gplx.xowa.apis.xowa.startups.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.apps.apis.xowa.apps.*; import gplx.xowa.apps.apis.xowa.envs.*; import gplx.xowa.apps.apis.xowa.startups.*;
|
||||
public class Xoapi_app implements GfoInvkAble {
|
||||
private Xog_win_itm win;
|
||||
public void Ctor_by_app(Xoae_app app) {
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.apis.xowa.wikis.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.wikis.*;
|
||||
public class Xoapi_app_wiki implements GfoInvkAble {
|
||||
public Xoapi_wiki_lang Lang() {return lang;} private final Xoapi_wiki_lang lang = new Xoapi_wiki_lang();
|
||||
public void Subscribe(GfoEvObj sub) {lang.Subscribe(sub);}
|
||||
@@ -15,9 +15,9 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
public class Xoapi_app_wikis implements GfoInvkAble {
|
||||
private final Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public Xoapi_app_wiki Get(byte[] domain) {
|
||||
Xoapi_app_wiki rv = (Xoapi_app_wiki)hash.Get_by(domain);
|
||||
if (rv == null) {
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.apis.xowa.bldrs.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.bldrs.*;
|
||||
public class Xoapi_bldr implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoa_app app) {wiki.Ctor_by_app(app);}
|
||||
public Xoapi_bldr_wiki Wiki() {return wiki;} private final Xoapi_bldr_wiki wiki = new Xoapi_bldr_wiki();
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.apis.xowa.gui.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
public class Xoapi_gui implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
browser.Init_by_kit(app);
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.apis.xowa.html.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_html implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoae_app app) {
|
||||
page.Ctor_by_app(app);
|
||||
@@ -15,9 +15,9 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.apis.xowa.navs.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.apps.apis.xowa.navs.*;
|
||||
public class Xoapi_nav implements GfoInvkAble {
|
||||
private Xog_win_itm win;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
public class Xoapi_net implements GfoInvkAble, GfoEvObj {
|
||||
public Xoapi_net() {this.ev_mgr = GfoEvMgr.new_(this);}
|
||||
public GfoEvMgr EvMgr() {return ev_mgr;} private GfoEvMgr ev_mgr;
|
||||
@@ -25,7 +25,7 @@ public class Xoapi_net implements GfoInvkAble, GfoEvObj {
|
||||
public void Enabled_(boolean v) {
|
||||
this.enabled = v;
|
||||
gplx.ios.IoEngine_system.Web_access_enabled = v;
|
||||
GfoEvMgr_.PubVal(this, gplx.xowa.gui.menus.dom.Xog_mnu_evt_mgr.Evt_selected_changed, v);
|
||||
GfoEvMgr_.PubVal(this, gplx.xowa.guis.menus.dom.Xog_mnu_evt_mgr.Evt_selected_changed, v);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return this.Enabled();
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.apis.xowa.specials.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.specials.*;
|
||||
public class Xoapi_special implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoae_app app) {
|
||||
}
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.apis.xowa.usrs.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.usrs.*;
|
||||
public class Xoapi_usr implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoae_app app) {
|
||||
bookmarks.Ctor_by_app(app);
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*;
|
||||
import gplx.xowa.apis.xowa.xtns.*;
|
||||
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
|
||||
import gplx.xowa.apps.apis.xowa.xtns.*;
|
||||
public class Xoapi_xtns implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
scribunto.Init_by_kit(app);
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.apps; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.apps; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
public class Xoapi_fsys implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoae_app app) {
|
||||
this.plat_jar = Env_.AppUrl();
|
||||
@@ -15,9 +15,9 @@ 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.apis.xowa.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.apis.xowa.bldrs.filters.*;
|
||||
import gplx.xowa.apis.xowa.bldrs.imports.*;
|
||||
package gplx.xowa.apps.apis.xowa.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.bldrs.filters.*;
|
||||
import gplx.xowa.apps.apis.xowa.bldrs.imports.*;
|
||||
public class Xoapi_bldr_wiki implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoa_app app) {filter.Ctor_by_app(app);}
|
||||
public Xoapi_filter Filter() {return filter;} private final Xoapi_filter filter = new Xoapi_filter();
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.bldrs.filters; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.bldrs.*;
|
||||
import gplx.xowa.apis.xowa.bldrs.filters.dansguardians.*;
|
||||
package gplx.xowa.apps.apis.xowa.bldrs.filters; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*;
|
||||
import gplx.xowa.apps.apis.xowa.bldrs.filters.dansguardians.*;
|
||||
public class Xoapi_filter implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoa_app app) {dansguardian.Ctor_by_app(app);}
|
||||
public Xoapi_dansguardian Dansguardian() {return dansguardian;} private final Xoapi_dansguardian dansguardian = new Xoapi_dansguardian();
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.bldrs.filters.dansguardians; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.bldrs.*; import gplx.xowa.apis.xowa.bldrs.filters.*;
|
||||
package gplx.xowa.apps.apis.xowa.bldrs.filters.dansguardians; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*; import gplx.xowa.apps.apis.xowa.bldrs.filters.*;
|
||||
import gplx.ios.*; import gplx.xowa.bldrs.filters.dansguardians.*;
|
||||
public class Xoapi_dansguardian implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoa_app app) {
|
||||
@@ -38,25 +38,25 @@ public class Xoapi_dansguardian implements GfoInvkAble {
|
||||
return rv;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(enabled);
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_root_dir)) return root_dir.Raw();
|
||||
else if (ctx.Match(k, Invk_root_dir_)) root_dir = m.ReadIoUrl("v");
|
||||
else if (ctx.Match(k, Invk_score_init)) return Int_.Xto_str(score_init);
|
||||
else if (ctx.Match(k, Invk_score_init)) return Int_.To_str(score_init);
|
||||
else if (ctx.Match(k, Invk_score_init_)) score_init = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_score_fail)) return Int_.Xto_str(score_fail);
|
||||
else if (ctx.Match(k, Invk_score_fail)) return Int_.To_str(score_fail);
|
||||
else if (ctx.Match(k, Invk_score_fail_)) score_fail = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_case_match)) return Yn.Xto_str(case_match);
|
||||
else if (ctx.Match(k, Invk_case_match)) return Yn.To_str(case_match);
|
||||
else if (ctx.Match(k, Invk_case_match_)) case_match = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_wildcard_enabled)) return Yn.Xto_str(wildcard_enabled);
|
||||
else if (ctx.Match(k, Invk_wildcard_enabled)) return Yn.To_str(wildcard_enabled);
|
||||
else if (ctx.Match(k, Invk_wildcard_enabled_)) wildcard_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_wildcard_char)) return String_.new_u8(wildcard_char);
|
||||
else if (ctx.Match(k, Invk_wildcard_char_)) wildcard_char = m.ReadBry("v");
|
||||
else if (ctx.Match(k, Invk_wildcard_list)) return "";
|
||||
else if (ctx.Match(k, Invk_wildcard_list_)) {}
|
||||
else if (ctx.Match(k, Invk_target_tid)) return Int_.Xto_str(target_tid);
|
||||
else if (ctx.Match(k, Invk_target_tid)) return Int_.To_str(target_tid);
|
||||
else if (ctx.Match(k, Invk_target_tid_)) target_tid = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_log_enabled)) return Yn.Xto_str(log_enabled);
|
||||
else if (ctx.Match(k, Invk_log_enabled)) return Yn.To_str(log_enabled);
|
||||
else if (ctx.Match(k, Invk_log_enabled_)) log_enabled = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.bldrs.filters.titles; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.bldrs.*; import gplx.xowa.apis.xowa.bldrs.filters.*;
|
||||
package gplx.xowa.apps.apis.xowa.bldrs.filters.titles; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*; import gplx.xowa.apps.apis.xowa.bldrs.filters.*;
|
||||
public class Xoapi_title implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
// wordlist_dir = app.Fsys_mgr().Bin_xtns_dir().GenSubDir_nest("xowa", "DansGuardian");
|
||||
@@ -26,15 +26,15 @@ public class Xoapi_title implements GfoInvkAble {
|
||||
public int Score_pass() {return score_pass;} private int score_pass = 0;
|
||||
public boolean Log_enabled() {return log_enabled;} private boolean log_enabled = Bool_.Y;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(enabled);
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_wordlist_dir)) return Int_.Xto_str(score_init);
|
||||
else if (ctx.Match(k, Invk_wordlist_dir)) return Int_.To_str(score_init);
|
||||
else if (ctx.Match(k, Invk_wordlist_dir_)) wordlist_dir= m.ReadIoUrl("v");
|
||||
else if (ctx.Match(k, Invk_score_init)) return Int_.Xto_str(score_init);
|
||||
else if (ctx.Match(k, Invk_score_init)) return Int_.To_str(score_init);
|
||||
else if (ctx.Match(k, Invk_score_init_)) score_init = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_score_pass)) return Int_.Xto_str(score_pass);
|
||||
else if (ctx.Match(k, Invk_score_pass)) return Int_.To_str(score_pass);
|
||||
else if (ctx.Match(k, Invk_score_pass_)) score_pass = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_log_enabled)) return Yn.Xto_str(enabled);
|
||||
else if (ctx.Match(k, Invk_log_enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk_log_enabled_)) log_enabled = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.bldrs.*;
|
||||
package gplx.xowa.apps.apis.xowa.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.bldrs.*;
|
||||
import gplx.ios.*; import gplx.xowa.wikis.data.*;
|
||||
public class Xoapi_import implements GfoInvkAble {
|
||||
public long Layout_all_max() {return layout_all_max;} private long layout_all_max = 0; // disable by default; may set to 200 MB in future
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.envs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.envs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
public class Xoapi_env implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {}
|
||||
public String Version_previous() {return version_previous;} private String version_previous = "";
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.apis.xowa.gui.browsers.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.gui.browsers.*;
|
||||
public class Xoapi_browser implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
url.Init_by_kit(app);
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.cfgs.gui.*; import gplx.xowa.html.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.cfgs.gui.*; import gplx.xowa.htmls.*;
|
||||
public class Xoapi_font implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
@@ -36,9 +36,9 @@ public class Xoapi_font implements GfoInvkAble {
|
||||
app.Html_mgr().Page_mgr().Font_enabled_(enabled);
|
||||
app.Html_mgr().Page_mgr().Font_size_(html_font_size);
|
||||
app.Cfg_mgr().Set_by_app("app.html.page.font_enabled", "y");
|
||||
app.Cfg_mgr().Set_by_app("app.html.page.font_size", Float_.Xto_str(app.Html_mgr().Page_mgr().Font_size()));
|
||||
app.Cfg_mgr().Set_by_app("app.html.page.font_size", Float_.To_str(app.Html_mgr().Page_mgr().Font_size()));
|
||||
app.Gui_mgr().Win_cfg().Font().Size_(gui_font_size);
|
||||
app.Cfg_mgr().Set_by_app("app.gui.win_opts.font.size", Float_.Xto_str(gui_font_size));
|
||||
app.Cfg_mgr().Set_by_app("app.gui.win_opts.font.size", Float_.To_str(gui_font_size));
|
||||
app.Cfg_mgr().Db_save_txt();
|
||||
app.Gui_mgr().Browser_win().Page__reload(); // NOTE: force reload; needed if viewing Help:Options/HTML, else Font size won't update
|
||||
}
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.apis.xowa.gui.pages.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.gui.pages.*;
|
||||
public class Xoapi_page implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
view.Init_by_kit(app);
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.pages.*; import gplx.xowa.gui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_find implements GfoInvkAble {
|
||||
private Xog_find_box find_box;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
@@ -50,7 +50,7 @@ class Xog_find_box {
|
||||
public void Hide() {
|
||||
app.Gui_mgr().Layout().Find_close();
|
||||
Xog_tab_itm tab = win.Tab_mgr().Active_tab(); if (tab == Xog_tab_itm_.Null) return;
|
||||
if (tab.View_mode() == Xopg_view_mode.Tid_read) // do not fire find("") for edit / html, else focus issues; DATE:2015-06-10
|
||||
if (tab.View_mode() == Xopg_page_.Tid_read) // do not fire find("") for edit / html, else focus issues; DATE:2015-06-10
|
||||
Exec_find(prv_find_text, Bool_.N);
|
||||
}
|
||||
public void Show_by_paste() {
|
||||
@@ -72,7 +72,7 @@ class Xog_find_box {
|
||||
private void Exec_find(String find, boolean highlight_matches) {
|
||||
Xog_tab_itm tab = win.Tab_mgr().Active_tab(); if (tab == Xog_tab_itm_.Null) return;
|
||||
find = String_.Replace(find, "\\", "\\\\"); // NOTE: backslashes are always literal, never escape codes; EX: "C:\new" "\n" means "\n", not (byte)10; DATE:2015-08-17
|
||||
boolean find_in_hdoc = tab.View_mode() == Xopg_view_mode.Tid_read;
|
||||
boolean find_in_hdoc = tab.View_mode() == Xopg_page_.Tid_read;
|
||||
if (find_in_hdoc)
|
||||
tab.Html_box().Html_js_eval_proc_as_str(Xog_js_procs.Win__find_in_hdoc , find, dir_fwd, case_match, wrap_search, highlight_matches);
|
||||
else
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.pages.*; import gplx.xowa.gui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_html_box implements GfoInvkAble, GfoEvMgrOwner {
|
||||
private Xog_win_itm win;
|
||||
public Xoapi_html_box() {
|
||||
@@ -29,7 +29,7 @@ public class Xoapi_html_box implements GfoInvkAble, GfoEvMgrOwner {
|
||||
Xog_tab_itm tab = win.Active_tab(); if (tab == Xog_tab_itm_.Null) return;
|
||||
Gfui_html html_box = tab.Html_itm().Html_box();
|
||||
html_box.Focus();
|
||||
if (tab.View_mode() != Xopg_view_mode.Tid_read) // if edit / html, place focus in edit box
|
||||
if (tab.View_mode() != Xopg_page_.Tid_read) // if edit / html, place focus in edit box
|
||||
html_box.Html_js_eval_proc_as_str(Xog_js_procs.Doc__elem_focus, Xog_html_itm.Elem_id__xowa_edit_data_box);
|
||||
}
|
||||
public void Selection_focus() {
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_info implements Gfo_usr_dlg__gui__opt, GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
private Xog_win_itm Win() {return app.Gui_mgr().Browser_win();}
|
||||
@@ -32,9 +32,9 @@ public class Xoapi_info implements Gfo_usr_dlg__gui__opt, GfoInvkAble {
|
||||
if (ctx.Match(k, Invk_focus)) this.Focus();
|
||||
else if (ctx.Match(k, Invk_clear)) this.Clear();
|
||||
else if (ctx.Match(k, Invk_launch)) this.Launch();
|
||||
else if (ctx.Match(k, Invk_warn_enabled)) return Yn.Xto_str(warn_enabled);
|
||||
else if (ctx.Match(k, Invk_warn_enabled)) return Yn.To_str(warn_enabled);
|
||||
else if (ctx.Match(k, Invk_warn_enabled_)) warn_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_note_enabled)) return Yn.Xto_str(note_enabled);
|
||||
else if (ctx.Match(k, Invk_note_enabled)) return Yn.To_str(note_enabled);
|
||||
else if (ctx.Match(k, Invk_note_enabled_)) note_enabled = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_prog implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
private Xog_win_itm Win() {return app.Gui_mgr().Browser_win();}
|
||||
@@ -25,7 +25,7 @@ public class Xoapi_prog implements GfoInvkAble {
|
||||
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_focus)) this.Focus();
|
||||
else if (ctx.Match(k, Invk_show_short_url)) return Yn.Xto_str(show_short_url);
|
||||
else if (ctx.Match(k, Invk_show_short_url)) return Yn.To_str(show_short_url);
|
||||
else if (ctx.Match(k, Invk_show_short_url_)) show_short_url = m.ReadBool("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_prog_log implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
public void Show() {app.Gui_mgr().Show_prog();}
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_search implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
private GfuiTextBox Search_box() {return app.Gui_mgr().Browser_win().Search_box();}
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_tabs implements GfoInvkAble {
|
||||
private Xog_tab_mgr tab_mgr;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_url implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
private GfuiTextBox Url_box() {return app.Gui_mgr().Browser_win().Url_box();}
|
||||
@@ -15,22 +15,22 @@ 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.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.xowa.gui.*; import gplx.xowa.gui.views.*; import gplx.xowa.pages.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.xowa.guis.*; import gplx.xowa.guis.views.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xoapi_edit implements GfoInvkAble {
|
||||
private Xog_win_itm win;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
win = app.Gui_mgr().Browser_win();
|
||||
}
|
||||
private boolean Active_tab_is_null() {return win.Tab_mgr().Active_tab_is_null();}
|
||||
private boolean Active_tab_is_edit() {return !win.Tab_mgr().Active_tab_is_null() && win.Tab_mgr().Active_tab().View_mode() == Xopg_view_mode.Tid_edit;}
|
||||
private boolean Active_tab_is_edit() {return !win.Tab_mgr().Active_tab_is_null() && win.Tab_mgr().Active_tab().View_mode() == Xopg_page_.Tid_edit;}
|
||||
public void Copy() {if (Active_tab_is_null()) return; win.Kit().Clipboard().Copy(win.Active_html_itm().Html_selected_get_text_or_href());}
|
||||
public void Select_all() {if (Active_tab_is_null()) return; GfoInvkAble_.InvkCmd(win.Win_box().Kit().Clipboard(), gplx.gfui.Gfui_clipboard_.Invk_select_all);}
|
||||
public void Save() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Save(win.Active_tab(), false);}
|
||||
public void Save_draft() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Save(win.Active_tab(), true);}
|
||||
public void Preview() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Preview(win.Active_tab());}
|
||||
public void Dbg_tmpl() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Debug(win, Xopg_view_mode.Tid_edit);}
|
||||
public void Dbg_html() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Debug(win, Xopg_view_mode.Tid_html);}
|
||||
public void Dbg_tmpl() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Debug(win, Xopg_page_.Tid_edit);}
|
||||
public void Dbg_html() {if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Debug(win, Xopg_page_.Tid_html);}
|
||||
public void Focus_edit_box(){if (!Active_tab_is_edit()) return; Xog_tab_itm_edit_mgr.Focus(win, Xog_html_itm.Elem_id__xowa_edit_data_box);}
|
||||
public void Exec() {
|
||||
}
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_selection implements GfoInvkAble {
|
||||
private Xoae_app app; private Xog_win_itm win;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
@@ -37,7 +37,7 @@ public class Xoapi_selection implements GfoInvkAble {
|
||||
String trg = app.Gui_mgr().Kit().New_dlg_file(Gfui_kit_.File_dlg_type_save, "Select file to save to:").Init_file_(trg_name).Ask();
|
||||
if (String_.Len_eq_0(trg)) return;
|
||||
Io_url trg_url = Io_url_.new_fil_(trg);
|
||||
Io_mgr.I.CopyFil(src_url, trg_url, true);
|
||||
Io_mgr.Instance.CopyFil(src_url, trg_url, true);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_copy)) this.Copy();
|
||||
@@ -15,17 +15,17 @@ 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.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.*; import gplx.xowa.gui.views.*; import gplx.xowa.pages.*;
|
||||
package gplx.xowa.apps.apis.xowa.gui.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xoapi_view implements GfoInvkAble {
|
||||
private Xoae_app app; private Xog_win_itm win;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
this.app = app; this.win = app.Gui_mgr().Browser_win();
|
||||
}
|
||||
private boolean Active_tab_is_null() {return win.Tab_mgr().Active_tab_is_null();}
|
||||
public void Mode_read() {Mode(Xopg_view_mode.Tid_read);}
|
||||
public void Mode_edit() {Mode(Xopg_view_mode.Tid_edit);}
|
||||
public void Mode_html() {Mode(Xopg_view_mode.Tid_html);}
|
||||
public void Mode_read() {Mode(Xopg_page_.Tid_read);}
|
||||
public void Mode_edit() {Mode(Xopg_page_.Tid_edit);}
|
||||
public void Mode_html() {Mode(Xopg_page_.Tid_html);}
|
||||
private void Mode(byte v) {if (Active_tab_is_null()) return; win.Page__mode_(v);}
|
||||
public void Reload() {if (Active_tab_is_null()) return; win.Page__reload();}
|
||||
public void Refresh() {if (Active_tab_is_null()) return; win.Page__refresh();}
|
||||
@@ -39,7 +39,7 @@ public class Xoapi_view implements GfoInvkAble {
|
||||
String file_name = Xoa_app_.Utl__encoder_mgr().Fsys_safe().Encode_str(String_.new_u8(tab.Page().Ttl().Full_url())) + ".html";
|
||||
String file_url = app.Gui_mgr().Kit().New_dlg_file(Gfui_kit_.File_dlg_type_save, "Select file to save to:").Init_file_(file_name).Ask();
|
||||
if (String_.Len_eq_0(file_url)) return;
|
||||
Io_mgr.I.SaveFilStr(file_url, tab.Html_box().Text());
|
||||
Io_mgr.Instance.SaveFilStr(file_url, tab.Html_box().Text());
|
||||
app.Usr_dlg().Prog_many("", "", "saved page: file=~{0}", file_url);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.apis.xowa.html.modules.*;
|
||||
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.html.modules.*;
|
||||
public class Xoapi_modules implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
popups.Init_by_app(app);
|
||||
@@ -15,15 +15,15 @@ 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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xoapi_page implements GfoInvkAble {
|
||||
public void Ctor_by_app(Xoae_app app) {
|
||||
toggle_mgr.Ctor_by_app(app);
|
||||
}
|
||||
public Xoapi_toggle_mgr Toggle_mgr() {return toggle_mgr;} private final Xoapi_toggle_mgr toggle_mgr = new Xoapi_toggle_mgr();
|
||||
public Xoapi_toggle_mgr Toggle_mgr() {return toggle_mgr;} private final Xoapi_toggle_mgr toggle_mgr = new Xoapi_toggle_mgr();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_toggles)) return toggle_mgr;
|
||||
if (ctx.Match(k, Invk_toggles)) return toggle_mgr;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk_toggles = "toggles";
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.apis.xowa.html.skins.*;
|
||||
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.html.skins.*;
|
||||
public class Xoapi_skins implements GfoInvkAble {
|
||||
private Hash_adp hash = Hash_adp_.new_();
|
||||
public Xoapi_skins() {
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.html.tidy.*;
|
||||
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.htmls.tidy.*;
|
||||
public class Xoapi_tidy implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
public class Xoapi_toggle_itm implements GfoInvkAble {
|
||||
private final Xoae_app app; // NOTE: needed to get "img_dir" below
|
||||
private byte[] img_title_val_y, img_title_val_n;
|
||||
@@ -79,7 +79,7 @@ public class Xoapi_toggle_itm implements GfoInvkAble {
|
||||
;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_visible)) return Yn.Xto_str(visible);
|
||||
if (ctx.Match(k, Invk_visible)) return Yn.To_str(visible);
|
||||
else if (ctx.Match(k, Invk_visible_)) this.visible = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,11 +15,11 @@ 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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.cfgs.*;
|
||||
package gplx.xowa.apps.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.cfgs.*;
|
||||
public class Xoapi_toggle_mgr implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
private final Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public void Ctor_by_app(Xoae_app app) {this.app = app;}
|
||||
public Xoapi_toggle_itm Get_or_new(String key_str) {
|
||||
byte[] key_bry = Bry_.new_u8(key_str);
|
||||
@@ -41,7 +41,7 @@ public class Xoapi_toggle_mgr implements GfoInvkAble {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xoapi_toggle_itm itm = (Xoapi_toggle_itm)hash.Get_at(i);
|
||||
cfg_mgr.Set_by_app("xowa.api.html.page.toggles.get('" + String_.new_u8(itm.Key_bry()) + "').visible", Yn.Xto_str(itm.Visible()));
|
||||
cfg_mgr.Set_by_app("xowa.api.html.page.toggles.get('" + String_.new_u8(itm.Key_bry()) + "').visible", Yn.To_str(itm.Visible()));
|
||||
}
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -15,13 +15,13 @@ 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.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.html.*;
|
||||
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_collapsible implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Collapsed() {return collapsed;} private boolean collapsed;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.Xto_str(collapsed);
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
|
||||
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,13 +15,13 @@ 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.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.html.*;
|
||||
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_navframe implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Collapsed() {return collapsed;} private boolean collapsed;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.Xto_str(collapsed);
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
|
||||
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.html.*;
|
||||
import gplx.xowa.html.modules.popups.*;
|
||||
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
import gplx.xowa.htmls.modules.popups.*;
|
||||
public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
|
||||
private Xoae_app app;
|
||||
public Xoapi_popups() {
|
||||
@@ -60,7 +60,7 @@ public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
|
||||
wiki.Html_mgr().Head_mgr().Popup_mgr().Show_all(popup_id);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(enabled);
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_show_more)) Show_more(m.ReadStr("popup_id"));
|
||||
else if (ctx.Match(k, Invk_show_all)) Show_all (m.ReadStr("popup_id"));
|
||||
@@ -80,7 +80,7 @@ public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
|
||||
else if (ctx.Match(k, Invk_win_max_h_)) {win_max_h = Set_int(m, win_max_h, Evt_win_max_h_changed);}
|
||||
else if (ctx.Match(k, Invk_win_show_all_max_w)) return win_show_all_max_w;
|
||||
else if (ctx.Match(k, Invk_win_show_all_max_w_)) {win_show_all_max_w = m.ReadInt("v");}
|
||||
else if (ctx.Match(k, Invk_win_bind_focus_blur)) return Yn.Xto_str(win_bind_focus_blur);
|
||||
else if (ctx.Match(k, Invk_win_bind_focus_blur)) return Yn.To_str(win_bind_focus_blur);
|
||||
else if (ctx.Match(k, Invk_win_bind_focus_blur_)) win_bind_focus_blur = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_xnde_ignore_ids)) return String_.new_u8(xnde_ignore_ids);
|
||||
else if (ctx.Match(k, Invk_xnde_ignore_ids_)) {xnde_ignore_ids = m.ReadBry("v"); GfoEvMgr_.PubVal(this, Evt_xnde_ignore_ids_changed, xnde_ignore_ids);}
|
||||
@@ -15,13 +15,13 @@ 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.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.html.*;
|
||||
package gplx.xowa.apps.apis.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_toc implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Collapsed() {return collapsed;} private boolean collapsed = false;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.Xto_str(collapsed);
|
||||
if (ctx.Match(k, Invk_collapsed)) return Yn.To_str(collapsed);
|
||||
else if (ctx.Match(k, Invk_collapsed_)) collapsed = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,13 +15,13 @@ 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.apis.xowa.html.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.html.*;
|
||||
package gplx.xowa.apps.apis.xowa.html.skins; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.html.*;
|
||||
public class Xoapi_skin_app_base implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
public boolean Sidebar_home_enabled() {return sidebar_home_enabled;} public void Sidebar_home_enabled_(boolean v) {sidebar_home_enabled = v;} private boolean sidebar_home_enabled;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_sidebar_home_enabled)) return Yn.Xto_str(sidebar_home_enabled);
|
||||
if (ctx.Match(k, Invk_sidebar_home_enabled)) return Yn.To_str(sidebar_home_enabled);
|
||||
else if (ctx.Match(k, Invk_sidebar_home_enabled_)) sidebar_home_enabled = m.ReadYn("v");
|
||||
return this;
|
||||
}
|
||||
@@ -15,9 +15,9 @@ 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.apis.xowa.navs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
package gplx.xowa.apps.apis.xowa.navs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
public class Xoapi_wiki implements GfoInvkAble {
|
||||
private Xog_win_itm win;
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.domains.crts.*;
|
||||
public class Xoapi_search implements GfoInvkAble, GfoEvMgrOwner {
|
||||
private final Xow_domain_crt_kv_itm_mgr multi_wikis_mgr = new Xow_domain_crt_kv_itm_mgr(); private byte[] multi_wikis_bry = Dflt_multi_wikis_bry;
|
||||
@@ -47,7 +47,7 @@ public class Xoapi_search implements GfoInvkAble, GfoEvMgrOwner {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_results_per_page)) return results_per_page;
|
||||
else if (ctx.Match(k, Invk_results_per_page_)) results_per_page = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_async_db)) return Yn.Xto_str(async_db);
|
||||
else if (ctx.Match(k, Invk_async_db)) return Yn.To_str(async_db);
|
||||
else if (ctx.Match(k, Invk_async_db_)) async_db = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_multi_wikis)) return String_.new_u8(multi_wikis_bry);
|
||||
else if (ctx.Match(k, Invk_multi_wikis_)) Multi_wikis_bry_(m.ReadBry("v"));
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.startups; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.apis.xowa.startups.tabs.*;
|
||||
package gplx.xowa.apps.apis.xowa.startups; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.startups.tabs.*;
|
||||
public class Xoapi_startups implements GfoInvkAble {
|
||||
public void Init_by_kit(Xoae_app app) {
|
||||
}
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.startups.*;
|
||||
package gplx.xowa.apps.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.startups.*;
|
||||
import gplx.xowa.specials.*;
|
||||
public class Xoapi_startup_tabs implements GfoInvkAble {
|
||||
public String Custom() {return custom;} private String custom;
|
||||
@@ -31,7 +31,7 @@ public class Xoapi_startup_tabs implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_previous_)) previous = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_custom)) return custom;
|
||||
else if (ctx.Match(k, Invk_custom_)) custom = m.ReadStr("v");
|
||||
else if (ctx.Match(k, Invk_custom_is_expr)) return Yn.Xto_str(custom_is_expr);
|
||||
else if (ctx.Match(k, Invk_custom_is_expr)) return Yn.To_str(custom_is_expr);
|
||||
else if (ctx.Match(k, Invk_custom_is_expr_)) custom_is_expr = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.startups.*;
|
||||
package gplx.xowa.apps.apis.xowa.startups.tabs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.startups.*;
|
||||
public class Xoapi_startup_tabs_tid_ {
|
||||
public static final byte Tid_blank = 0, Tid_xowa = 1, Tid_previous = 2, Tid_custom = 3;
|
||||
public static final String Key_blank = "blank", Key_xowa = "xowa", Key_previous = "previous", Key_custom = "custom";
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.gui.history.*; import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.guis.history.*; import gplx.xowa.guis.views.*;
|
||||
import gplx.xowa.users.bmks.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
public class Xoapi_bookmarks implements GfoInvkAble {
|
||||
@@ -43,9 +43,9 @@ public class Xoapi_bookmarks implements GfoInvkAble {
|
||||
return rv;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(enabled);
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_delete_confirm)) return Yn.Xto_str(delete_confirm);
|
||||
else if (ctx.Match(k, Invk_delete_confirm)) return Yn.To_str(delete_confirm);
|
||||
else if (ctx.Match(k, Invk_delete_confirm_)) delete_confirm = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_add)) return this.Add(m.ReadStrOr("v", null));
|
||||
else if (ctx.Match(k, Invk_show)) this.Show();
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.ios.*; import gplx.xowa.files.caches.*;
|
||||
public class Xoapi_cache implements GfoInvkAble {
|
||||
private Xou_cache_mgr cache_mgr;
|
||||
@@ -29,7 +29,7 @@ public class Xoapi_cache implements GfoInvkAble {
|
||||
KeyVal kv = ary[i];
|
||||
bfr.Add_str_a7(kv.Key()).Add_str_a7(": ").Add_str_u8(kv.Val_to_str_or_empty()).Add_byte_nl();
|
||||
}
|
||||
return bfr.Xto_str_and_clear();
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_fsys_size_min)) return cache_mgr.Fsys_size_min() / Io_mgr.Len_mb;
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_history implements GfoInvkAble {
|
||||
private Xoae_app app; private Xog_win_itm win;
|
||||
public void Ctor_by_app(Xoae_app app) {this.app = app;}
|
||||
@@ -26,7 +26,7 @@ public class Xoapi_history implements GfoInvkAble {
|
||||
public void Goto_recent() {win.Page__navigate_by_url_bar(app.Usere().History_mgr().Get_at_last());}
|
||||
public void Show() {win.Page__navigate_by_url_bar("home/wiki/Special:XowaPageHistory");}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(this.Enabled());
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(this.Enabled());
|
||||
else if (ctx.Match(k, Invk_enabled_)) Enabled_(m.ReadYn("v"));
|
||||
else if (ctx.Match(k, Invk_goto_recent)) this.Goto_recent();
|
||||
else if (ctx.Match(k, Invk_show)) this.Show();
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
package gplx.xowa.apps.apis.xowa.usrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.guis.views.*;
|
||||
public class Xoapi_logs implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
public void Ctor_by_app(Xoae_app app) {this.app = app;}
|
||||
@@ -25,10 +25,10 @@ public class Xoapi_logs implements GfoInvkAble {
|
||||
public void Enabled_(boolean v) {
|
||||
app.Log_wtr().Enabled_(v);
|
||||
if (!v)
|
||||
Io_mgr.I.DeleteFil_args(app.Log_wtr().Session_fil()).MissingFails_off().Exec();
|
||||
Io_mgr.Instance.DeleteFil_args(app.Log_wtr().Session_fil()).MissingFails_off().Exec();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(this.Enabled());
|
||||
if (ctx.Match(k, Invk_enabled)) return Yn.To_str(this.Enabled());
|
||||
else if (ctx.Match(k, Invk_enabled_)) Enabled_(m.ReadYn("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,8 +15,8 @@ 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.apis.xowa.wikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.apis.xowa.wikis.langs.*;
|
||||
package gplx.xowa.apps.apis.xowa.wikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.apps.apis.xowa.wikis.langs.*;
|
||||
public class Xoapi_wiki_lang implements GfoInvkAble {
|
||||
public Xoap_lang_variants Variants() {return variants;} private final Xoap_lang_variants variants = new Xoap_lang_variants();
|
||||
public void Subscribe(GfoEvObj sub) {variants.Subscribe(sub);}
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.wikis.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*; import gplx.xowa.apis.xowa.wikis.*;
|
||||
package gplx.xowa.apps.apis.xowa.wikis.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.wikis.*;
|
||||
public class Xoap_lang_variants implements GfoInvkAble, GfoEvMgrOwner {
|
||||
public Xoap_lang_variants() {
|
||||
this.ev_mgr = GfoEvMgr.new_(this);
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.xtns; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.xtns; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.scribunto.engines.*;
|
||||
public class Xoapi_scribunto implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
@@ -15,7 +15,7 @@ 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.apis.xowa.xtns; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
package gplx.xowa.apps.apis.xowa.xtns; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
|
||||
import gplx.xowa.xtns.wdatas.*;
|
||||
public class Xoapi_wikibase implements GfoInvkAble, GfoEvMgrOwner {
|
||||
public Xoapi_wikibase() {
|
||||
125
400_xowa/src/gplx/xowa/apps/boots/Xoa_boot_mgr.java
Normal file
125
400_xowa/src/gplx/xowa/apps/boots/Xoa_boot_mgr.java
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
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.apps.boots; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.core.consoles.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.views.boots.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.users.*;
|
||||
public class Xoa_boot_mgr {
|
||||
private Gfo_usr_dlg usr_dlg; private Gfo_usr_dlg__log log_wtr;
|
||||
public void Run(String[] args, Xoa_cmd_arg_mgr arg_mgr) {
|
||||
try {
|
||||
Init_env(args);
|
||||
if (arg_mgr.Process(usr_dlg, args, Env_.AppUrl().OwnerDir()))
|
||||
Run_app(arg_mgr);
|
||||
}
|
||||
catch (Exception e) {
|
||||
String err_str = Err_.Message_gplx_full(e);
|
||||
log_wtr.Log_to_err(err_str);
|
||||
Console_adp__sys.Instance.Write_str_w_nl(err_str);
|
||||
if (log_wtr.Log_dir() == null) log_wtr.Log_dir_(Env_.AppUrl().OwnerDir().GenSubFil("xowa.log"));
|
||||
log_wtr.Queue_enabled_(false);
|
||||
}
|
||||
}
|
||||
private void Init_env(String[] args) {
|
||||
Gfo_usr_dlg_.Instance = usr_dlg = Xoa_app_.usr_dlg_console_();
|
||||
log_wtr = usr_dlg.Log_wkr(); log_wtr.Log_to_session_fmt("env.init: version=~{0}", Xoa_app_.Version);
|
||||
GfuiEnv_.Init_swt(args, Xoa_app_.class);
|
||||
Io_url jar_url = Env_.AppUrl();
|
||||
Xoa_app_.Build_date = Io_mgr.Instance.QueryFil(jar_url).ModifiedTime().XtoUtc().XtoStr_fmt("yyyy-MM-dd HH:mm");
|
||||
log_wtr.Log_to_session_fmt("env.init: jar_url=~{0}; build_date=~{1}", jar_url.NameAndExt(), Xoa_app_.Build_date);
|
||||
log_wtr.Log_to_session_fmt("env.init: op_sys=~{0}", Op_sys.Cur().To_str());
|
||||
}
|
||||
private void Run_app(Xoa_cmd_arg_mgr arg_mgr) {
|
||||
boolean app_type_is_gui = false;
|
||||
Xoae_app app = null;
|
||||
try {
|
||||
// init vars
|
||||
Io_url root_dir = arg_mgr.Fsys__root_dir();
|
||||
Xoa_app_.Op_sys_str = arg_mgr.Fsys__bin_dir();
|
||||
Xoa_app_.User_agent = String_.Format("XOWA/{0} ({1}) [gnosygnu@gmail.com]", Xoa_app_.Version, Xoa_app_.Op_sys_str);
|
||||
Xoa_app_mode app_type = arg_mgr.App_type();
|
||||
app_type_is_gui = app_type.Tid_is_gui();
|
||||
Xog_splash_win splash_win = new Xog_splash_win(app_type_is_gui);
|
||||
Db_conn_bldr.Instance.Reg_default_sqlite();
|
||||
|
||||
// init app
|
||||
app = new Xoae_app(usr_dlg, app_type
|
||||
, root_dir
|
||||
, arg_mgr.Fsys__wiki_dir()
|
||||
, root_dir.GenSubDir("file")
|
||||
, arg_mgr.Fsys__user_dir()
|
||||
, root_dir.GenSubDir_nest("user", "anonymous", "wiki")
|
||||
, Xoa_app_.Op_sys_str);
|
||||
usr_dlg.Log_wkr().Queue_enabled_(false); log_wtr.Log_to_session_fmt("app.init");
|
||||
try {
|
||||
app.Sys_cfg().Lang_(System_lang());
|
||||
String launch_url = arg_mgr.Gui__home_page();
|
||||
if (launch_url != null) app.Api_root().App().Startup().Tabs().Manual_(launch_url);
|
||||
app.Tcp_server().Rdr_port_(arg_mgr.Tcp__port_recv()).Wtr_port_(arg_mgr.Tcp__port_send());
|
||||
gplx.xowa.apps.servers.http.Http_server_mgr server_mgr = app.Http_server();
|
||||
server_mgr.Port_(arg_mgr.Http__port());
|
||||
server_mgr.Home_(Bry_.new_u8(arg_mgr.Http__home_page()));
|
||||
server_mgr.Wkr_pool().Init(arg_mgr.Http__max_clients(), arg_mgr.Http__max_clients_timeout());
|
||||
app.Init_by_app();
|
||||
}
|
||||
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());
|
||||
Io_url cmd_file = arg_mgr.Cmd__file();
|
||||
try {app.Gfs_mgr().Run_url(cmd_file);}
|
||||
catch (Exception e) {
|
||||
usr_dlg.Warn_many("", "", "script file failed: ~{0} ~{1}", cmd_file.Raw(), Err_.Message_gplx_full(e));
|
||||
if (app_type_is_gui)
|
||||
GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));
|
||||
}
|
||||
gplx.xowa.apps.setups.Xoa_setup_mgr.Delete_old_files(app);
|
||||
|
||||
// launch
|
||||
app.Launch();
|
||||
if (app_type.Tid_is_tcp()) app.Tcp_server().Run();
|
||||
else if (app_type.Tid_is_http()) app.Http_server().Run();
|
||||
else {
|
||||
String cmd_text = arg_mgr.Cmd__text();
|
||||
if (cmd_text != null) {
|
||||
gplx.xowa.apps.servers.Gxw_html_server.Init_gui_for_server(app, null); // NOTE: must init kit else "app.shell.fetch_page" will fail; DATE:2015-04-30
|
||||
Console_adp__sys.Instance.Write_str_w_nl_utf8(Object_.Xto_str_strict_or_empty(app.Gfs_mgr().Run_str(cmd_text)));
|
||||
}
|
||||
if (app_type_is_gui)
|
||||
app.Gui_mgr().Run(splash_win);
|
||||
else // teardown app, else lua will keep process running
|
||||
if (gplx.xowa.xtns.scribunto.Scrib_core.Core() != null) gplx.xowa.xtns.scribunto.Scrib_core.Core().Term();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {usr_dlg.Warn_many("", "", "app launch failed: ~{0}", Err_.Message_gplx_full(e));}
|
||||
finally {
|
||||
if (app != null && app_type_is_gui) // only cancel if app_type_is_gui is true; (force cmd_line to end process)
|
||||
app.Setup_mgr().Cmd_mgr().Canceled_y_();
|
||||
}
|
||||
}
|
||||
private static byte[] System_lang() {
|
||||
String lang_code = Env_.Env_prop__user_language();
|
||||
byte[] lang_code_bry = Bry_.new_a7(lang_code);
|
||||
Xol_lang_stub lang_itm = Xol_lang_stub_.Get_by_key_or_null(lang_code_bry);
|
||||
return lang_itm == null ? Xol_lang_itm_.Key_en : lang_itm.Key();
|
||||
}
|
||||
}
|
||||
|
||||
102
400_xowa/src/gplx/xowa/apps/boots/Xoa_cmd_arg_mgr.java
Normal file
102
400_xowa/src/gplx/xowa/apps/boots/Xoa_cmd_arg_mgr.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
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.apps.boots; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.core.consoles.*;
|
||||
import gplx.xowa.apps.*;
|
||||
public class Xoa_cmd_arg_mgr {
|
||||
Xoa_cmd_arg_mgr(Gfo_cmd_arg_mgr arg_mgr) {this.arg_mgr = arg_mgr;}
|
||||
public Gfo_cmd_arg_mgr Arg_mgr() {return arg_mgr;} private final Gfo_cmd_arg_mgr arg_mgr;
|
||||
public Xoa_app_mode App_type() {return app_type;} private Xoa_app_mode app_type;
|
||||
public Io_url Fsys__root_dir() {return fsys__root_dir;} private Io_url fsys__root_dir;
|
||||
public String Fsys__bin_dir() {return fsys__bin_dir;} private String fsys__bin_dir;
|
||||
public Io_url Fsys__user_dir() {return fsys__user_dir;} private Io_url fsys__user_dir;
|
||||
public Io_url Fsys__wiki_dir() {return fsys__wiki_dir;} private Io_url fsys__wiki_dir;
|
||||
public Io_url Cmd__file() {return cmd__file;} private Io_url cmd__file;
|
||||
public String Cmd__text() {return cmd__text;} private String cmd__text;
|
||||
public int Tcp__port_recv() {return tcp__port_recv;} private int tcp__port_recv;
|
||||
public int Tcp__port_send() {return tcp__port_send;} private int tcp__port_send;
|
||||
public int Http__port() {return http__port;} private int http__port;
|
||||
public String Http__home_page() {return http__home_page;} private String http__home_page;
|
||||
public int Http__max_clients() {return http__max_clients;} private int http__max_clients;
|
||||
public int Http__max_clients_timeout() {return http__max_clients_timeout;} private int http__max_clients_timeout;
|
||||
public String Gui__home_page() {return gui__home_page;} private String gui__home_page;
|
||||
public boolean Process(Gfo_usr_dlg usr_dlg, String[] args, Io_url jar_dir) {
|
||||
arg_mgr.Parse(args);
|
||||
if (!Print(usr_dlg)) return false;
|
||||
this.app_type = Xoa_app_mode.parse(arg_mgr.Get_by("app_mode").Val_as_str_or("gui"));
|
||||
this.fsys__root_dir = arg_mgr.Get_by("root_dir").Val_as_url__rel_dir_or(jar_dir, jar_dir);
|
||||
this.fsys__user_dir = arg_mgr.Get_by("user_dir").Val_as_url__rel_dir_or(fsys__root_dir.GenSubDir("user"), fsys__root_dir.GenSubDir_nest("user", User_name_default));
|
||||
this.fsys__wiki_dir = arg_mgr.Get_by("wiki_dir").Val_as_url__rel_dir_or(fsys__root_dir.GenSubDir("wiki"), fsys__root_dir.GenSubDir("wiki"));
|
||||
this.cmd__file = arg_mgr.Get_by("cmd_file").Val_as_url__rel_fil_or(jar_dir, fsys__root_dir.GenSubFil_nest("bin", "any", "xowa", "cfg" ,"app", "xowa.gfs"));
|
||||
this.cmd__text = arg_mgr.Get_by("cmd_text").Val_as_str_or(null);
|
||||
this.tcp__port_recv = arg_mgr.Get_by("server_port_recv").Val_as_int_or(55000);
|
||||
this.tcp__port_send = arg_mgr.Get_by("server_port_send").Val_as_int_or(55001);
|
||||
this.http__port = arg_mgr.Get_by("http_server_port").Val_as_int_or(8080);
|
||||
this.http__home_page = arg_mgr.Get_by("http_server_home").Val_as_str_or("home/wiki/Main_Page");
|
||||
this.http__max_clients = arg_mgr.Get_by("http_server.max_clients").Val_as_int_or(0);
|
||||
this.http__max_clients_timeout = arg_mgr.Get_by("http_server.max_clients_timeout").Val_as_int_or(50);
|
||||
this.gui__home_page = arg_mgr.Get_by("url").Val_as_str_or(null);
|
||||
this.fsys__bin_dir = arg_mgr.Get_by("bin_dir_name").Val_as_str_or(Bin_dir_name());
|
||||
return true;
|
||||
}
|
||||
private boolean Print(Gfo_usr_dlg usr_dlg) {
|
||||
String header = String_.Concat_lines_nl_skip_last
|
||||
( Env_.GenHdr(false, "XOWA", "XOWA: the XOWA Offline Wiki Application\n", "")
|
||||
, String_.Repeat("-", 80)
|
||||
, ""
|
||||
, "version: " + Xoa_app_.Version + "; build date: " + Xoa_app_.Build_date
|
||||
);
|
||||
Gfo_cmd_arg_mgr_printer printer = new Gfo_cmd_arg_mgr_printer(arg_mgr);
|
||||
return printer.Print(usr_dlg, header, Xoa_app_.Name, "help", "show_license", "show_args");
|
||||
}
|
||||
public static Xoa_cmd_arg_mgr new_() {
|
||||
Gfo_cmd_arg_mgr arg_mgr = new Gfo_cmd_arg_mgr().Reg_many
|
||||
( Gfo_cmd_arg_itm_.opt_("root_dir").Example_url_("C:\\xowa").Note_("root directory for xowa; defaults to current directory of xowa.jar")
|
||||
, Gfo_cmd_arg_itm_.opt_("user_dir").Example_url_("C:\\xowa\\user\\" + User_name_default).Note_("directory for user_data; defaults to '/xowa/user/" + User_name_default + "'")
|
||||
, Gfo_cmd_arg_itm_.opt_("wiki_dir").Example_url_("C:\\xowa\\wiki\\").Note_("directory for wikis; defaults to '/xowa/wiki/'")
|
||||
, Gfo_cmd_arg_itm_.opt_("bin_dir_name").Example_("windows").Note_("platform-dependent directory name inside /xowa/bin/; valid values are 'linux', 'macosx', 'windows', 'linux_64', 'macosx_64', 'windows_64'; defaults to detected version")
|
||||
, Gfo_cmd_arg_itm_.opt_("app_mode").Example_("gui").Note_("type of app to run; valid values are 'gui', 'cmd', 'server', 'http_server'; defaults to 'gui'")
|
||||
, Gfo_cmd_arg_itm_.opt_("cmd_file").Example_url_("C:\\xowa\\bin\\any\\xowa\\cfg\\app\\xowa.gfs").Note_("file_path of script to execute; defaults to 'xowa.gfs'")
|
||||
, Gfo_cmd_arg_itm_.opt_("cmd_text").Example_("\"app.shell.fetch_page('en.wikipedia.org/wiki/Earth', 'html');\"").Note_("script to run; runs after cmd_file; does nothing if empty; default is empty.\nCurrently a useful cmd is to do 'java -jar xowa_your_platform.jar --app_mode cmd --show_license n --show_args n --cmd_text \"app.shell.fetch_page('en.wikipedia.org/wiki/Earth' 'html');\"'. This will output the page's html to the console. You can also change 'html' to 'wiki' to get the wikitext.")
|
||||
, Gfo_cmd_arg_itm_.opt_("url").Example_("en.wikipedia.org/wiki/Earth").Note_("url to be shown when xowa first launches; default is home/wiki/Main_Page")
|
||||
, Gfo_cmd_arg_itm_.opt_("server_port_recv").Example_("55000").Note_("applies to --app_mode server; port where xowa server will receive messages; clients should send messages to this port")
|
||||
, Gfo_cmd_arg_itm_.opt_("server_port_send").Example_("55001").Note_("applies to --app_mode server; port where xowa server will send messages; clients should listen for messages from this port")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server_port").Example_("8080").Note_("applies to --app_mode http_server; port used by http_server; default is 8080")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server_home").Example_("home/wiki/Main_Page").Note_("applies to --app_mode http_server; default home page for root address. EX: navigating to localhost:8080 will navigate to localhost:8080/home/wiki/Main_Page")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server.max_clients").Example_("15").Note_("applies to --app_mode http_server; limits maximum number of concurrent connections; default is 0 (no limit)")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server.max_clients_timeout").Example_("50").Note_("applies to --app_mode http_server; time in milliseconds to wait before checking again to see if a connection is free; default is 50 (wait 50 ms)")
|
||||
, Gfo_cmd_arg_itm_.sys_("show_license").Dflt_(true)
|
||||
, Gfo_cmd_arg_itm_.sys_("show_args").Dflt_(true)
|
||||
, Gfo_cmd_arg_itm_.new_(Gfo_cmd_arg_itm_.Tid_system, "help", Bool_.N, Gfo_cmd_arg_itm_.Val_tid_string)
|
||||
);
|
||||
return new Xoa_cmd_arg_mgr(arg_mgr);
|
||||
}
|
||||
private static final String User_name_default = gplx.xowa.users.Xoue_user.Key_xowa_user;
|
||||
private static String Bin_dir_name() {
|
||||
String rv = "";
|
||||
Op_sys op_sys = Op_sys.Cur();
|
||||
switch (op_sys.Tid()) {
|
||||
case Op_sys.Tid_lnx: rv = "linux"; break;
|
||||
case Op_sys.Tid_wnt: rv = "windows"; break;
|
||||
case Op_sys.Tid_osx: rv = "macosx"; break;
|
||||
default: throw Err_.new_unhandled("unknown platform " + Op_sys.Cur());
|
||||
}
|
||||
if (op_sys.Bitness() == Op_sys.Bitness_64) rv += "_64";
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
public interface Xoa_cfg_db {
|
||||
void Cfg_reset_all(Xoa_cfg_mgr cfg_mgr);
|
||||
void Cfg_save_bgn(Xoa_cfg_mgr cfg_mgr);
|
||||
@@ -15,30 +15,31 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.apps.gfss.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.apps.gfs.*;
|
||||
public class Xoa_cfg_db_txt implements Xoa_cfg_db {
|
||||
private Bry_fmtr fmtr = Bry_fmtr.new_("app.cfgs.get('~{msg}', '~{wiki}').val = '~{val}';\n", "msg", "wiki", "val");
|
||||
public void Cfg_reset_all(Xoa_cfg_mgr cfg_mgr) {
|
||||
Io_url src_url = this.Cfg_url(cfg_mgr);
|
||||
Io_url trg_url = src_url.GenNewNameAndExt("xowa_user_cfg." + DateAdp_.Now().XtoStr_fmt_yyyyMMdd_HHmmss() + ".gfs");
|
||||
Io_mgr.I.MoveFil_args(src_url, trg_url, true).Exec();
|
||||
cfg_mgr.App().Gui_mgr().Kit().Ask_ok("", "", "Options cleared. Please restart XOWA.");
|
||||
Io_mgr.Instance.MoveFil_args(src_url, trg_url, true).Exec();
|
||||
if (cfg_mgr.App().Tid_is_edit())
|
||||
((Xoae_app)cfg_mgr.App()).Gui_mgr().Kit().Ask_ok("", "", "Options cleared. Please restart XOWA.");
|
||||
}
|
||||
public void Cfg_load_run(Xoa_cfg_mgr cfg_mgr) {
|
||||
String load = Io_mgr.I.LoadFilStr(Cfg_url(cfg_mgr));
|
||||
String load = Io_mgr.Instance.LoadFilStr(Cfg_url(cfg_mgr));
|
||||
cfg_mgr.App().Gfs_mgr().Run_str(load);
|
||||
}
|
||||
public void Cfg_save_bgn(Xoa_cfg_mgr cfg_mgr) {
|
||||
bfr.ClearAndReset();
|
||||
} private Bry_bfr bfr = Bry_bfr.new_();
|
||||
public void Cfg_save_end(Xoa_cfg_mgr cfg_mgr) {
|
||||
cfg_mgr.App().Usr_dlg().Log_many("", "", "shutting down app; saving cfg: len=~{0}", bfr.Len());
|
||||
Io_mgr.I.SaveFilBfr(Cfg_url(cfg_mgr), bfr);
|
||||
Xoa_app_.Usr_dlg().Log_many("", "", "shutting down app; saving cfg: len=~{0}", bfr.Len());
|
||||
Io_mgr.Instance.SaveFilBfr(Cfg_url(cfg_mgr), bfr);
|
||||
}
|
||||
public void Cfg_save_run(Xoa_cfg_mgr cfg_mgr, Xoa_cfg_grp cfg_grp, Xoa_cfg_itm cfg_itm) {
|
||||
fmtr.Bld_bfr_many(bfr, Xoa_gfs_mgr.Cfg_save_escape(cfg_grp.Key_bry()), Xoa_gfs_mgr.Cfg_save_escape(cfg_itm.Key()), Xoa_gfs_mgr.Cfg_save_escape(cfg_itm.Val()));
|
||||
fmtr.Bld_bfr_many(bfr, Xoa_gfs_wtr_.Escape(cfg_grp.Key_bry()), Xoa_gfs_wtr_.Escape(cfg_itm.Key()), Xoa_gfs_wtr_.Escape(cfg_itm.Val()));
|
||||
}
|
||||
public Io_url Cfg_url(Xoa_cfg_mgr cfg_mgr) {return cfg_mgr.App().Usere().Fsys_mgr().App_data_cfg_dir().GenSubFil(File_name);}
|
||||
public Io_url Cfg_url(Xoa_cfg_mgr cfg_mgr) {return ((Xoae_app)cfg_mgr.App()).Usere().Fsys_mgr().App_data_cfg_dir().GenSubFil(File_name);}
|
||||
public static final String File_name = "xowa_user_cfg.gfs";
|
||||
}
|
||||
64
400_xowa/src/gplx/xowa/apps/cfgs/Xoa_cfg_grp.java
Normal file
64
400_xowa/src/gplx/xowa/apps/cfgs/Xoa_cfg_grp.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
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.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_cfg_grp {
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry(); private final Xoa_cfg_mgr mgr;
|
||||
public Xoa_cfg_grp(Xoa_cfg_mgr mgr, Xoa_cfg_grp_tid tid, byte[] key_bry) {
|
||||
this.mgr = mgr; this.tid = tid; this.key_bry = key_bry; this.key_str = String_.new_u8(key_bry);
|
||||
}
|
||||
public Xoa_cfg_grp_tid Tid() {return tid;} private final Xoa_cfg_grp_tid tid;
|
||||
public byte[] Key_bry() {return key_bry;} private final byte[] key_bry;
|
||||
public String Key_str() {return key_str;} private final String key_str;
|
||||
public boolean Notify(Xoa_cfg_itm itm) {return mgr.Notify(this, itm);}
|
||||
public Xoa_cfg_itm Get_by_or_null(byte[] key) {return (Xoa_cfg_itm)hash.Get_by(key);}
|
||||
public Xoa_cfg_itm Get_by_or_make(byte[] key) {
|
||||
Xoa_cfg_itm rv = (Xoa_cfg_itm)hash.Get_by(key);
|
||||
if (rv == null) {
|
||||
rv = new Xoa_cfg_itm(this, key);
|
||||
hash.Add(key, rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public Xoa_cfg_itm Get_by_wiki(byte[] domain_bry, int domain_tid) {
|
||||
Xoa_cfg_itm rv = (Xoa_cfg_itm)hash.Get_by(domain_bry);
|
||||
if (rv == null) { // match by domain_bry failed; try tid
|
||||
rv = (Xoa_cfg_itm)hash.Get_by(Xow_domain_tid_.Get_type_as_bry(domain_tid));
|
||||
if (rv == null) // match by type failed; try all
|
||||
rv = (Xoa_cfg_itm)hash.Get_by(Xoa_cfg_grp_tid.Key_all_bry);
|
||||
if (rv == null) // match by all failed; try app
|
||||
rv = (Xoa_cfg_itm)hash.Get_by(Xoa_cfg_grp_tid.Key_app_bry);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public void Db_load_end() {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xoa_cfg_itm itm = (Xoa_cfg_itm)hash.Get_at(i);
|
||||
itm.Val_load_done();
|
||||
}
|
||||
}
|
||||
public void Db_save(Xoa_cfg_db db) {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xoa_cfg_itm itm = (Xoa_cfg_itm)hash.Get_at(i);
|
||||
if (!itm.Val_is_customized() && !itm.Val_is_dirty()) continue; // system default and unchanged; no need to save
|
||||
db.Cfg_save_run(mgr, this, itm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_cfg_grp_tid {
|
||||
public byte Tid() {return tid;} private byte tid;
|
||||
@@ -32,7 +32,7 @@ public class Xoa_cfg_grp_tid {
|
||||
else if (Bry_.Eq(key, Key_app_bry)) rv.tid = Tid_app;
|
||||
else {
|
||||
Xow_domain_itm wiki_type = Xow_domain_itm_.parse(key);
|
||||
if (wiki_type.Domain_type_id() == Xow_domain_type_.Int__other)
|
||||
if (wiki_type.Domain_type_id() == Xow_domain_tid_.Int__other)
|
||||
rv.tid = Tid_wiki;
|
||||
else {
|
||||
rv.tid = Tid_type;
|
||||
@@ -15,25 +15,25 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
public class Xoa_cfg_itm implements GfoInvkAble {
|
||||
public Xoa_cfg_itm(Xoa_cfg_grp grp, byte[] key) {this.grp = grp; this.key = key;}
|
||||
public Xoa_cfg_grp Grp() {return grp;} private Xoa_cfg_grp grp;
|
||||
public byte[] Key() {return key;} private byte[] key;
|
||||
public Xoa_cfg_grp Grp() {return grp;} private final Xoa_cfg_grp grp;
|
||||
public byte[] Key() {return key;} private final byte[] key;
|
||||
public String Val() {return val;} private String val;
|
||||
public Xoa_cfg_itm Val_(String v) {
|
||||
val = v;
|
||||
public boolean Val_is_dirty() {return val_is_dirty;} private boolean val_is_dirty;
|
||||
public boolean Val_is_customized() {return val_is_customized;} private boolean val_is_customized; // false if value is system default; true if changed by user
|
||||
public void Val_(String v) {
|
||||
this.val = v;
|
||||
if (grp.Notify(this)) {
|
||||
db_customized = true;
|
||||
db_dirty = true;
|
||||
val_is_customized = true;
|
||||
val_is_dirty = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public boolean Db_customized() {return db_customized;} public Xoa_cfg_itm Db_customized_(boolean v) {db_customized = v; return this;} private boolean db_customized;
|
||||
public boolean Db_dirty() {return db_dirty;} public Xoa_cfg_itm Db_dirty_(boolean v) {db_dirty = v; return this;} private boolean db_dirty;
|
||||
public void Clear() {
|
||||
grp = null;
|
||||
}
|
||||
public void Val_load_done() {
|
||||
val_is_dirty = false;
|
||||
val_is_customized = true;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_val)) return val;
|
||||
else if (ctx.Match(k, Invk_val_)) Val_(m.ReadStr("v"));
|
||||
@@ -15,14 +15,15 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_cfg_mgr implements GfoInvkAble {
|
||||
public Xoa_cfg_mgr(Xoae_app app) {this.app = app;} private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
public Xoae_app App() {return app;} private Xoae_app app;
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public Xoa_cfg_mgr(Xoa_app app) {this.app = app;}
|
||||
public Xoa_app App() {return app;} private final Xoa_app app;
|
||||
public Xoa_cfg_itm Get_itm_or_null(byte[] grp_key, byte[] itm_key) {
|
||||
Xoa_cfg_grp grp = (Xoa_cfg_grp)hash.Get_by(grp_key);
|
||||
return grp == null ? null : grp.Get_itm_or_null(itm_key);
|
||||
return grp == null ? null : grp.Get_by_or_null(itm_key);
|
||||
}
|
||||
public Xoa_cfg_itm Get_itm_or_make(byte[] grp_key, byte[] itm_key) {
|
||||
Xoa_cfg_grp grp = null;
|
||||
@@ -34,20 +35,17 @@ public class Xoa_cfg_mgr implements GfoInvkAble {
|
||||
}
|
||||
else
|
||||
grp = (Xoa_cfg_grp)grp_obj;
|
||||
return grp.Get_itm_or_make(itm_key);
|
||||
return grp.Get_by_or_make(itm_key);
|
||||
}
|
||||
public void Set_by_app(String grp_key, String val) {Set(Bry_.new_u8(grp_key), Xoa_cfg_grp_tid.Key_app_bry, val);}
|
||||
public void Set_by_all(String grp_key, String val) {Set(Bry_.new_u8(grp_key), Xoa_cfg_grp_tid.Key_all_bry, val);}
|
||||
public void Set_by_type(String grp_key, byte tid, String val) {Set(Bry_.new_u8(grp_key), Xow_domain_type_.Get_type_as_bry(tid), val);}
|
||||
private void Set(byte[] grp_key, byte[] tid_key, String val) {
|
||||
Xoa_cfg_itm itm = Get_itm_or_make(grp_key, tid_key);
|
||||
itm.Val_(val);
|
||||
}
|
||||
public void Init(Xowe_wiki wiki) {
|
||||
public void Set_by_type(String grp_key, byte tid, String val) {Set(Bry_.new_u8(grp_key), Xow_domain_tid_.Get_type_as_bry(tid), val);}
|
||||
private void Set(byte[] grp_key, byte[] tid_key, String val) {Get_itm_or_make(grp_key, tid_key).Val_(val);}
|
||||
public void Init(Xow_wiki wiki) {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoa_cfg_grp grp = (Xoa_cfg_grp)hash.Get_at(i);
|
||||
Xoa_cfg_itm itm = grp.Get_itm_by_wiki(wiki.Domain_bry(), wiki.Domain_tid());
|
||||
Xoa_cfg_itm itm = grp.Get_by_wiki(wiki.Domain_bry(), wiki.Domain_tid());
|
||||
if (itm == null) continue; // grp exists, but not for wiki; EX: rule exists for download.enabled and enwiki, but frwiki loaded
|
||||
if (itm.Grp().Tid().Tid() == Xoa_cfg_grp_tid.Tid_app) continue; // rule is for app; don't run for wiki init
|
||||
Eval_set(wiki, grp.Key_str(), itm.Val());
|
||||
@@ -62,10 +60,10 @@ public class Xoa_cfg_mgr implements GfoInvkAble {
|
||||
case Xoa_cfg_grp_tid.Tid_all:
|
||||
case Xoa_cfg_grp_tid.Tid_type:
|
||||
boolean all = tid_byte == Xoa_cfg_grp_tid.Tid_all;
|
||||
int wiki_count = app.Wiki_mgr().Count();
|
||||
int wiki_count = app.Wiki_mgri().Count();
|
||||
boolean rv = true;
|
||||
for (int i = 0; i < wiki_count; i++) {
|
||||
Xowe_wiki wiki = app.Wiki_mgr().Get_at(i);
|
||||
Xow_wiki wiki = app.Wiki_mgri().Get_at_i(i);
|
||||
if (all || wiki.Domain_tid() == grp_tid.Wiki_tid()) {
|
||||
if (!Eval_set(wiki, grp.Key_str(), itm.Val()))
|
||||
rv = false;
|
||||
@@ -73,7 +71,7 @@ public class Xoa_cfg_mgr implements GfoInvkAble {
|
||||
}
|
||||
return rv;
|
||||
case Xoa_cfg_grp_tid.Tid_wiki: {
|
||||
Xowe_wiki wiki = app.Wiki_mgr().Get_by_key_or_null(itm.Key());
|
||||
Xow_wiki wiki = app.Wiki_mgri().Get_by_key_or_null_i(itm.Key());
|
||||
if (wiki == null) return true; // wiki not installed; return true (no error)
|
||||
return Eval_set(wiki, grp.Key_str(), itm.Val());
|
||||
}
|
||||
@@ -85,26 +83,19 @@ public class Xoa_cfg_mgr implements GfoInvkAble {
|
||||
hash.Clear();
|
||||
db_txt.Cfg_reset_all(this);
|
||||
}
|
||||
public void Db_customized_n_() {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoa_cfg_grp grp = (Xoa_cfg_grp)hash.Get_at(i);
|
||||
grp.Db_customized_n_();
|
||||
}
|
||||
}
|
||||
public void Db_loaded_y_() {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoa_cfg_grp grp = (Xoa_cfg_grp)hash.Get_at(i);
|
||||
grp.Db_loaded_y_();
|
||||
}
|
||||
}
|
||||
public void Db_load_txt() {Db_load(db_txt);}
|
||||
public void Db_load(Xoa_cfg_db db) {
|
||||
db.Cfg_load_run(this);
|
||||
this.Db_loaded_y_();
|
||||
this.Db_load_end();
|
||||
}
|
||||
public void Db_save_txt() {Db_save(db_txt);} private Xoa_cfg_db_txt db_txt = new Xoa_cfg_db_txt();
|
||||
private void Db_load_end() {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoa_cfg_grp grp = (Xoa_cfg_grp)hash.Get_at(i);
|
||||
grp.Db_load_end();
|
||||
}
|
||||
}
|
||||
public void Db_save_txt() {Db_save(db_txt);} private final Xoa_cfg_db_txt db_txt = new Xoa_cfg_db_txt();
|
||||
public void Db_save(Xoa_cfg_db db) {
|
||||
int len = hash.Count();
|
||||
db.Cfg_save_bgn(this);
|
||||
@@ -114,15 +105,7 @@ public class Xoa_cfg_mgr implements GfoInvkAble {
|
||||
}
|
||||
db.Cfg_save_end(this);
|
||||
}
|
||||
public void Clear() {
|
||||
int len = hash.Count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xoa_cfg_grp grp = (Xoa_cfg_grp)hash.Get_at(i);
|
||||
grp.Clear();
|
||||
}
|
||||
hash.Clear();
|
||||
}
|
||||
boolean Eval_set(GfoInvkAble invk, String key, String val) {
|
||||
private boolean Eval_set(GfoInvkAble invk, String key, String val) {
|
||||
String msg_str = key + "_(<:['\n" + val + "\n']:>);";
|
||||
Object rslt = app.Gfs_mgr().Run_str_for(invk, msg_str);
|
||||
return rslt != GfoInvkAble_.Rv_error;
|
||||
@@ -15,7 +15,7 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import org.junit.*; import gplx.dbs.*;
|
||||
public class Xoa_cfg_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xoa_cfg_mgr_fxt fxt = new Xoa_cfg_mgr_fxt();
|
||||
@@ -52,7 +52,6 @@ class Xoa_cfg_mgr_fxt {
|
||||
private void Init_cfg(String key, String val, byte[] tid) {
|
||||
Xoa_cfg_itm itm = app.Cfg_mgr().Get_itm_or_make(Bry_.new_a7(key), tid);
|
||||
itm.Val_(val);
|
||||
itm.Db_customized_(false);
|
||||
}
|
||||
public Xowe_wiki Exec_make_wiki(String wiki_key_str) {return Exec_make_wiki(Bry_.new_a7(wiki_key_str));}
|
||||
public Xowe_wiki Exec_make_wiki(byte[] wiki_key_bry) {return app.Wiki_mgr().Get_by_key_or_make(wiki_key_bry);}
|
||||
@@ -76,12 +75,12 @@ class Xoa_cfg_mgr_fxt {
|
||||
}
|
||||
public void Test_cfg_itm(byte[] wiki, byte[] prop, boolean expd_customized, boolean expd_dirty) {
|
||||
Xoa_cfg_itm itm = cfg_mgr.Get_itm_or_make(prop, wiki);
|
||||
Tfds.Eq(itm.Db_customized(), expd_customized);
|
||||
Tfds.Eq(itm.Db_dirty(), expd_dirty);
|
||||
Tfds.Eq(itm.Val_is_customized(), expd_customized);
|
||||
Tfds.Eq(itm.Val_is_dirty(), expd_dirty);
|
||||
}
|
||||
public void Test_save(String expd) {
|
||||
Xoa_cfg_db_txt db = new Xoa_cfg_db_txt();
|
||||
cfg_mgr.Db_save(db);
|
||||
Tfds.Eq(expd, Io_mgr.I.LoadFilStr(db.Cfg_url(cfg_mgr)));
|
||||
Tfds.Eq(expd, Io_mgr.Instance.LoadFilStr(db.Cfg_url(cfg_mgr)));
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.parsers.lnkis.cfgs.*;
|
||||
public class Xowc_parser implements GfoInvkAble {
|
||||
public Xowc_parser(Xowe_wiki wiki) {
|
||||
@@ -15,8 +15,8 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.nss.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xowc_xtn_pages implements GfoInvkAble {
|
||||
public boolean Init_needed() {return init_needed;} private boolean init_needed = true;
|
||||
public int Ns_page_id() {return ns_page_id;} private int ns_page_id = Int_.Min_value;
|
||||
@@ -15,8 +15,8 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.*; import gplx.xowa.nss.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.nss.*;
|
||||
public class Xowc_xtn_pages_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xowc_xtn_pages_fxt fxt = new Xowc_xtn_pages_fxt();
|
||||
@Test public void Init() {
|
||||
@@ -15,7 +15,7 @@ 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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
package gplx.xowa.apps.cfgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
public class Xowc_xtns implements GfoInvkAble {
|
||||
private Hash_adp_bry hash = Hash_adp_bry.ci_a7();
|
||||
public Xowc_xtns() {hash.Add(Xowc_xtn_pages.Xtn_key, itm_pages);}
|
||||
@@ -15,7 +15,7 @@ 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.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.cfgs.*;
|
||||
package gplx.xowa.apps.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
|
||||
public class Xocfg_gui_mgr implements GfoInvkAble {
|
||||
public Xocfg_gui_mgr(Xoae_app app) {
|
||||
win_cfg = new Xocfg_win(app);
|
||||
@@ -15,14 +15,14 @@ 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.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.cfgs.*;
|
||||
package gplx.xowa.apps.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
|
||||
public class Xocfg_html implements GfoInvkAble {
|
||||
public Xocfg_html() {
|
||||
this.content_editable = false; // CFG: default to false for general user
|
||||
}
|
||||
public boolean Content_editable() {return content_editable;} public Xocfg_html Content_editable_(boolean v) {content_editable = v; return this;} private boolean content_editable;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_content_editable)) return Yn.Xto_str(content_editable);
|
||||
if (ctx.Match(k, Invk_content_editable)) return Yn.To_str(content_editable);
|
||||
else if (ctx.Match(k, Invk_content_editable_)) content_editable = m.ReadYn_toggle("v", content_editable);
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
@@ -15,7 +15,7 @@ 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.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.cfgs.*;
|
||||
package gplx.xowa.apps.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
|
||||
class Test_api implements GfoInvkAble {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_meta)) return meta_mgr.Get_or_null(m.ReadStr("v"));
|
||||
@@ -15,8 +15,8 @@ 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.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.cfgs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
package gplx.xowa.apps.cfgs.gui; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.cfgs.*;
|
||||
import gplx.xowa.guis.langs.*;
|
||||
public class Xocfg_win implements GfoInvkAble {
|
||||
public Xocfg_win(Xoae_app app) {}
|
||||
public Xol_font_info Font() {return font;} private Xol_font_info font = new Xol_font_info("Arial", 8, gplx.gfui.FontStyleAdp_.Plain);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user