1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.7.1.1'

This commit is contained in:
gnosygnu
2016-07-03 22:41:56 -04:00
parent 1a4ca00c0b
commit 36584a0cc2
220 changed files with 4762 additions and 2627 deletions

View File

@@ -40,7 +40,7 @@ public class Xowv_wiki implements Xow_wiki, Xow_ttl_parser, Gfo_invk {
this.domain_tid = domain_itm.Domain_type_id();
this.domain_abrv = Xow_abrv_wm_.To_abrv(Xow_domain_itm_.parse(domain_bry));
this.ns_mgr = Xow_ns_mgr_.default_(app.Utl_case_mgr());
this.lang = app.Lang_mgr().Get_by(domain_itm.Lang_actl_key());
this.lang = app.Lang_mgr().Get_by_or_en(domain_itm.Lang_actl_key()); // NOTE: must not be null, or causes null ref exception on redlinks in drd; DATE:2016-06-28
this.html__hdump_mgr = new Xow_hdump_mgr(this);
this.special_mgr = new Xosp_special_mgr(this);
this.fsys_mgr = new Xow_fsys_mgr(wiki_root_dir, app.Fsys_mgr().File_dir().GenSubDir(domain_str));

View File

@@ -153,10 +153,3 @@ class Xoctg_fmtr_all {
, Div_id_file = Bry_.new_a7("mw-category-media")
;
}
interface Xoctg_fmtr_itm extends gplx.core.brys.Bfr_arg {
int Grp_end_idx();
boolean Grp_end_at_col();
int Col_idx(); void Col_idx_(int col_idx, int col_bgn);
void Init_from_all(Xowe_wiki wiki, Xol_lang_itm lang, Xoh_wtr_ctx hctx, Xoctg_view_ctg ctg, Xoctg_fmtr_all mgr, Xoctg_view_grp itms_list, int itms_list_len);
void Init_from_grp(byte[] grp_ttl, int i);
}

View File

@@ -16,109 +16,11 @@ 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.wikis.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
import gplx.xowa.users.history.*;
abstract class Xoctg_fmtr_itm_base implements gplx.core.brys.Bfr_arg, Xoctg_fmtr_itm {
private Xou_history_mgr history_mgr; private Xoh_wtr_ctx hctx;
protected Xowe_wiki wiki; Xol_lang_itm lang; Xoctg_view_ctg ctg; protected int len; protected Xoh_href_parser href_parser; protected Bry_fmtr html_itm, html_itm_missing; protected Xoctg_view_grp list; protected Xow_msg_mgr msg_mgr;
public void Init_from_all(Xowe_wiki wiki, Xol_lang_itm lang, Xoh_wtr_ctx hctx, Xoctg_view_ctg ctg, Xoctg_fmtr_all mgr, Xoctg_view_grp itms_list, int itms_list_len) {
this.wiki = wiki; this.lang = lang; this.hctx = hctx; this.ctg = ctg; this.list = itms_list; this.len = itms_list_len; this.msg_mgr = wiki.Msg_mgr();
href_parser = wiki.Appe().Html__href_parser();
html_itm = mgr.Html_itm();
html_itm_missing = mgr.Html_itm_missing();
history_mgr = wiki.Appe().Usere().History_mgr();
}
public void Init_from_grp(byte[] ttl_char_0, int col_bgn) {this.ttl_char_0 = ttl_char_0; this.col_bgn = col_bgn;} private byte[] ttl_char_0; int col_bgn; int col_end;
public int Col_idx() {return col_idx;}
public void Col_idx_(int col_idx, int col_bgn) {
this.col_idx = col_idx;
this.col_bgn = col_bgn;
col_end = col_bgn + Xoctg_fmtr_grp.Calc_col_max(Xoctg_html_mgr.Cols_max, len, col_idx);
} int col_idx;
public int Grp_end_idx() {return grp_end_idx;} private int grp_end_idx;
public boolean Grp_end_at_col() {return grp_end_at_col;} private boolean grp_end_at_col;
public void Bfr_arg__add(Bry_bfr bfr) {
for (int i = col_bgn; i < len; i++) {
if (i == col_end) {
grp_end_idx = i;
grp_end_at_col = true;
return;
}
Xoctg_view_itm itm = list.Itms()[i];
Xoa_ttl ttl = itm.Ttl();
byte[] itm_sortkey = itm.Sort_key();
byte[] ttl_bry = ttl.Page_txt();
if (!Bry_.Has_at_bgn(itm_sortkey, ttl_char_0, 0, itm_sortkey.length)) {
grp_end_idx = i;
grp_end_at_col = i == col_end;
return;
}
Bld_html(bfr, wiki, hctx, itm, ttl, ttl_bry, href_parser, html_itm);
}
grp_end_idx = len;
grp_end_at_col = true;
}
@gplx.Virtual public void Bld_html(Bry_bfr bfr, Xowe_wiki wiki, Xoh_wtr_ctx hctx, Xoctg_view_itm itm, Xoa_ttl ttl, byte[] ttl_page, Xoh_href_parser href_parser, Bry_fmtr html_itm) {
byte[] itm_href = wiki.App().Html__href_wtr().Build_to_bry(wiki, ttl);
byte[] itm_full_ttl = gplx.langs.htmls.Gfh_utl.Escape_html_as_bry(ttl.Full_txt_w_ttl_case());// NOTE: ttl.Full_txt() to get full ns; EX: Template:A instead of just "A"
byte[] itm_atr_cls = hctx.Mode_is_hdump() ? Bry_.Empty : 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
Bry_fmtr fmtr = itm.Missing() ? html_itm_missing : html_itm;
fmtr.Bld_bfr_many(bfr, itm_href, itm_full_ttl, itm_full_ttl, itm.Page_id(), itm_atr_cls);
}
}
class Xoctg_fmtr_itm_page extends Xoctg_fmtr_itm_base {
public static final Xoctg_fmtr_itm_page Instance = new Xoctg_fmtr_itm_page(); Xoctg_fmtr_itm_page() {}
}
class Xoctg_fmtr_itm_file extends Xoctg_fmtr_itm_base {
// public void Bfr_arg__add(Bry_bfr bfr) {
// html_itm = wiki.Html_mgr().Gallery_xtn_mgr().Html_gallery_itm_img();
// for (int i = list.Bgn(); i < len; i++) {
// Xoctg_view_itm itm = list.Itms()[i];
// Xoa_ttl ttl = itm.Ttl();
// byte[] ttl_page = ttl.Page_txt();
// byte[] itm_href = href_parser.Build_to_bry(ttl, wiki);
// html_itm.Bld_bfr_many(bfr
// , 155 // "itm_box_width"
// , 155 // "itm_div_width"
// , 15 // "itm_margin"
// , -1 // "img_id"
// , ttl_page // "img_ttl"
// , itm_href // "img_href"
// , Bry_.Empty // "html_src"
// , -1 // "img_width"
// , -1 // "img_height"
// , ttl_page // "itm_caption"
// );
// }
// }
public static final Xoctg_fmtr_itm_file Instance = new Xoctg_fmtr_itm_file(); Xoctg_fmtr_itm_file() {}
}
class Xoctg_fmtr_itm_subc extends Xoctg_fmtr_itm_base {
@Override public void Bld_html(Bry_bfr bfr, Xowe_wiki wiki, Xoh_wtr_ctx hctx, Xoctg_view_itm itm, Xoa_ttl ttl, byte[] ttl_page, Xoh_href_parser href_parser, Bry_fmtr html_itm) {
byte[] itm_href = wiki.App().Html__href_wtr().Build_to_bry(wiki, ttl);
int sub_ctgs = 0; // itm.Subs_ctgs();
int sub_pages = 0; // itm.Subs_pages();
int sub_files = 0; // itm.Subs_files();
byte[] contains_title = msg_mgr.Val_by_id_args(Xol_msg_itm_.Id_ctgtree_subc_counts, sub_ctgs, sub_pages, sub_files);
byte[] contains_text = Bld_contains_text(sub_ctgs, sub_pages, sub_files);
html_itm.Bld_bfr_many(bfr, ttl.Page_db(), ttl_page, itm_href, ttl_page, contains_title, contains_text);
}
byte[] Bld_contains_text(int sub_ctgs, int sub_pages, int sub_files) {
if (sub_ctgs == 0 && sub_pages == 0 && sub_files == 0) return Bry_.Empty;
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b128();
bfr.Add_byte(Byte_ascii.Paren_bgn);
Bld_contains_text_itm(bfr, Xol_msg_itm_.Id_ctgtree_subc_counts_ctg, sub_ctgs);
Bld_contains_text_itm(bfr, Xol_msg_itm_.Id_ctgtree_subc_counts_page, sub_pages);
Bld_contains_text_itm(bfr, Xol_msg_itm_.Id_ctgtree_subc_counts_file, sub_files);
bfr.Add_byte(Byte_ascii.Paren_end);
return bfr.To_bry_and_rls();
}
private void Bld_contains_text_itm(Bry_bfr bfr, int msg_id, int val) {
if (val == 0) return;
if (bfr.Len() > 1) bfr.Add(Bld_contains_text_itm_dlm); // NOTE: 1 b/c Paren_bgn is always added
bfr.Add(msg_mgr.Val_by_id_args(msg_id, val));
} static final byte[] Bld_contains_text_itm_dlm = Bry_.new_a7(", ");
public static final Xoctg_fmtr_itm_subc Instance = new Xoctg_fmtr_itm_subc(); Xoctg_fmtr_itm_subc() {}
import gplx.xowa.langs.*; import gplx.xowa.htmls.core.htmls.*;
interface Xoctg_fmtr_itm extends gplx.core.brys.Bfr_arg {
int Grp_end_idx();
boolean Grp_end_at_col();
int Col_idx(); void Col_idx_(int col_idx, int col_bgn);
void Init_from_all(Xowe_wiki wiki, Xol_lang_itm lang, Xoh_wtr_ctx hctx, Xoctg_view_ctg ctg, Xoctg_fmtr_all mgr, Xoctg_view_grp itms_list, int itms_list_len);
void Init_from_grp(byte[] grp_ttl, int i);
}

View File

@@ -0,0 +1,70 @@
/*
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.wikis.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*; import gplx.xowa.htmls.core.htmls.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
import gplx.xowa.users.history.*;
abstract class Xoctg_fmtr_itm_base implements gplx.core.brys.Bfr_arg, Xoctg_fmtr_itm {
private Xou_history_mgr history_mgr; private Xoh_wtr_ctx hctx;
protected Xowe_wiki wiki; Xol_lang_itm lang; Xoctg_view_ctg ctg; protected int len; protected Xoh_href_parser href_parser; protected Bry_fmtr html_itm, html_itm_missing; protected Xoctg_view_grp list; protected Xow_msg_mgr msg_mgr;
public void Init_from_all(Xowe_wiki wiki, Xol_lang_itm lang, Xoh_wtr_ctx hctx, Xoctg_view_ctg ctg, Xoctg_fmtr_all mgr, Xoctg_view_grp itms_list, int itms_list_len) {
this.wiki = wiki; this.lang = lang; this.hctx = hctx; this.ctg = ctg; this.list = itms_list; this.len = itms_list_len; this.msg_mgr = wiki.Msg_mgr();
href_parser = wiki.Appe().Html__href_parser();
html_itm = mgr.Html_itm();
html_itm_missing = mgr.Html_itm_missing();
history_mgr = wiki.Appe().Usere().History_mgr();
}
public void Init_from_grp(byte[] ttl_char_0, int col_bgn) {this.ttl_char_0 = ttl_char_0; this.col_bgn = col_bgn;} private byte[] ttl_char_0; int col_bgn; int col_end;
public int Col_idx() {return col_idx;}
public void Col_idx_(int col_idx, int col_bgn) {
this.col_idx = col_idx;
this.col_bgn = col_bgn;
col_end = col_bgn + Xoctg_fmtr_grp.Calc_col_max(Xoctg_html_mgr.Cols_max, len, col_idx);
} int col_idx;
public int Grp_end_idx() {return grp_end_idx;} private int grp_end_idx;
public boolean Grp_end_at_col() {return grp_end_at_col;} private boolean grp_end_at_col;
public void Bfr_arg__add(Bry_bfr bfr) {
for (int i = col_bgn; i < len; i++) {
if (i == col_end) {
grp_end_idx = i;
grp_end_at_col = true;
return;
}
Xoctg_view_itm itm = list.Itms()[i];
Xoa_ttl ttl = itm.Ttl();
byte[] itm_sortkey = itm.Sort_key();
byte[] ttl_bry = ttl.Page_txt();
if (!Bry_.Has_at_bgn(itm_sortkey, ttl_char_0, 0, itm_sortkey.length)) {
grp_end_idx = i;
grp_end_at_col = i == col_end;
return;
}
Bld_html(bfr, wiki, hctx, itm, ttl, ttl_bry, href_parser, html_itm);
}
grp_end_idx = len;
grp_end_at_col = true;
}
@gplx.Virtual public void Bld_html(Bry_bfr bfr, Xowe_wiki wiki, Xoh_wtr_ctx hctx, Xoctg_view_itm itm, Xoa_ttl ttl, byte[] ttl_page, Xoh_href_parser href_parser, Bry_fmtr html_itm) {
byte[] itm_href = wiki.App().Html__href_wtr().Build_to_bry(wiki, ttl);
byte[] itm_full_ttl = gplx.langs.htmls.Gfh_utl.Escape_html_as_bry(ttl.Full_txt_w_ttl_case());// NOTE: ttl.Full_txt() to get full ns; EX: Template:A instead of just "A"
byte[] itm_atr_cls = hctx.Mode_is_hdump() ? Bry_.Empty : 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
Bry_fmtr fmtr = itm.Missing() ? html_itm_missing : html_itm;
fmtr.Bld_bfr_many(bfr, itm_href, itm_full_ttl, itm_full_ttl, itm.Page_id(), itm_atr_cls);
}
}

View File

@@ -0,0 +1,45 @@
/*
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.wikis.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
class Xoctg_fmtr_itm_page extends Xoctg_fmtr_itm_base {
public static final Xoctg_fmtr_itm_page Instance = new Xoctg_fmtr_itm_page(); Xoctg_fmtr_itm_page() {}
}
class Xoctg_fmtr_itm_file extends Xoctg_fmtr_itm_base {
// public void Bfr_arg__add(Bry_bfr bfr) {
// html_itm = wiki.Html_mgr().Gallery_xtn_mgr().Html_gallery_itm_img();
// for (int i = list.Bgn(); i < len; i++) {
// Xoctg_view_itm itm = list.Itms()[i];
// Xoa_ttl ttl = itm.Ttl();
// byte[] ttl_page = ttl.Page_txt();
// byte[] itm_href = href_parser.Build_to_bry(ttl, wiki);
// html_itm.Bld_bfr_many(bfr
// , 155 // "itm_box_width"
// , 155 // "itm_div_width"
// , 15 // "itm_margin"
// , -1 // "img_id"
// , ttl_page // "img_ttl"
// , itm_href // "img_href"
// , Bry_.Empty // "html_src"
// , -1 // "img_width"
// , -1 // "img_height"
// , ttl_page // "itm_caption"
// );
// }
// }
public static final Xoctg_fmtr_itm_file Instance = new Xoctg_fmtr_itm_file(); Xoctg_fmtr_itm_file() {}
}

View File

@@ -0,0 +1,48 @@
/*
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.wikis.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.brys.fmtrs.*;
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.hrefs.*;
import gplx.xowa.langs.msgs.*;
class Xoctg_fmtr_itm_subc extends Xoctg_fmtr_itm_base {
@Override public void Bld_html(Bry_bfr bfr, Xowe_wiki wiki, Xoh_wtr_ctx hctx, Xoctg_view_itm itm, Xoa_ttl ttl, byte[] ttl_page, Xoh_href_parser href_parser, Bry_fmtr html_itm) {
byte[] itm_href = wiki.App().Html__href_wtr().Build_to_bry(wiki, ttl);
int sub_ctgs = 0; // itm.Subs_ctgs();
int sub_pages = 0; // itm.Subs_pages();
int sub_files = 0; // itm.Subs_files();
byte[] contains_title = msg_mgr.Val_by_id_args(Xol_msg_itm_.Id_ctgtree_subc_counts, sub_ctgs, sub_pages, sub_files);
byte[] contains_text = Bld_contains_text(sub_ctgs, sub_pages, sub_files);
html_itm.Bld_bfr_many(bfr, ttl.Page_db(), ttl_page, itm_href, ttl_page, contains_title, contains_text);
}
byte[] Bld_contains_text(int sub_ctgs, int sub_pages, int sub_files) {
if (sub_ctgs == 0 && sub_pages == 0 && sub_files == 0) return Bry_.Empty;
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b128();
bfr.Add_byte(Byte_ascii.Paren_bgn);
Bld_contains_text_itm(bfr, Xol_msg_itm_.Id_ctgtree_subc_counts_ctg, sub_ctgs);
Bld_contains_text_itm(bfr, Xol_msg_itm_.Id_ctgtree_subc_counts_page, sub_pages);
Bld_contains_text_itm(bfr, Xol_msg_itm_.Id_ctgtree_subc_counts_file, sub_files);
bfr.Add_byte(Byte_ascii.Paren_end);
return bfr.To_bry_and_rls();
}
private void Bld_contains_text_itm(Bry_bfr bfr, int msg_id, int val) {
if (val == 0) return;
if (bfr.Len() > 1) bfr.Add(Bld_contains_text_itm_dlm); // NOTE: 1 b/c Paren_bgn is always added
bfr.Add(msg_mgr.Val_by_id_args(msg_id, val));
} static final byte[] Bld_contains_text_itm_dlm = Bry_.new_a7(", ");
public static final Xoctg_fmtr_itm_subc Instance = new Xoctg_fmtr_itm_subc(); Xoctg_fmtr_itm_subc() {}
}

View File

@@ -0,0 +1,36 @@
/*
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.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
import gplx.core.criterias.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
class Xowd_page_tbl__id extends Xowd_page_tbl__in_wkr__base {
private List_adp list; // list is original list of ids which may have dupes; needed to fill statement (which takes range of bgn - end); DATE:2013-12-08
private Ordered_hash hash; // hash is unique list of ids; needed for fetch from rdr (which indexes by id)
public void Init(List_adp list, Ordered_hash hash) {this.list = list; this.hash = hash; this.Fill_idx_fields_only_(true);}
@Override protected boolean Show_progress() {return true;}
@Override protected Criteria In_filter(Object[] part_ary) {
return Db_crt_.New_in(this.In_fld_name(), part_ary);
}
@Override protected void Fill_stmt(Db_stmt stmt, int bgn, int end) {
for (int i = bgn; i < end; i++) {
Xowd_page_itm page = (Xowd_page_itm)list.Get_at(i);
stmt.Val_int(page.Id());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Id_val());}
}

View File

@@ -0,0 +1,52 @@
/*
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.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
import gplx.core.criterias.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
abstract class Xowd_page_tbl__in_wkr__base extends Db_in_wkr__base {
protected Xowd_page_tbl tbl; private String tbl_name, fld_in_name;
public String Tbl_name() {return tbl_name;}
public void Ctor(Xowd_page_tbl tbl, String tbl_name, String fld_in_name) {this.tbl = tbl; this.tbl_name = tbl_name; this.fld_in_name = fld_in_name;}
public String In_fld_name() {return fld_in_name;}
protected abstract Criteria In_filter(Object[] part_ary);
public abstract Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page);
public boolean Fill_idx_fields_only() {return fill_idx_fields_only;} public void Fill_idx_fields_only_(boolean v) {fill_idx_fields_only = v;} private boolean fill_idx_fields_only;
@Override protected Db_qry Make_qry(int bgn, int end) {
Object[] part_ary = In_ary(end - bgn);
return Db_qry_.select_cols_
( this.Tbl_name()
, In_filter(part_ary)
, fill_idx_fields_only ? tbl.Flds_select_idx() : tbl.Flds_select_all()
)
;
}
@Override protected void Read_data(Cancelable cancelable, Db_rdr rdr) {
Xowd_page_itm temp = new Xowd_page_itm();
while (rdr.Move_next()) {
if (cancelable.Canceled()) return;
if (fill_idx_fields_only)
tbl.Read_page__idx(temp, rdr);
else
tbl.Read_page__all(temp, rdr);
Xowd_page_itm page = Read_data_to_page(temp);
if (page == null) continue; // page not found
temp.Exists_(true);
page.Copy(temp);
}
}
}

View File

@@ -1,121 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
import gplx.core.criterias.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
import gplx.xowa.wikis.nss.*;
class Xowd_page_tbl__ttl_ns extends Xowd_page_tbl__in_wkr__base {
private Xowd_page_tbl page_tbl;
private Xow_ns_mgr ns_mgr; private Ordered_hash hash;
@Override protected int Interval() {return 64;} // NOTE: 96+ overflows; PAGE:en.w:Space_Liability_Convention; DATE:2013-10-24
public void Init(Xowd_page_tbl page_tbl, Xow_ns_mgr ns_mgr, Ordered_hash hash) {
this.page_tbl = page_tbl;
this.ns_mgr = ns_mgr; this.hash = hash;
}
@Override protected Criteria In_filter(Object[] part_ary) {
int len = part_ary.length;
Criteria[] crt_ary = new Criteria[len];
String fld_ns = tbl.Fld_page_ns(); String fld_ttl = tbl.Fld_page_title();
for (int i = 0; i < len; i++)
crt_ary[i] = Criteria_.And(Db_crt_.New_eq(fld_ns, 0), Db_crt_.New_eq(fld_ttl, Bry_.Empty));
return Criteria_.Or_many(crt_ary);
}
@Override protected void Fill_stmt(Db_stmt stmt, int bgn, int end) {
for (int i = bgn; i < end; i++) {
Xowd_page_itm page = (Xowd_page_itm)hash.Get_at(i);
stmt.Crt_int(page_tbl.Fld_page_ns(), page.Ns_id());
stmt.Crt_bry_as_str(page_tbl.Fld_page_title(), page.Ttl_page_db());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {
Xow_ns ns = ns_mgr.Ids_get_or_null(rdr_page.Ns_id());
if (ns == null) return null; // NOTE: ns seems to "randomly" be null when threading during redlinks; guard against null; DATE:2014-01-03
byte[] ttl_wo_ns = rdr_page.Ttl_page_db();
rdr_page.Ttl_(ns, ttl_wo_ns);
return (Xowd_page_itm)hash.Get_by(rdr_page.Ttl_full_db());
}
}
class Xowd_page_tbl__ttl extends Xowd_page_tbl__in_wkr__base {
private Ordered_hash hash; private int in_ns;
@Override protected int Interval() {return 64;} // NOTE: 96+ overflows; EX: w:Space_Liability_Convention; DATE:2013-10-24
public void Init(Ordered_hash hash, int in_ns) {this.hash = hash; this.in_ns = in_ns;}
@Override protected Criteria In_filter(Object[] part_ary) {
int len = part_ary.length;
Criteria[] crt_ary = new Criteria[len];
String fld_ns = tbl.Fld_page_ns(); String fld_ttl = tbl.Fld_page_title();
for (int i = 0; i < len; i++)
crt_ary[i] = Criteria_.And(Db_crt_.New_eq(fld_ns, in_ns), Db_crt_.New_eq(fld_ttl, Bry_.Empty));
return Criteria_.Or_many(crt_ary);
}
@Override protected void Fill_stmt(Db_stmt stmt, int bgn, int end) {
for (int i = bgn; i < end; i++) {
Xowd_page_itm page = (Xowd_page_itm)hash.Get_at(i);
stmt.Val_int(in_ns);
stmt.Val_bry_as_str(page.Ttl_page_db());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Ttl_page_db());}
}
class Xowd_page_tbl__id extends Xowd_page_tbl__in_wkr__base {
private List_adp list; // list is original list of ids which may have dupes; needed to fill statement (which takes range of bgn - end); DATE:2013-12-08
private Ordered_hash hash; // hash is unique list of ids; needed for fetch from rdr (which indexes by id)
public void Init(List_adp list, Ordered_hash hash) {this.list = list; this.hash = hash; this.Fill_idx_fields_only_(true);}
@Override protected boolean Show_progress() {return true;}
@Override protected Criteria In_filter(Object[] part_ary) {
return Db_crt_.New_in(this.In_fld_name(), part_ary);
}
@Override protected void Fill_stmt(Db_stmt stmt, int bgn, int end) {
for (int i = bgn; i < end; i++) {
Xowd_page_itm page = (Xowd_page_itm)list.Get_at(i);
stmt.Val_int(page.Id());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Id_val());}
}
abstract class Xowd_page_tbl__in_wkr__base extends Db_in_wkr__base {
protected Xowd_page_tbl tbl; private String tbl_name, fld_in_name;
public String Tbl_name() {return tbl_name;}
public void Ctor(Xowd_page_tbl tbl, String tbl_name, String fld_in_name) {this.tbl = tbl; this.tbl_name = tbl_name; this.fld_in_name = fld_in_name;}
public String In_fld_name() {return fld_in_name;}
protected abstract Criteria In_filter(Object[] part_ary);
public abstract Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page);
public boolean Fill_idx_fields_only() {return fill_idx_fields_only;} public void Fill_idx_fields_only_(boolean v) {fill_idx_fields_only = v;} private boolean fill_idx_fields_only;
@Override protected Db_qry Make_qry(int bgn, int end) {
Object[] part_ary = In_ary(end - bgn);
return Db_qry_.select_cols_
( this.Tbl_name()
, In_filter(part_ary)
, fill_idx_fields_only ? tbl.Flds_select_idx() : tbl.Flds_select_all()
)
;
}
@Override protected void Read_data(Cancelable cancelable, Db_rdr rdr) {
Xowd_page_itm temp = new Xowd_page_itm();
while (rdr.Move_next()) {
if (cancelable.Canceled()) return;
if (fill_idx_fields_only)
tbl.Read_page__idx(temp, rdr);
else
tbl.Read_page__all(temp, rdr);
Xowd_page_itm page = Read_data_to_page(temp);
if (page == null) continue; // page not found
temp.Exists_(true);
page.Copy(temp);
}
}
}

View File

@@ -0,0 +1,41 @@
/*
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.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
import gplx.core.criterias.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
class Xowd_page_tbl__ttl extends Xowd_page_tbl__in_wkr__base {
private Ordered_hash hash; private int in_ns;
@Override protected int Interval() {return 64;} // NOTE: 96+ overflows; EX: w:Space_Liability_Convention; DATE:2013-10-24
public void Init(Ordered_hash hash, int in_ns) {this.hash = hash; this.in_ns = in_ns;}
@Override protected Criteria In_filter(Object[] part_ary) {
int len = part_ary.length;
Criteria[] crt_ary = new Criteria[len];
String fld_ns = tbl.Fld_page_ns(); String fld_ttl = tbl.Fld_page_title();
for (int i = 0; i < len; i++)
crt_ary[i] = Criteria_.And(Db_crt_.New_eq(fld_ns, in_ns), Db_crt_.New_eq(fld_ttl, Bry_.Empty));
return Criteria_.Or_many(crt_ary);
}
@Override protected void Fill_stmt(Db_stmt stmt, int bgn, int end) {
for (int i = bgn; i < end; i++) {
Xowd_page_itm page = (Xowd_page_itm)hash.Get_at(i);
stmt.Val_int(in_ns);
stmt.Val_bry_as_str(page.Ttl_page_db());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {return (Xowd_page_itm)hash.Get_by(rdr_page.Ttl_page_db());}
}

View File

@@ -0,0 +1,52 @@
/*
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.wikis.data.tbls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
import gplx.core.criterias.*;
import gplx.dbs.*; import gplx.dbs.utls.*;
import gplx.xowa.wikis.nss.*;
class Xowd_page_tbl__ttl_ns extends Xowd_page_tbl__in_wkr__base {
private Xowd_page_tbl page_tbl;
private Xow_ns_mgr ns_mgr; private Ordered_hash hash;
@Override protected int Interval() {return 64;} // NOTE: 96+ overflows; PAGE:en.w:Space_Liability_Convention; DATE:2013-10-24
public void Init(Xowd_page_tbl page_tbl, Xow_ns_mgr ns_mgr, Ordered_hash hash) {
this.page_tbl = page_tbl;
this.ns_mgr = ns_mgr; this.hash = hash;
}
@Override protected Criteria In_filter(Object[] part_ary) {
int len = part_ary.length;
Criteria[] crt_ary = new Criteria[len];
String fld_ns = tbl.Fld_page_ns(); String fld_ttl = tbl.Fld_page_title();
for (int i = 0; i < len; i++)
crt_ary[i] = Criteria_.And(Db_crt_.New_eq(fld_ns, 0), Db_crt_.New_eq(fld_ttl, Bry_.Empty));
return Criteria_.Or_many(crt_ary);
}
@Override protected void Fill_stmt(Db_stmt stmt, int bgn, int end) {
for (int i = bgn; i < end; i++) {
Xowd_page_itm page = (Xowd_page_itm)hash.Get_at(i);
stmt.Crt_int(page_tbl.Fld_page_ns(), page.Ns_id());
stmt.Crt_bry_as_str(page_tbl.Fld_page_title(), page.Ttl_page_db());
}
}
@Override public Xowd_page_itm Read_data_to_page(Xowd_page_itm rdr_page) {
Xow_ns ns = ns_mgr.Ids_get_or_null(rdr_page.Ns_id());
if (ns == null) return null; // NOTE: ns seems to "randomly" be null when threading during redlinks; guard against null; DATE:2014-01-03
byte[] ttl_wo_ns = rdr_page.Ttl_page_db();
rdr_page.Ttl_(ns, ttl_wo_ns);
return (Xowd_page_itm)hash.Get_by(rdr_page.Ttl_full_db());
}
}

View File

@@ -17,14 +17,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.domains.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
class Xow_domain_crt_itm_ {
public static final Xow_domain_crt_itm Null = null;
}
class Xow_domain_crt_itm__any_wiki implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return true;}
public static final Xow_domain_crt_itm__any_wiki Instance = new Xow_domain_crt_itm__any_wiki(); Xow_domain_crt_itm__any_wiki() {}
public static final Xow_domain_crt_itm Null = null;
}
class Xow_domain_crt_itm__in implements Xow_domain_crt_itm {
private final Xow_domain_crt_itm[] ary;
private final Xow_domain_crt_itm[] ary;
public Xow_domain_crt_itm__in(Xow_domain_crt_itm[] ary) {this.ary = ary;}
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {
int len = ary.length;
@@ -49,36 +45,20 @@ class Xow_domain_crt_itm__any_standard implements Xow_domain_crt_itm {
default: return false;
}
}
public static final Xow_domain_crt_itm__any_standard Instance = new Xow_domain_crt_itm__any_standard(); Xow_domain_crt_itm__any_standard() {}
}
class Xow_domain_crt_itm__none implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return false;}
public static final Xow_domain_crt_itm__none Instance = new Xow_domain_crt_itm__none(); Xow_domain_crt_itm__none() {}
}
class Xow_domain_crt_itm__self implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return Bry_.Eq(cur.Domain_bry(), comp.Domain_bry());}
public static final Xow_domain_crt_itm__self Instance = new Xow_domain_crt_itm__self(); Xow_domain_crt_itm__self() {}
}
class Xow_domain_crt_itm__same_lang implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return Bry_.Eq(cur.Lang_orig_key(), comp.Lang_orig_key());}
public static final Xow_domain_crt_itm__same_lang Instance = new Xow_domain_crt_itm__same_lang(); Xow_domain_crt_itm__same_lang() {}
}
class Xow_domain_crt_itm__same_type implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return cur.Domain_type_id() == comp.Domain_type_id();}
public static final Xow_domain_crt_itm__same_type Instance = new Xow_domain_crt_itm__same_type(); Xow_domain_crt_itm__same_type() {}
public static final Xow_domain_crt_itm__any_standard Instance = new Xow_domain_crt_itm__any_standard(); Xow_domain_crt_itm__any_standard() {}
}
class Xow_domain_crt_itm__lang implements Xow_domain_crt_itm {
private final byte[] lang_key;
private final byte[] lang_key;
public Xow_domain_crt_itm__lang(byte[] lang_key) {this.lang_key = lang_key;}
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return Bry_.Eq(comp.Lang_orig_key(), lang_key);}
}
class Xow_domain_crt_itm__type implements Xow_domain_crt_itm {
private final int wiki_tid;
private final int wiki_tid;
public Xow_domain_crt_itm__type(int wiki_tid) {this.wiki_tid = wiki_tid;}
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return comp.Domain_type_id() == wiki_tid;}
}
class Xow_domain_crt_itm__wiki implements Xow_domain_crt_itm {
private final byte[] domain;
private final byte[] domain;
public Xow_domain_crt_itm__wiki(byte[] domain) {this.domain = domain;}
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return Bry_.Eq(comp.Domain_bry(), domain);}
}

View File

@@ -0,0 +1,22 @@
/*
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.wikis.domains.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
class Xow_domain_crt_itm__any_wiki implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return true;}
public static final Xow_domain_crt_itm__any_wiki Instance = new Xow_domain_crt_itm__any_wiki(); Xow_domain_crt_itm__any_wiki() {}
}

View File

@@ -0,0 +1,22 @@
/*
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.wikis.domains.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
class Xow_domain_crt_itm__none implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return false;}
public static final Xow_domain_crt_itm__none Instance = new Xow_domain_crt_itm__none(); Xow_domain_crt_itm__none() {}
}

View File

@@ -0,0 +1,22 @@
/*
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.wikis.domains.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
class Xow_domain_crt_itm__same_lang implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return Bry_.Eq(cur.Lang_orig_key(), comp.Lang_orig_key());}
public static final Xow_domain_crt_itm__same_lang Instance = new Xow_domain_crt_itm__same_lang(); Xow_domain_crt_itm__same_lang() {}
}

View File

@@ -0,0 +1,22 @@
/*
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.wikis.domains.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
class Xow_domain_crt_itm__same_type implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return cur.Domain_type_id() == comp.Domain_type_id();}
public static final Xow_domain_crt_itm__same_type Instance = new Xow_domain_crt_itm__same_type(); Xow_domain_crt_itm__same_type() {}
}

View File

@@ -0,0 +1,22 @@
/*
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.wikis.domains.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
class Xow_domain_crt_itm__self implements Xow_domain_crt_itm {
public boolean Matches(Xow_domain_itm cur, Xow_domain_itm comp) {return Bry_.Eq(cur.Domain_bry(), comp.Domain_bry());}
public static final Xow_domain_crt_itm__self Instance = new Xow_domain_crt_itm__self(); Xow_domain_crt_itm__self() {}
}

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.wikis.pages.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
import gplx.xowa.files.gui.*;
import gplx.xowa.guis.cbks.js.*;
import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.langs.vnts.*;
public class Xopg_redlink_mgr implements Gfo_invk {