mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.10.3.1
This commit is contained in:
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials; import gplx.*; import gplx.xowa.*;
|
||||
public class Xoa_special_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash = Ordered_hash_.new_();
|
||||
private Ordered_hash hash = Ordered_hash_.New();
|
||||
public Xoa_special_mgr() {
|
||||
hash.Add(gplx.xowa.xtns.wdatas.specials.Wdata_itemByTitle_cfg.Key, new gplx.xowa.xtns.wdatas.specials.Wdata_itemByTitle_cfg());
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.users.history.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.specials.*;
|
||||
import gplx.xowa.specials.*;
|
||||
import gplx.xowa.specials.allPages.*; import gplx.xowa.specials.search.*; import gplx.xowa.specials.nearby.*; import gplx.xowa.specials.randoms.*; import gplx.xowa.specials.statistics.*; import gplx.xowa.xtns.translates.*; import gplx.xowa.specials.movePage.*;
|
||||
import gplx.xowa.specials.xowa.system_data.*; import gplx.xowa.specials.xowa.default_tab.*; import gplx.xowa.specials.xowa.popup_history.*; import gplx.xowa.specials.xowa.file_browsers.*; import gplx.xowa.specials.xowa.diags.*;
|
||||
@@ -25,7 +25,7 @@ import gplx.xowa.xtns.wdatas.specials.*;
|
||||
import gplx.xowa.users.data.*; import gplx.xowa.users.bmks.*;
|
||||
public class Xows_mgr {
|
||||
private final Hash_adp_bry hash;
|
||||
public Xows_mgr(Xowe_wiki wiki, Xol_lang lang) {
|
||||
public Xows_mgr(Xowe_wiki wiki, Xol_lang_itm lang) {
|
||||
hash = Hash_adp_bry.ci_u8(lang.Case_mgr());
|
||||
page_allpages = new Xows_page_allpages(wiki);
|
||||
page_search = new Xows_page__search(wiki);
|
||||
@@ -49,7 +49,7 @@ public class Xows_mgr {
|
||||
public Xosp_fbrow_special Page_file_browser() {return page_file_browser;} private final Xosp_fbrow_special page_file_browser = new Xosp_fbrow_special();
|
||||
public Xows_bmk_page Page_bmk() {return page_bmk;} private final Xows_bmk_page page_bmk = new Xows_bmk_page();
|
||||
public Xows_diag_page Page_diag() {return page_diag;} private final Xows_diag_page page_diag = new Xows_diag_page();
|
||||
public void Evt_lang_changed(Xol_lang lang) {
|
||||
public void Evt_lang_changed(Xol_lang_itm lang) {
|
||||
hash.Clear();
|
||||
hash.Add_str_obj(Xows_special_meta_.Key__search , page_search);
|
||||
hash.Add_str_obj(Xows_special_meta_.Key__all_pages , page_allpages);
|
||||
|
||||
@@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.allPages; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.html.*; import gplx.xowa.html.hrefs.*; import gplx.xowa.html.lnkis.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.lnkis.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
public class Xows_page_allpages implements GfoInvkAble, Bry_fmtr_arg, Xows_page {
|
||||
public Xows_page_allpages(Xowe_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
@@ -75,7 +75,7 @@ public class Xows_page_allpages implements GfoInvkAble, Bry_fmtr_arg, Xows_page
|
||||
public void Special_gen(Xowe_wiki wiki, Xoae_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
wiki.Parser_mgr().Ctx().Cur_page().Html_data().Display_ttl_(wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_sp_allpages_hdr));
|
||||
url.Page_bry_(Bry_.Add(Bry_.new_a7("Special:"), ttl.Page_txt_wo_qargs())); // HACK: need to re-set Page b/c href_wtr does not eliminate qargs; DATE:2013-02-08
|
||||
if (wiki.Domain_tid() == Xow_domain_type_.Int__home) {wiki.Appe().Usr_dlg().Prog_many(GRP_KEY, "home.invalid", "AllPages not implemented for home wiki"); return;}
|
||||
if (wiki.Domain_tid() == Xow_domain_tid_.Int__home) {wiki.Appe().Usr_dlg().Prog_many(GRP_KEY, "home.invalid", "AllPages not implemented for home wiki"); return;}
|
||||
if (rslt_list_ttls == null) this.Itms_per_page_(itms_per_page);
|
||||
boolean found = Build_data(url, ttl); if (!found) return;
|
||||
Build_html(page);
|
||||
@@ -124,7 +124,7 @@ public class Xows_page_allpages implements GfoInvkAble, Bry_fmtr_arg, Xows_page
|
||||
byte[] anchor_prv = Build_html_end(tmp_bfr, rslt_prv, false);
|
||||
byte[] anchor_nxt = Build_html_end(tmp_bfr, rslt_nxt, true);
|
||||
html_all.Bld_bfr_many(tmp_bfr, this, anchor_prv, anchor_nxt);
|
||||
page.Data_raw_(tmp_bfr.Xto_bry_and_clear());
|
||||
page.Data_raw_(tmp_bfr.To_bry_and_clear());
|
||||
tmp_bfr.Mkr_rls();
|
||||
page.Html_data().Html_restricted_n_();
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class Xows_page_allpages implements GfoInvkAble, Bry_fmtr_arg, Xows_page
|
||||
if (!ns.Id_main()) ttl_bry = Bry_.Add(ns.Name_db_w_colon(), ttl_bry);
|
||||
return Xoa_ttl.parse(wiki, ttl_bry);
|
||||
}
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
int len = rslt_list_ttls.length;
|
||||
html_itm_fmtr.XferAry_bgn();
|
||||
for (int i = 0; i < len; i += itms_per_grp) {
|
||||
@@ -182,7 +182,7 @@ class Xos_pagelist_html_itm_fmtr implements Bry_fmtr_arg {
|
||||
init_ns = mgr.Init_ns();
|
||||
} int itms_per_grp, ttls_len, itm_pct; Xowd_page_itm[] ttls; Xow_ns init_ns;
|
||||
public void XferAry_end() {ttls = null;}
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
int itm_end = itm_idx + itms_per_grp;
|
||||
for (int i = itm_idx; i < itm_end; i++) {
|
||||
if (i >= ttls_len) break; // handle odd number of itms; EX: interval=3; items=4; proc gets called on 0 (0-2) and 3 (3-5); ArrayIndex for 4, 5
|
||||
|
||||
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.allPages; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import org.junit.*; import gplx.core.net.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.tdbs.hives.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.tdbs.hives.*;
|
||||
public class Xows_page_allpages_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xows_page_allpages_fxt fxt = new Xows_page_allpages_fxt();
|
||||
@Test public void Build_data() {
|
||||
|
||||
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.specials.movePage; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.parsers.utils.*;
|
||||
public class Move_page implements Xows_page {
|
||||
private Move_trg_ns_list_fmtr ns_list_fmtr = new Move_trg_ns_list_fmtr();
|
||||
@@ -39,7 +39,7 @@ public class Move_page implements Xows_page {
|
||||
page.Data_raw_(html);
|
||||
}
|
||||
private void Exec_rename(Xowe_wiki wiki, Xoae_page page) {
|
||||
gplx.xowa.dbs.Xodb_save_mgr save_mgr = wiki.Db_mgr().Save_mgr();
|
||||
gplx.xowa.wikis.dbs.Xodb_save_mgr save_mgr = wiki.Db_mgr().Save_mgr();
|
||||
int trg_ns_id = args.Trg_ns();
|
||||
Xow_ns trg_ns = wiki.Ns_mgr().Ids_get_or_null(trg_ns_id); if (trg_ns == null) throw Err_.new_wo_type("unknown ns", "ns", trg_ns_id);
|
||||
byte[] trg_ttl_bry = args.Trg_ttl();
|
||||
@@ -126,7 +126,7 @@ class Move_trg_ns_list_fmtr implements Bry_fmtr_arg {
|
||||
this.wiki = wiki;
|
||||
this.ttl = ttl;
|
||||
}
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
Xow_ns_mgr ns_mgr = wiki.Ns_mgr();
|
||||
int ns_len = ns_mgr.Ids_len();
|
||||
for (int i = 0; i < ns_len; i++) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Nearby_mgr implements Xows_page {
|
||||
tmp_bfr.Add_str_a7("</tr>");
|
||||
}
|
||||
tmp_bfr.Add_str_a7("</table>");
|
||||
return tmp_bfr.Xto_bry_and_clear();
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
Bry_fmtr form_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl
|
||||
( "<form id='xowa_nearby_form' action='/wiki/Special:XowaNearby'>"
|
||||
@@ -66,7 +66,7 @@ public class Nearby_mgr implements Xows_page {
|
||||
, "</form>"
|
||||
));
|
||||
Xoa_ttl trg_ttl;
|
||||
Ordered_hash src_pool = Ordered_hash_.new_bry_();
|
||||
Ordered_hash src_pool = Ordered_hash_.New_bry();
|
||||
public List_adp Find_from_to(Xowe_wiki wiki, byte[] src_bry, byte[] trg_bry, Hash_adp_bry excluded) {
|
||||
this.wiki = wiki; this.excluded = excluded;
|
||||
Xoa_ttl src_ttl = Xoa_ttl.parse(wiki, src_bry); if (src_ttl == null) return List_adp_.Noop;
|
||||
@@ -84,7 +84,7 @@ public class Nearby_mgr implements Xows_page {
|
||||
}
|
||||
private void Examine_page(Ordered_hash src_pool){
|
||||
int len = src_pool.Count();
|
||||
Ordered_hash next_pool = Ordered_hash_.new_bry_();
|
||||
Ordered_hash next_pool = Ordered_hash_.New_bry();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Nearby_itmx itmx = (Nearby_itmx)src_pool.Get_at(i);
|
||||
Xoa_ttl ttl = itmx.Ttl();
|
||||
@@ -95,7 +95,7 @@ public class Nearby_mgr implements Xows_page {
|
||||
Xoae_page page = wiki.Data_mgr().Get_page(ttl, false);
|
||||
if (page.Missing()) continue;
|
||||
wiki.Parser_mgr().Parse(page, true);
|
||||
Ordered_hash lnkis = Ordered_hash_.new_bry_();
|
||||
Ordered_hash lnkis = Ordered_hash_.New_bry();
|
||||
Collect_lnkis(lnkis, page.Root());
|
||||
if (lnkis.Has(trg)) {
|
||||
++results_cur;
|
||||
@@ -114,7 +114,7 @@ public class Nearby_mgr implements Xows_page {
|
||||
Examine_page(next_pool);
|
||||
// ++pages_count;
|
||||
// wiki.Parser_mgr().Parse(page, true);
|
||||
// Ordered_hash lnkis = Ordered_hash_.new_bry_();
|
||||
// Ordered_hash lnkis = Ordered_hash_.New_bry();
|
||||
// int len = lnkis.Count();
|
||||
// for (int i = 0; i < len; i++) {
|
||||
// Xoa_ttl lnki_ttl = (Xoa_ttl)lnkis.Get_at(i);
|
||||
@@ -135,7 +135,7 @@ public class Nearby_mgr implements Xows_page {
|
||||
// if (page.Missing()) return;
|
||||
// ++pages_count;
|
||||
// wiki.Parser_mgr().Parse(page, true);
|
||||
// Ordered_hash lnkis = Ordered_hash_.new_bry_();
|
||||
// Ordered_hash lnkis = Ordered_hash_.New_bry();
|
||||
// Collect_lnkis(lnkis, page.Root());
|
||||
// if (lnkis.Has(trg)) {
|
||||
// ++results_cur;
|
||||
|
||||
@@ -50,7 +50,7 @@ class Nearby_mgr_fxt {
|
||||
tmp_bfr = Bry_bfr.new_();
|
||||
}
|
||||
fxt.Reset();
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
Io_mgr.Instance.InitEngine_mem();
|
||||
nearby_mgr.Results_max_(1);
|
||||
return this;
|
||||
} private Xop_fxt fxt; Nearby_mgr nearby_mgr; Hash_adp_bry excluded; Bry_bfr tmp_bfr;
|
||||
@@ -72,6 +72,6 @@ class Nearby_mgr_fxt {
|
||||
tmp_bfr.Add(ttl.Page_db());
|
||||
}
|
||||
}
|
||||
return tmp_bfr.Xto_str_and_clear();
|
||||
return tmp_bfr.To_str_and_clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.specials.randoms; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xop_randomRootPage_page implements Xows_page {
|
||||
public Xows_special_meta Special_meta() {return Xows_special_meta_.Itm__random_root_page;}
|
||||
public void Special_gen(Xowe_wiki wiki, Xoae_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
|
||||
@@ -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.specials.randoms; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xows_page_random implements Xows_page {
|
||||
public Xows_page_random(Xowe_wiki wiki) {}
|
||||
public Xows_special_meta Special_meta() {return Xows_special_meta_.Itm__random;}
|
||||
|
||||
@@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.net.*; import gplx.core.threads.*;
|
||||
import gplx.gfui.*; import gplx.xowa.gui.*; import gplx.xowa.gui.views.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.gfui.*; import gplx.xowa.guis.*; import gplx.xowa.guis.views.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.core.js.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xog_search_suggest_mgr implements GfoInvkAble {
|
||||
public Xog_search_suggest_mgr(Xoa_gui_mgr gui_mgr) {
|
||||
this.app = gui_mgr.App();
|
||||
@@ -100,7 +100,7 @@ public class Xog_search_suggest_mgr implements GfoInvkAble {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_search_async)) Search_async();
|
||||
else if (ctx.Match(k, Invk_notify)) Notify();
|
||||
else if (ctx.Match(k, Invk_enabled)) return Yn.Xto_str(enabled);
|
||||
else if (ctx.Match(k, Invk_enabled)) return Yn.To_str(enabled);
|
||||
else if (ctx.Match(k, Invk_enabled_)) enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_results_max)) return results_max;
|
||||
else if (ctx.Match(k, Invk_results_max_)) results_max = m.ReadInt("v");
|
||||
@@ -111,9 +111,9 @@ public class Xog_search_suggest_mgr implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_all_pages_extend_)) all_pages_extend = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_all_pages_min)) return all_pages_min;
|
||||
else if (ctx.Match(k, Invk_all_pages_min_)) all_pages_min = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_auto_wildcard)) return Yn.Xto_str(auto_wildcard);
|
||||
else if (ctx.Match(k, Invk_auto_wildcard)) return Yn.To_str(auto_wildcard);
|
||||
else if (ctx.Match(k, Invk_auto_wildcard_)) auto_wildcard = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_log_enabled)) return Yn.Xto_str(log_enabled);
|
||||
else if (ctx.Match(k, Invk_log_enabled)) return Yn.To_str(log_enabled);
|
||||
else if (ctx.Match(k, Invk_log_enabled_)) log_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_args_default)) return args_default_str;
|
||||
else if (ctx.Match(k, Invk_args_default_)) Args_default_str_(m.ReadStr("v"));
|
||||
|
||||
@@ -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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import org.junit.*; import gplx.xowa.tdbs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xosrh_core_tst {
|
||||
// @Before public void Init() {fxt.Clear();} private Xos_search_mgr_fxt fxt = new Xos_search_mgr_fxt();
|
||||
@Test public void Basic() {
|
||||
@@ -121,7 +121,7 @@ public class Xosrh_core_tst {
|
||||
// Xobl_regy_itm itm = ary[i];
|
||||
// itm.Srl_save(tmp_bfr);
|
||||
// }
|
||||
// Io_mgr.I.SaveFilBfr(url, tmp_bfr);
|
||||
// Io_mgr.Instance.SaveFilBfr(url, tmp_bfr);
|
||||
// } private Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
// public void Init_data(Io_url fil, params Xobl_data_itm[] ary) {
|
||||
// Xob_xdat_file xdat_file = new Xob_xdat_file();
|
||||
@@ -129,7 +129,7 @@ public class Xosrh_core_tst {
|
||||
// for (int i = 0; i < ary_len; i++) {
|
||||
// Xobl_data_itm itm = ary[i];
|
||||
// itm.Srl_save(tmp_bfr);
|
||||
// xdat_file.Insert(bfr, tmp_bfr.Xto_bry_and_clear());
|
||||
// xdat_file.Insert(bfr, tmp_bfr.To_bry_and_clear());
|
||||
// }
|
||||
// xdat_file.Save(fil);
|
||||
// }
|
||||
@@ -159,7 +159,7 @@ public class Xosrh_core_tst {
|
||||
// search_mgr.Page_mgr().Ns_mgr().Add_all(); // WORKAROUND: xdat fmt does not store ns with search data; pages will be retrieved with ns_id = null; force ns_all (instead of allowing ns_main default);
|
||||
// }
|
||||
// public void Clear() {
|
||||
// Io_mgr.I.InitEngine_mem();
|
||||
// Io_mgr.Instance.InitEngine_mem();
|
||||
// app = Xoa_app_fxt.app_();
|
||||
// wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
// search_mgr = wiki.Special_mgr().Page_search();
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Xosrh_page_mgr implements Xosrh_page_mgr_searcher {
|
||||
if (page_idx < 0 || page_idx >= pages_ary.length) return Grp_empty;
|
||||
if ( sort_tid != Xosrh_rslt_itm_sorter.Tid_ttl_asc
|
||||
&& cancelable == Cancelable_.Never // cancelable != Cancelable_.Never for search_suggest
|
||||
&& wiki.Db_mgr().Tid() == gplx.xowa.dbs.Xodb_mgr_txt.Tid_txt // txt only has search_title fields (page_id, word_id), so it needs to do another load to get page fields; note that sql has page fields already
|
||||
&& wiki.Db_mgr().Tid() == gplx.xowa.wikis.dbs.Xodb_mgr_txt.Tid_txt // txt only has search_title fields (page_id, word_id), so it needs to do another load to get page fields; note that sql has page fields already
|
||||
) {
|
||||
wiki.Db_mgr().Load_mgr().Load_by_ids(cancelable, cur_ids, itms_bgn, itms_end);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class Xosrh_page_mgr implements Xosrh_page_mgr_searcher {
|
||||
}
|
||||
public List_adp Parse_search_and_load_ids(Cancelable cancelable, Bry_bfr bfr, Xows_ns_mgr ns_mgr, byte[] search) {
|
||||
search = wiki.Lang().Case_mgr().Case_build_lower(search, 0, search.length);
|
||||
Xosrh_qry_itm cur_root = Xosrh_parser._.Parse(search);
|
||||
Xosrh_qry_itm cur_root = Xosrh_parser.Instance.Parse(search);
|
||||
cur_root.Search(cancelable, bfr, search, wiki, itms_per_page, ns_mgr);
|
||||
return cur_root.Matches(search).Ids();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import org.junit.*; import gplx.xowa.tdbs.*; import gplx.xowa.tdbs.hives.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.tdbs.hives.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xosrh_page_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xosrh_page_mgr_fxt fxt = new Xosrh_page_mgr_fxt();
|
||||
@Test public void Basic() {
|
||||
@@ -49,7 +49,7 @@ class Xosrh_page_mgr_fxt {
|
||||
Base85_utl.XtoStrByAry(i, id_bry, 0, 5);
|
||||
tmp_itm.Ns_id_(Xow_ns_.Id_main).Init(i, Bry_.To_a7_bry(i, 0), false, 10, 0, i - bgn);
|
||||
Xotdb_page_itm_.Txt_id_save(tmp_bfr, tmp_itm);
|
||||
hive_mgr.Create(id_bry, tmp_bfr.Xto_bry_and_clear(), null);
|
||||
hive_mgr.Create(id_bry, tmp_bfr.To_bry_and_clear(), null);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.specials.search; import gplx.*; import gplx.xowa.*; import gpl
|
||||
class Xosrh_parser {
|
||||
public Xosrh_qry_itm Parse(byte[] src) {
|
||||
this.src = src;
|
||||
Xosrh_qry_tkn[] tkns = Xosrh_scanner._.Scan(src);
|
||||
Xosrh_qry_tkn[] tkns = Xosrh_scanner.Instance.Scan(src);
|
||||
return Parse_itm_or(make_ctx.Init(tkns));
|
||||
} private Xosrh_parser_ctx make_ctx = new Xosrh_parser_ctx(); byte[] src;
|
||||
Xosrh_qry_itm Parse_itm_or(Xosrh_parser_ctx make_ctx) {
|
||||
@@ -70,7 +70,7 @@ class Xosrh_parser {
|
||||
return Xosrh_qry_itm.word_(src, word_tkn);
|
||||
}
|
||||
}
|
||||
public static final Xosrh_parser _ = new Xosrh_parser(); Xosrh_parser() {}
|
||||
public static final Xosrh_parser Instance = new Xosrh_parser(); Xosrh_parser() {}
|
||||
}
|
||||
class Xosrh_parser_ctx {
|
||||
public Xosrh_parser_ctx Init(Xosrh_qry_tkn[] ary) {
|
||||
|
||||
@@ -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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import org.junit.*; import gplx.xowa.tdbs.*; import gplx.xowa.tdbs.hives.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import org.junit.*; import gplx.xowa.wikis.tdbs.*; import gplx.xowa.wikis.tdbs.hives.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xosrh_parser_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xosearch_parser_fxt fxt = new Xosearch_parser_fxt();
|
||||
@Test public void Scan_word() {fxt.Test_scan("abc", "abc");}
|
||||
@@ -62,7 +62,7 @@ class Xosearch_searcher_fxt {
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
mgr = new Xowd_hive_mgr(wiki, Xotdb_dir_info_.Tid_search_ttl);
|
||||
tmp_bfr = Bry_bfr.reset_(255);
|
||||
parser = Xosrh_parser._;
|
||||
parser = Xosrh_parser.Instance;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class Xosearch_searcher_fxt {
|
||||
tmp_bfr.Add_byte(Byte_ascii.Semic);
|
||||
tmp_bfr.Add_base85_len_5(0);
|
||||
}
|
||||
mgr.Create(wiki.Ns_mgr().Ns_main(), ttl_bry, tmp_bfr.Xto_bry_and_clear(), null);
|
||||
mgr.Create(wiki.Ns_mgr().Ns_main(), ttl_bry, tmp_bfr.To_bry_and_clear(), null);
|
||||
}
|
||||
public void Test_search(String ttl_str, int... expd) {
|
||||
byte[] ttl_bry = Bry_.new_a7(ttl_str);
|
||||
@@ -93,8 +93,8 @@ class Xosearch_searcher_fxt {
|
||||
class Xosearch_parser_fxt {
|
||||
public Xosearch_parser_fxt Clear() {
|
||||
if (parser == null) {
|
||||
parser = Xosrh_parser._;
|
||||
matches = Ordered_hash_.new_bry_();
|
||||
parser = Xosrh_parser.Instance;
|
||||
matches = Ordered_hash_.New_bry();
|
||||
}
|
||||
matches.Clear();
|
||||
return this;
|
||||
@@ -134,12 +134,12 @@ class Xosearch_parser_fxt {
|
||||
}
|
||||
public void Test_scan(String raw, String... expd) {
|
||||
byte[] src = Bry_.new_a7(raw);
|
||||
Xosrh_qry_tkn[] actl_itms = Xosrh_scanner._.Scan(src);
|
||||
Xosrh_qry_tkn[] actl_itms = Xosrh_scanner.Instance.Scan(src);
|
||||
Tfds.Eq_ary(expd, To_strings(src, actl_itms));
|
||||
}
|
||||
public void Test_scan_tids(String raw, byte... expd) {
|
||||
byte[] src = Bry_.new_a7(raw);
|
||||
Xosrh_qry_tkn[] actl_itms = Xosrh_scanner._.Scan(src);
|
||||
Xosrh_qry_tkn[] actl_itms = Xosrh_scanner.Instance.Scan(src);
|
||||
Tfds.Eq_ary(expd, To_tids(actl_itms));
|
||||
}
|
||||
String[] To_strings(byte[] src, Xosrh_qry_tkn[] ary) {
|
||||
|
||||
@@ -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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.xowa.dbs.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.bldrs.cmds.texts.*;
|
||||
import gplx.xowa.wikis.dbs.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.bldrs.cmds.texts.*;
|
||||
class Xosrh_qry_itm {
|
||||
public Xosrh_qry_itm(byte tid, byte[] word, Xosrh_qry_itm lhs, Xosrh_qry_itm rhs) {
|
||||
this.tid = tid; this.word = word; this.lhs = lhs; this.rhs = rhs;
|
||||
@@ -29,7 +29,7 @@ class Xosrh_qry_itm {
|
||||
public String Xto_str(byte[] src) {
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
Xto_str_bld(src, bfr);
|
||||
return bfr.Xto_str_and_clear();
|
||||
return bfr.To_str_and_clear();
|
||||
}
|
||||
public Xosrh_qry_ids Matches(byte[] src) {
|
||||
switch (tid) {
|
||||
@@ -74,7 +74,7 @@ class Xosrh_qry_itm {
|
||||
ids = Search_word(wiki, cancelable, tmp_bfr, ns_mgr, word, results_max);
|
||||
break;
|
||||
case Xosrh_qry_itm.Tid_word_quote:
|
||||
Ordered_hash tmp_search_list = Ordered_hash_.new_();
|
||||
Ordered_hash tmp_search_list = Ordered_hash_.New();
|
||||
byte[][] words = gplx.xowa.bldrs.cmds.texts.Xob_search_base.Split_ttl_into_words(wiki.Lang(), tmp_search_list, tmp_bfr, word);
|
||||
int words_len = words.length;
|
||||
List_adp prv_list = null;
|
||||
@@ -182,7 +182,7 @@ class Xosrh_qry_itm {
|
||||
}
|
||||
tmp_hash.Clear();
|
||||
return rv;
|
||||
} static Ordered_hash tmp_hash = Ordered_hash_.new_();
|
||||
} static Ordered_hash tmp_hash = Ordered_hash_.New();
|
||||
List_adp Evaluate_not_found(String msg, Object... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class Xosrh_scanner {
|
||||
}
|
||||
tkns.Add(new_tkn_(tid, src_bgn, src_end));
|
||||
}
|
||||
Ordered_hash tmp_list = Ordered_hash_.new_(); Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
Ordered_hash tmp_list = Ordered_hash_.New(); Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
Xosrh_qry_tkn new_tkn_(byte tid, int val_bgn, int val_end) {return Xosrh_qry_tkn.new_pos_(tid, val_bgn, val_end);}
|
||||
private static byte[] Bry_and = Bry_.new_a7("AND");
|
||||
private static final Btrie_slim_mgr trie = Btrie_slim_mgr.ci_a7()// NOTE:ci.ascii:OR / AND only
|
||||
@@ -138,7 +138,7 @@ class Xosrh_scanner {
|
||||
.Add_str_byte(")", Xosrh_qry_tkn.Tid_paren_end)
|
||||
.Add_str_byte("or", Xosrh_qry_tkn.Tid_or)
|
||||
.Add_str_byte("and", Xosrh_qry_tkn.Tid_and);
|
||||
public static final Xosrh_scanner _ = new Xosrh_scanner(); Xosrh_scanner() {}
|
||||
public static final Xosrh_scanner Instance = new Xosrh_scanner(); Xosrh_scanner() {}
|
||||
}
|
||||
class Xosrh_qry_tkn {
|
||||
Xosrh_qry_tkn(byte tid, int val_bgn, int val_end, byte[] val_bry) {this.tid = tid; this.val_bgn = val_bgn; this.val_end = val_end; this.val_bry = val_bry;}
|
||||
|
||||
@@ -68,7 +68,7 @@ class Xow_domain_sorter__manual_tid implements gplx.lists.ComparerAble {
|
||||
if (lhs_sort == -1 && rhs_sort != -1) return rhs_sort;
|
||||
else if (lhs_sort != -1 && rhs_sort == -1) return lhs_sort;
|
||||
else if (lhs_sort != -1 && rhs_sort != -1) return Int_.Compare(lhs_sort, rhs_sort);
|
||||
else return Bry_.Compare(Xow_domain_type_.Get_type_as_bry(lhs.Domain_type_id()), Xow_domain_type_.Get_type_as_bry(rhs.Domain_type_id()));
|
||||
else return Bry_.Compare(Xow_domain_tid_.Get_type_as_bry(lhs.Domain_type_id()), Xow_domain_tid_.Get_type_as_bry(rhs.Domain_type_id()));
|
||||
}
|
||||
private int Get_sort_idx_or_neg1(int tid) {
|
||||
Object o = sort_hash.Get_by(sort_key.Val_(tid));
|
||||
@@ -79,7 +79,7 @@ class Xow_domain_sorter__manual_tid implements gplx.lists.ComparerAble {
|
||||
int[] id_ints = new int[len];
|
||||
for (int i = 0; i < len; ++i) {
|
||||
byte[] id_bry = id_brys[i];
|
||||
int id_int = Xow_domain_type_.Get_type_as_tid(id_bry);
|
||||
int id_int = Xow_domain_tid_.Get_type_as_tid(id_bry);
|
||||
id_ints[i] = id_int;
|
||||
}
|
||||
return new Xow_domain_sorter__manual_tid(id_ints);
|
||||
@@ -113,7 +113,7 @@ class Xow_domain_sorter__manual_lang implements gplx.lists.ComparerAble {
|
||||
int[] id_ints = new int[len];
|
||||
for (int i = 0; i < len; ++i) {
|
||||
byte[] id_bry = id_brys[i];
|
||||
int id_int = Xol_lang_itm_.Get_by_key_or_intl(id_bry).Id();
|
||||
int id_int = Xol_lang_stub_.Get_by_key_or_intl(id_bry).Id();
|
||||
id_ints[i] = id_int;
|
||||
}
|
||||
return new Xow_domain_sorter__manual_lang(id_ints);
|
||||
|
||||
@@ -55,7 +55,7 @@ class Xows_core {
|
||||
boolean searching_db = cmd.Search();
|
||||
html_wkr.Gen_tbl(tmp_bfr, cmd.Rslt(), cmd_key, cmd.Wiki().Domain_bry(), searching_db);
|
||||
}
|
||||
page.Data_raw_(html_wkr.Gen_page(tmp_bfr.Xto_bry_and_clear()));
|
||||
page.Data_raw_(html_wkr.Gen_page(tmp_bfr.To_bry_and_clear()));
|
||||
}
|
||||
public void Search_end(Xows_ui_cmd cmd) {
|
||||
cmd_hash.Del(cmd.Key());
|
||||
@@ -69,7 +69,7 @@ class Xows_core {
|
||||
private void Assert_page_count(Xowe_wiki wiki) {
|
||||
Xowd_db_file search_db = wiki.Data__core_mgr().Db__search();
|
||||
if (ask_for_upgrade
|
||||
&& wiki.App().App_type().Uid_is_gui()
|
||||
&& wiki.App().Mode().Tid_is_gui()
|
||||
&& !search_db.Tbl__search_word().Ddl__page_count()
|
||||
&& !upgraded_wikis.Has(wiki.Domain_bry()) ) {
|
||||
ask_for_upgrade = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.xowa.specials.search.parsers_old.*;
|
||||
class Xows_db_cache { // one cache per search term; EX: "Earth* AND (History OR Future) AND -"middle earth"" is one cache
|
||||
private final Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public Xows_db_word[] Words() {return words;} private Xows_db_word[] words; // words in cache; EX: earth, history, future but not "middle earth" (since not'ed)
|
||||
public Xows_db_matcher Matcher() {return matcher;} private Xows_db_matcher matcher; // criteria
|
||||
public boolean Done() {return done;} public void Done_y_() {done = true;} private boolean done; // marks if db search is done
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.primitives.*; import gplx.dbs.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.langs.cases.*;
|
||||
import gplx.gfui.*;
|
||||
class Xows_db_wkr {
|
||||
@@ -77,7 +77,7 @@ class Xows_db_wkr {
|
||||
int page_ns = rdr.Read_int(page_tbl.Fld_page_ns());
|
||||
if (!qry.Ns_mgr().Has(page_ns)) continue; // ignore: ns doesn't match
|
||||
byte[] page_ttl = rdr.Read_bry_by_str(page_tbl.Fld_page_title());
|
||||
// Io_mgr.I.AppendFilStr("C:\\temp.txt", String_.new_u8(word.Text()) + "|" + Int_.Xto_str(page_ns) + "|" + String_.new_u8(page_ttl) + "\n");
|
||||
// Io_mgr.Instance.AppendFilStr("C:\\temp.txt", String_.new_u8(word.Text()) + "|" + Int_.To_str(page_ns) + "|" + String_.new_u8(page_ttl) + "\n");
|
||||
byte[] page_ttl_lc = case_mgr.Case_build_lower(Xoa_ttl.Replace_unders(page_ttl));
|
||||
byte[][] page_ttl_words = Bry_split_.Split(page_ttl_lc, Byte_ascii.Space, Bool_.Y);
|
||||
if (!matcher.Matches(page_ttl_lc, page_ttl_words)) continue; // ignore: ttl doesn't match matcher
|
||||
|
||||
@@ -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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.langs.numbers.*;
|
||||
class Xows_html_wkr {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_(255);
|
||||
private Xows_ui_qry qry; private Xow_wiki wiki; private Xol_num_mgr num_mgr;
|
||||
@@ -31,7 +31,7 @@ class Xows_html_wkr {
|
||||
byte[] rslts_hdr = fmtr_rslts.Bld_bry_many(tmp_bfr, num_mgr.Format_num(qry.Itms_bgn() + List_adp_.Base1), num_mgr.Format_num(qry.Itms_end()), qry.Search_raw());
|
||||
byte[] option_link = lnki_bldr.Href_(Bry_.new_a7("home"), wiki.Ttl_parse(Bry_.new_a7("Help:Options/Search"))).Img_16x16(Xoh_img_path.Img_option).Bld_to_bry();
|
||||
fmtr_page.Bld_bfr_many(tmp_bfr, rslts_hdr, option_link, Paging_link(Bool_.N), Paging_link(Bool_.Y), tbls);
|
||||
return tmp_bfr.Xto_bry_and_clear();
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
public void Gen_tbl(Bry_bfr bfr, Xows_ui_rslt rslt, byte[] cmd_key, byte[] wiki_domain, boolean searching_db) {
|
||||
html_rows.Init(rslt);
|
||||
@@ -95,7 +95,7 @@ class Xows_html_row implements Bry_fmtr_arg {
|
||||
private final Object thread_lock = new Object();
|
||||
public Xows_html_row(Xoh_lnki_bldr lnki_bldr) {this.lnki_bldr = lnki_bldr;}
|
||||
public Xows_html_row Init(Xows_ui_rslt rslt) {this.rslt = rslt; return this;}
|
||||
public void XferAry(Bry_bfr bfr, int idx) { // <a href="/wiki/A" title="A" class="xowa-visited">A</a>
|
||||
public void Fmt__do(Bry_bfr bfr) { // <a href="/wiki/A" title="A" class="xowa-visited">A</a>
|
||||
int len = rslt.Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xows_db_row row = rslt.Get_at(i);
|
||||
|
||||
@@ -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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import org.junit.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.tdbs.*;
|
||||
import org.junit.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.wikis.tdbs.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xows_html_wkr_tst {
|
||||
@@ -68,8 +68,8 @@ class Xows_html_wkr_fxt {
|
||||
html_row.Init(rslt);
|
||||
for (int i = 0; i < rows.length; ++i)
|
||||
rslt.Add(rows[i]);
|
||||
html_row.XferAry(tmp_bfr, 0);
|
||||
Tfds.Eq_str_lines(expd, tmp_bfr.Xto_str_and_clear());
|
||||
html_row.Fmt__do(tmp_bfr);
|
||||
Tfds.Eq_str_lines(expd, tmp_bfr.To_str_and_clear());
|
||||
}
|
||||
public Xows_db_row Make_row(int len, String ttl_str) {
|
||||
byte[] ttl_bry = Bry_.new_u8(ttl_str);
|
||||
|
||||
@@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xows_ns_mgr {
|
||||
private final Ordered_hash ns_hash = Ordered_hash_.new_(); private final Int_obj_ref tmp_ns_id = Int_obj_ref.neg1_(); private final Bry_bfr tmp_bfr = Bry_bfr.reset_(32);
|
||||
private final Ordered_hash ns_hash = Ordered_hash_.New(); private final Int_obj_ref tmp_ns_id = Int_obj_ref.neg1_(); private final Bry_bfr tmp_bfr = Bry_bfr.reset_(32);
|
||||
private boolean ns_all, ns_main;
|
||||
public void Clear() {
|
||||
ns_hash.Clear();
|
||||
@@ -75,7 +75,7 @@ public class Xows_ns_mgr {
|
||||
Int_obj_ref ns_id_ref = (Int_obj_ref)ns_hash.Get_at(i);
|
||||
tmp_bfr.Add_int_variable(ns_id_ref.Val());
|
||||
}
|
||||
return tmp_bfr.Xto_bry_and_clear();
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
}
|
||||
private static final byte[] Hash_key_all = new byte[] {Byte_ascii.Star}, Hash_key_main = new byte[] {Byte_ascii.Num_0};
|
||||
|
||||
@@ -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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.apis.xowa.specials.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.apps.apis.xowa.specials.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.domains.crts.*;
|
||||
public class Xows_page__search implements Xows_page, GfoInvkAble, GfoEvObj {
|
||||
private final Xoae_app app; private final Xow_domain_itm wiki_domain; private final Xoapi_search search_api;
|
||||
@@ -34,7 +34,7 @@ public class Xows_page__search implements Xows_page, GfoInvkAble, GfoEvObj {
|
||||
public Xows_special_meta Special_meta() {return Xows_special_meta_.Itm__search;}
|
||||
private void Multi_wikis_changed() {
|
||||
Xow_domain_crt_itm crt = search_api.Multi_wikis_crt(wiki_domain);
|
||||
this.search_domain_ary = app.Usere().Wiki().Xwiki_mgr().Get_by_crt(wiki_domain, crt);
|
||||
this.search_domain_ary = Get_by_crt(app.Usere().Wiki().Xwiki_mgr(), wiki_domain, crt);
|
||||
if (search_domain_ary.length == 0) search_domain_ary = new Xow_domain_itm[] {wiki_domain}; // default to current if bad input
|
||||
Multi_sorts_changed();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class Xows_page__search implements Xows_page, GfoInvkAble, GfoEvObj {
|
||||
Xow_domain_sorter__manual.Sort(sorter, search_domain_ary);
|
||||
}
|
||||
public void Special_gen(Xowe_wiki wiki, Xoae_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
if (wiki.Domain_tid() == Xow_domain_type_.Int__home) return; // do not allow search in home wiki; will throw null ref error b/c no search_ttl dirs
|
||||
if (wiki.Domain_tid() == Xow_domain_tid_.Int__home) return; // do not allow search in home wiki; will throw null ref error b/c no search_ttl dirs
|
||||
if (search_domain_ary == null) Multi_wikis_changed();
|
||||
// get args
|
||||
Xog_search_suggest_mgr search_suggest_mgr = wiki.Appe().Gui_mgr().Search_suggest_mgr();
|
||||
@@ -61,7 +61,7 @@ public class Xows_page__search implements Xows_page, GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
if (Bry_.Len_eq_0(search_bry)) return; // emptry String; exit now, else null ref error; DATE:2015-08-11
|
||||
if ( search_suggest_mgr.Auto_wildcard() // add * automatically if option set
|
||||
&& wiki.Db_mgr().Tid() == gplx.xowa.dbs.Xodb_mgr_sql.Tid_sql // only apply to sql
|
||||
&& wiki.Db_mgr().Tid() == gplx.xowa.wikis.dbs.Xodb_mgr_sql.Tid_sql // only apply to sql
|
||||
&& Bry_find_.Find_fwd(search_bry, Byte_ascii.Star) == -1 // search term does not have asterisk
|
||||
)
|
||||
search_bry = Bry_.Add(search_bry, Byte_ascii.Star);
|
||||
@@ -101,4 +101,14 @@ public class Xows_page__search implements Xows_page, GfoInvkAble, GfoEvObj {
|
||||
public static final byte Match_tid_all = 0, Match_tid_bgn = 1;
|
||||
public static final byte Version_null = 0, Version_1 = 1, Version_2 = 2;
|
||||
private static final byte[] Qarg__fulltext = Bry_.new_a7("fulltext"), Qarg__fulltext__y = Bry_.new_a7("y");
|
||||
private static Xow_domain_itm[] Get_by_crt(gplx.xowa.wikis.xwikis.Xow_xwiki_mgr xwiki_mgr, Xow_domain_itm cur, gplx.xowa.wikis.domains.crts.Xow_domain_crt_itm crt) {
|
||||
List_adp rv = List_adp_.new_();
|
||||
int len = xwiki_mgr.Len();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
gplx.xowa.wikis.xwikis.Xow_xwiki_itm xwiki = xwiki_mgr.Get_at(i); if (!xwiki.Offline()) continue;
|
||||
Xow_domain_itm domain_itm = Xow_domain_itm_.parse(xwiki.Domain_bry());
|
||||
if (crt.Matches(cur, domain_itm)) rv.Add(domain_itm);
|
||||
}
|
||||
return (Xow_domain_itm[])rv.To_ary_and_clear(Xow_domain_itm.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class Xows_ui_async {
|
||||
byte[] insert_key = insert_row == null ? insert_new_key : insert_row.Key();
|
||||
Displace(new_row_slot, new_row);
|
||||
html_row.Gen_html(bfr, new_row);
|
||||
String html_tbl = bfr.Xto_str_and_clear();
|
||||
String html_tbl = bfr.To_str_and_clear();
|
||||
if (cxl.Canceled()) return;
|
||||
js_wkr.Html_elem_append_above(Html_utl.Encode_id_as_str(insert_key), html_tbl);
|
||||
if (last_row != null) {
|
||||
|
||||
@@ -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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import org.junit.*; import gplx.xowa.html.wtrs.*; import gplx.xowa.files.gui.*;
|
||||
import org.junit.*; import gplx.xowa.htmls.wtrs.*; import gplx.xowa.files.gui.*;
|
||||
public class Xows_ui_async_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xows_ui_async_fxt fxt = new Xows_ui_async_fxt();
|
||||
@Test public void Basic() {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.threads.*; import gplx.langs.htmls.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.files.gui.*; import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.files.gui.*; import gplx.xowa.guis.views.*;
|
||||
class Xows_ui_cmd implements GfoInvkAble, Cancelable, Xog_tab_close_lnr {
|
||||
private final Xows_core mgr; private final Xows_ui_qry qry; private final Xows_ui_rslt rslt;
|
||||
private final Xow_wiki wiki; private final Xoae_page page; private final Xog_tab_close_mgr tab_close_mgr; private final Xog_js_wkr js_wkr;
|
||||
@@ -25,7 +25,7 @@ class Xows_ui_cmd implements GfoInvkAble, Cancelable, Xog_tab_close_lnr {
|
||||
private Xows_db_cache cache;
|
||||
public Xows_ui_cmd(Xows_core mgr, Xows_ui_qry qry, Xow_wiki wiki, Xoae_page page, Xog_tab_close_mgr tab_close_mgr, Xog_js_wkr js_wkr) {
|
||||
this.mgr = mgr; this.qry = qry; this.wiki = wiki; this.page = page; this.tab_close_mgr = tab_close_mgr; this.js_wkr = js_wkr;
|
||||
this.async = wiki.App().App_type().Uid_is_gui() && qry.Async_db();
|
||||
this.async = wiki.App().Mode().Tid_is_gui() && qry.Async_db();
|
||||
this.rslt = new Xows_ui_rslt();
|
||||
this.key = Html_utl.Encode_id_as_bry(Bry_.Add(qry.Key(), Byte_ascii.Pipe_bry, wiki.Domain_bry()));
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class Xows_ui_cmd implements GfoInvkAble, Cancelable, Xog_tab_close_lnr {
|
||||
if (!cache.Done() && (qry.Itms_end() > cache.Itms_end())) {
|
||||
if (async) {
|
||||
fill_from_cache = false; // NOTE: do not retrieve cached results to page, else ui_async cmd will add out of order; DATE:2015-04-24
|
||||
if (async_wkr == null) async_wkr = new Xows_ui_async(this, new Xows_html_row(new gplx.xowa.html.wtrs.Xoh_lnki_bldr(wiki.App(), wiki.App().Html__href_wtr())), js_wkr, qry.Page_len(), wiki.Domain_bry());
|
||||
if (async_wkr == null) async_wkr = new Xows_ui_async(this, new Xows_html_row(new gplx.xowa.htmls.wtrs.Xoh_lnki_bldr(wiki.App(), wiki.App().Html__href_wtr())), js_wkr, qry.Page_len(), wiki.Domain_bry());
|
||||
Thread_adp_.invk_(gplx.xowa.apps.Xoa_thread_.Key_special_search_db, this, Invk_search_db).Start();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -19,9 +19,9 @@ package gplx.xowa.specials.search.parsers; import gplx.*; import gplx.xowa.*; im
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.langs.*;
|
||||
class Xows_text_parser__v1 {
|
||||
private Xol_lang lang; private Bry_bfr bfr = Bry_bfr.new_(255);
|
||||
private final Ordered_hash list = Ordered_hash_.new_bry_();
|
||||
public void Init(Xol_lang lang) {this.lang = lang;}
|
||||
private Xol_lang_itm lang; private Bry_bfr bfr = Bry_bfr.new_(255);
|
||||
private final Ordered_hash list = Ordered_hash_.New_bry();
|
||||
public void Init(Xol_lang_itm lang) {this.lang = lang;}
|
||||
public void Parse(byte[] src, int src_len, int bgn, int end) {
|
||||
if (lang != null) { // null lang passed in by searcher
|
||||
src = lang.Case_mgr().Case_build_lower(src);
|
||||
@@ -31,7 +31,7 @@ class Xows_text_parser__v1 {
|
||||
while (true) {
|
||||
if (word_done || i == src_len) {
|
||||
if (bfr.Len() > 0) {
|
||||
byte[] word = bfr.Xto_bry_and_clear();
|
||||
byte[] word = bfr.To_bry_and_clear();
|
||||
if (!list.Has(word)) list.Add(word, word); // don't add same word twice; EX: Title of "Can Can" should only have "Can" in index
|
||||
}
|
||||
if (i == src_len) break;
|
||||
|
||||
@@ -65,7 +65,7 @@ class Xows_text_parser__v2 {
|
||||
public void Word__add(int bgn__ws, int word_end) {
|
||||
if (bgn__ws == word_end) return; // handle situations like "A!" where sym is at eos
|
||||
if (bgn__ws == -1) return; // handle situations like "A... " where " " is different than "..."
|
||||
byte[] word = dirty ? bfr.Xto_bry_and_clear() : Bry_.Mid(src, bgn__ws, word_end);
|
||||
byte[] word = dirty ? bfr.To_bry_and_clear() : Bry_.Mid(src, bgn__ws, word_end);
|
||||
word_mgr.Add(word);
|
||||
if (bgn__dash != -1) {
|
||||
word_mgr.Add(Bry_.Mid(src, bgn__dash, word_end));
|
||||
@@ -83,7 +83,7 @@ class Xows_text_parser__v2 {
|
||||
public boolean Ws__is_word_end(int pos) {return parser__ws.Is_word_end(src, end, pos);}
|
||||
}
|
||||
class Xob_word_mgr {
|
||||
private final Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public void Clear() {hash.Clear();}
|
||||
public int Len() {return hash.Count();}
|
||||
public Xob_word_itm Get_at(int i) {return (Xob_word_itm)hash.Get_at(i);}
|
||||
|
||||
@@ -144,7 +144,7 @@ class Xows_text_parser__v2_fxt {
|
||||
tmp_bfr.Add(word.Word()).Add_byte_pipe();
|
||||
tmp_bfr.Add_int_variable(word.Count());
|
||||
}
|
||||
return tmp_bfr.Xto_str_and_clear();
|
||||
return tmp_bfr.To_str_and_clear();
|
||||
}
|
||||
private String To_str(Xob_word_mgr word_mgr) {
|
||||
int len = word_mgr.Len();
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.specials.search.parsers_old; import gplx.*; import gplx.xowa.*
|
||||
import gplx.core.primitives.*; import gplx.core.btries.*;
|
||||
class Xow_search_scanner {
|
||||
private final List_adp tkns = List_adp_.new_(); private byte[] src; private int src_len, pos, txt_bgn;
|
||||
private final Ordered_hash tmp_list = Ordered_hash_.new_(); private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
private final Ordered_hash tmp_list = Ordered_hash_.New(); private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
public Xow_search_tkn[] Scan(byte[] src) {
|
||||
this.src = src; this.src_len = src.length;
|
||||
tkns.Clear(); pos = 0; txt_bgn = -1;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
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.specials.search.quicks; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.search.*;
|
||||
public class Xoa_search_itm {
|
||||
public Xoa_search_itm(byte[] url, byte[] name, byte[] descrip, byte[] img) {
|
||||
this.url = url; this.name = name; this.descrip = descrip; this.img = img;
|
||||
}
|
||||
public byte[] Url() {return url;} private final byte[] url; // EX: en.wikipedia.org/wiki/Earth
|
||||
public byte[] Name() {return name;} private final byte[] name; // EX: Earth
|
||||
public byte[] Descrip() {return descrip;} private final byte[] descrip; // EX: Third planet from the Sun
|
||||
public byte[] Img() {return img;} private final byte[] img; // EX: Earth.png
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
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.specials.search.quicks; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.search.*;
|
||||
public class Xoa_search_mgr {
|
||||
public Xoa_search_itm[] Search(byte[] search) {
|
||||
// page_title LIKE 'Ear%'
|
||||
// page_title LIKE '%Ear%'
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
//namespace gplx.xowa.specials.search.quicks {
|
||||
// using gplx.dbs;
|
||||
// public class Xoa_search_tbl : RlsAble {
|
||||
// private final String tbl_name = "quick_search"; private final Db_meta_fld_list flds = Db_meta_fld_list.new_();
|
||||
// private final String fld_page_id, fld_page_title, fld_page_title_lower, fld_page_ns, fld_page_score, fld_page_len, fld_page_links, fld_page_descrip, fld_page_file_title;
|
||||
// private final Db_conn conn; // private Db_stmt stmt_insert, stmt_update, stmt_select;
|
||||
// public Db_conn Conn() {return conn;}
|
||||
// public Xoa_search_tbl(Db_conn conn) {
|
||||
// this.conn = conn;
|
||||
// fld_page_id = flds.Add_int ("page_id");
|
||||
// fld_page_title = flds.Add_str ("page_title", 255);
|
||||
// fld_page_title_lower = flds.Add_str ("page_title_lower", 255);
|
||||
// fld_page_ns = flds.Add_int ("page_ns");
|
||||
// fld_page_score = flds.Add_byte ("page_score");
|
||||
// fld_page_len = flds.Add_byte ("page_len");
|
||||
// fld_page_links = flds.Add_byte ("page_links");
|
||||
// fld_page_descrip = flds.Add_str ("page_descrip", 1024);
|
||||
// fld_page_file_title = flds.Add_str ("page_file_title", 255);
|
||||
// conn.Rls_reg(this);
|
||||
// }
|
||||
// public void Insert(int page_id, byte[] page_title, int page_ns, int page_score, int page_len, int page_links, byte[] page_descrip, byte[] page_file_title) {
|
||||
// Db_stmt stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
// stmt_insert.Clear()
|
||||
// .Val_int(fld_page_id, page_id).Val_bry_as_str(fld_page_title, page_title)
|
||||
// .Val_int(fld_page_ns, page_ns).Val_int(fld_page_len, page_len)
|
||||
// .Val_int(fld_page_links, page_links).Val_bry_as_str(fld_page_descrip, page_descrip)
|
||||
// .Val_bry_as_str(fld_page_file_title, page_file_title)
|
||||
// .Exec_insert();
|
||||
// }
|
||||
// public void Rls() {
|
||||
// }
|
||||
// }
|
||||
///*
|
||||
//quick_search
|
||||
//. page_id 123
|
||||
//. page_title Earth
|
||||
//. page_title_lower earth
|
||||
//. page_ns 0
|
||||
//. page_score 0
|
||||
//. page_len 140
|
||||
//. page_pagelinks 20
|
||||
//. page_descrip planet earth
|
||||
//. page_file Earth.png
|
||||
//
|
||||
//*/
|
||||
//}
|
||||
@@ -16,8 +16,8 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.statistics; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.xowa.nss.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xop_statistics_page implements Xows_page {
|
||||
private Xop_statistics_stats_page_grp stats_page = new Xop_statistics_stats_page_grp();
|
||||
// private Xop_statistics_stats_wiki_grp stats_wiki = new Xop_statistics_stats_wiki_grp();
|
||||
@@ -45,7 +45,7 @@ public class Xop_statistics_page implements Xows_page {
|
||||
}
|
||||
class Xop_statistics_stats_page_grp implements Bry_fmtr_arg {
|
||||
public void Wiki_(Xowe_wiki v) {this.wiki = v;} private Xowe_wiki wiki;
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
byte[] lbl_header_pages = wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_statistics_header_pages);
|
||||
byte[] lbl_articles = wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_statistics_articles);
|
||||
byte[] lbl_pages = wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_statistics_pages);
|
||||
@@ -71,7 +71,7 @@ class Xop_statistics_stats_page_grp implements Bry_fmtr_arg {
|
||||
class Xop_statistics_stats_ns_grp implements Bry_fmtr_arg {
|
||||
private Xop_statistics_stats_ns_itm ns_itm_fmtr = new Xop_statistics_stats_ns_itm();
|
||||
public void Wiki_(Xowe_wiki v) {this.wiki = v; ns_itm_fmtr.Wiki_(v);} private Xowe_wiki wiki;
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
byte[] lbl_header_ns = wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_statistics_header_ns);
|
||||
fmtr_ns_grp.Bld_bfr_many(bfr, lbl_header_ns, ns_itm_fmtr);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class Xop_statistics_stats_ns_grp implements Bry_fmtr_arg {
|
||||
}
|
||||
class Xop_statistics_stats_ns_itm implements Bry_fmtr_arg {
|
||||
public void Wiki_(Xowe_wiki v) {this.wiki = v;} private Xowe_wiki wiki;
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
Xow_ns_mgr ns_mgr = wiki.Ns_mgr();
|
||||
int ns_len = ns_mgr.Count();
|
||||
for (int i = 0; i < ns_len; i++) {
|
||||
@@ -105,7 +105,7 @@ class Xop_statistics_stats_ns_itm implements Bry_fmtr_arg {
|
||||
}
|
||||
class Xop_statistics_stats_wiki_grp implements Bry_fmtr_arg {
|
||||
public void Wiki_(Xowe_wiki v) {this.wiki = v;} private Xowe_wiki wiki;
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
fmtr_wiki.Bld_bfr_many(bfr, wiki.Db_mgr().Tid_name(), wiki.Fsys_mgr().Root_dir().Raw(), Byte_.To_str(wiki.Db_mgr().Category_version()), wiki.Maint_mgr().Wiki_dump_date().XtoStr_fmt_iso_8561());
|
||||
}
|
||||
private Bry_fmtr fmtr_wiki = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Default_tab_page implements Xows_page {
|
||||
public void Special_gen(Xowe_wiki wiki, Xoae_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
page.Data_raw_(Bry_.Empty);
|
||||
page.Html_data().Custom_html_(Bry_.Empty);
|
||||
page.Html_data().Custom_name_(Tab_name_bry);
|
||||
page.Html_data().Custom_tab_name_(Tab_name_bry);
|
||||
}
|
||||
public static final byte[] Tab_name_bry = Bry_.new_a7("New Tab");
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.specials.xowa.diags; import gplx.*; import gplx.xowa.*; import
|
||||
import gplx.core.net.*;
|
||||
import gplx.fsdb.*; import gplx.fsdb.meta.*;
|
||||
import gplx.xowa.files.origs.*;
|
||||
import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
class Xows_cmd__file_check {
|
||||
private Io_url tmp_dir;
|
||||
public void Exec(Bry_bfr bfr, Xoa_app app, Xoa_url url, Gfo_qarg_mgr arg_hash) {
|
||||
@@ -40,7 +40,7 @@ class Xows_cmd__file_check {
|
||||
Write_kv(bfr, "fsdb.atr_file", atr_main.Url());
|
||||
} catch (Exception e) {bfr.Add_str_u8(Err_.Message_gplx_full(e));}
|
||||
try {Write_kv(bfr, "fsdb.orig", wiki.File__fsdb_core().File__orig_tbl_ary()[0].Conn().Conn_info().Xto_raw());} catch (Exception e) {bfr.Add_str_u8(Err_.Message_gplx_full(e));}
|
||||
Fsdb_sql_mkr sql_mkr = schema_1 ? Fsdb_sql_mkr__v1.I : Fsdb_sql_mkr__v2.I;
|
||||
Fsdb_sql_mkr sql_mkr = schema_1 ? Fsdb_sql_mkr__v1.Instance : Fsdb_sql_mkr__v2.Instance;
|
||||
String sql = "";
|
||||
try {
|
||||
Xof_orig_tbl orig_tbl = wiki.File__fsdb_core().File__orig_tbl_ary()[0];
|
||||
@@ -96,10 +96,10 @@ class Xows_cmd__file_check {
|
||||
byte[] bin_data = (byte[])row[bin_data_ordinal];
|
||||
file_bry = gplx.xowa.files.repos.Xof_repo_itm_.Ttl_invalid_fsys_chars(tmp_bfr, file_bry);
|
||||
Io_url bin_url = tmp_dir.GenSubFil(String_.new_u8(file_bry));
|
||||
bin_url = tmp_dir.GenSubFil(bin_url.NameOnly() + "_" + Int_.Xto_str(owner_id) + bin_url.Ext());
|
||||
bin_url = tmp_dir.GenSubFil(bin_url.NameOnly() + "_" + Int_.To_str(owner_id) + bin_url.Ext());
|
||||
Write_kv(bfr, "fsdb.bin.export", bin_url.Raw());
|
||||
Write_kv(bfr, "fsdb.bin.len", bin_data.length);
|
||||
Io_mgr.I.SaveFilBry(bin_url, bin_data);
|
||||
Io_mgr.Instance.SaveFilBry(bin_url, bin_data);
|
||||
}
|
||||
}
|
||||
private static void Write_kv(Bry_bfr bfr, String key, Object val) {
|
||||
@@ -115,7 +115,7 @@ class Xows_cmd__file_check {
|
||||
bfr.Add_str_u8("------------------------------------------------------").Add_byte_nl();
|
||||
}
|
||||
private static final byte[] Arg_wiki = Bry_.new_a7("wiki"), Arg_file = Bry_.new_a7("file");
|
||||
public static final Xows_cmd__file_check I = new Xows_cmd__file_check(); Xows_cmd__file_check() {}
|
||||
public static final Xows_cmd__file_check Instance = new Xows_cmd__file_check(); Xows_cmd__file_check() {}
|
||||
}
|
||||
interface Fsdb_sql_mkr {
|
||||
String Orig_by_ttl(byte[] ttl);
|
||||
@@ -130,10 +130,10 @@ abstract class Fsdb_sql_mkr__base {
|
||||
class Fsdb_sql_mkr__v1 extends Fsdb_sql_mkr__base implements Fsdb_sql_mkr {
|
||||
public String Orig_by_ttl(byte[] ttl) {return String_.Format("SELECT * FROM wiki_orig WHERE orig_ttl = '{0}';", ttl);}
|
||||
public String Thm_by_id(int id) {return String_.Format("SELECT * FROM fsdb_xtn_thm WHERE thm_owner_id = {0};", id);}
|
||||
public static final Fsdb_sql_mkr I = new Fsdb_sql_mkr__v1(); Fsdb_sql_mkr__v1() {}
|
||||
public static final Fsdb_sql_mkr Instance = new Fsdb_sql_mkr__v1(); Fsdb_sql_mkr__v1() {}
|
||||
}
|
||||
class Fsdb_sql_mkr__v2 extends Fsdb_sql_mkr__base implements Fsdb_sql_mkr {
|
||||
public String Orig_by_ttl(byte[] ttl) {return String_.Format("SELECT * FROM orig_reg WHERE orig_ttl = '{0}';", ttl);}
|
||||
public String Thm_by_id(int id) {return String_.Format("SELECT * FROM fsdb_thm WHERE thm_owner_id = {0};", id);}
|
||||
public static final Fsdb_sql_mkr I = new Fsdb_sql_mkr__v2(); Fsdb_sql_mkr__v2() {}
|
||||
public static final Fsdb_sql_mkr Instance = new Fsdb_sql_mkr__v2(); Fsdb_sql_mkr__v2() {}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.specials.xowa.diags; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
|
||||
import gplx.ios.*; import gplx.core.net.*;
|
||||
import gplx.fsdb.meta.*;
|
||||
import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
class Xows_cmd__fs_check {
|
||||
public void Exec(Bry_bfr bfr, Xoa_app app, Xoa_url url, Gfo_qarg_mgr arg_hash) {
|
||||
byte[] dir_bry = arg_hash.Get_val_bry_or(Arg_dir, null);
|
||||
@@ -38,8 +38,8 @@ class Xows_cmd__fs_check {
|
||||
}
|
||||
private void Write_dir(Bry_bfr bfr, Io_url dir_url) {
|
||||
bfr.Add_byte_nl().Add_str_a7("scanning: ").Add_str_u8(dir_url.Raw()).Add_byte_nl();
|
||||
if (!Io_mgr.I.ExistsDir(dir_url)) return;
|
||||
IoItmDir dir_itm = Io_mgr.I.QueryDir_args(dir_url).Recur_(false).DirInclude_(true).ExecAsDir();
|
||||
if (!Io_mgr.Instance.ExistsDir(dir_url)) return;
|
||||
IoItmDir dir_itm = Io_mgr.Instance.QueryDir_args(dir_url).Recur_(false).DirInclude_(true).ExecAsDir();
|
||||
IoItmList sub_itms = dir_itm.SubDirs(); int len = sub_itms.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
try {
|
||||
@@ -55,6 +55,6 @@ class Xows_cmd__fs_check {
|
||||
} catch (Exception e) {bfr.Add_str_u8(Err_.Message_gplx_full(e));}
|
||||
}
|
||||
}
|
||||
public static final Xows_cmd__fs_check I = new Xows_cmd__fs_check(); Xows_cmd__fs_check() {}
|
||||
public static final Xows_cmd__fs_check Instance = new Xows_cmd__fs_check(); Xows_cmd__fs_check() {}
|
||||
private static final byte[] Arg_wiki = Bry_.new_a7("wiki"), Arg_dir = Bry_.new_a7("dir");
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.specials.xowa.diags; import gplx.*; import gplx.xowa.*; import
|
||||
import gplx.ios.*; import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.fsdb.meta.*;
|
||||
import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
class Xows_cmd__sql_dump {
|
||||
public void Exec(Bry_bfr bfr, Xoa_app app, Xoa_url url, Gfo_qarg_mgr arg_hash) {
|
||||
Db_conn conn = null;
|
||||
@@ -27,7 +27,7 @@ class Xows_cmd__sql_dump {
|
||||
byte[] wiki_bry = arg_hash.Get_val_bry_or(Arg_wiki, null);
|
||||
if (wiki_bry == null) {
|
||||
byte[] db_file_bry = arg_hash.Get_val_bry_or(Arg_db_file, null); if (db_file_bry == null) {Xoa_app_.Usr_dlg().Warn_many("", "", "special.cmd; no db_type: url=~{0}", url.Raw()); return;}
|
||||
conn = Db_conn_bldr.I.Get(Io_url_.new_fil_(String_.new_u8(db_file_bry)));
|
||||
conn = Db_conn_bldr.Instance.Get(Io_url_.new_fil_(String_.new_u8(db_file_bry)));
|
||||
}
|
||||
else {
|
||||
byte[] db_type_bry = arg_hash.Get_val_bry_or(Arg_db_type, null); if (db_type_bry == null) {Xoa_app_.Usr_dlg().Warn_many("", "", "special.cmd; no db_type: url=~{0}", url.Raw()); return;}
|
||||
@@ -41,7 +41,7 @@ class Xows_cmd__sql_dump {
|
||||
}
|
||||
Db_rdr_utl.Load_and_write(conn, String_.new_u8(sql_bry), bfr);
|
||||
}
|
||||
public static final Xows_cmd__sql_dump I = new Xows_cmd__sql_dump(); Xows_cmd__sql_dump() {}
|
||||
public static final Xows_cmd__sql_dump Instance = new Xows_cmd__sql_dump(); Xows_cmd__sql_dump() {}
|
||||
private static final byte[] Arg_wiki = Bry_.new_a7("wiki"), Arg_db_file = Bry_.new_a7("db_file"), Arg_db_type = Bry_.new_a7("db_type"), Arg_sql = Bry_.new_a7("sql");
|
||||
private static final byte Db_type_fsdb_abc = 1, Db_type_fsdb_atr = 2, Db_type_wiki_core = 3;
|
||||
private static final Hash_adp_bry db_type_hash = Hash_adp_bry.cs()
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.specials.xowa.diags; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
public class Xows_diag_page implements Xows_page {
|
||||
private Gfo_qarg_mgr arg_hash = new Gfo_qarg_mgr();
|
||||
public Xows_special_meta Special_meta() {return Xows_special_meta_.Itm__diag;}
|
||||
@@ -28,12 +28,12 @@ public class Xows_diag_page implements Xows_page {
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_m001();
|
||||
bfr.Add_str_a7("<pre>\n");
|
||||
switch (cmd_type_val.Val()) {
|
||||
case Type_file_check: Xows_cmd__file_check.I.Exec(bfr, wiki.App(), url, arg_hash); break;
|
||||
case Type_fs_check: Xows_cmd__fs_check.I.Exec(bfr, wiki.App(), url, arg_hash); break;
|
||||
case Type_sql_dump: Xows_cmd__sql_dump.I.Exec(bfr, wiki.App(), url, arg_hash); break;
|
||||
case Type_file_check: Xows_cmd__file_check.Instance.Exec(bfr, wiki.App(), url, arg_hash); break;
|
||||
case Type_fs_check: Xows_cmd__fs_check.Instance.Exec(bfr, wiki.App(), url, arg_hash); break;
|
||||
case Type_sql_dump: Xows_cmd__sql_dump.Instance.Exec(bfr, wiki.App(), url, arg_hash); break;
|
||||
}
|
||||
bfr.Add_str_a7("</pre>\n");
|
||||
page.Data_raw_(bfr.Xto_bry_and_clear());
|
||||
page.Data_raw_(bfr.To_bry_and_clear());
|
||||
}
|
||||
private static final byte[] Arg_type = Bry_.new_a7("type");
|
||||
private static final byte Type_file_check = 1, Type_fs_check = 2, Type_sql_dump = 3;
|
||||
|
||||
@@ -34,7 +34,7 @@ abstract class Xosp_fbrow_cmd__base implements Xosp_fbrow_cmd {
|
||||
String path_str = arg_mgr.Read_str_or_null("path"); if (path_str == null) return Xosp_fbrow_rslt.err_("url has unknown path");
|
||||
// if (Op_sys.Cur().Tid_is_wnt()) path_str = String_.Replace(path_str, "/", "\\");
|
||||
Io_url path_url = Io_url_.new_any_(path_str);
|
||||
IoItmDir dir = Io_mgr.I.QueryDir_args(path_url).DirInclude_(true).ExecAsDir();
|
||||
IoItmDir dir = Io_mgr.Instance.QueryDir_args(path_url).DirInclude_(true).ExecAsDir();
|
||||
dir.SubDirs().Sort(); dir.SubFils().Sort();
|
||||
Xosp_fbrow_data_dir dir_itm = Xosp_fbrow_data_dir.new_(dir);
|
||||
Process_itms(dir_itm);
|
||||
@@ -42,7 +42,7 @@ abstract class Xosp_fbrow_cmd__base implements Xosp_fbrow_cmd {
|
||||
byte[] cmd_src = this.Cmd_src();
|
||||
byte[] cmd_row = Html_body_cmd_row.Bld_bry_many(tmp_bfr, url_enc, cmd_src, this.Cmd_gui());
|
||||
html_wtr.Write(tmp_bfr, cmd_src, cmd_row, dir_itm);
|
||||
return new Xosp_fbrow_rslt(Html_head_default, tmp_bfr.Xto_bry_and_clear());
|
||||
return new Xosp_fbrow_rslt(Html_head_default, tmp_bfr.To_bry_and_clear());
|
||||
}
|
||||
else
|
||||
return Write_html_selected(arg_mgr, selected_str, select_invkable);
|
||||
@@ -110,7 +110,7 @@ class Xosp_fbrow_html implements Bry_fmtr_arg {
|
||||
, this
|
||||
);
|
||||
}
|
||||
public void XferAry(Bry_bfr bfr, int idx) {
|
||||
public void Fmt__do(Bry_bfr bfr) {
|
||||
int len = dir.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xosp_fbrow_data_sub itm = (Xosp_fbrow_data_sub)dir.Get_at(i);
|
||||
@@ -176,7 +176,7 @@ class Xosp_fbrow_cmd__err implements Xosp_fbrow_cmd {
|
||||
public Xosp_fbrow_cmd Make_new() {return this;}
|
||||
public Xosp_fbrow_rslt Write_html(Xoa_url_arg_mgr arg_mgr, GfoInvkAble select_invkable) {return Rslt;}
|
||||
private static final Xosp_fbrow_rslt Rslt = new Xosp_fbrow_rslt(Bry_.Empty, Bry_.new_a7("url has unknown cmd"));
|
||||
public static final Xosp_fbrow_cmd__err I = new Xosp_fbrow_cmd__err(); Xosp_fbrow_cmd__err() {}
|
||||
public static final Xosp_fbrow_cmd__err Instance = new Xosp_fbrow_cmd__err(); Xosp_fbrow_cmd__err() {}
|
||||
}
|
||||
class Xosp_fbrow_cmd__wiki_add extends Xosp_fbrow_cmd__base {
|
||||
@Override protected byte[] Cmd_src() {return Regy_key;}
|
||||
@@ -192,7 +192,7 @@ class Xosp_fbrow_cmd__wiki_add extends Xosp_fbrow_cmd__base {
|
||||
Xowv_wiki wiki = (Xowv_wiki)GfoInvkAble_.InvkCmd_val(select_invkable, Xoav_wiki_mgr.Invk_import_by_fil, path_str + wikis[0]);
|
||||
Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
done_fmtr.Bld_bfr_many(bfr, wiki.Domain_str());
|
||||
return new Xosp_fbrow_rslt(Bry_.Empty, bfr.Xto_bry_and_clear());
|
||||
return new Xosp_fbrow_rslt(Bry_.Empty, bfr.To_bry_and_clear());
|
||||
}
|
||||
private static final Bry_fmtr done_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( "<a href='/site/~{domain}/wiki/Earth'>~{domain} Main Page</a>"
|
||||
@@ -200,7 +200,7 @@ class Xosp_fbrow_cmd__wiki_add extends Xosp_fbrow_cmd__base {
|
||||
, "domain");
|
||||
private static final byte[] Ext_xowa = Bry_.new_a7(".xowa");
|
||||
public static final byte[] Regy_key = Bry_.new_a7("xowa.wiki.add");
|
||||
public static final Xosp_fbrow_cmd__wiki_add I = new Xosp_fbrow_cmd__wiki_add();
|
||||
public static final Xosp_fbrow_cmd__wiki_add Instance = new Xosp_fbrow_cmd__wiki_add();
|
||||
}
|
||||
class Xosp_fbrow_cmd__root_set extends Xosp_fbrow_cmd__base {
|
||||
@Override protected byte[] Cmd_src() {return Regy_key;}
|
||||
@@ -213,5 +213,5 @@ class Xosp_fbrow_cmd__root_set extends Xosp_fbrow_cmd__base {
|
||||
return new Xosp_fbrow_rslt(Bry_.Empty, Bry_.new_u8(selected));
|
||||
}
|
||||
public static final byte[] Regy_key = Bry_.new_a7("xowa.fsys.root_");
|
||||
public static final Xosp_fbrow_cmd__root_set I = new Xosp_fbrow_cmd__root_set();
|
||||
public static final Xosp_fbrow_cmd__root_set Instance = new Xosp_fbrow_cmd__root_set();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.specials.xowa.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
|
||||
import gplx.ios.*;
|
||||
class Xosp_fbrow_data_dir {
|
||||
private final Ordered_hash hash = Ordered_hash_.new_();
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
public Xosp_fbrow_data_dir(Io_url url) {this.url = url;}
|
||||
public Io_url Url() {return url;} private final Io_url url;
|
||||
public int Count() {return hash.Count();}
|
||||
|
||||
@@ -29,12 +29,12 @@ public class Xosp_fbrow_special implements Xows_page {
|
||||
public static Xosp_fbrow_rslt Gen(Gfo_qarg_itm[] args, GfoInvkAble select_invkable) {
|
||||
url_args.Init(args);
|
||||
byte[] cmd_bry = url_args.Read_bry_or_empty(Arg_cmd);
|
||||
Xosp_fbrow_cmd cmd = (Xosp_fbrow_cmd)cmd_regy.Get_by_bry(cmd_bry); if (cmd == null) cmd = Xosp_fbrow_cmd__err.I;
|
||||
Xosp_fbrow_cmd cmd = (Xosp_fbrow_cmd)cmd_regy.Get_by_bry(cmd_bry); if (cmd == null) cmd = Xosp_fbrow_cmd__err.Instance;
|
||||
return cmd.Make_new().Write_html(url_args, select_invkable);
|
||||
}
|
||||
private static final byte[] Arg_cmd = Bry_.new_a7("cmd");
|
||||
private static final Hash_adp_bry cmd_regy = Hash_adp_bry.cs()
|
||||
.Add_bry_obj(Xosp_fbrow_cmd__wiki_add.Regy_key, Xosp_fbrow_cmd__wiki_add.I)
|
||||
.Add_bry_obj(Xosp_fbrow_cmd__root_set.Regy_key, Xosp_fbrow_cmd__root_set.I)
|
||||
.Add_bry_obj(Xosp_fbrow_cmd__wiki_add.Regy_key, Xosp_fbrow_cmd__wiki_add.Instance)
|
||||
.Add_bry_obj(Xosp_fbrow_cmd__root_set.Regy_key, Xosp_fbrow_cmd__root_set.Instance)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -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.specials.xowa.popup_history; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
|
||||
import gplx.xowa.html.modules.popups.*;
|
||||
import gplx.xowa.htmls.modules.popups.*;
|
||||
public class Popup_history_page implements Xows_page {
|
||||
public Xows_special_meta Special_meta() {return Xows_special_meta_.Itm__popup_history;}
|
||||
public void Special_gen(Xowe_wiki wiki, Xoae_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.specials.xowa.system_data; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.urls.*;
|
||||
import gplx.xowa.apps.urls.*;
|
||||
public class System_data_page implements Xows_page {
|
||||
private Gfo_qarg_mgr arg_hash = new Gfo_qarg_mgr();
|
||||
public Xows_special_meta Special_meta() {return Xows_special_meta_.Itm__system_data;}
|
||||
@@ -28,7 +28,7 @@ public class System_data_page implements Xows_page {
|
||||
Byte_obj_val type_val = (Byte_obj_val)type_hash.Get_by_bry(file_type); if (type_val == null) return;
|
||||
Io_url file_url = Path_from_type(wiki, type_val.Val()); if (file_url == null) return;
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_m001();
|
||||
byte[] file_txt = Io_mgr.I.LoadFilBry(file_url);
|
||||
byte[] file_txt = Io_mgr.Instance.LoadFilBry(file_url);
|
||||
file_txt = gplx.langs.htmls.Html_utl.Escape_html_as_bry(file_txt, true, false, false, false, false); // escape < or "</pre>" in messages will cause pre to break
|
||||
fmtr_all.Bld_bfr_many(tmp_bfr, file_url.Raw(), file_txt);
|
||||
page.Data_raw_(tmp_bfr.To_bry_and_rls());
|
||||
@@ -38,7 +38,7 @@ public class System_data_page implements Xows_page {
|
||||
switch (type) {
|
||||
case Type_log_session: return app.Log_wtr().Session_fil();
|
||||
case Type_cfg_app: return app.Fsys_mgr().Cfg_app_fil();
|
||||
case Type_cfg_lang: return Xol_lang_.xo_lang_fil_(app.Fsys_mgr(), wiki.Lang().Key_str());
|
||||
case Type_cfg_lang: return Xol_lang_itm_.xo_lang_fil_(app.Fsys_mgr(), wiki.Lang().Key_str());
|
||||
case Type_cfg_user: return app.Usere().Fsys_mgr().App_data_cfg_user_fil();
|
||||
case Type_cfg_custom: return app.Usere().Fsys_mgr().App_data_cfg_custom_fil();
|
||||
case Type_usr_history: return app.Usere().Fsys_mgr().App_data_history_fil();
|
||||
|
||||
Reference in New Issue
Block a user