1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-08-30 22:57:59 -04:00
parent ed911e3de5
commit 5fc4eb41ec
579 changed files with 2460 additions and 1564 deletions

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa; import gplx.*;
import gplx.ios.*;
import gplx.core.json.*;
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.metas.*; import gplx.xowa.apis.*;
import gplx.xowa.bldrs.css.*;
import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
@@ -46,4 +47,5 @@ public interface Xoa_app {
Gfo_usr_dlg Usr_dlg();
Bry_bfr_mkr Utl__bfr_mkr();
Url_encoder_mgr Utl__encoder_mgr();
Json_parser Utl__json_parser();
}

View File

@@ -58,7 +58,7 @@ public class Xoa_app_ {
}
}
public static final String Name = "xowa";
public static final String Version = "2.8.4.1";
public static final String Version = "2.8.5.1";
public static String Build_date = "2012-12-30 00:00:00";
public static String Op_sys_str;
public static String User_agent = "";

View File

@@ -24,11 +24,12 @@ public class Xoa_url_ {
default: return false;
}
}
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 final byte[]
Qarg__redirect = Bry_.new_a7("redirect")
, Qarg__redirect__yes = Bry_.new_a7("yes")
, Qarg__action = Bry_.new_a7("action")
, Qarg__action__edit = Bry_.new_a7("edit")
Qarg__redirect = Bry_.new_a7("redirect")
, Qarg__redirect__yes = Bry_.new_a7("yes")
, Qarg__action = Bry_.new_a7("action")
, Qarg__action__edit = Bry_.new_a7("edit")
;
}

View File

@@ -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.core.btries.*; import gplx.core.flds.*; import gplx.ios.*; import gplx.core.threads.*;
import gplx.core.btries.*; import gplx.core.flds.*; import gplx.ios.*; import gplx.core.threads.*; import gplx.core.json.*;
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.xowa.urls.encoders.*; import gplx.xowa.apps.progs.*;
import gplx.xowa.langs.*; import gplx.xowa.specials.*; import gplx.xowa.cfgs2.*;
import gplx.xowa.bldrs.css.*;
@@ -62,6 +62,7 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
cfg_regy = new Xocfg_regy(this);
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);
}
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;
@@ -72,10 +73,11 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
public Xoh_href_wtr Html__href_wtr() {return html__href_wtr;} private final Xoh_href_wtr html__href_wtr = new Xoh_href_wtr();
public Xoh_lnki_bldr Html__lnki_bldr() {return html__lnki_bldr;} private final Xoh_lnki_bldr html__lnki_bldr;
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 = new Xoh_bridge_mgr();
public Xoh_bridge_mgr Html__bridge_mgr() {return html__bridge_mgr;} private final Xoh_bridge_mgr html__bridge_mgr;
public Xowmf_mgr Wmf_mgr() {return wmf_mgr;} private final Xowmf_mgr wmf_mgr = new Xowmf_mgr();
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 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;

View File

@@ -36,7 +36,7 @@ public class Xoapi_root implements GfoInvkAble {
xtns_api.Init_by_kit(app);
}
public void Init_by_app(Xoae_app app) {
Io_url img_dir = app.Usere().Fsys_mgr().App_img_dir().GenSubDir_nest("window", "portal");
Io_url img_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("app.general");
html_api.Page().Toggle_mgr().Img_dir_(img_dir);
usr_api.Init_by_app(app);
}

View File

@@ -51,7 +51,7 @@ public class Xoapi_toggle_itm implements GfoInvkAble {
public byte[] Html_toggle_hdr() {return html_toggle_hdr;} private byte[] html_toggle_hdr;
private void Assert_img_src() {
if (Img_src_y == null) {
Io_url img_dir = app.Usere().Fsys_mgr().App_img_dir().GenSubDir_nest("window", "portal");
Io_url img_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("app.general");
Img_src_y = img_dir.GenSubFil("twisty_down.png").To_http_file_bry();
Img_src_n = img_dir.GenSubFil("twisty_right.png").To_http_file_bry();
}

View File

@@ -197,14 +197,14 @@ public class Xoapi_popups implements GfoInvkAble, GfoEvMgrOwner {
, " </div>"
, " <hr/>"
, " <div style='float:bottom;'>"
, " <span><a href='xowa-cmd:xowa.api.nav.goto(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.url.exec-name');<>}'><img src='~{xowa_root_dir}user/anonymous/app/img/window/menu/page/open.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_y(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.tabs.new_link__at_dflt__focus_y-name');<>}'><img src='~{xowa_root_dir}user/anonymous/app/img/window/menu/tabs/new.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_n(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.tabs.new_link__at_dflt__focus_n-name');<>}'><img src='~{xowa_root_dir}user/anonymous/app/img/window/menu/tabs/new_background.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.usr.bookmarks.add(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.usr.bookmarks.add-name');<>}'><img src='~{xowa_root_dir}user/anonymous/app/img/window/menu/bookmarks/add.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.nav.goto(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.url.exec-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/page/open.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_y(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.tabs.new_link__at_dflt__focus_y-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/tabs/new.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_n(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.gui.browser.tabs.new_link__at_dflt__focus_n-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/tabs/new_background.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.usr.bookmarks.add(\"~{page_url}\");' title='~{<>msgs.get('api-xowa.usr.bookmarks.add-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/bookmarks/add.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.html.modules.popups.show_more(\"~{popup_id}\");' title='~{<>msgs.get('api-xowa.html.modules.popups.show_more-tip');<>}'><img src='~{xowa_root_dir}bin/any/xowa/html/res/src/xowa/popups/imgs/show_more.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.html.modules.popups.show_all (\"~{popup_id}\");' title='~{<>msgs.get('api-xowa.html.modules.popups.show_all-tip');<>}'> <img src='~{xowa_root_dir}bin/any/xowa/html/res/src/xowa/popups/imgs/show_all.png' ></a></span>"
, " <span><a href='/wiki/Special:XowaPopupHistory' title='~{<>msgs.get('api-xowa.html.modules.popups.history-tip');<>}'><img src='~{xowa_root_dir}user/anonymous/app/img/window/menu/history/show.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_y(\"home/wiki/Help:Options/Popups\");' title='~{<>msgs.get('api-xowa.nav.cfg.main-name');<>}'><img src='~{xowa_root_dir}user/anonymous/app/img/window/menu/tools/options.png'></a></span>"
, " <span><a href='/wiki/Special:XowaPopupHistory' title='~{<>msgs.get('api-xowa.html.modules.popups.history-tip');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/history/show.png'></a></span>"
, " <span><a href='xowa-cmd:xowa.api.gui.browser.tabs.new_link__at_dflt__focus_y(\"home/wiki/Help:Options/Popups\");' title='~{<>msgs.get('api-xowa.nav.cfg.main-name');<>}'><img src='~{xowa_root_dir}bin/any/xowa/file/app.menu/tools/options.png'></a></span>"
, " </div>"
, "</div>"
))

View File

@@ -26,6 +26,7 @@ public class Xoa_fsys_mgr implements GfoInvkAble {
this.bin_plat_dir = root_dir.GenSubDir("bin").GenSubDir(plat_name);
this.bin_any_dir = root_dir.GenSubDir("bin").GenSubDir("any");
this.bin_xowa_dir = bin_any_dir.GenSubDir("xowa");
this.bin_xowa_file_dir = bin_xowa_dir.GenSubDir_nest("file");
this.bin_xtns_dir = bin_xowa_dir.GenSubDir_nest("xtns");
this.cfg_app_fil = bin_xowa_dir.GenSubFil_nest("cfg", "app", "xowa.gfs");
this.cfg_lang_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "lang", "core");
@@ -40,6 +41,7 @@ public class Xoa_fsys_mgr implements GfoInvkAble {
public Io_url Bin_plat_dir() {return bin_plat_dir;} private final Io_url bin_plat_dir;
public Io_url Bin_any_dir() {return bin_any_dir;} private final Io_url bin_any_dir;
public Io_url Bin_xowa_dir() {return bin_xowa_dir;} private final Io_url bin_xowa_dir;
public Io_url Bin_xowa_file_dir() {return bin_xowa_file_dir;} private final Io_url bin_xowa_file_dir;
public Io_url Bin_xtns_dir() {return bin_xtns_dir;} private final Io_url bin_xtns_dir;
public Io_url Cfg_lang_core_dir() {return cfg_lang_core_dir;} private final Io_url cfg_lang_core_dir;
public Io_url Cfg_wiki_core_dir() {return cfg_wiki_core_dir;} private final Io_url cfg_wiki_core_dir;

View File

@@ -30,7 +30,7 @@ public class Xoa_version_ {
for (int i = 0; i < lhs_ary_len; ++i) {
String lhs_itm = lhs_ary[i];
String rhs_itm = rhs_ary[i];
int itm_comp = Int_.Compare(Int_.parse_or_(lhs_itm, 0), Int_.parse_or_(rhs_itm, 0));
int itm_comp = Int_.Compare(Int_.parse_or(lhs_itm, 0), Int_.parse_or(rhs_itm, 0));
if (itm_comp != CompareAble_.Same) return itm_comp;
}
return CompareAble_.Same;

View File

@@ -32,6 +32,7 @@ public class Xob_cmd_keys {
, Key_wiki_image = "wiki.image" // "wiki.image"
, Key_wiki_page_dump_make = "wiki.page_dump.make" // "file.page_dump"
, Key_wiki_page_dump_drop = "wiki.page_dump.drop"
, Key_wiki_pagelink = "wiki.pagelink"
, Key_file_lnki_temp = "file.lnki_temp"
, Key_file_lnki_regy = "file.lnki_regy"
, Key_file_page_regy = "file.page_regy"

View File

@@ -41,6 +41,7 @@ public class Xob_cmd_mgr implements GfoInvkAble {
else if (String_.Eq(cmd_key, Xob_cmd_keys.Key_wiki_page_dump_drop)) return Add(new Xob_page_dump_cmd_drop(bldr, wiki));
else if (String_.Eq(cmd_key, Xob_cmd_keys.Key_wiki_redirect)) return Add(new Xob_redirect_cmd(bldr, wiki));
else if (String_.Eq(cmd_key, Xob_cmd_keys.Key_wiki_image)) return Add(new Xob_image_cmd(bldr, wiki));
else if (String_.Eq(cmd_key, Xob_cmd_keys.Key_wiki_pagelink)) return Add(new Xob_pagelinks_parser_cmd(bldr, wiki));
else if (String_.Eq(cmd_key, Xob_cmd_keys.Key_file_lnki_temp)) return Add(new Xob_lnki_temp_wkr(bldr, wiki));
else if (String_.Eq(cmd_key, Xob_cmd_keys.Key_file_lnki_regy)) return Add(new Xob_lnki_regy_cmd(bldr, wiki));
else if (String_.Eq(cmd_key, Xob_cmd_keys.Key_file_page_regy)) return Add(new Xob_page_regy_cmd(bldr, wiki));

View File

@@ -21,7 +21,7 @@ public class Aria2_lib_mgr implements GfoInvkAble {
public ProcessAdp Lib() {return lib;} private ProcessAdp lib = new ProcessAdp();
public void Init_by_app(Xoae_app app) {
Xoa_fsys_eval cmd_eval = app.Url_cmd_eval();
ProcessAdp.ini_(this, app.Usr_dlg(), lib, cmd_eval, ProcessAdp.Run_mode_sync_block, Int_.MaxValue
ProcessAdp.ini_(this, app.Usr_dlg(), lib, cmd_eval, ProcessAdp.Run_mode_sync_block, Int_.Max_value
, "~{<>bin_plat_dir<>}aria2" + Op_sys.Cur().Fsys_dir_spr_str() + "aria2c"
, Lib_args_fmt
, "wiki_abrv", "wiki_date", "wiki_type");

View File

@@ -129,14 +129,14 @@ public class Xob_wiki_cfg_bldr_tst {
String api = protocol + wiki + "/w/api.php?action=query&format=xml&meta=siteinfo&siprop=namespacealiases";
String xml = String_.new_u8(Io_mgr.I.DownloadFil_args("", null).Trg_engine_key_(trg_engine_key).Exec_as_bry(api));
if (xml == null) continue; // not found
gplx.xmls.XmlDoc xdoc = gplx.xmls.XmlDoc_.parse_(xml);
gplx.xmls.XmlDoc xdoc = gplx.xmls.XmlDoc_.parse(xml);
gplx.xmls.XmlNde xnde = gplx.xmls.Xpath_.SelectFirst(xdoc.Root(), "query/namespacealiases");
sb.Add("app.bldr.wiki_cfg_bldr.get('").Add(wiki).Add("').new_cmd_('wiki.ns_mgr.aliases', 'ns_mgr.add_alias_bulk(\"\n");
int xndes_len = xnde.SubNdes().Count();
for (int j = 0; j < xndes_len; j++) {
gplx.xmls.XmlNde ns_nde = xnde.SubNdes().Get_at(j);
if (!String_.Eq(ns_nde.Name(), "ns")) continue;
int id = Int_.parse_(ns_nde.Atrs().FetchValOr("id", "-1"));
int id = Int_.parse(ns_nde.Atrs().FetchValOr("id", "-1"));
String name = String_.Replace(String_.Replace(ns_nde.Text_inner(), " ", "_"), "'", "''");
sb.Add(Int_.Xto_str(id)).Add("|").Add(String_.Trim(name)).Add_char_nl();
}

View File

@@ -23,9 +23,9 @@ public abstract class Xob_dump_mgr_base extends Xob_itm_basic_base implements Xo
private Xowd_db_mgr db_fsys_mgr; protected Xop_parser parser; protected Xop_ctx ctx; protected Xop_root_tkn root;
private int[] ns_ary; private Xowd_db_file[] db_ary;
private int ns_bgn = -1, db_bgn = -1, pg_bgn = -1;
private int ns_end = -1, db_end = -1, pg_end = Int_.MaxValue;
private int ns_end = -1, db_end = -1, pg_end = Int_.Max_value;
private int commit_interval = 1000, progress_interval = 250, cleanup_interval = 2500, select_size = 10 * Io_mgr.Len_mb;
private int exec_count, exec_count_max = Int_.MaxValue;
private int exec_count, exec_count_max = Int_.Max_value;
private boolean reset_db = false, exit_after_commit = false, exit_now = false;
private boolean load_tmpls;
private Xob_dump_bmk_mgr bmk_mgr = new Xob_dump_bmk_mgr();
@@ -67,7 +67,7 @@ public abstract class Xob_dump_mgr_base extends Xob_itm_basic_base implements Xo
private long time_bgn;
public void Cmd_run() {Exec_ns_ary();}
private void Exec_ns_ary() {
if (pg_bgn == Int_.MaxValue) return;
if (pg_bgn == Int_.Max_value) return;
if (load_tmpls) Xob_dump_mgr_base_.Load_all_tmpls(usr_dlg, wiki, page_src);
time_bgn = Env_.TickCount();
Xob_dump_bmk dump_bmk = new Xob_dump_bmk();
@@ -169,7 +169,7 @@ public abstract class Xob_dump_mgr_base extends Xob_itm_basic_base implements Xo
public void Cmd_term() {}
public void Cmd_end() {
if (!exit_now)
pg_bgn = Int_.MaxValue;
pg_bgn = Int_.Max_value;
Exec_commit(-1, -1, -1, Bry_.Empty);
Exec_end_hook();
Free();

View File

@@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.bldrs.cmds.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
import gplx.core.flds.*; import gplx.ios.*; import gplx.xowa.ctgs.*; import gplx.xowa.tdbs.*;
public class Xoctg_link_idx_wkr extends Xob_idx_base { // NOTE: similar functionality to Xob_make_cmd_site, but more complicated due to p,f,s; not inheriting
Io_url src_link_dir; int make_fil_max = Int_.MinValue;
Io_url src_link_dir; int make_fil_max = Int_.Min_value;
public Xoctg_link_idx_wkr(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki);}
@Override public String Cmd_key() {return Xob_cmd_keys.Key_tdb_ctg_link_idx;}
@Override public void Cmd_bgn_hook() {
this.fld_rdr = this.Fld_rdr();
if (src_link_dir == null) src_link_dir = wiki.Fsys_mgr().Tmp_dir().GenSubDir_nest(Xob_cmd_keys.Key_tdb_text_cat_link, "make");
if (make_fil_max == Int_.MinValue) make_fil_max = Io_mgr.Len_mb;
if (make_fil_max == Int_.Min_value) make_fil_max = Io_mgr.Len_mb;
make_link_mgr = new Xoctg_make_link_mgr(usr_dlg, make_fil_max, wiki.Tdb_fsys_mgr());
make_main_mgr = new Xoctg_make_main_mgr(usr_dlg, make_fil_max, wiki.Tdb_fsys_mgr());
Io_mgr.I.DeleteDirDeep_ary(make_link_mgr.Make_dir(), make_main_mgr.Make_dir());

View File

@@ -38,7 +38,7 @@ class Xob_bin_db_itm {
public static Xob_bin_db_itm new_v1(Fsm_bin_fil fil) {
byte[] name = Bry_.new_u8(fil.Url_rel()); // EX: "fsdb.bin.0000.sqlite3"
int ns_id = 0; // assume v1 dbs are all in main ns
int pt_id = Bry_.To_int_or(name, 9 , 13, Int_.MinValue); if (pt_id == Int_.MinValue) throw Err_.new_wo_type("bin_db_itm.parse: invalid pt_id", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
int pt_id = Bry_.To_int_or(name, 9 , 13, Int_.Min_value); if (pt_id == Int_.Min_value) throw Err_.new_wo_type("bin_db_itm.parse: invalid pt_id", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
return new Xob_bin_db_itm(fil.Id(), fil.Url(), ns_id, pt_id);
}
public static Xob_bin_db_itm new_v2(Fsm_bin_fil fil) {
@@ -50,8 +50,8 @@ class Xob_bin_db_itm {
int ns_end = Bry_finder.Find_fwd(name, ns_end_tkn, ns_bgn); if (ns_end == Bry_finder.Not_found) throw Err_.new_wo_type("bin_db_itm.parse: invalid ns_end", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
int pt_bgn = ns_end + ns_end_tkn_len;
int pt_end = Bry_finder.Find_fwd(name, pt_end_tkn, pt_bgn); if (pt_end == Bry_finder.Not_found) throw Err_.new_wo_type("bin_db_itm.parse: invalid pt_end", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
int ns_id = Bry_.To_int_or(name, ns_bgn, ns_end, Int_.MinValue); if (ns_id == Int_.MinValue) throw Err_.new_wo_type("bin_db_itm.parse: invalid ns_id", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
int pt_id = Bry_.To_int_or(name, pt_bgn, pt_end, Int_.MinValue); if (pt_id == Int_.MinValue) throw Err_.new_wo_type("bin_db_itm.parse: invalid pt_id", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
int ns_id = Bry_.To_int_or(name, ns_bgn, ns_end, Int_.Min_value); if (ns_id == Int_.Min_value) throw Err_.new_wo_type("bin_db_itm.parse: invalid ns_id", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
int pt_id = Bry_.To_int_or(name, pt_bgn, pt_end, Int_.Min_value); if (pt_id == Int_.Min_value) throw Err_.new_wo_type("bin_db_itm.parse: invalid pt_id", "name", fil.Url_rel(), "conn", fil.Conn().Conn_info().Xto_raw());
return new Xob_bin_db_itm(fil.Id(), fil.Url(), ns_id, pt_id);
}
}

View File

@@ -56,7 +56,7 @@ class Xob_diff_regy_sql_runner {
this.url = url;
String[] parts = String_.Split(url.NameOnly(), "-");
wiki_domain = parts[0];
fsdb_db_id = Int_.parse_(parts[1]);
fsdb_db_id = Int_.parse(parts[1]);
fsdb_db_tid = Fsdb_db_tid_.Xto_tid(parts[2]);
}
public void Run_sql(Xoae_app app) {

View File

@@ -28,8 +28,8 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
private long download_size_max = Io_mgr.Len_mb_long * 5; private int[] download_keep_tier_ids = Int_.Ary(0);
private Xobu_poll_mgr poll_mgr; private int poll_interval; private long time_bgn;
private int select_interval = 2500, progress_interval = 1, commit_interval = 1, delete_interval = 5000;
private boolean exec_done, resume_enabled; private int exec_count, exec_count_max = Int_.MaxValue, exec_fail, exec_fail_max = 10000; // 115 errors over 900k images
private int tier_id_bmk = -1, tier_id_val = -1; private int page_id_bmk = -1, page_id_val = -1, page_id_end = Int_.MaxValue; private int lnki_id_bmk = -1, lnki_id_val = -1;
private boolean exec_done, resume_enabled; private int exec_count, exec_count_max = Int_.Max_value, exec_fail, exec_fail_max = 10000; // 115 errors over 900k images
private int tier_id_bmk = -1, tier_id_val = -1; private int page_id_bmk = -1, page_id_val = -1, page_id_end = Int_.Max_value; private int lnki_id_bmk = -1, lnki_id_val = -1;
private boolean exit_after_commit, exit_now;
public Xob_fsdb_make_cmd(Xob_bldr bldr, Xowe_wiki wiki) {
this.Cmd_ctor(bldr, wiki);
@@ -140,7 +140,7 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
}
else {
if (tier_id_bmk == -1) {
tier_id_bmk = Int_.parse_(tier_id_str);
tier_id_bmk = Int_.parse(tier_id_str);
usr_dlg.Note_many("", "", "restoring from bmk: tier_id=~{0}", tier_id_bmk);
}
if (page_id_bmk == -1) {

View File

@@ -63,6 +63,7 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
gplx.xowa.Xop_xnde_wkr.Timeline_log_wkr = log_mgr.Make_wkr();
gplx.xowa.xtns.scores.Score_xnde.Log_wkr = log_mgr.Make_wkr();
gplx.xowa.xtns.hieros.Hiero_xnde.Log_wkr = log_mgr.Make_wkr();
gplx.xowa.xtns.math.Math_nde.Log_wkr = log_mgr.Make_wkr();
Xof_fsdb_mgr__sql trg_fsdb_mgr = new Xof_fsdb_mgr__sql();
wiki.File__fsdb_mode().Tid_v2_bld_y_();
Fsdb_db_mgr__v2 fsdb_core = Fsdb_db_mgr__v2_bldr.I.Get_or_make(wiki, Bool_.Y);
@@ -84,7 +85,7 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
log_mgr.Txn_bgn();
}
@Override public void Exec_pg_itm_hook(int ns_ord, Xow_ns ns, Xowd_page_itm db_page, byte[] page_src) {
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, ns.Gen_ttl(db_page.Ttl_page_db()));
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ns.Gen_ttl(db_page.Ttl_page_db()));
byte[] ttl_bry = ttl.Page_db();
byte page_tid = Xow_page_tid.Identify(wiki.Domain_tid(), ns.Id(), ttl_bry);
if (page_tid != Xow_page_tid.Tid_wikitext) return; // ignore js, css, lua, json
@@ -142,7 +143,7 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
int lnki_page = lnki.Page();
byte[] ttl_commons = Xto_commons(ns_file_is_case_match_all, commons_wiki, ttl);
if ( Xof_lnki_page.Null_n(lnki_page) // page set
&& Xof_lnki_time.Null_n(lnki_time)) // thumbtime set
&& Xof_lnki_time.Null_n(lnki_time)) // thumbtime set
usr_dlg.Warn_many("", "", "page and thumbtime both set; this may be an issue with fsdb: page=~{0} ttl=~{1}", ctx.Cur_page().Ttl().Page_db_as_str(), String_.new_u8(ttl));
if (lnki.Ns_id() == Xow_ns_.Id_media)
lnki_src_tid = Xob_lnki_src_tid.Tid_media;
@@ -176,7 +177,7 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
}
public static byte[] Xto_commons(boolean ns_file_is_case_match_all, Xowe_wiki commons_wiki, byte[] ttl_bry) {
if (!ns_file_is_case_match_all) return null; // return "" if wiki matches common
Xoa_ttl ttl = Xoa_ttl.parse_(commons_wiki, Xow_ns_.Id_file, ttl_bry);
Xoa_ttl ttl = Xoa_ttl.parse(commons_wiki, Xow_ns_.Id_file, ttl_bry);
byte[] rv = ttl.Page_db();
return Bry_.Eq(rv, ttl_bry) ? null : rv;
}

View File

@@ -0,0 +1,72 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.bldrs.cmds.texts.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*; import gplx.xowa.bldrs.cmds.texts.*;
import gplx.dbs.*;
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*;
public class Xob_pagelinks_parser_cmd extends Xob_sql_dump_base implements Sql_file_parser_cmd {
private Db_conn core_conn;
private Xowd_pagelinks_temp_tbl temp_tbl;
public Xob_pagelinks_parser_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki); this.make_fil_len = Io_mgr.Len_mb;}
@Override public String Sql_file_name() {return "pagelinks";}
@Override public String Cmd_key() {return Xob_cmd_keys.Key_wiki_pagelink;}
private static final byte Fld__pl_from = 0, Fld__pl_namespace = 1, Fld__pl_title = 2;
private int tmp_src_id, tmp_trg_ns;
private int rows = 0;
@Override public void Cmd_bgn_hook(Xob_bldr bldr, Sql_file_parser parser) {
parser.Fld_cmd_(this).Flds_req_idx_(4, 0, 1, 2);
wiki.Init_assert();
Xowd_db_file core_db = wiki.Data__core_mgr().Db__core();
this.core_conn = core_db.Conn();
this.temp_tbl = new Xowd_pagelinks_temp_tbl(core_conn);
core_conn.Ddl_delete_tbl(temp_tbl.Tbl_name());
temp_tbl.Create_tbl();
temp_tbl.Insert_bgn();
}
@Override public void Cmd_end() {
temp_tbl.Insert_end();
temp_tbl.Create_idx();
Xowd_pagelinks_tbl actl_tbl = new Xowd_pagelinks_tbl(core_conn);
core_conn.Ddl_delete_tbl(actl_tbl.Tbl_name());
actl_tbl.Create_tbl();
core_conn.Exec_sql(Sql__pagelinks__make);
core_conn.Ddl_delete_tbl(temp_tbl.Tbl_name());
actl_tbl.Create_idx__src_trg();
actl_tbl.Create_idx__trg_src();
core_conn.Env_vacuum();
}
public void Exec(byte[] src, byte[] fld_key, int fld_idx, int fld_bgn, int fld_end, Bry_bfr file_bfr, Sql_file_parser_data data) {
switch (fld_idx) {
case Fld__pl_from: this.tmp_src_id = Bry_.To_int_or(src, fld_bgn, fld_end, -1); break;
case Fld__pl_namespace: this.tmp_trg_ns = Bry_.To_int_or(src, fld_bgn, fld_end, -1); break;
case Fld__pl_title:
byte[] tmp_trg_ttl = Bry_.Mid(src, fld_bgn, fld_end);
temp_tbl.Insert(tmp_src_id, tmp_trg_ns, tmp_trg_ttl);
if (++rows % 100000 == 0) usr_dlg.Prog_many("", "", "reading row ~{0}", Int_.Xto_str_fmt(rows, "#,##0"));
break;
}
}
private static final String Sql__pagelinks__make = String_.Concat_lines_nl_skip_last
( "INSERT INTO pagelinks (src_id, trg_id, trg_count)"
, "SELECT pl.src_id"
, ", p.page_id"
, ", Count(p.page_id)"
, "FROM pagelinks_temp pl"
, " JOIN page p ON pl.trg_ns = p.page_namespace AND pl.trg_ttl = p.page_title"
, "GROUP BY pl.src_id, p.page_id"
);
}

View File

@@ -0,0 +1,61 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.bldrs.cmds.texts.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*; import gplx.xowa.bldrs.cmds.texts.*;
import org.junit.*;
// public class Xob_pagelinks_parser_tst {
// @Before public void init() {if (Xoa_test_.Db_skip()) return; fxt.Ctor_fsys();} Db_mgr_fxt fxt = new Db_mgr_fxt();
// @After public void term() {if (Xoa_test_.Db_skip()) return; fxt.Rls();}
// @Test public void Basic() {
// if (Xoa_test_.Db_skip()) return;
// fxt.Init_db_sqlite();
// fxt.Wiki().Db_mgr_as_sql().Core_data_mgr().Db__cat_core().Tbl__cat_core().Create_tbl();
// Init_ctgs(1, 2, 3);
// Io_url page_props_url = Xoa_test_.Url_root().GenSubFil_nest("root", "wiki", "en.wikipedia.org", "page_props.sql");
// fxt .Init_fil(page_props_url, String_.Concat
// ( "INSERT INTO `page_props` VALUES"
// , " (1,'hiddencat','')"
// , ",(2,'pageimage','A.png')"
// , ",(3,'hiddencat','')"
// , ";"
// ))
// .Exec_run(new Xoctg_hiddencat_parser_sql(fxt.Bldr(), fxt.Wiki()))
// ;
// Tst_ctg_hidden(Bool_.Y, 1, 3);
// Tst_ctg_hidden(Bool_.N, 2);
// }
// private void Init_ctgs(params int[] ctgs) {
// int len = ctgs.length;
// Xowd_cat_core_tbl tbl = fxt.Wiki().Db_mgr_as_sql().Core_data_mgr().Db__cat_core().Tbl__cat_core().Create_tbl();
// tbl.Insert_bgn();
// try {
// for (int i = 0; i < len; i++) {
// int ctg_id = ctgs[i];
// tbl.Insert_cmd_by_batch(ctg_id, 0, 0, 0, Bool_.N_byte, 0);
// }
// } finally {tbl.Insert_end();}
// }
// private void Tst_ctg_hidden(boolean expd_hidden, params int[] ctgs) {
// int len = ctgs.length;
// Xowd_cat_core_tbl tbl = fxt.Wiki().Db_mgr_as_sql().Core_data_mgr().Db__cat_core().Tbl__cat_core();
// for (int i = 0; i < len; i++) {
// int ctg_id = ctgs[i];
// Xowd_category_itm ctg_itm = tbl.Select(ctg_id);
// Tfds.Eq(expd_hidden, ctg_itm.Hidden(), Int_.Xto_str(ctg_id));
// }
// }
// }

View File

@@ -79,7 +79,7 @@ public class Xob_cleanup_cmd extends Xob_itm_basic_base implements Xob_cmd {
Criteria_ioMatch[] rv = new Criteria_ioMatch[match_ary_len];
for (int i = 0; i < rv.length; i++) {
String match = match_ary[i];
rv[i] = Criteria_ioMatch.parse_(true, match, false);
rv[i] = Criteria_ioMatch.parse(true, match, false);
}
return rv;
}

View File

@@ -34,7 +34,7 @@ public class Xob_deploy_zip_cmd extends Xob_itm_basic_base implements Xob_cmd {
for (Io_url ns_dir : ns_dirs) {
Log("zipping dir: ~{0}", ns_dir.Raw());
String ns_num = ns_dir.NameOnly();
Xow_ns ns_itm = wiki.Ns_mgr().Ids_get_or_null(Int_.parse_(ns_num));
Xow_ns ns_itm = wiki.Ns_mgr().Ids_get_or_null(Int_.parse(ns_num));
Zip_ns(bldr, ns_dir, type_name, ns_itm.Name_str());
}
}

View File

@@ -28,7 +28,7 @@ public class Xob_site_meta_cmd implements Xob_cmd {
if (wikis == null) wikis = Xow_wmf_api_mgr.Wikis;
if (db_url == null) db_url = bldr.App().Fsys_mgr().Cfg_site_meta_fil();
if (cutoff_time == null) cutoff_time = DateAdp_.Now().Add_day(-1);
Site_meta_itm.Build_site_meta(bldr.App().Wmf_mgr(), db_url, wikis, cutoff_time);
Site_meta_itm.Build_site_meta(bldr.App().Utl__json_parser(), bldr.App().Wmf_mgr(), db_url, wikis, cutoff_time);
}
public void Cmd_init(Xob_bldr bldr) {}
public void Cmd_bgn(Xob_bldr bldr) {}

View File

@@ -116,7 +116,7 @@ public class Dg_match_mgr {
int rule_score = rule_tally.Rule().Score();
int rule_score_total = rule_score * min_results;
if (log_enabled) log_mgr.Insert_page_rule(log_tid, page_id, rule_tally.Rule().Id(), rule_score_total);
if (rule_score == Dg_rule.Score_banned) {score_cur = Int_.MaxValue; break;}
if (rule_score == Dg_rule.Score_banned) {score_cur = Int_.Max_value; break;}
score_cur += rule_score_total;
++rule_match_count;
}
@@ -154,7 +154,7 @@ class Dg_rule_tally {
results[idx_val] = results[idx_val] + 1;
}
public int Results_pass_count() {
int rv = Int_.MaxValue;
int rv = Int_.Max_value;
for (int i = 0; i < results_len; ++i) {
int result = results[i];
if (rv > result) rv = result;

View File

@@ -71,8 +71,8 @@ class Dg_parser {
if (src[brack_bgn] != Byte_ascii.Lt) {Warn("dg.invalid_line.wrong_term_dlm", rel_path, line_idx, src, line_bgn, line_end); break;}
brack_end = Bry_finder.Find_fwd(src, Byte_ascii.Gt, brack_bgn);
if (brack_end == Bry_finder.Not_found) {Warn("dg.invalid_line.score not found", rel_path, line_idx, src, line_bgn, line_end); break;}
int parse_score = Bry_.To_int_or(src, brack_bgn + 1, brack_end, Int_.MinValue);
if (parse_score == Int_.MinValue) {Warn("dg.invalid_line.score is invalid", rel_path, line_idx, src, line_bgn, line_end); break;}
int parse_score = Bry_.To_int_or(src, brack_bgn + 1, brack_end, Int_.Min_value);
if (parse_score == Int_.Min_value) {Warn("dg.invalid_line.score is invalid", rel_path, line_idx, src, line_bgn, line_end); break;}
score = parse_score;
break;
}

View File

@@ -27,12 +27,12 @@ abstract class Json_itm_wkr__base implements Json_itm_wkr {
List_adp tmp_list = List_adp_.new_(); Byte_obj_ref tmp_result = Byte_obj_ref.zero_(); Bry_bfr tmp_bfr = Bry_bfr.reset_(16);
Json_doc jdoc = json_parser.Parse(src);
this.Exec_bgn();
Json_nde root = jdoc.Root();
Json_nde root = jdoc.Root_nde();
int subs_len = root.Len();
for (int i = 0; i < subs_len; ++i) {
Json_itm itm = root.Get_at(i);
switch (itm.Tid()) {
case Json_itm_.Tid_kv:
case Json_itm_.Tid__kv:
Json_kv kv = (Json_kv)itm;
if (kv.Key().Data_eq(Name_metadata)) continue; // ignore @metadata node
byte[] kv_key = kv.Key().Data_bry();

View File

@@ -254,8 +254,8 @@ public class Xol_mw_lang_parser {
int kv_ary_len = kv_ary.Subs_len();
boolean case_match = false; // if 1 arg, default to false
int kv_ary_bgn = 0; int words_len = kv_ary_len; // if 1 arg, default to entire kv_ary; words_len
int case_match_int = Php_itm_.Parse_int_or(kv_ary.Subs_get(0), Int_.MinValue);
if (case_match_int != Int_.MinValue) {
int case_match_int = Php_itm_.Parse_int_or(kv_ary.Subs_get(0), Int_.Min_value);
if (case_match_int != Int_.Min_value) {
case_match = Parse_int_as_bool(kv_ary.Subs_get(0)); // arg[0] is case_match
kv_ary_bgn = 1; // arg[1] is 1st word
words_len = kv_ary_len - 1; // words.len = kv_len - 1 (skip case_match
@@ -291,8 +291,8 @@ public class Xol_mw_lang_parser {
}
}
private boolean Parse_int_as_bool(Php_itm itm) {
int rv = Php_itm_.Parse_int_or(itm, Int_.MinValue);
if (rv == Int_.MinValue) throw Err_.new_wo_type("value must be 0 or 1", "val", String_.new_u8(itm.Val_obj_bry()));
int rv = Php_itm_.Parse_int_or(itm, Int_.Min_value);
if (rv == Int_.Min_value) throw Err_.new_wo_type("value must be 0 or 1", "val", String_.new_u8(itm.Val_obj_bry()));
return rv == 1;
}
private void Parse_separatorTransformTable(Php_line_assign line, Xol_num_mgr num_mgr) {

View File

@@ -19,12 +19,12 @@ package gplx.xowa.bldrs.syncs; import gplx.*; import gplx.xowa.*; import gplx.xo
import gplx.ios.*;
class Xob_sync_grp {
private final Ordered_hash itms = Ordered_hash_.new_();
public Xob_sync_grp Ctor_itm(DateAdp upload_time, DateAdp related_time) {
this.upload_time = upload_time; this.related_time = related_time;
public Xob_sync_grp Ctor_itm(DateAdp dump_time, DateAdp upload_time) {
this.dump_time = dump_time; this.upload_time = upload_time;
return this;
}
public DateAdp Dump_time() {return dump_time;} private DateAdp dump_time;
public DateAdp Upload_time() {return upload_time;} private DateAdp upload_time;
public DateAdp Related_time() {return related_time;} private DateAdp related_time;
public int Itms__len() {return itms.Count();}
public void Itms__add(Xob_sync_pkg file) {itms.Add(file.Path(), file);}
public Xob_sync_pkg Itms__get_at(int i) {return (Xob_sync_pkg)itms.Get_at(i);}

View File

@@ -21,7 +21,7 @@ public class Xoi_wiki_props_alias {
public String Alias() {return alias;} private String alias;
public Xoi_wiki_props_alias Init_by_ctor(int id, String alias) {this.id = id; this.alias = alias; return this;}
public void Init_by_xml(gplx.xmls.XmlNde ns_nde) {
this.id = Int_.parse_(ns_nde.Atrs().FetchValOr("id", "-1"));
this.id = Int_.parse(ns_nde.Atrs().FetchValOr("id", "-1"));
this.alias = String_.Replace(String_.Replace(ns_nde.Text_inner(), " ", "_"), "'", "''");
}
}

View File

@@ -52,7 +52,7 @@ public class Xoi_wiki_props_api {
bfr.Add_byte_nl();
}
public void Parse(Xoi_wiki_props_wiki wiki, String xml) {
XmlDoc xdoc = XmlDoc_.parse_(xml);
XmlDoc xdoc = XmlDoc_.parse(xml);
XmlNde query_xnde = Xpath_.SelectFirst(xdoc.Root(), "query");
XmlNde aliases_xnde = Xpath_.SelectFirst(query_xnde, "namespace"+"aliases");
wiki.Alias_ary_(Parse_alias_ary(aliases_xnde));

View File

@@ -135,7 +135,7 @@ class Xob_subpage_tst_fxt {
int ns_len = wiki.Ns_list().Count();
for (int i = 0; i < ns_len; i++) {
Xob_subpage_ns ns = (Xob_subpage_ns)wiki.Ns_list().Get_at(i);
sb.Add(ns.Id()).Add("=").Add(Bool_.Xto_str_lower(ns.Enabled())).Add_char_nl();
sb.Add(ns.Id()).Add("=").Add(Bool_.To_str_lower(ns.Enabled())).Add_char_nl();
}
sb.Add_char_nl();
}

View File

@@ -21,7 +21,7 @@ public class Xoi_wiki_props_ns {
public boolean Subpages_enabled() {return subpages_enabled;} private boolean subpages_enabled;
public Xoi_wiki_props_ns Init_by_ctor(int id, boolean subpages_enabled) {this.id = id; this.subpages_enabled = subpages_enabled; return this;}
public void Init_by_xml(gplx.xmls.XmlNde ns_nde) {
this.id = Int_.parse_(ns_nde.Atrs().FetchValOr("id", "-1"));
this.id = Int_.parse(ns_nde.Atrs().FetchValOr("id", "-1"));
this.subpages_enabled = ns_nde.Atrs().Fetch_or_null("subpages") != null;// per api, subpages="" means ns has subpages; no subpages attribute means no subpages
}
}

View File

@@ -31,7 +31,7 @@ public class Xob_siteinfo_parser {
finally {rdr.Rls();}
}
public static void Siteinfo_parse(Xowe_wiki wiki, Gfo_usr_dlg usr_dlg, String siteinfo_str) {
XmlDoc xdoc = XmlDoc_.parse_(siteinfo_str);
XmlDoc xdoc = XmlDoc_.parse(siteinfo_str);
XmlNde root = xdoc.Root();
int root_subs_len = root.SubNdes().Count();
Bry_bfr siteinfo_misc_bfr = Bry_bfr.reset_(512);
@@ -74,8 +74,8 @@ public class Xob_siteinfo_parser {
XmlNde sub_nde = ns_nde.SubNdes().Get_at(i);
if (sub_nde.Atrs().Count() == 0) continue; // NOTE: JAVA again has unexpected nodes
try {
int ns_id = Int_.parse_(sub_nde.Atrs().FetchValOr("key", ""));
byte case_match = Xow_ns_case_.parse_(sub_nde.Atrs().FetchValOr("case", ""));
int ns_id = Int_.parse(sub_nde.Atrs().FetchValOr("key", ""));
byte case_match = Xow_ns_case_.parse(sub_nde.Atrs().FetchValOr("case", ""));
String name = sub_nde.Text_inner();
ns_mgr.Add_new(ns_id, Bry_.new_u8(name), case_match, false);
}

View File

@@ -24,7 +24,7 @@ public class Xoa_cfg_grp_tid {
public static final byte Tid_null = 0, Tid_all = 1, Tid_type = 2, Tid_wiki = 3, Tid_app = 4;
public static final String Key_app_str = "app";
public static final byte[] Key_all_bry = Bry_.new_a7("*"), Key_app_bry = Bry_.new_a7(Key_app_str);
public static Xoa_cfg_grp_tid parse_(byte[] key) {
public static Xoa_cfg_grp_tid parse(byte[] key) {
Xoa_cfg_grp_tid rv = (Xoa_cfg_grp_tid)factory.Get_by_bry(key);
if (rv == null) {
rv = new Xoa_cfg_grp_tid();

View File

@@ -28,7 +28,7 @@ public class Xoa_cfg_mgr implements GfoInvkAble {
Xoa_cfg_grp grp = null;
Object grp_obj = hash.Get_by(grp_key);
if (grp_obj == null) {
Xoa_cfg_grp_tid tid = Xoa_cfg_grp_tid.parse_(itm_key);
Xoa_cfg_grp_tid tid = Xoa_cfg_grp_tid.parse(itm_key);
grp = new Xoa_cfg_grp(this, tid, grp_key);
hash.Add(grp_key, grp);
}

View File

@@ -86,7 +86,7 @@ class Xocfg_meta_itm_bool extends Xocfg_meta_itm_base {
}
class Xocfg_meta_itm_int extends Xocfg_meta_itm_base {
public Xocfg_meta_itm_int(String prop_key, int prop_dflt) {this.Set(Xodfg_pref_itm_type_.Tid_int, prop_key, prop_dflt);}
public Xocfg_meta_itm_int Rng_bgn_(int bgn) {return Rng_(bgn, Int_.MaxValue);}
public Xocfg_meta_itm_int Rng_bgn_(int bgn) {return Rng_(bgn, Int_.Max_value);}
public Xocfg_meta_itm_int Rng_(int bgn, int end) {
return this;
}

View File

@@ -30,7 +30,7 @@ public class Xocfg_bnd_itm_srl implements GfoInvkAble {
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_src_)) Src_(app, this, m.ReadStr("v"));
else if (ctx.Match(k, Invk_box_)) box = Xog_bnd_box_.Xto_sys_int(m.ReadStr("v"));
else if (ctx.Match(k, Invk_ipt_)) ipt = IptArg_.parse_(m.ReadStr("v"));
else if (ctx.Match(k, Invk_ipt_)) ipt = IptArg_.parse(m.ReadStr("v"));
else return GfoInvkAble_.Rv_unhandled;
return this;
}

View File

@@ -61,11 +61,11 @@ public class Xoctg_html_mgr implements GfoInvkAble {
boolean id_exists = wiki.Db_mgr().Load_mgr().Load_by_id(dbo_page, itm.Id());
Xoa_ttl itm_ttl = null;
if (id_exists)
itm_ttl = Xoa_ttl.parse_(wiki, dbo_page.Ns_id(), dbo_page.Ttl_page_db());
itm_ttl = Xoa_ttl.parse(wiki, dbo_page.Ns_id(), dbo_page.Ttl_page_db());
else {
itm_ttl = Xoa_ttl.parse_(wiki, itm.Sortkey());
itm_ttl = Xoa_ttl.parse(wiki, itm.Sortkey());
if (itm_ttl == null)
itm_ttl = Xoa_ttl.parse_(wiki, Bry_missing);
itm_ttl = Xoa_ttl.parse(wiki, Bry_missing);
itm.Id_missing_(true);
}
itm.Ttl_(itm_ttl);
@@ -93,7 +93,7 @@ public class Xoctg_html_mgr implements GfoInvkAble {
Xow_msg_mgr msg_mgr = wiki.Msg_mgr();
byte[] all_label = msg_mgr.Val_by_id_args(fmtr_all.Msg_id_label(), view_ctg.Name());
byte[] all_stats = msg_mgr.Val_by_id_args(fmtr_all.Msg_id_stats(), view_grp.Len(), view_grp.Total());
Xoa_ttl ctg_ttl = Xoa_ttl.parse_(wiki, Xow_ns_.Id_category, view_ctg.Name());
Xoa_ttl ctg_ttl = Xoa_ttl.parse(wiki, Xow_ns_.Id_category, view_ctg.Name());
byte[] all_navs = fmtr_all.Bld_bwd_fwd(wiki, ctg_ttl, view_grp);
fmtr_grp.Init_from_all(wiki, lang, view_ctg, fmtr_all, view_grp);
fmtr_all.Html_all().Bld_bfr_many(bfr, fmtr_all.Div_id(), all_label, all_stats, all_navs, lang.Key_bry(), lang.Dir_ltr_bry(), fmtr_grp);

View File

@@ -32,7 +32,7 @@ public class Xoctg_html_mgr_tst {
@Test public void Visited_doesnt_work_for_space() {// PURPOSE: xowa-visited not inserted for pages with space
byte[] page_bry = Bry_.new_a7("A 1");
Xoa_url url = Xoa_url.new_(Bry_.new_a7("en.wikipedia.org"), page_bry);
Xoa_ttl ttl = Xoa_ttl.parse_(fxt.Wiki(), page_bry);
Xoa_ttl ttl = Xoa_ttl.parse(fxt.Wiki(), page_bry);
fxt.Wiki().Appe().Usere().History_mgr().Add(url, ttl, page_bry);
fxt .Init_itm_page("A_1").Init_ctg_name_("Ctg_1").Init_ctg_pages_(0, 1)
.Test_html_all(Xoa_ctg_mgr.Tid_page, String_.Concat_lines_nl_skip_last
@@ -223,7 +223,7 @@ class Xoh_ctg_page_fxt {
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
public Xoctg_view_ctg Ctg() {return ctg;} private Xoctg_view_ctg ctg;
public void Test_bld_rslts_lnk(boolean next, String ctg_str, String expd) {
byte[] actl = ctg_html.Fmtr(Xoa_ctg_mgr.Tid_page).Grp_max_(0).Bld_bwd_fwd(wiki, Xoa_ttl.parse_(wiki, Bry_.new_a7(ctg_str)), ctg.Grp_by_tid(Xoa_ctg_mgr.Tid_page));
byte[] actl = ctg_html.Fmtr(Xoa_ctg_mgr.Tid_page).Grp_max_(0).Bld_bwd_fwd(wiki, Xoa_ttl.parse(wiki, Bry_.new_a7(ctg_str)), ctg.Grp_by_tid(Xoa_ctg_mgr.Tid_page));
Tfds.Eq_str_lines(expd, String_.new_u8(actl));
}
public Xoh_ctg_page_fxt Init_ctg_name_(String v) {ctg.Name_(Bry_.new_u8(v)); return this;}
@@ -238,7 +238,7 @@ class Xoh_ctg_page_fxt {
for (int i = 0; i < len; i++) {
String title = titles[i];
byte[] title_bry = Bry_.new_u8(title);
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, title_bry);
Xoa_ttl ttl = Xoa_ttl.parse(wiki, title_bry);
rv[i] = new Xoctg_view_itm().Ttl_(ttl).Sortkey_(ttl.Page_txt());
}
return rv;

View File

@@ -53,7 +53,7 @@ public class Xoctg_idx_mgr implements GfoInvkAble {
int dif = max / 2;
int pos = dif;
Xoctg_idx_itm rv = null;
int comp_prv = Int_.MinValue, comp_cur = 0;
int comp_prv = Int_.Min_value, comp_cur = 0;
while (true) {
rv = (Xoctg_idx_itm)itms.Get_at(pos);
comp_cur = Bry_.Compare(find, rv.Sortkey());
@@ -80,7 +80,7 @@ public class Xoctg_idx_mgr implements GfoInvkAble {
*/
boolean dir_fwd = bmk_comp == CompareAble_.More; // bmk is > than find; move forward
fld_rdr.Data_(src);
int comp_prv = bmk_comp, comp_cur = Int_.MinValue; int pos_cur = bmk_bgn;
int comp_prv = bmk_comp, comp_cur = Int_.Min_value; int pos_cur = bmk_bgn;
tmp_prv_itm.Parse(fld_rdr.Pos_(pos_cur), pos_cur); // fill prv_itm to whatever binary search found
while (true) {
int itm_bgn = dir_fwd ? Bry_finder.Find_fwd(src, Byte_ascii.Pipe, pos_cur, src_len) : Bry_finder.Find_bwd(src, Byte_ascii.Pipe, pos_cur);

View File

@@ -32,7 +32,7 @@ public class Xoctg_pagelist_itms implements Bry_fmtr_arg {
int len = itms.Count();
for (int i = 0; i < len; i++) {
Xowd_page_itm page = (Xowd_page_itm)itms.Get_at(i);
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, Xow_ns_.Id_category, page.Ttl_page_db());
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Xow_ns_.Id_category, page.Ttl_page_db());
byte[] lnki_cls = Xoh_lnki_wtr.Lnki_cls_visited(history_mgr, wiki.Domain_bry(), ttl.Page_txt()); // NOTE: must be ttl.Page_txt() in order to match Xou_history_mgr.Add
byte[] lnki_href = href_wtr.Build_to_bry(wiki, ttl);
byte[] lnki_ttl = ttl.Full_txt();

View File

@@ -97,14 +97,14 @@ public class Xodb_load_mgr_sql implements Xodb_load_mgr {
Xoctg_view_grp view_grp = null;
for (int i = 0; i < len; i++) {
Xowd_page_itm db_page = (Xowd_page_itm)list.Get_at(i);
if (db_page.Ns_id() == Int_.MinValue) continue; // HACK: page not found; ignore
if (db_page.Ns_id() == Int_.Min_value) continue; // HACK: page not found; ignore
Xoctg_page_xtn db_ctg = (Xoctg_page_xtn)db_page.Xtn();
byte cur_tid = db_ctg.Tid();
if (prv_tid != cur_tid) {
view_grp = rv.Grp_by_tid(cur_tid);
prv_tid = cur_tid;
}
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, db_page.Ns_id(), db_page.Ttl_page_db());
Xoa_ttl ttl = Xoa_ttl.parse(wiki, db_page.Ns_id(), db_page.Ttl_page_db());
Xoctg_view_itm view_itm = new Xoctg_view_itm().Sortkey_(db_ctg.Sortkey()).Ttl_(ttl);
view_itm.Load_by_ttl_data(cur_tid, db_page.Id(), Xowd_page_itm.Modified_on_null_int, db_page.Text_len());
view_grp.Itms_add(view_itm);
@@ -184,12 +184,12 @@ public class Xodb_load_mgr_sql implements Xodb_load_mgr {
boolean rv = false;
for (int i = 0; i < link_list.Count(); i++) {
Xowd_page_itm page = (Xowd_page_itm)link_list.Get_at(i);
if (page.Ns_id() == Int_.MinValue) continue; // HACK: page not found; ignore
if (page.Ns_id() == Int_.Min_value) continue; // HACK: page not found; ignore
byte ctg_tid = Xodb_load_mgr_txt.Load_ctg_v1_tid(page.Ns_id());
Xoctg_view_grp ctg_grp = view_ctg.Grp_by_tid(ctg_tid);
Xoctg_view_itm ctg_itm = new Xoctg_view_itm();
ctg_itm.Load_by_ttl_data(ctg_tid, page.Id(), 0, page.Text_len());
ctg_itm.Ttl_(Xoa_ttl.parse_(wiki, page.Ns_id(), page.Ttl_page_db()));
ctg_itm.Ttl_(Xoa_ttl.parse(wiki, page.Ns_id(), page.Ttl_page_db()));
ctg_itm.Sortkey_(page.Ttl_page_db());
ctg_grp.Itms_add(ctg_itm);
rv = true;

View File

@@ -70,7 +70,7 @@ class Xodb_load_mgr_sql_fxt {
Xowd_page_itm page = ary[i];
tbl_page.Insert_cmd_by_batch(page.Id(), page.Ns_id(), page.Ttl_page_db(), false, modified, 10, page.Id(), 0, 0);
Xowd_category_itm ctg_itm = (Xowd_category_itm)page.Xtn();
cat_core_tbl.Insert_cmd_by_batch(ctg_itm.Id(), ctg_itm.Count_pages(), ctg_itm.Count_subcs(), ctg_itm.Count_files(), Bool_.Xto_byte(ctg_itm.Hidden()), 0);
cat_core_tbl.Insert_cmd_by_batch(ctg_itm.Id(), ctg_itm.Count_pages(), ctg_itm.Count_subcs(), ctg_itm.Count_files(), Bool_.To_byte(ctg_itm.Hidden()), 0);
}
cat_core_tbl.Insert_end();
tbl_page.Insert_end();
@@ -92,7 +92,7 @@ class Xodb_load_mgr_sql_fxt {
Xowd_category_itm ctg_itm = (Xowd_category_itm)page.Xtn();
bfr.Add_int_variable(page.Id()).Add_byte_pipe();
bfr.Add(page.Ttl_page_db()).Add_byte_pipe();
bfr.Add_byte(Bool_.Xto_byte(ctg_itm.Hidden())).Add_byte_nl();
bfr.Add_byte(Bool_.To_byte(ctg_itm.Hidden())).Add_byte_nl();
}
return bfr.Xto_str_and_clear();
}

View File

@@ -304,7 +304,7 @@ public class Xodb_load_mgr_txt implements Xodb_load_mgr {
Xowd_page_itm itm = (Xowd_page_itm)ctgs.Get_at(i);
byte itm_tid = Load_ctg_v1_tid(itm.Ns_id());
Xoctg_view_itm sub = Load_ctg_v1_sub(itm_tid, itm);
sub.Ttl_(Xoa_ttl.parse_(wiki, itm.Ns_id(), itm.Ttl_page_db())).Sortkey_(itm.Ttl_page_db());
sub.Ttl_(Xoa_ttl.parse(wiki, itm.Ns_id(), itm.Ttl_page_db())).Sortkey_(itm.Ttl_page_db());
view_ctg.Grp_by_tid(itm_tid).Itms_add(sub);
}
for (byte i = 0; i < Xoa_ctg_mgr.Tid__max; i++) {

View File

@@ -42,7 +42,7 @@ class Xodb_upgrade_mgr {
// KeyVal kv = kv_ary[i];
// String kv_key = kv.Key();
// if (String_.Eq(kv_key, gfs_data_storage_format)) {
// byte data_storage_format_byte = Byte_.parse_(kv.Val_to_str_or_empty());
// byte data_storage_format_byte = Byte_.parse(kv.Val_to_str_or_empty());
// String data_storage_format_name = Xoi_dump_mgr.Wtr_tid_to_str(data_storage_format_byte);
// kv.Val_(data_storage_format_name); // update memory
// db_mgr.Tbl_xowa_cfg().Update(Xodb_mgr_sql.Grp__wiki_init, gfs_data_storage_format, data_storage_format_name); // update_database

View File

@@ -67,7 +67,7 @@ public class Xof_img_size_tst {
fxt.Lnki_ext_(Xof_ext_.Id_svg).Lnki_(-1, 40).Orig_(1, 1).Test_html(40, 40, Bool_.N); // NOTE: used to be 1,1
}
@Test public void Svg_max_width() { // PURPOSE: large width causes int overflow; vi.w:Danh_sách_quốc_kỳ DATE:2014-04-26
fxt.Lnki_ext_(Xof_ext_.Id_svg).Lnki_(Int_.MaxValue, 90).Orig_(900, 600).Test_html(135, 90, Bool_.N); // NOTE: used to be Int_.MaxValue,90
fxt.Lnki_ext_(Xof_ext_.Id_svg).Lnki_(Int_.Max_value, 90).Orig_(900, 600).Test_html(135, 90, Bool_.N); // NOTE: used to be Int_.Max_value,90
}
@Test public void Pdf_none_defaults_to_thumb() { // PURPOSE: if no width is specified, pdf uses thumb width default, not orig width); DATE: 2013-11-27
fxt.Lnki_type_(Xop_lnki_type.Id_none).Lnki_ext_(Xof_ext_.Id_pdf).Lnki_(-1, -1).Orig_(440, 220).Test_html(220, 110, Bool_.N); // NOTE: used to be 1,1

View File

@@ -31,9 +31,9 @@ public class Xof_xfer_itm_tst {
@Test public void Explicit_ratio_small() {tst_Calc_view("120,80" , "200,100" , "120,60");} // see NOTE_1:view ratio > file ratio
private void tst_Calc_view(String lnki_str, String file_str, String expd_str) {
Int_2_ref rv = new Int_2_ref();
Int_2_val lnki = Int_2_val.parse_(lnki_str);
Int_2_val file = Int_2_val.parse_(file_str);
Int_2_val expd = Int_2_val.parse_(expd_str);
Int_2_val lnki = Int_2_val.parse(lnki_str);
Int_2_val file = Int_2_val.parse(file_str);
Int_2_val expd = Int_2_val.parse(expd_str);
Xof_xfer_itm_.Calc_view(rv, Xop_lnki_type.Id_thumb, lnki.Val_0(), lnki.Val_1(), file.Val_0(), file.Val_1(), true);
Tfds.Eq(expd.Val_0(), rv.Val_0());
Tfds.Eq(expd.Val_1(), rv.Val_1());

View File

@@ -45,7 +45,7 @@ public class Xof_bin_wkr__fsdb_sql implements Xof_bin_wkr {
}
public Io_stream_rdr Get_to_fsys_near(Xof_fsdb_itm rv, byte[] orig_repo, byte[] orig_ttl, Xof_ext orig_ext, double lnki_time, int lnki_page) {
Fsd_thm_itm thm_itm = Fsd_thm_itm.new_();
thm_itm.Init_by_req(Int_.MaxValue, lnki_time, lnki_page);
thm_itm.Init_by_req(Int_.Max_value, lnki_time, lnki_page);
boolean found = Select_thm_bin(Bool_.N, thm_itm, orig_repo, orig_ttl);
if (found) {
tmp_ids.Init_by_thm(found, thm_itm);

View File

@@ -33,7 +33,7 @@ public class Xou_cache_mgr {
public long Fsys_size_min() {return fsys_size_min;} public void Fsys_size_min_(long v) {fsys_size_min = v;} private long fsys_size_min = Io_mgr.Len_mb * 75;
public long Fsys_size_max() {return fsys_size_max;} public void Fsys_size_max_(long v) {fsys_size_max = v;} private long fsys_size_max = Io_mgr.Len_mb * 100;
public KeyVal[] Info() {
long view_date = Long_.MaxValue;
long view_date = Long_.Max_value;
long fsys_size = 0;
int len = hash.Count();
for (int i = 0; i < len; ++i) {
@@ -45,7 +45,7 @@ public class Xou_cache_mgr {
( KeyVal_.new_("cache folder", cache_dir.Xto_api())
, KeyVal_.new_("space used", gplx.ios.Io_size_.To_str(fsys_size))
, KeyVal_.new_("file count", len)
, KeyVal_.new_("oldest file", view_date == Long_.MaxValue ? "" : DateAdp_.unixtime_utc_seconds_(view_date).XtoStr_fmt_iso_8561())
, KeyVal_.new_("oldest file", view_date == Long_.Max_value ? "" : DateAdp_.unixtime_utc_seconds_(view_date).XtoStr_fmt_iso_8561())
);
}
public Xou_cache_itm Get_or_null(Xof_fsdb_itm fsdb) {return Get_or_null(fsdb.Lnki_wiki_abrv(), fsdb.Lnki_ttl(), fsdb.Lnki_type(), fsdb.Lnki_upright(), fsdb.Lnki_w(), fsdb.Lnki_h(), fsdb.Lnki_time(), fsdb.Lnki_page(), fsdb.User_thumb_w());}

View File

@@ -66,7 +66,7 @@ class Xof_file_fxt {
itm.Init_at_lnki(arg.Exec_tid(), wiki.Domain_itm().Abrv_xo(), ttl_bry, arg.Lnki_type(), arg.Lnki_upright(), arg.Lnki_w(), arg.Lnki_h(), arg.Lnki_time(), Xof_lnki_page.Null, Xof_patch_upright_tid_.Tid_all);
List_adp itms_list = List_adp_.new_(); itms_list.Add(itm);
orig_mgr.Find_by_list(Ordered_hash_.new_bry_(), itms_list, Xof_exec_tid.Tid_wiki_page);
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, Xow_ns_.Id_main, ttl_bry);
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Xow_ns_.Id_main, ttl_bry);
Xoae_page page = Xoae_page.new_(wiki, ttl);
fsdb_mgr.Fsdb_search_by_list(itms_list, wiki, page, Xog_js_wkr_.Noop);
if (arg.Rslt_orig_exists() != Bool_.__byte) Tfds.Eq(arg.Rslt_orig_exists() == Bool_.Y_byte, itm.Orig_exists(), "orig_exists");

View File

@@ -31,7 +31,7 @@ class Xof_img_wkr_query_img_size_imageMagick implements Xof_img_wkr_query_img_si
int pos_bgn = String_.FindFwd(size_str, "<{", 0); if (pos_bgn == String_.Find_none) return SizeAdp_.Zero; // NOTE: RE: "FindFwd(,0)"; multiple frames are possible; 1st frame must be used as last frame is not accurate; EX:w.Chess:[[File:ChessCastlingMovie.gif|thumb|250px]]
int pos_end = String_.FindFwd(size_str, "}>", pos_bgn); if (pos_end == String_.Find_none) return SizeAdp_.Zero;
size_str = String_.Mid(size_str, pos_bgn + Marker_bgn_len, pos_end);
return SizeAdp_.parse_or_(size_str, SizeAdp_.Zero);
return SizeAdp_.parse_or(size_str, SizeAdp_.Zero);
}
static final String Marker_bgn = "<{", Marker_end = "}>"; static final int Marker_bgn_len = String_.Len(Marker_bgn);
}

View File

@@ -30,7 +30,7 @@ class Xof_wiki_finder { // UNUSED
return rv;
}
private Xoae_page Get_page__by_wiki(Xowe_wiki wiki, int ns_id, byte[] ttl_bry) {
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, ns_id, ttl_bry) ;
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ns_id, ttl_bry) ;
Xoa_url url = Xoa_url.new_(wiki.Domain_bry(), ttl_bry);
return wiki.Load_page_by_ttl(url, ttl);
}

View File

@@ -69,7 +69,7 @@ public class Xof_xfer_queue_base_fxt {
public void ini_page_create_en_wiki(String ttl) {Init_page_create(en_wiki, ttl, "");}
public void ini_page_create_en_wiki_redirect(String ttl, String redirect) {Init_page_create(en_wiki, ttl, "#REDIRECT [[" + redirect + "]]");}
public void Init_page_create(Xowe_wiki wiki, String ttl, String txt) {
Xoa_ttl page_ttl = Xoa_ttl.parse_(wiki, Bry_.new_u8(ttl));
Xoa_ttl page_ttl = Xoa_ttl.parse(wiki, Bry_.new_u8(ttl));
byte[] page_raw = Bry_.new_u8(txt);
wiki.Db_mgr().Save_mgr().Data_create(page_ttl, page_raw);
}

View File

@@ -26,7 +26,7 @@ public class Xoa_fmtr_itm implements GfoInvkAble {
}
public String Run() {
GfoInvkAble src_invk = (GfoInvkAble)app.Gfs_mgr().Run_str(src);
int len = Int_.cast_(GfoInvkAble_.InvkCmd(src_invk, Invk_len));
int len = Int_.cast(GfoInvkAble_.InvkCmd(src_invk, Invk_len));
Bry_bfr bfr = Bry_bfr.new_();
Bfmtr_eval_invk eval_mgr = new Bfmtr_eval_invk(app);
Bry_fmtr fmtr = Bry_fmtr.new_bry_(fmt).Eval_mgr_(eval_mgr);

View File

@@ -66,7 +66,7 @@ public class Xoa_gui_mgr implements GfoEvObj, GfoInvkAble {
layout.Init(browser_win);
cmd_mgr.Init_by_kit(app);
app.Api_root().Init_by_kit(app);
menu_mgr.Menu_bldr().Init_by_kit(app, kit, app.Usere().Fsys_mgr().App_img_dir().GenSubDir_nest("window", "menu"));
menu_mgr.Menu_bldr().Init_by_kit(app, kit, app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("app.menu"));
menu_mgr.Init_by_kit();
bnd_mgr.Init_by_kit(app);
GfoEvMgr_.SubSame_many(app.Usere(), this, Xoue_user.Evt_lang_changed);

View File

@@ -59,7 +59,7 @@ public class Xog_history_mgr {
byte[] page_key = Build_page_key(itm.Wiki(), itm.Page(), itm.Qarg());
Xoae_page rv = (Xoae_page)hash.Get_by(page_key);
if (rv != null) return rv;
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, itm.Page());
Xoa_ttl ttl = Xoa_ttl.parse(wiki, itm.Page());
return wiki.Data_mgr().Get_page(ttl, false);
}
private static byte[] Build_page_key(Xoae_page page) {return Build_page_key(page.Wiki().Domain_bry(), page.Ttl().Full_url(), page.Url().Qargs_mgr().To_bry());}

View File

@@ -71,7 +71,7 @@ class Xog_history_stack_fxt {
}
public Xog_history_stack_fxt Exec_add_one(String ttl_str, String arg_str) {
byte[] ttl_bry = Bry_.new_u8(ttl_str);
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, ttl_bry);
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
Xoae_page page = Xoae_page.test_(wiki, ttl);
byte[] url_bry = ttl_bry;
if (arg_str != null) url_bry = Bry_.Add(url_bry, Bry_.new_u8(arg_str));

View File

@@ -66,7 +66,7 @@ public class Xog_mnu_bldr {
Gfui_mnu_itm mnu_itm = owner_gui.Itms_add_chk_msg(sub.Gui_text(), img, app, app.Gfs_mgr(), msg_n, msg_y);
sub.Evt_mgr().Sub(mnu_itm);
Xog_cmd_itm cmd = app.Gui_mgr().Cmd_mgr().Get_or_null(sub.Key());
boolean v = Bool_.cast_(app.Gfs_mgr().Run_str_for(app, cmd.Cmd()));
boolean v = Bool_.cast(app.Gfs_mgr().Run_str_for(app, cmd.Cmd()));
mnu_itm.Selected_(v);
return mnu_itm;
}

View File

@@ -22,7 +22,7 @@ public class Xof_orig_file_downloader {
Xof_fsdb_itm fsdb = new Xof_fsdb_itm();
lnki_ttl = Xoa_ttl.Replace_spaces(Xoa_app_.Utl__encoder_mgr().Http_url().Decode(lnki_ttl));
fsdb.Init_at_lnki(Xof_exec_tid.Tid_viewer_app, wiki.Domain_itm().Abrv_xo(), lnki_ttl, Xop_lnki_type.Id_none, Xop_lnki_tkn.Upright_null, Xof_img_size.Size__neg1, Xof_img_size.Size__neg1, Xof_lnki_time.Null, Xof_lnki_page.Null, Xof_patch_upright_tid_.Tid_all);
fsdb.Init_at_hdoc(Int_.MaxValue, Xof_html_elem.Tid_img);// NOTE: set elem_id to "impossible" number, otherwise it will auto-update an image on the page with a super-large size; [[File:Alfred Sisley 062.jpg]]
fsdb.Init_at_hdoc(Int_.Max_value, Xof_html_elem.Tid_img);// NOTE: set elem_id to "impossible" number, otherwise it will auto-update an image on the page with a super-large size; [[File:Alfred Sisley 062.jpg]]
Xof_orig_itm orig = wiki.File__orig_mgr().Find_by_ttl_or_null(lnki_ttl); if (orig == Xof_orig_itm.Null) return null; // orig not found; need orig in order to get repo
Xof_repo_itm repo = wiki.File__repo_mgr().Get_trg_by_id_or_null(orig.Repo(), lnki_ttl, Bry_.Empty); if (repo == null) return null; // repo not found
fsdb.Init_at_orig(orig.Repo(), repo.Wiki_domain(), orig.Ttl(), orig.Ext(), orig.W(), orig.H(), orig.Redirect());

View File

@@ -154,7 +154,7 @@ public class Xog_url_wkr {
// wiki = app.Wiki_mgr().Get_by_key_or_make(href.Wiki()).Init_assert(); // get xwiki and set to wiki
// if (use_main_page)
// page_bry = wiki.Props().Main_page(); // get Main_page for new wiki; DATE:2014-02-23
// Xoa_ttl tmp_ttl = Xoa_ttl.parse_(wiki, page_bry); // reparse ttl according to xwiki's case_match rules; NOTE: do not use rv.Page_bry() or else will lose sub_pages (A/B/C); DATE:2014-02-21
// Xoa_ttl tmp_ttl = Xoa_ttl.parse(wiki, page_bry); // reparse ttl according to xwiki's case_match rules; NOTE: do not use rv.Page_bry() or else will lose sub_pages (A/B/C); DATE:2014-02-21
// if (tmp_ttl != null)
// page_bry = tmp_ttl.Full_db();
// }

View File

@@ -29,10 +29,10 @@ public class Rect_ref {
@Override public String toString() {return String_.Format("{0},{1},{2},{3}", x, y, w, h);}
public static final Rect_ref Zero = new Rect_ref(0, 0, 0, 0);
public static Rect_ref rectAdp_(gplx.gfui.RectAdp v) {return new Rect_ref(v.X(), v.Y(), v.Width(), v.Height());}
public static Rect_ref parse_(String raw) {
public static Rect_ref parse(String raw) {
try {
String[] ary = String_.Split(raw, ",");
return new Rect_ref(Int_.parse_(ary[0]), Int_.parse_(ary[1]), Int_.parse_(ary[2]), Int_.parse_(ary[3]));
return new Rect_ref(Int_.parse(ary[0]), Int_.parse(ary[1]), Int_.parse(ary[2]), Int_.parse(ary[3]));
} catch(Exception exc) {throw Err_.new_parse_exc(exc, Rect_ref.class, raw);}
}
}

View File

@@ -103,7 +103,7 @@ public class Xog_html_itm implements Xog_js_wkr, GfoInvkAble, GfoEvObj {
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_elem_delete, m);
}
@gplx.Virtual public String Html_elem_atr_get_str(String id, String atr_key) {return html_box.Html_js_eval_proc_as_str(Xog_js_procs.Doc__atr_get_as_obj, id, atr_key);}
@gplx.Virtual public boolean Html_elem_atr_get_bool(String id, String atr_key) {return Bool_.parse_(html_box.Html_js_eval_proc_as_str(Xog_js_procs.Doc__atr_get_to_str, id, atr_key));}
@gplx.Virtual public boolean Html_elem_atr_get_bool(String id, String atr_key) {return Bool_.parse(html_box.Html_js_eval_proc_as_str(Xog_js_procs.Doc__atr_get_to_str, id, atr_key));}
public void Html_atr_set(String elem_id, String atr_key, String atr_val) {

View File

@@ -60,9 +60,9 @@ class Xog_launcher_tabs {
}
private void Launch_tab(Xog_win_itm win, Xowe_wiki home_wiki, String launch_str) {
Xoae_app app = win.App();
Xoa_url launch_url = home_wiki.Utl__url_parser().Parse_by_urlbar(launch_str);
Xoa_url launch_url = home_wiki.Utl__url_parser().Parse_by_urlbar_or_null(launch_str); if (launch_url == null) return;
Xowe_wiki launch_wiki = (Xowe_wiki)app.Wiki_mgr().Get_by_key_or_make_init_y(launch_url.Wiki_bry());
Xoa_ttl launch_ttl = Xoa_ttl.parse_(launch_wiki, launch_url.Page_bry());
Xoa_ttl launch_ttl = Xoa_ttl.parse(launch_wiki, launch_url.Page_bry());
Xog_tab_itm tab = win.Tab_mgr().Tabs_new_init(launch_wiki, Xoae_page.new_(launch_wiki, launch_ttl)); // WORKAROUND: set the tab to an empty page, else null ref later; DATE:2014-07-23
tab.Show_url_bgn(launch_url);
}

View File

@@ -19,26 +19,26 @@ package gplx.xowa.gui.views; import gplx.*; import gplx.xowa.*; import gplx.xowa
import gplx.gfui.*;
public class Xog_layout_box implements GfoInvkAble {
public GfoInvkAble Owner() {return owner;} public Xog_layout_box Owner_(GfoInvkAble v) {owner = v; return this;} GfoInvkAble owner;
public int X_abs() {return x_abs;} public Xog_layout_box X_abs_(int v) {x_abs = v; return this;} private int x_abs = Int_.MinValue;
public int Y_abs() {return y_abs;} public Xog_layout_box Y_abs_(int v) {y_abs = v; return this;} private int y_abs = Int_.MinValue;
public int W_abs() {return w_abs;} public Xog_layout_box W_abs_(int v) {w_abs = v; return this;} private int w_abs = Int_.MinValue;
public int H_abs() {return h_abs;} public Xog_layout_box H_abs_(int v) {h_abs = v; return this;} private int h_abs = Int_.MinValue;
public int X_rel() {return x_rel;} public Xog_layout_box X_rel_(int v) {x_rel = v; return this;} private int x_rel = Int_.MinValue;
public int Y_rel() {return y_rel;} public Xog_layout_box Y_rel_(int v) {y_rel = v; return this;} private int y_rel = Int_.MinValue;
public int W_rel() {return w_rel;} public Xog_layout_box W_rel_(int v) {w_rel = v; return this;} private int w_rel = Int_.MinValue;
public int H_rel() {return h_rel;} public Xog_layout_box H_rel_(int v) {h_rel = v; return this;} private int h_rel = Int_.MinValue;
public int X_abs() {return x_abs;} public Xog_layout_box X_abs_(int v) {x_abs = v; return this;} private int x_abs = Int_.Min_value;
public int Y_abs() {return y_abs;} public Xog_layout_box Y_abs_(int v) {y_abs = v; return this;} private int y_abs = Int_.Min_value;
public int W_abs() {return w_abs;} public Xog_layout_box W_abs_(int v) {w_abs = v; return this;} private int w_abs = Int_.Min_value;
public int H_abs() {return h_abs;} public Xog_layout_box H_abs_(int v) {h_abs = v; return this;} private int h_abs = Int_.Min_value;
public int X_rel() {return x_rel;} public Xog_layout_box X_rel_(int v) {x_rel = v; return this;} private int x_rel = Int_.Min_value;
public int Y_rel() {return y_rel;} public Xog_layout_box Y_rel_(int v) {y_rel = v; return this;} private int y_rel = Int_.Min_value;
public int W_rel() {return w_rel;} public Xog_layout_box W_rel_(int v) {w_rel = v; return this;} private int w_rel = Int_.Min_value;
public int H_rel() {return h_rel;} public Xog_layout_box H_rel_(int v) {h_rel = v; return this;} private int h_rel = Int_.Min_value;
public String Text() {return text;} public Xog_layout_box Text_(String v) {text = v; return this;} private String text;
public String Font_name() {return font_name;} public Xog_layout_box Font_name_(String v) {font_name = v; return this;} private String font_name;
public float Font_size() {return font_size;} public Xog_layout_box Font_size_(float v) {font_size = v; return this;} float font_size = Float_.NaN;
public FontStyleAdp Font_style() {return font_style;} public Xog_layout_box Font_style_(FontStyleAdp v) {font_style = v; return this;} FontStyleAdp font_style;
public byte Mode() {return mode;} public Xog_layout_box Mode_(byte v) {mode = v; return this;} private byte mode = Mode_rel;
public void Adj_size(Rect_ref rect) {
if (w_abs > -1) rect.W_(w_abs); if (w_rel != Int_.MinValue) rect.W_(w_rel + rect.W());
if (h_abs > -1) rect.H_(h_abs); if (h_rel != Int_.MinValue) rect.H_(h_rel + rect.H());
if (w_abs > -1) rect.W_(w_abs); if (w_rel != Int_.Min_value) rect.W_(w_rel + rect.W());
if (h_abs > -1) rect.H_(h_abs); if (h_rel != Int_.Min_value) rect.H_(h_rel + rect.H());
}
public void Adj_pos(Rect_ref rect) {
if (x_abs > -1) rect.X_(x_abs); if (x_rel != Int_.MinValue) rect.X_(x_rel + rect.X());
if (y_abs > -1) rect.Y_(y_abs); if (y_rel != Int_.MinValue) rect.Y_(y_rel + rect.Y());
if (x_abs > -1) rect.X_(x_abs); if (x_rel != Int_.Min_value) rect.X_(x_rel + rect.X());
if (y_abs > -1) rect.Y_(y_abs); if (y_rel != Int_.Min_value) rect.Y_(y_rel + rect.Y());
}
public void Adj_text(GfuiElem elem) {
if (text != null) elem.Text_(text);
@@ -63,7 +63,7 @@ public class Xog_layout_box implements GfoInvkAble {
else if (ctx.Match(k, Invk_text_)) text = m.ReadStr("v");
else if (ctx.Match(k, Invk_font_name_)) font_name = m.ReadStr("v");
else if (ctx.Match(k, Invk_font_size_)) font_size = m.ReadFloat("v");
else if (ctx.Match(k, Invk_font_style_)) font_style = FontStyleAdp_.parse_(m.ReadStr("v"));
else if (ctx.Match(k, Invk_font_style_)) font_style = FontStyleAdp_.parse(m.ReadStr("v"));
else if (ctx.Match(k, Invk_mode_)) mode = String_.Eq(m.ReadStr("v"), "abs") ? Mode_abs : Mode_rel;
else if (ctx.Match(k, Invk_owner)) return owner;
else return GfoInvkAble_.Rv_unhandled;

View File

@@ -116,7 +116,7 @@ public class Xog_tab_itm implements GfoInvkAble {
this.wiki = (Xowe_wiki)app.Wiki_mgr().Get_by_key_or_make_init_y(url.Wiki_bry()); // NOTE: must update wiki variable; DATE:????-??-??; NOTE: must load wiki; DATE:2015-07-22
if (url.Page_is_main()) url.Page_bry_(wiki.Props().Main_page());
if (url.Vnt_bry() != null) Cur_vnt_(wiki, url.Vnt_bry());
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, url.Page_bry());
Xoa_ttl ttl = Xoa_ttl.parse(wiki, url.Page_bry());
if (ttl == null) {usr_dlg.Prog_one("", "", "title is invalid: ~{0}", String_.new_u8(url.Raw())); return;}
Tab_name_(String_.new_u8(ttl.Full_txt()));
usr_dlg.Prog_one("", "", "loading: ~{0}", String_.new_u8(ttl.Raw()));

View File

@@ -79,14 +79,14 @@ public class Xog_tab_itm_edit_mgr {
byte[] new_text = Bry_.new_u8(tab.Html_itm().Get_elem_value(Xog_html_itm.Elem_id__xowa_edit_rename_box));
if (Bry_.Len_eq_0(new_text)) return; // no ttl given; exit
new_text = Xoa_ttl.Replace_spaces(new_text); // ttls cannot have spaces; only underscores
Xoa_ttl new_ttl = Xoa_ttl.parse_(wiki, new_text);
Xoa_ttl new_ttl = Xoa_ttl.parse(wiki, new_text);
int new_ns_id = new_ttl.Ns().Id();
if (new_ns_id != Xow_ns_.Id_main) {
win_itm.Usr_dlg().Warn_many("", "", "The new page name must remain in the same namespace");
return;
}
wiki.Db_mgr().Save_mgr().Data_rename(page, new_ns_id, new_text);
page.Ttl_(Xoa_ttl.parse_(wiki, Bry_.Add(page.Ttl().Ns().Name_db_w_colon(), new_text)));
page.Ttl_(Xoa_ttl.parse(wiki, Bry_.Add(page.Ttl().Ns().Name_db_w_colon(), new_text)));
win_itm.Page__mode_(Xopg_view_mode.Tid_read);
win_itm.Usr_dlg().Prog_one("", "", "renamed page to {0}", String_.new_u8(page.Ttl().Full_txt_raw()));
}

View File

@@ -77,8 +77,8 @@ public class Xog_tab_mgr implements GfoEvObj {
public Xog_tab_itm Tabs_new_dflt(boolean focus) {
boolean active_tab_is_null = this.Active_tab_is_null();
Xowe_wiki cur_wiki = active_tab_is_null ? win.App().Usere().Wiki() : active_tab.Wiki();
Xoa_ttl ttl = Xoa_ttl.parse_(cur_wiki, Xows_special_meta_.Itm__default_tab.Ttl_bry());
Xoa_url url = cur_wiki.Utl__url_parser().Parse_by_urlbar(ttl.Full_db_as_str());
Xoa_ttl ttl = Xoa_ttl.parse(cur_wiki, Xows_special_meta_.Itm__default_tab.Ttl_bry());
Xoa_url url = cur_wiki.Utl__url_parser().Parse_by_urlbar_or_null(ttl.Full_db_as_str()); if (url == null) throw Err_.new_("url", "invalid url", "url", url);
Xog_tab_itm rv = Tabs_new(focus, active_tab_is_null, cur_wiki, Xoae_page.new_(cur_wiki, ttl));
rv.Page_update_ui();
rv.Show_url_bgn(url);
@@ -219,7 +219,7 @@ public class Xog_tab_mgr implements GfoEvObj {
public void Tabs_new_link(String link, boolean focus) {
Xowe_wiki wiki = active_tab.Wiki();
Xog_tab_itm new_tab = Tabs_new(focus, false, wiki, Xoae_page.new_(wiki, active_tab.Page().Ttl())); // NOTE: do not use ttl from link, else middle-clicking pages with anchors won't work; DATE:2015-05-03
Xoa_url url = wiki.Utl__url_parser().Parse_by_urlbar(link); // NOTE: link must be of form domain/wiki/page; DATE:2014-05-27
Xoa_url url = wiki.Utl__url_parser().Parse_by_urlbar_or_null(link); if (url == null) return; // NOTE: link must be of form domain/wiki/page; DATE:2014-05-27
new_tab.Show_url_bgn(url);
if (focus)
tab_mgr.Tabs_select_by_idx(new_tab.Tab_idx());

View File

@@ -170,7 +170,8 @@ public class Xog_win_itm implements GfoInvkAble, GfoEvObj {
public void Page__navigate_by_search() {Page__navigate_by_url_bar(app.Gui_mgr().Win_cfg().Search_box_fmtr().Bld_str_many(search_box.Text()));}
public void Page__navigate_by_url_bar(String href) {
Xog_tab_itm tab = tab_mgr.Active_tab_assert();
tab.Show_url_bgn(tab.Wiki().Utl__url_parser().Parse_by_urlbar(href));
Xoa_url url = tab.Wiki().Utl__url_parser().Parse_by_urlbar_or_null(href); if (url == null) return;
tab.Show_url_bgn(url);
}
private void Page__navigate_by_href(Xog_tab_itm tab, String href) { // NOTE: different from Navigate_by_url_bar in that it handles "file:///" and other @gplx.Internal protected formats; EX: "/site/", "about:blank"; etc..
Xoa_url url = Xog_url_wkr.Exec_url(this, href);
@@ -250,9 +251,9 @@ public class Xog_win_itm implements GfoInvkAble, GfoEvObj {
synchronized (App__retrieve__lock) {
boolean output_html = String_.Eq(output_str, "html");
Xowe_wiki home_wiki = app.Usere().Wiki();
Xoa_url url = home_wiki.Utl__url_parser().Parse_by_urlbar(url_str);
Xoa_url url = home_wiki.Utl__url_parser().Parse_by_urlbar_or_null(url_str); if (url == null) return Bry_.Empty;
Xowe_wiki wiki = (Xowe_wiki)app.Wiki_mgr().Get_by_key_or_make_init_y(url.Wiki_bry());
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, url.Page_bry());
Xoa_ttl ttl = Xoa_ttl.parse(wiki, url.Page_bry());
Xoae_page new_page = wiki.Load_page_by_ttl(url, ttl);
if (new_page.Missing()) {return Bry_.Empty;}
gplx.xowa.servers.Gxw_html_server.Assert_tab(app, new_page); // HACK: assert at least 1 tab for Firefox addon; DATE:2015-01-23
@@ -271,7 +272,7 @@ public class Xog_win_itm implements GfoInvkAble, GfoEvObj {
this.kit = kit;
win_box = kit.New_win_app("win");
sync_cmd = win_box.Kit().New_cmd_sync(this);
Io_url img_dir = app.Usere().Fsys_mgr().App_img_dir().GenSubDir_nest("window", "chrome");
Io_url img_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("app.window");
FontAdp ui_font = app.Gui_mgr().Win_cfg().Font().XtoFontAdp();
go_bwd_btn = Xog_win_itm_.new_btn(app, kit, win_box, img_dir, "go_bwd_btn", "go_bwd.png" );
go_fwd_btn = Xog_win_itm_.new_btn(app, kit, win_box, img_dir, "go_fwd_btn", "go_fwd.png" );

View File

@@ -28,8 +28,7 @@ public class Xog_win_itm_ {
app.Usere().Cfg_mgr().Startup_mgr().Window_mgr().Init_window(win_box);
win.Resizer().Exec_win_resize(app, win_box.Width(), win_box.Height());
IconAdp.regy_loadDir_shallow(app.Usere().Fsys_mgr().Root_dir().GenSubDir_nest("app", "img", "win"));
win_box.Icon_(IconAdp.regy_("xowa.app"));
win_box.Icon_(IconAdp.file_or_blank(app.Fsys_mgr().Bin_xowa_dir().GenSubFil_nest("file", "app.window", "app_icon.png")));
}
public static GfuiBtn new_btn(Xoae_app app, Gfui_kit kit, GfuiWin win, Io_url img_dir, String id, String file) {
GfuiBtn rv = kit.New_btn(id, win);

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.html; import gplx.*; import gplx.xowa.*;
public class Xoh_cfg_file {
public Xoh_cfg_file(Url_encoder url_encoder, Io_url xowa_dir) {
Io_url mw_file_dir = xowa_dir.GenSubDir_nest("file", "mw.file");
Io_url mw_file_dir = xowa_dir.GenSubDir_nest("file", "mediawiki.file");
img_media_play_btn = url_encoder.Encode_http(mw_file_dir.GenSubFil("play.png"));
img_media_info_btn = url_encoder.Encode_http(mw_file_dir.GenSubFil("info.png"));
img_thumb_magnify = url_encoder.Encode_http(mw_file_dir.GenSubFil("magnify-clip.png"));

View File

@@ -48,10 +48,10 @@ class Xoh_page_wtr_wkr_fxt {
} private Bry_bfr tmp_bfr = Bry_bfr.reset_(255); private Xowe_wiki wiki;
public Xoae_app App() {return app;} private Xoae_app app;
public void Test_page_name_by_display(String ttl, String display, String expd) {
Tfds.Eq(expd, String_.new_a7(Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, Xoa_ttl.parse_(wiki, Bry_.new_a7(ttl)), Bry_.new_a7(display))));
Tfds.Eq(expd, String_.new_a7(Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, Xoa_ttl.parse(wiki, Bry_.new_a7(ttl)), Bry_.new_a7(display))));
}
public void Test_page_name_by_ttl(String raw, String expd) {
Tfds.Eq(expd, String_.new_a7(Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, Xoa_ttl.parse_(wiki, Bry_.new_a7(raw)), null)));
Tfds.Eq(expd, String_.new_a7(Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, Xoa_ttl.parse(wiki, Bry_.new_a7(raw)), null)));
}
public void Test_edit(String raw, String expd) {
wiki.Html_mgr().Page_wtr_mgr().Html_capable_(true);
@@ -65,7 +65,7 @@ class Xoh_page_wtr_wkr_fxt {
public void Test_read(String page_name, String page_text, String expd) {
wiki.Html_mgr().Page_wtr_mgr().Html_capable_(true);
Xoae_page page = wiki.Ctx().Cur_page();
page.Ttl_(Xoa_ttl.parse_(wiki, Bry_.new_a7(page_name)));
page.Ttl_(Xoa_ttl.parse(wiki, Bry_.new_a7(page_name)));
page.Data_raw_(Bry_.new_u8(page_text));
Xohe_page_wtr_mgr mgr = wiki.Html_mgr().Page_wtr_mgr();
Xoh_page_wtr_wkr wkr = mgr.Wkr(Xopg_view_mode.Tid_read).Page_(page).Mgr_(mgr);

View File

@@ -24,11 +24,11 @@ public class Xow_html_mgr implements GfoInvkAble {
html_wtr = new Xoh_html_wtr(wiki, this);
Xoae_app app = wiki.Appe();
page_wtr_mgr = new Xohe_page_wtr_mgr(app.Gui_mgr().Kit().Tid() != gplx.gfui.Gfui_kit_.Swing_tid); // reverse logic to handle swt,drd but not mem
Io_url file_dir = app.Usere().Fsys_mgr().App_img_dir().GenSubDir_nest("file");
Io_url file_dir = app.Fsys_mgr().Bin_xowa_file_dir().GenSubDir_nest("mediawiki.file");
img_media_play_btn = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(file_dir.GenSubFil("play.png"));
img_media_info_btn = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(file_dir.GenSubFil("info.png"));
img_thumb_magnify = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(file_dir.GenSubFil("magnify-clip.png"));
img_xowa_protocol = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(app.Usere().Fsys_mgr().App_img_dir().GenSubFil_nest("xowa", "protocol.png"));
img_xowa_protocol = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(app.Fsys_mgr().Bin_xowa_file_dir().GenSubFil_nest("app.general", "xowa_exec.png"));
portal_mgr = new Xow_portal_mgr(wiki);
imgs_mgr = new Xoh_imgs_mgr(this);
module_mgr = new Xow_module_mgr(wiki);

View File

@@ -18,7 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.html.bridges; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
import gplx.core.json.*;
public class Bridge_cmd_mgr {
private final Json_parser parser;
private final Hash_adp_bry cmd_hash = Hash_adp_bry.cs();
public Bridge_cmd_mgr(Json_parser parser) {this.parser = parser;}
public void Add(Bridge_cmd_itm cmd) {cmd_hash.Add_bry_obj(cmd.Key(), cmd);}
public String Exec(GfoMsg m) {
if (m.Args_count() == 0) throw Err_.new_("bridge.cmds", "no json specified for json_exec");
@@ -26,9 +28,9 @@ public class Bridge_cmd_mgr {
}
public String Exec(byte[] jdoc_bry) {
Json_doc jdoc = null;
try {jdoc = Json_doc.new_(jdoc_bry);}
try {jdoc = parser.Parse(jdoc_bry);}
catch (Exception e) {throw Err_.new_exc(e, "bridge.cmds", "invalid json", "json", jdoc_bry);}
Json_nde msg = jdoc.Root();
Json_nde msg = jdoc.Root_nde();
byte[] key_bry = msg.Get_bry(Key_cmd);
Bridge_cmd_itm cmd = (Bridge_cmd_itm)cmd_hash.Get_by_bry(key_bry); if (cmd == null) throw Err_.new_("bridge.cmds", "unknown cmd", "cmd", cmd);
try {return cmd.Exec(msg.Get(Key_data));}

View File

@@ -83,8 +83,8 @@ public class Bridge_msg_bldr {
Gfo_tree_data sub_kv = (Gfo_tree_data)itm;
String key = sub_kv.Key(); Object val = sub_kv.Val();
switch (sub_kv.Val_tid()) {
case Type_adp_.Tid__bool: wtr.Kv_bool(key, Bool_.cast_(val)); break;
case Type_adp_.Tid__int: wtr.Kv_int(key, Int_.cast_(val)); break;
case Type_adp_.Tid__bool: wtr.Kv_bool(key, Bool_.cast(val)); break;
case Type_adp_.Tid__int: wtr.Kv_int(key, Int_.cast(val)); break;
case Type_adp_.Tid__bry: wtr.Kv_bry(key, (byte[])val); break;
default: wtr.Kv_str(key, Object_.Xto_str_strict_or_null_mark(val)); break;
}

View File

@@ -16,8 +16,10 @@ 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.html.bridges; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
import gplx.core.json.*;
import gplx.xowa.html.bridges.dbuis.tbls.*;
public class Xoh_bridge_mgr {
public Bridge_cmd_mgr Cmd_mgr() {return cmd_mgr;} private final Bridge_cmd_mgr cmd_mgr = new Bridge_cmd_mgr();
public Xoh_bridge_mgr(Json_parser parser) {this.cmd_mgr = new Bridge_cmd_mgr(parser);}
public Bridge_cmd_mgr Cmd_mgr() {return cmd_mgr;} private final Bridge_cmd_mgr cmd_mgr;
public Bridge_msg_bldr Msg_bldr() {return msg_bldr;} private final Bridge_msg_bldr msg_bldr = new Bridge_msg_bldr();
}

View File

@@ -37,7 +37,7 @@ public class Xohd_abrv_mgr_tst {
( ""
, " <div>"
, " <a href=\"/wiki/File:A.png\" class=\"image\" title=\"About this file\">"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mw.file/info.png\" width=\"22\" height=\"22\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/info.png\" width=\"22\" height=\"22\" />"
, " </a>"
, " </div>"
));
@@ -48,7 +48,7 @@ public class Xohd_abrv_mgr_tst {
( ""
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"A.png\">"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mw.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
));
@@ -59,7 +59,7 @@ public class Xohd_abrv_mgr_tst {
( ""
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"/wiki/File:A.png\" xowa_title=\"A.png\" class=\"xowa_anchor_button\" style=\"width:220px;max-width:1024px;\">"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mw.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
));

View File

@@ -52,7 +52,7 @@ class Xoh_href_wtr_fxt {
}
public Xoh_href_wtr_fxt Prep_xwiki_by_many(String raw) {wiki.Xwiki_mgr().Add_many(Bry_.new_u8(raw)); return this;} // need to add to wiki's xwiki_mgr for ttl_parse
public void Test_build(String raw, String expd) {
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, Bry_.new_u8(raw));
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.new_u8(raw));
href_wtr.Build_to_bfr(tmp_bfr, app, wiki.Domain_bry(), ttl);
Tfds.Eq(expd, tmp_bfr.Xto_str_and_clear());
}

View File

@@ -28,7 +28,7 @@ public class Xow_hzip_int_ {
public static void Save_bin_int_abrv(Bry_bfr bfr, int val_int) { // save int in binary little endian form; range from -2,080,766,977 to 2,147,483,648; 255^4 or 4,228,250,625
if (val_int == 0) {bfr.Add_byte(Byte_ascii.Null); return;}
long val = val_int;
if (val < 0) val = Int_.MaxValue + -val;
if (val < 0) val = Int_.Max_value + -val;
int count = 0;
while (val > 0) {
byte mod = (byte)(val % Base_255_int);
@@ -54,8 +54,8 @@ public class Xow_hzip_int_ {
mult *= Base_255_int;
}
}
if (rv > Int_.MaxValue) {
rv -= Int_.MaxValue;
if (rv > Int_.Max_value) {
rv -= Int_.Max_value;
rv *= -1;
}
count_ref.Val_(count);

View File

@@ -33,7 +33,7 @@ public class Xow_hzip_int__tst {
fxt.Test_srl( 16646655, 255, 255, 255, 0);
fxt.Test_srl( 16646656, 1, 1, 1, 1);
fxt.Test_srl( 16646657, 2, 1, 1, 1);
fxt.Test_srl(Int_.MaxValue, 127, 129, 130, 129);
fxt.Test_srl(Int_.Max_value, 127, 129, 130, 129);
fxt.Test_srl( -1, 128, 129, 130, 129);
fxt.Test_srl( -2, 129, 129, 130, 129);
}

View File

@@ -119,6 +119,7 @@ public class Xow_hzip_itm__anchor {
int href_bgn = Bry_finder.Find_fwd(src, Find_href_bry, pos, src_len); if (href_bgn == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.href_missing", bgn, pos);
href_bgn += Find_href_len;
int href_end = Bry_finder.Find_fwd(src, Byte_ascii.Quote, href_bgn, src_len); if (href_end == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.href_missing", bgn, href_bgn);
int bfr_bgn = bfr.Len();
bfr.Add_byte(Xow_hzip_dict.Escape).Add_byte(xtid);
bfr.Add_mid(src, href_bgn, href_end);
bfr.Add_byte(Xow_hzip_dict.Escape);
@@ -129,7 +130,11 @@ public class Xow_hzip_itm__anchor {
return a_rhs_bgn + Find_a_rhs_bgn_len;
}
case Xow_hzip_dict.Tid_lnke_brk_text_n: {
int a_lhs_end = Bry_finder.Find_fwd(src, Byte_ascii.Gt, href_end, src_len); if (a_lhs_end == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.a_lhs_end_missing", bgn, href_end);
int a_lhs_end = Bry_finder.Find_fwd(src, Byte_ascii.Gt, href_end, src_len); if (a_lhs_end == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.a_lhs_end_missing", bgn, href_end);
if (src[a_lhs_end + 1] != Byte_ascii.Brack_bgn) { // check if next char is [; DATE:2015-08-25
bfr.Delete_rng_to_end(bfr_bgn); // delete from start and exit;
return Xow_hzip_mgr.Unhandled;
}
int num_bgn = a_lhs_end + 2; // skip >[
int num_end = Bry_finder.Find_fwd(src, Byte_ascii.Brack_end, num_bgn, src_len); if (num_end == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.num_end_missing", bgn, href_end);
int num = Bry_.To_int_or(src, num_bgn, num_end, -1); if (num == -1) return hzip_mgr.Warn_by_pos_add_dflt("a.num_invalid", num_bgn, num_end);

View File

@@ -95,6 +95,11 @@ public class Xow_hzip_itm__anchor_tst {
fxt.Test_save(brys, "<a xtid='a_lnke_brk_n' class=\"external autonumber\" rel=\"nofollow\" href=\"http://a.org\">[123]</a>");
fxt.Test_load(brys, "<a rel=\"nofollow\" class=\"external autonumber\" href=\"http://a.org\">[123]</a>");
}
@Test public void Srl_lnke_brk_n__tidy() { // PURPOSE:handle reparenting of html elements by HTML tidy EX:<font color="red">[http://a.org]</font>; DATE:2015-08-25
String raw_bgn = "<a xtid='a_lnke_brk_n' class=\"external autonumber\" rel=\"nofollow\" href=\"http://a.org\"><font color=\"red\">[123]</font>";
byte[][] brys = Bry_.Ary(Bry_.new_u8(raw_bgn), Xow_hzip_dict.Bry_a_rhs);
fxt.Test_save(brys, raw_bgn + "</a>");
}
@Test public void Html_lnki_ttl() {
fxt.Test_html("[[A]]", "<a xtid='a_lnki_text_n' href=\"/wiki/A\" xowa_redlink='1'>A</a>");
}

View File

@@ -48,7 +48,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
Xop_ctx ctx = wiki.Ctx();
boolean old_para_enabled = ctx.Para().Enabled();
byte[] raw = Bry_.new_u8(m.Args_getAt(0).Val_to_str_or_empty());
boolean para_enabled = m.Args_count() < 2 ? false : Bool_.parse_(m.Args_getAt(1).Val_to_str_or_empty());
boolean para_enabled = m.Args_count() < 2 ? false : Bool_.parse(m.Args_getAt(1).Val_to_str_or_empty());
try {
wiki.Ctx().Para().Enabled_(para_enabled);
wiki.Parser().Parse_text_to_wdom(root, wiki.Ctx(), wiki.Ctx().Tkn_mkr(), raw, 0);
@@ -63,7 +63,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
private String Get_page(GfoMsg m) {
Xowe_wiki wiki = html_itm.Owner_tab().Wiki();
try {
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, m.Args_getAt(0).Val_to_bry());
Xoa_ttl ttl = Xoa_ttl.parse(wiki, m.Args_getAt(0).Val_to_bry());
Xoae_page page = wiki.Data_mgr().Get_page(ttl, false);
return String_.new_u8(page.Data_raw());
} catch (Exception e) {Err_.Noop(e); return null;}
@@ -77,7 +77,7 @@ public class Xoh_js_cbk implements GfoInvkAble {
}
private String Popups_get_html(GfoMsg m) {
try {
int popups_id = Int_.Xby_double_(Double_.cast_(m.Args_getAt(0).Val()));
int popups_id = Int_.Xby_double_(Double_.cast(m.Args_getAt(0).Val()));
byte[] href_bry = m.Args_getAt(1).Val_to_bry();
byte[] tooltip_bry = m.Args_getAt(2).Val_to_bry();
return html_itm.Owner_tab().Wiki().Html_mgr().Head_mgr().Popup_mgr().Show_init(popups_id, href_bry, tooltip_bry);
@@ -86,10 +86,10 @@ public class Xoh_js_cbk implements GfoInvkAble {
private String[] Get_title_meta(Xowe_wiki wiki, byte[] ttl_bry) {
synchronized (tmp_page) {
tmp_page.Clear();
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, ttl_bry);
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
wiki.Db_mgr().Load_mgr().Load_by_ttl(tmp_page, ttl.Ns(), ttl.Page_db());
}
return String_.Ary(tmp_page.Exists() ? "1" : "0", Int_.Xto_str(tmp_page.Id()), Int_.Xto_str(tmp_page.Ns_id()), String_.new_u8(tmp_page.Ttl_page_db()), Bool_.Xto_str_lower(tmp_page.Redirected()), tmp_page.Modified_on().XtoStr_fmt("yyyy-MM-dd HH:mm:ss"), Int_.Xto_str(tmp_page.Text_len()));
return String_.Ary(tmp_page.Exists() ? "1" : "0", Int_.Xto_str(tmp_page.Id()), Int_.Xto_str(tmp_page.Ns_id()), String_.new_u8(tmp_page.Ttl_page_db()), Bool_.To_str_lower(tmp_page.Redirected()), tmp_page.Modified_on().XtoStr_fmt("yyyy-MM-dd HH:mm:ss"), Int_.Xto_str(tmp_page.Text_len()));
} private static final Xowd_page_itm tmp_page = Xowd_page_itm.new_tmp();
private String[][] Get_titles_meta(GfoMsg m) {
Xowe_wiki wiki = html_itm.Owner_tab().Wiki();

View File

@@ -22,8 +22,8 @@ public class Xoh_js_cbk_tst {
@Before public void init() {fxt.Clear();} private Xoh_js_cbk_fxt fxt = new Xoh_js_cbk_fxt();
@Test public void Get_title() {
fxt.Fxt().Init_page_create("exists");
fxt.Test_get_title("exists", "1" , "0" , Int_.Xto_str(Int_.MinValue), "Exists", "false", "0001-01-01 00:00:00", "0");
fxt.Test_get_title("absent", "0", "-1", Int_.Xto_str(Int_.MinValue), null , "false", "0001-01-01 00:00:00", "0");
fxt.Test_get_title("exists", "1" , "0" , Int_.Xto_str(Int_.Min_value), "Exists", "false", "0001-01-01 00:00:00", "0");
fxt.Test_get_title("absent", "0", "-1", Int_.Xto_str(Int_.Min_value), null , "false", "0001-01-01 00:00:00", "0");
}
}
class Xoh_js_cbk_fxt {
@@ -35,7 +35,7 @@ class Xoh_js_cbk_fxt {
public void Test_get_title(String ttl, Object... expd) {
Xoae_app app = fxt.App();
Xowe_wiki wiki = fxt.Wiki();
Xoae_page page = Xoae_page.test_(wiki, Xoa_ttl.parse_(wiki, Bry_.new_a7("mock_page")));
Xoae_page page = Xoae_page.test_(wiki, Xoa_ttl.parse(wiki, Bry_.new_a7("mock_page")));
Xog_tab_itm tab = app.Gui_mgr().Browser_win().Active_tab();
tab.Page_(page);
Xoh_js_cbk exec = tab.Html_itm().Js_cbk();

View File

@@ -16,9 +16,9 @@ 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.html.js; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
import org.junit.*; import gplx.xowa.xtns.wdatas.*;
import org.junit.*; import gplx.core.json.*; import gplx.xowa.xtns.wdatas.*;
public class Xoh_js_cbk_wdata_labels_tst {
@Before public void init() {fxt.Init();} Wdata_wiki_mgr_fxt fxt = new Wdata_wiki_mgr_fxt();
@Before public void init() {fxt.Init();} private final Wdata_wiki_mgr_fxt fxt = new Wdata_wiki_mgr_fxt();
@Test public void Basic() {
fxt.Init_pages_add(fxt.Wdoc_bldr("q1").Add_label("en", "en_q1").Xto_wdoc());
fxt.Init_pages_add(fxt.Wdoc_bldr("q2").Add_label("en", "en_q2").Xto_wdoc());
@@ -45,9 +45,9 @@ public class Xoh_js_cbk_wdata_labels_tst {
Tst_wikidata_label_get(String_.Ary("en", "q1"), String_.Ary("\ta"));
}
private Wdata_doc doc_(String qid, String src) {
gplx.core.json.Json_doc doc = gplx.core.json.Json_doc.new_apos_(src);
Json_doc jdoc = fxt.Make_json(src);
Xoae_app app = Xoa_app_fxt.app_();
Wdata_doc rv = new Wdata_doc(Bry_.new_a7(qid), app.Wiki_mgr().Wdata_mgr(), doc);
Wdata_doc rv = new Wdata_doc(Bry_.new_a7(qid), app.Wiki_mgr().Wdata_mgr(), jdoc);
return rv;
}
private void Tst_wikidata_label_get(String[] args, String[] expd) {

View File

@@ -25,7 +25,7 @@ public class Xoh_file_wtr_audio_video_tst {
( " <div id=\"xowa_media_div\">"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///mem/wiki/repo/trg/orig/4/f/A.oga\" xowa_title=\"A.oga\" class=\"xowa_anchor_button\" style=\"width:218px;max-width:1024px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " </div>"
@@ -46,7 +46,7 @@ public class Xoh_file_wtr_audio_video_tst {
, " </div>"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///mem/wiki/repo/trg/orig/4/2/A.ogg\" xowa_title=\"A.ogg\" class=\"xowa_anchor_button\" style=\"width:218px;max-width:220px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " </div>"
@@ -61,19 +61,19 @@ public class Xoh_file_wtr_audio_video_tst {
, " <div id=\"xowa_media_div\">"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///mem/wiki/repo/trg/orig/4/f/A.oga\" xowa_title=\"A.oga\" class=\"xowa_anchor_button\" style=\"width:218px;max-width:1024px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " <div>"
, " <a href=\"/wiki/File:A.oga\" class=\"image\" title=\"About this file\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/info.png\" width=\"22\" height=\"22\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/info.png\" width=\"22\" height=\"22\" />"
, " </a>"
, " </div>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.oga\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a"
@@ -99,7 +99,7 @@ public class Xoh_file_wtr_audio_video_tst {
( " <div id=\"xowa_media_div\">"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///mem/wiki/repo/trg/orig/4/f/A.oga\" xowa_title=\"A.oga\" class=\"xowa_anchor_button\" style=\"width:218px;max-width:1024px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " </div>"
@@ -123,7 +123,7 @@ public class Xoh_file_wtr_audio_video_tst {
, " </div>"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///mem/wiki/repo/trg/orig/d/0/A.ogv\" xowa_title=\"A.ogv\" class=\"xowa_anchor_button\" style=\"width:398px;max-width:400px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " </div>"
@@ -139,19 +139,19 @@ public class Xoh_file_wtr_audio_video_tst {
, " <div id=\"xowa_media_div\">"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///\" xowa_title=\"A.ogg\" class=\"xowa_anchor_button\" style=\"width:398px;max-width:1024px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " <div>"
, " <a href=\"/wiki/File:A.ogg\" class=\"image\" title=\"About this file\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/info.png\" width=\"22\" height=\"22\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/info.png\" width=\"22\" height=\"22\" />"
, " </a>"
, " </div>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.ogg\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a"
@@ -177,14 +177,14 @@ public class Xoh_file_wtr_audio_video_tst {
, " </div>"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///mem/wiki/repo/trg/orig/d/0/A.ogv\" xowa_title=\"A.ogv\" class=\"xowa_anchor_button\" style=\"width:398px;max-width:400px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.ogv\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a"
@@ -211,14 +211,14 @@ public class Xoh_file_wtr_audio_video_tst {
, " </div>"
, " <div>"
, " <a id=\"xowa_file_play_0\" href=\"file:///mem/wiki/repo/trg/orig/3/4/A.webm\" xowa_title=\"A.webm\" class=\"xowa_anchor_button\" style=\"width:398px;max-width:400px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, " </div>"
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.webm\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a"

View File

@@ -68,7 +68,7 @@ public class Xoh_file_wtr_basic_tst {
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " b"
@@ -88,7 +88,7 @@ public class Xoh_file_wtr_basic_tst {
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " b"
@@ -108,7 +108,7 @@ public class Xoh_file_wtr_basic_tst {
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " b"
@@ -147,7 +147,7 @@ public class Xoh_file_wtr_basic_tst {
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " "
@@ -172,7 +172,7 @@ public class Xoh_file_wtr_basic_tst {
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " a" // no pre

View File

@@ -28,7 +28,7 @@ public class Xoh_file_wtr_media_tst {
, " <div class=\"thumbcaption\">"
, " <div class=\"magnify\">"
, " <a href=\"/wiki/File:A.png\" class=\"internal\" title=\"Enlarge\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/magnify-clip.png\" width=\"15\" height=\"11\" alt=\"\" />"
, " </a>"
, " </div>"
, " b <a href=\"file:///mem/wiki/repo/trg/orig/4/2/A.ogg\" xowa_title=\"A.ogg\">"

View File

@@ -35,7 +35,7 @@ public class Xow_popup_itm implements Cancelable {
public boolean Mode_all() {return mode == Mode_tid_all;}
public Xow_popup_itm Mode_all_() {
mode = Mode_tid_all;
words_needed = Int_.MaxValue;
words_needed = Int_.Max_value;
return this;
}
public String Popup_id() {return popup_id;} private String popup_id;

View File

@@ -121,7 +121,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
if (!Xoa_url_.Tid_is_pagelike(tmp_url.Tid())) return Bry_.Empty; // NOTE: do not get popups for "file:///"; DATE:2015-04-05
Xowe_wiki popup_wiki = app.Wiki_mgr().Get_by_key_or_null(tmp_url.Wiki_bry());
popup_wiki.Init_assert();
Xoa_ttl popup_ttl = Xoa_ttl.parse_(popup_wiki, tmp_url.To_bry_page_w_anch());
Xoa_ttl popup_ttl = Xoa_ttl.parse(popup_wiki, tmp_url.To_bry_page_w_anch());
switch (popup_ttl.Ns().Id()) {
case Xow_ns_.Id_media:
case Xow_ns_.Id_file:
@@ -276,7 +276,7 @@ class Load_popup_wkr implements Gfo_thread_wkr {
if (!Xoa_url_.Tid_is_pagelike(tmp_url.Tid())) return; // NOTE: do not get popups for "file:///"; DATE:2015-04-05
Xowe_wiki popup_wiki = app.Wiki_mgr().Get_by_key_or_null(tmp_url.Wiki_bry());
popup_wiki.Init_assert();
Xoa_ttl popup_ttl = Xoa_ttl.parse_(popup_wiki, tmp_url.To_bry_page_w_anch());
Xoa_ttl popup_ttl = Xoa_ttl.parse(popup_wiki, tmp_url.To_bry_page_w_anch());
switch (popup_ttl.Ns().Id()) {
case Xow_ns_.Id_media:
case Xow_ns_.Id_file:

View File

@@ -33,7 +33,7 @@ public class Xow_popup_parser {
public Xop_keeplist_wiki Tmpl_keeplist() {return tmpl_keeplist;} private Xop_keeplist_wiki tmpl_keeplist; // private byte[] tmpl_keeplist_bry = Bry_.Empty;
public Xop_ctx Wtxt_ctx() {return wtxt_ctx;} private Xop_ctx wtxt_ctx;
public void Tmpl_tkn_max_(int v) {
if (v < 0) v = Int_.MaxValue; // allow -1 as shortcut to deactivate
if (v < 0) v = Int_.Max_value; // allow -1 as shortcut to deactivate
tmpl_ctx.Tmpl_tkn_max_(v);
wtxt_ctx.Tmpl_tkn_max_(v);
}

View File

@@ -41,7 +41,7 @@ public class Xow_popup_parser_data {
words_needed_val = words_needed_max = popup_itm.Words_needed();
switch (popup_itm.Mode()) {
case Xow_popup_itm.Mode_tid_all:
tmpl_max = Int_.MaxValue;
tmpl_max = Int_.Max_value;
break;
case Xow_popup_itm.Mode_tid_init:
case Xow_popup_itm.Mode_tid_more:

View File

@@ -497,7 +497,7 @@ class Xop_popup_parser_fxt {
}
public void Test_parse(String raw, String expd) {Test_parse(raw, "Test_1", expd);}
public void Test_parse(String raw, String ttl, String expd) {
Xoae_page page = Xoae_page.create_(wiki, Xoa_ttl.parse_(wiki, Bry_.new_a7(ttl)));
Xoae_page page = Xoae_page.create_(wiki, Xoa_ttl.parse(wiki, Bry_.new_a7(ttl)));
page.Data_raw_(Bry_.new_u8(raw));
Xow_popup_itm itm = new Xow_popup_itm(1, Bry_.new_u8(raw), Bry_.Empty, word_min);
itm.Init(wiki.Domain_bry(), page.Ttl());

View File

@@ -58,7 +58,7 @@ public class Xoh_ns_file_page_mgr_tst {
, "<div class=\"fullImageLink\" id=\"file\">"
, " <div>"
, " <a href=\"file:///mem/file/orig.oga\" xowa_title=\"Test.oga\" class=\"xowa_anchor_button\" style=\"width:300px;max-width:300px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, "</div>"
@@ -77,7 +77,7 @@ public class Xoh_ns_file_page_mgr_tst {
, " </div>"
, " <div>"
, " <a href=\"file:///mem/file/orig.ogv\" xowa_title=\"Test.ogv\" class=\"xowa_anchor_button\" style=\"width:300px;max-width:300px;\">"
, " <img src=\"file:///mem/xowa/user/test_user/app/img/file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " <img src=\"file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png\" width=\"22\" height=\"22\" alt=\"Play sound\" />"
, " </a>"
, " </div>"
, "</div>"
@@ -103,14 +103,14 @@ class Xoh_ns_file_page_mgr_fxt {
}
public void tst(String expd) {
byte[] ttl_bry = Bry_.new_u8(ttl_str);
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, ttl_bry);
Xoa_ttl ttl = Xoa_ttl.parse(wiki, ttl_bry);
file.Init_at_gallery_end(html_w, html_h, Io_url_.mem_fil_(html_src), Io_url_.mem_fil_(html_orig_src));
// file.Orig_ttl_and_redirect_(ttl_bry, Bry_.Empty);
file.Init_at_orig(Byte_.Zero, wiki.Domain_bry(), ttl_bry, Xof_ext_.new_by_ttl_(ttl_bry), 0, 0, Bry_.Empty);
file.Init_at_hdoc(0, Xof_html_elem.Tid_img);
wkr.Bld_html(wiki, bfr, file, ttl, opt, Bry_.To_a7_bry(html_file_size, 0), play_btn_icon); // TEST: must pass in elem_val b/c test only uses 2nd Bld_html while app uses 1st
Tfds.Eq_str_lines(expd, bfr.Xto_str_and_clear());
} static final byte[] play_btn_icon = Bry_.new_a7("file:///mem/xowa/user/test_user/app/img/file/play.png");
} static final byte[] play_btn_icon = Bry_.new_a7("file:///mem/xowa/bin/any/xowa/file/mediawiki.file/play.png");
public static final String Hdr = String_.Concat_lines_nl_skip_last
( "<ul id=\"filetoc\">"
, " <li>"

View File

@@ -45,7 +45,7 @@ public class Xoa_available_wikis_mgr implements GfoInvkAble {
else if (ctx.Match(k, Invk_itms_refresh)) Itms_reset();
else if (ctx.Match(k, Invk_visible)) return Yn.Xto_str(visible);
else if (ctx.Match(k, Invk_visible_)) visible = m.ReadYn("v");
else if (ctx.Match(k, Invk_visible_toggle)) {visible = !visible; app.Gui_mgr().Browser_win().Active_html_box().Html_js_eval_proc_as_str("xowa-portal-wikis-visible-toggle", Bool_.Xto_str_lower(visible));}
else if (ctx.Match(k, Invk_visible_toggle)) {visible = !visible; app.Gui_mgr().Browser_win().Active_html_box().Html_js_eval_proc_as_str("xowa-portal-wikis-visible-toggle", Bool_.To_str_lower(visible));}
else if (ctx.Match(k, Invk_itms_as_html_fmtr_)) itms_as_html_fmtr.Fmt_(m.ReadBry("v"));
else return GfoInvkAble_.Rv_unhandled;
return this;

View File

@@ -48,7 +48,7 @@ class Xoh_page_body_cls_fxt {
tmp_bfr = Bry_bfr.reset_(255);
wiki.Ns_mgr().Add_new(Wdata_wiki_mgr.Ns_property, Wdata_wiki_mgr.Ns_property_name);
}
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, Bry_.new_u8(ttl_str));
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.new_u8(ttl_str));
Tfds.Eq(expd, String_.new_u8(Xoh_page_body_cls.Calc(tmp_bfr, ttl, page_tid)));
}
}

View File

@@ -43,7 +43,7 @@ class Xoh_subpages_bldr_fxt {
wiki.Ns_mgr().Ids_get_or_null(Xow_ns_.Id_help).Subpages_enabled_(true);
}
public void Test_bld(String ttl_str, String expd) {
byte[] actl = subpages_bldr.Bld(wiki.Ns_mgr(), Xoa_ttl.parse_(wiki, Bry_.new_u8(ttl_str)));
byte[] actl = subpages_bldr.Bld(wiki.Ns_mgr(), Xoa_ttl.parse(wiki, Bry_.new_u8(ttl_str)));
Tfds.Eq_str_lines(expd, String_.new_u8(actl));
}
}

View File

@@ -40,7 +40,7 @@ class Xowh_portal_mgr_fxt {
}
} private Xoae_app app; Xowe_wiki wiki;
public void Test_div_ns_bry(String ttl, String expd) {
Tfds.Eq(expd, String_.new_a7(wiki.Html_mgr().Portal_mgr().Div_ns_bry(wiki.Utl__bfr_mkr(), Xoa_ttl.parse_(wiki, Bry_.new_a7(ttl)), wiki.Ns_mgr())));
Tfds.Eq(expd, String_.new_a7(wiki.Html_mgr().Portal_mgr().Div_ns_bry(wiki.Utl__bfr_mkr(), Xoa_ttl.parse(wiki, Bry_.new_a7(ttl)), wiki.Ns_mgr())));
}
public void Test_div_personal_bry(String expd) {
Tfds.Eq(expd, String_.new_a7(wiki.Html_mgr().Portal_mgr().Div_personal_bry()));

View File

@@ -18,10 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.html.wtrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
public class Xoh_img_path {
public static final byte[]
Img_cancel = Bry_.new_a7("window/menu/file/cancel.png") // 32,32
, Img_search = Bry_.new_a7("window/chrome/search_exec.png")
, Img_option = Bry_.new_a7("window/menu/tools/options.png")
, Img_go_bwd = Bry_.new_a7("window/paging/go_bwd.png")
, Img_go_fwd = Bry_.new_a7("window/paging/go_fwd.png")
Img_cancel = Bry_.new_a7("app.general/cancel.png") // 32,32
, Img_go_bwd = Bry_.new_a7("app.general/go_bwd.png")
, Img_go_fwd = Bry_.new_a7("app.general/go_fwd.png")
, Img_search = Bry_.new_a7("app.window/search_exec.png")
, Img_option = Bry_.new_a7("app.menu/tools/options.png")
;
}

View File

@@ -24,7 +24,7 @@ public class Xoh_lnki_bldr {
private byte[] img_rel_path; private int img_w, img_h; private boolean img_pos_is_left;
public Xoh_lnki_bldr(Xoa_app app, Xoh_href_wtr href_wtr) {
this.app = app; this.href_wtr = href_wtr;
this.img_root_dir = app.Fsys_mgr().Root_dir().GenSubDir_nest("user", "anonymous", "app", "img").To_http_file_bry();
this.img_root_dir = app.Fsys_mgr().Bin_xowa_file_dir().To_http_file_bry();
}
public Xoh_lnki_bldr Clear() {
href = title = id = caption = null;

Some files were not shown because too many files have changed in this diff Show More