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

'v3.6.3.1'

This commit is contained in:
gnosygnu
2016-06-19 23:58:10 -04:00
parent 96636f3161
commit d4e8590345
1960 changed files with 20790 additions and 9272 deletions

View File

@@ -16,15 +16,15 @@ 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; import gplx.*; import gplx.xowa.*;
public class Xoa_special_mgr implements GfoInvkAble {
public class Xoa_special_mgr implements Gfo_invk {
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());
}
public void Add(String key, GfoInvkAble cfg) {hash.Add(key, cfg);}
public GfoInvkAble Get_or_null(String key) {return (GfoInvkAble)hash.Get_by(key);}
public void Add(String key, Gfo_invk cfg) {hash.Add(key, cfg);}
public Gfo_invk Get_or_null(String key) {return (Gfo_invk)hash.Get_by(key);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_get)) return Get_or_null(m.ReadStr("v"));
else return GfoInvkAble_.Rv_unhandled;
if (ctx.Match(k, Invk_get)) return Get_or_null(m.ReadStr("v"));
else return Gfo_invk_.Rv_unhandled;
} private static final String Invk_get = "get";
}

View File

@@ -0,0 +1,42 @@
/*
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; import gplx.*; import gplx.xowa.*;
public class Xow_special_meta {
public Xow_special_meta(int src, String key_str, String... aliases) {
this.src = src; this.key_str = key_str;
this.key_bry = Bry_.new_u8(key_str);
this.ttl_bry = Bry_.Add(gplx.xowa.wikis.nss.Xow_ns_.Bry__special, Byte_ascii.Colon_bry, key_bry);
this.ttl_str = String_.new_u8(ttl_bry);
this.aliases = Bry_.Ary(aliases);
}
public int Src() {return src;} private final int src; // either MW or XOWA
public String Key_str() {return key_str;} private final String key_str; // EX: AllPages
public byte[] Key_bry() {return key_bry;} private final byte[] key_bry;
public String Ttl_str() {return ttl_str;} private final String ttl_str; // EX: Special:AllPages
public byte[] Ttl_bry() {return ttl_bry;} private final byte[] ttl_bry;
public byte[][] Aliases() {return aliases;} private final byte[][] aliases; // EX: Special:RandomPage has Special:Random as alias
public byte[] Display_ttl() {return display_ttl;} private byte[] display_ttl; public Xow_special_meta Display_ttl_(String v) {display_ttl = Bry_.new_u8(v); return this;}
public boolean Match_ttl(Xoa_ttl ttl) {
return ttl.Ns().Id_is_special() && Bry_.Eq(ttl.Root_txt(), key_bry);
}
public static Xow_special_meta New_xo(String key, String display, String... aliases) {
return new Xow_special_meta(Xow_special_meta_.Src__xowa, key, aliases).Display_ttl_(display);
}
}

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.specials; import gplx.*; import gplx.xowa.*;
public class Xows_special_meta_ {
public class Xow_special_meta_ {
public static final int Src__mw = 1, Src__xowa = 2;
public static final String
Ttl__all_pages = "AllPages"
@@ -35,21 +35,21 @@ public class Xows_special_meta_ {
, Ttl__bookmarks = "XowaBookmarks"
, Ttl__diag = "XowaDiag"
;
public static final Xows_special_meta
Itm__all_pages = new Xows_special_meta(Src__mw , Ttl__all_pages)
, Itm__random = new Xows_special_meta(Src__mw , Ttl__random)
, Itm__random_root_page = new Xows_special_meta(Src__mw , Ttl__random_root_page)
, Itm__search = new Xows_special_meta(Src__mw , Ttl__search)
, Itm__statistics = new Xows_special_meta(Src__mw , Ttl__statistics)
, Itm__move_page = new Xows_special_meta(Src__xowa , Ttl__move_page)
, Itm__my_language = new Xows_special_meta(Src__xowa , Ttl__my_language)
, Itm__item_by_title = new Xows_special_meta(Src__xowa , Ttl__item_by_title)
, Itm__default_tab = new Xows_special_meta(Src__xowa , Ttl__default_tab)
, Itm__popup_history = new Xows_special_meta(Src__xowa , Ttl__popup_history)
, Itm__system_data = new Xows_special_meta(Src__xowa , Ttl__system_data)
, Itm__nearby = new Xows_special_meta(Src__xowa , Ttl__nearby)
, Itm__page_history = new Xows_special_meta(Src__xowa , Ttl__page_history)
, Itm__bookmarks = new Xows_special_meta(Src__xowa , Ttl__bookmarks)
, Itm__diag = new Xows_special_meta(Src__xowa , Ttl__diag)
public static final Xow_special_meta
Itm__all_pages = new Xow_special_meta(Src__mw , Ttl__all_pages)
, Itm__random = new Xow_special_meta(Src__mw , Ttl__random)
, Itm__random_root_page = new Xow_special_meta(Src__mw , Ttl__random_root_page)
, Itm__search = new Xow_special_meta(Src__mw , Ttl__search)
, Itm__statistics = new Xow_special_meta(Src__mw , Ttl__statistics)
, Itm__move_page = new Xow_special_meta(Src__xowa , Ttl__move_page)
, Itm__my_language = new Xow_special_meta(Src__xowa , Ttl__my_language)
, Itm__item_by_title = new Xow_special_meta(Src__xowa , Ttl__item_by_title)
, Itm__default_tab = new Xow_special_meta(Src__xowa , Ttl__default_tab)
, Itm__popup_history = new Xow_special_meta(Src__xowa , Ttl__popup_history)
, Itm__system_data = new Xow_special_meta(Src__xowa , Ttl__system_data)
, Itm__nearby = new Xow_special_meta(Src__xowa , Ttl__nearby)
, Itm__page_history = new Xow_special_meta(Src__xowa , Ttl__page_history)
, Itm__bookmarks = new Xow_special_meta(Src__xowa , Ttl__bookmarks)
, Itm__diag = new Xow_special_meta(Src__xowa , Ttl__diag)
;
}

View File

@@ -19,24 +19,23 @@ package gplx.xowa.specials; import gplx.*; import gplx.xowa.*;
import gplx.xowa.users.history.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.specials.*;
import gplx.xowa.specials.*;
import gplx.xowa.specials.allPages.*; 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.addons.apps.file_browsers.*; import gplx.xowa.specials.xowa.diags.*;
import gplx.xowa.specials.allPages.*; import gplx.xowa.specials.nearby.*; 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.addons.wikis.imports.*; import gplx.xowa.specials.xowa.diags.*;
import gplx.xowa.xtns.wdatas.specials.*;
import gplx.xowa.addons.apps.searchs.specials.*;
import gplx.xowa.users.data.*; import gplx.xowa.users.bmks.*;
public class Xows_mgr {
import gplx.xowa.specials.mgrs.*; import gplx.xowa.addons.wikis.searchs.specials.*;
public class Xow_special_mgr {
private final Hash_adp_bry hash;
public Xows_mgr(Xowe_wiki wiki, Xol_lang_itm lang) {
private Xoa_app app;
public Xow_special_mgr(Xowe_wiki wiki, Xol_lang_itm lang) {
this.app = wiki.App();
hash = Hash_adp_bry.ci_u8(lang.Case_mgr());
page_allpages = new Xows_page_allpages(wiki);
page_search = new Srch_special_page(wiki);
page_random = new Xows_page_random(wiki);
Evt_lang_changed(wiki.Lang());
}
public Xows_page_allpages Page_allpages() {return page_allpages;} private final Xows_page_allpages page_allpages;
public Srch_special_page Page_search() {return page_search;} private final Srch_special_page page_search;
public Xows_page_random Page_random() {return page_random;} private final Xows_page_random page_random;
public Xop_randomRootPage_page Page_randomRootPage() {return page_randomRootPage;} private final Xop_randomRootPage_page page_randomRootPage = new Xop_randomRootPage_page();
public Xou_history_html Page_history() {return page_history;} private final Xou_history_html page_history = new Xou_history_html();
public Xoud_history_special Page_history2() {return page_history2;} private final Xoud_history_special page_history2 = new Xoud_history_special();
public Nearby_mgr Page_nearby() {return page_nearby;} private final Nearby_mgr page_nearby = new Nearby_mgr();
@@ -50,50 +49,62 @@ public class Xows_mgr {
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_itm lang) {
// add special pages by old manual method; DEPRECATED
hash.Clear();
hash.Add_str_obj(Xows_special_meta_.Ttl__search , page_search);
hash.Add_str_obj(Xows_special_meta_.Ttl__all_pages , page_allpages);
hash.Add_str_obj(Xow_special_meta_.Ttl__search , page_search);
hash.Add_str_obj(Xow_special_meta_.Ttl__all_pages , page_allpages);
hash.Add_str_obj("prefixindex" , page_allpages);
hash.Add_str_obj(Xows_special_meta_.Ttl__random , page_random);
hash.Add_str_obj("random" , page_random);
hash.Add_str_obj(Xows_special_meta_.Ttl__random_root_page , page_randomRootPage);
hash.Add_bry_obj(Xou_history_mgr.Ttl_name , page_history);
hash.Add_str_obj(Xows_special_meta_.Ttl__page_history , page_history2);
hash.Add_str_obj(Xows_special_meta_.Ttl__nearby , page_nearby);
hash.Add_str_obj(Xows_special_meta_.Ttl__my_language , page_mylanguage);
hash.Add_str_obj(Xows_special_meta_.Ttl__item_by_title , page_itemByTitle);
hash.Add_str_obj(Xows_special_meta_.Ttl__statistics , page_statistics);
hash.Add_str_obj(Xows_special_meta_.Ttl__move_page , page_movePage);
hash.Add_str_obj(Xows_special_meta_.Ttl__system_data , page_system_data);
hash.Add_str_obj(Xows_special_meta_.Ttl__default_tab , page_default_tab);
hash.Add_str_obj(Xows_special_meta_.Ttl__popup_history , page_popup_history);
hash.Add_str_obj(Xows_special_meta_.Ttl__bookmarks , page_bmk);
hash.Add_str_obj(Xows_special_meta_.Ttl__diag , page_diag);
hash.Add_str_obj(Xow_special_meta_.Ttl__page_history , page_history2);
hash.Add_str_obj(Xow_special_meta_.Ttl__nearby , page_nearby);
hash.Add_str_obj(Xow_special_meta_.Ttl__my_language , page_mylanguage);
hash.Add_str_obj(Xow_special_meta_.Ttl__item_by_title , page_itemByTitle);
hash.Add_str_obj(Xow_special_meta_.Ttl__statistics , page_statistics);
hash.Add_str_obj(Xow_special_meta_.Ttl__move_page , page_movePage);
hash.Add_str_obj(Xow_special_meta_.Ttl__system_data , page_system_data);
hash.Add_str_obj(Xow_special_meta_.Ttl__default_tab , page_default_tab);
hash.Add_str_obj(Xow_special_meta_.Ttl__popup_history , page_popup_history);
hash.Add_str_obj(Xow_special_meta_.Ttl__bookmarks , page_bmk);
hash.Add_str_obj(Xow_special_meta_.Ttl__diag , page_diag);
// add app's Special_regy to hash table; needed for case insensitivity by wiki's lang; EX: Special:rANDom; NOTE: needs to go before lang aliases
Xoa_special_regy special_regy = app.Special_regy();
int len = special_regy.Len();
for (int i = 0; i < len; ++i) {
Xow_special_page proto = special_regy.Get_at(i);
Xow_special_meta proto_meta = proto.Special__meta();
hash.Add_if_dupe_use_1st(proto_meta.Key_bry(), proto);
for (byte[] alias : proto_meta.Aliases())
hash.Add_if_dupe_use_1st(alias, proto);
}
// add lang's special aliases to hash table; EX: Special:Recherche
Xol_specials_mgr lang_mgr = lang.Specials_mgr();
len = lang_mgr.Len();
for (int i = 0; i < len; ++i) {
Xol_specials_itm lang_itm = lang_mgr.Get_at(i);
Xow_special_page page = (Xow_special_page)hash.Get_by_bry(lang_itm.Special());
if (page == null) continue; // NOTE: ignore specials that are not in XOWA; EX: Special:ChangeEmail
for (byte[] alias : lang_itm.Aliases())
hash.Add_if_dupe_use_1st(alias, page);
}
}
public void Special__gen(Xoa_app app, Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
int slash_pos = Bry_find_.Find_fwd(ttl.Page_txt_wo_qargs(), Xoa_ttl.Subpage_spr); // check for slash
byte[] special_name = slash_pos == Bry_find_.Not_found
? ttl.Base_txt_wo_qarg() // no slash found; use base_txt; ignore qry args and just get page_names; EX: Search/Earth?fulltext=y; Allpages?from=Earth...
: Bry_.Mid(ttl.Page_txt_wo_qargs(), 0, slash_pos); // slash found; use root page; EX: Special:ItemByTitle/enwiki/Earth
Xows_page special = app.Special_regy().Get_by_or_null(special_name);
if (special == null) { // special_name not in app_regy; try wiki_regy
special = (Xows_page)hash.Get_by_bry(special_name);
if (special == null) { // special_name not in wiki_regy; try alias;
Xol_specials_itm special_itm = wiki.Lang().Specials_mgr().Get_by_alias(special_name);
if (special_itm != null)
special = (Xows_page)hash.Get_by_bry(special_itm.Special());
}
}
else {
special = special.Special__clone();
}
special_name = Xoa_ttl.Replace_spaces(special_name); // handle spaces; EX:Spezial:Zufällige_Seite
Xow_special_page special = (Xow_special_page)hash.Get_by_bry(special_name);
if (special != null) { // special found; generate it;
special = special.Special__clone();
page.Revision_data().Modified_on_(DateAdp_.Now());
special.Special__gen(wiki, page, url, ttl);
try {special.Special__gen(wiki, page, url, ttl);}
catch (Exception e) {Gfo_log_.Instance.Warn("failed to generate special page", "url", url.To_str(), "err", Err_.Message_gplx_log(e));}
}
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_search)) return page_search;
else return GfoInvkAble_.Rv_unhandled;
else return Gfo_invk_.Rv_unhandled;
} private static final String Invk_search = "search";
}

View File

@@ -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; import gplx.*; import gplx.xowa.*;
public interface Xows_page {
Xows_special_meta Special__meta();
Xows_page Special__clone();
public interface Xow_special_page {
Xow_special_meta Special__meta();
Xow_special_page Special__clone();
void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl);
}

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.specials; import gplx.*; import gplx.xowa.*;
import gplx.langs.mustaches.*; import gplx.xowa.wikis.pages.*;
public abstract class Xow_special_wtr__base {
public void Bld_page_by_mustache(Xoa_app app, Xoa_page page, Xow_special_page special) {
Mustache_doc_itm mustache_root = Bld_mustache_root(app);
if (mustache_root == null) { // handle invalid urls; EX: Special:XowaWikiInfo?wiki=deleted_wiki
Handle_invalid(app, page, special);
return;
}
Io_url addon_dir = this.Get_addon_dir(app);
byte[] body = Bld_html_body(addon_dir, mustache_root);
Xopage_html_data page_data = new Xopage_html_data(special.Special__meta().Display_ttl(), body);
Bld_tags(app, addon_dir, page_data);
page_data.Apply(page);
}
@gplx.Virtual protected byte[] Bld_html_body(Io_url addon_dir, gplx.langs.mustaches.Mustache_doc_itm itm) {
byte[] tmpl = Io_mgr.Instance.LoadFilBry(this.Get_mustache_fil(addon_dir));
return gplx.langs.mustaches.Mustache_wtr_.Write_to_bry(Bry_bfr_.New(), tmpl, itm);
}
protected abstract Io_url Get_addon_dir(Xoa_app app);
protected abstract Io_url Get_mustache_fil(Io_url addon_dir);
protected abstract Mustache_doc_itm Bld_mustache_root(Xoa_app app);
protected abstract void Bld_tags(Xoa_app app, Io_url addon_dir, Xopage_html_data data);
@gplx.Virtual protected void Handle_invalid(Xoa_app app, Xoa_page page, Xow_special_page special) {
new Xopage_html_data(special.Special__meta().Display_ttl(), Bry_.new_a7("Not available")).Apply(page);
}
}

View File

@@ -1,34 +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.specials; import gplx.*; import gplx.xowa.*;
public class Xows_special_meta {
public Xows_special_meta(int src, String key_str) {
this.src = src; this.key_str = key_str;
this.key_bry = Bry_.new_u8(key_str);
this.ttl_str = "Special:" + key_str; // canonical name
this.ttl_bry = Bry_.new_u8(ttl_str);
}
public int Src() {return src;} private final int src;
public String Key_str() {return key_str;} private final String key_str;
public byte[] Key_bry() {return key_bry;} private final byte[] key_bry;
public String Ttl_str() {return ttl_str;} private final String ttl_str;
public byte[] Ttl_bry() {return ttl_bry;} private final byte[] ttl_bry;
public boolean Match_ttl(Xoa_ttl ttl) {
return ttl.Ns().Id_is_special() && Bry_.Eq(ttl.Root_txt(), key_bry);
}
}

View File

@@ -16,18 +16,18 @@ 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.allPages; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
import gplx.core.primitives.*; import gplx.core.net.*; import gplx.core.brys.fmtrs.*;
import gplx.core.primitives.*; import gplx.core.net.*; import gplx.core.net.qargs.*; import gplx.core.brys.fmtrs.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
import gplx.xowa.wikis.nss.*;
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.hrefs.*; import gplx.xowa.htmls.core.wkrs.lnkis.htmls.*;
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.apps.urls.*;
public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, GfoInvkAble, Xows_page {
public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, Gfo_invk, Xow_special_page {
public Xows_page_allpages(Xowe_wiki wiki) {
this.wiki = wiki;
html_itm_fmtr = new Xos_pagelist_html_itm_fmtr(this, wiki);
} private Xos_pagelist_html_itm_fmtr html_itm_fmtr;
public Xows_special_meta Special__meta() {return Xows_special_meta_.Itm__all_pages;}
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__all_pages;}
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
public Bry_fmtr Html_all() {return html_all;} Bry_fmtr html_all = Bry_fmtr.new_(String_.Concat_lines_nl
( "<table class=\"mw-allpages-table-form\">"
@@ -81,7 +81,7 @@ public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, GfoInvkAble,
boolean found = Build_data(url, ttl); if (!found) return;
Build_html(page);
}
private static byte[] Get_from(Gfo_qarg_mgr arg_hash, Xowe_wiki wiki, Xoa_url url, Xoa_ttl ttl) {
private static byte[] Get_from(Gfo_qarg_mgr_old arg_hash, Xowe_wiki wiki, Xoa_url url, Xoa_ttl ttl) {
return ttl.Leaf_bgn() == -1
? arg_hash.Get_val_bry_or(Bry_arg_from, null)
: ttl.Leaf_url()
@@ -105,11 +105,11 @@ public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, GfoInvkAble,
arg_hash.Set_val_by_bry(Bry_arg_from, from_ttl.Page_db());
url.Qargs_ary_(arg_hash.To_ary());
}
Int_obj_ref rslt_len = Int_obj_ref.new_(rslt_list_len);
Int_obj_ref rslt_len = Int_obj_ref.New(rslt_list_len);
Xowd_page_itm rslt_nxt2 = new Xowd_page_itm();
Xowd_page_itm rslt_prv2 = new Xowd_page_itm();
int all_pages_min = 0;// no minimum for all pages
List_adp rslt_list = List_adp_.new_();
List_adp rslt_list = List_adp_.New();
wiki.Db_mgr().Load_mgr().Load_ttls_for_all_pages(Cancelable_.Never, rslt_list, rslt_nxt2, rslt_prv2, rslt_len, init_ns, from_ttl.Page_db(), itms_per_page, all_pages_min, itms_per_page, !hide_redirects_val, true);
rslt_list_len = rslt_len.Val();
for (int i = 0; i < rslt_list_len; i++)
@@ -117,7 +117,7 @@ public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, GfoInvkAble,
rslt_nxt = rslt_nxt2;
rslt_prv = rslt_prv2;
return true;
} private Gfo_qarg_mgr arg_hash = new Gfo_qarg_mgr();
} private Gfo_qarg_mgr_old arg_hash = new Gfo_qarg_mgr_old();
private static final byte[] Bry_arg_from = Bry_.new_a7("from"), Bry_arg_ns = Bry_.new_a7("namespace"), Bry_arg_hideredirects = Bry_.new_a7("hideredirects");
public Xow_ns Init_ns() {return init_ns;} private Xow_ns init_ns;
public void Build_html(Xoae_page page) {
@@ -161,14 +161,14 @@ public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, GfoInvkAble,
else if (ctx.Match(k, Invk_itms_per_page_)) Itms_per_page_(m.ReadInt("v"));
else if (ctx.Match(k, Invk_itms_per_grp_)) itms_per_grp = m.ReadInt("v");
else if (ctx.Match(k, Invk_show_redirects_)) show_redirects = m.ReadYn("v");
else return GfoInvkAble_.Rv_unhandled;
else return Gfo_invk_.Rv_unhandled;
return this;
}
public static final String Invk_html_all_ = "html_all_", Invk_html_list_grp_ = "html_list_grp_", Invk_html_list_itm_normal_ = "html_list_itm_normal_", Invk_html_list_itm_redirect_ = "html_list_itm_redirect_"
, Invk_itms_per_page_ = "itms_per_page_", Invk_itms_per_grp_ = "itms_per_grp_", Invk_show_redirects_ = "show_redirects_";
public static final String GRP_KEY = "xowa.special.allpages";
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}
class Xos_pagelist_html_itm_fmtr implements gplx.core.brys.Bfr_arg {
public Xos_pagelist_html_itm_fmtr(Xows_page_allpages mgr, Xowe_wiki wiki) {

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.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 org.junit.*; import gplx.core.net.*; import gplx.core.net.qargs.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.wikis.nss.*;
import gplx.xowa.wikis.tdbs.hives.*;
public class Xows_page_allpages_tst {
@@ -127,7 +127,7 @@ class Xows_page_allpages_fxt {
app = Xoa_app_fxt.Make__app__edit();
wiki = Xoa_app_fxt.Make__wiki__edit(app);
allpages = wiki.Special_mgr().Page_allpages();
GfoInvkAble_.InvkCmd_val(allpages, Xows_page_allpages.Invk_itms_per_page_, 5);
Gfo_invk_.Invk_by_val(allpages, Xows_page_allpages.Invk_itms_per_page_, 5);
}
init_ttl_leaf = "";
expd_prv = expd_nxt = null;
@@ -136,10 +136,10 @@ class Xows_page_allpages_fxt {
return this;
} private Xoae_app app;
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki; Xows_page_allpages allpages;
public Xows_page_allpages_fxt Init_arg(String key, String val) {init_args.Add(new Gfo_qarg_itm(Bry_.new_a7(key), Bry_.new_a7(val))); return this;} private List_adp init_args = List_adp_.new_();
public Xows_page_allpages_fxt Init_arg(String key, String val) {init_args.Add(new Gfo_qarg_itm(Bry_.new_a7(key), Bry_.new_a7(val))); return this;} private List_adp init_args = List_adp_.New();
public Xows_page_allpages_fxt Init_ttl_leaf(String val) {init_ttl_leaf = val; return this;} private String init_ttl_leaf;
public Xows_page_allpages_fxt Init_itms_per_page(int v) {init_itms_per_page = v; return this;} private int init_itms_per_page = 5;
public Xows_page_allpages_fxt Expd_arg(String key, String val) {expd_args.Add(new Gfo_qarg_itm(Bry_.new_a7(key), Bry_.new_a7(val))); return this;} private List_adp expd_args = List_adp_.new_();
public Xows_page_allpages_fxt Expd_arg(String key, String val) {expd_args.Add(new Gfo_qarg_itm(Bry_.new_a7(key), Bry_.new_a7(val))); return this;} private List_adp expd_args = List_adp_.New();
public Xows_page_allpages_fxt Expd_prv(String v) {expd_prv = v; return this;} private String expd_prv;
public Xows_page_allpages_fxt Expd_nxt(String v) {expd_nxt = v; return this;} private String expd_nxt;
public Xows_page_allpages_fxt Expd_ttls(String... v) {expd_ttls = v; return this;} private String[] expd_ttls;
@@ -171,7 +171,7 @@ class Xows_page_allpages_fxt {
return rv;
}
public Xows_page_allpages_fxt Test_special_gen() {
init_url = app.User().Wikii().Utl__url_parser().Parse(Xows_special_meta_.Itm__all_pages.Ttl_bry());
init_url = app.User().Wikii().Utl__url_parser().Parse(Xow_special_meta_.Itm__all_pages.Ttl_bry());
Xoa_ttl init_ttl = Make_init_ttl();
allpages.Special__gen(wiki, wiki.Parser_mgr().Ctx().Page(), init_url, init_ttl);
if (expd_display_ttl != null) Tfds.Eq(expd_display_ttl, String_.new_u8(wiki.Parser_mgr().Ctx().Page().Html_data().Display_ttl()));
@@ -202,5 +202,5 @@ class Xows_page_allpages_fxt {
Xoa_ttl init_ttl = Make_init_ttl();
allpages.Build_data(init_url, init_ttl);
}
private Xoa_ttl Make_init_ttl() {return Xoa_ttl.parse(wiki, Bry_.new_u8(Xows_special_meta_.Itm__all_pages.Ttl_str() + init_ttl_leaf));}
private Xoa_ttl Make_init_ttl() {return Xoa_ttl.parse(wiki, Bry_.new_u8(Xow_special_meta_.Itm__all_pages.Ttl_str() + init_ttl_leaf));}
}

View File

@@ -0,0 +1,32 @@
/*
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.mgrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
import gplx.xowa.specials.*;
public class Xoa_special_regy {
private final Ordered_hash hash = Ordered_hash_.New_bry(); // NOTE: case-sensitive; case-insensitive requires lang, but regy is at app level
public int Len() {return hash.Len();}
public Xow_special_page Get_at(int i) {return (Xow_special_page)hash.Get_at(i);}
public Xow_special_page Get_by_or_null(byte[] key) {return (Xow_special_page)hash.Get_by(key);}
public void Add(Xow_special_page page) {
hash.Add(page.Special__meta().Key_bry(), page);
byte[][] aliases = page.Special__meta().Aliases();
for (byte[] alias : aliases)
hash.Add(alias, page);
}
public void Add_many(Xow_special_page... ary) {for (Xow_special_page itm : ary) Add(itm);}
}

View File

@@ -0,0 +1,54 @@
/*
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.mgrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
import gplx.core.net.*;
import gplx.xowa.htmls.*;
import gplx.xowa.wikis.*;
import gplx.xowa.langs.specials.*;
public class Xosp_special_mgr {
// private final Xowv_wiki wiki;
private final Hash_adp_bry hash;
public Xosp_special_mgr(Xowv_wiki wiki) {
// this.wiki = wiki;
// hash.Add_str_obj(Xow_special_meta_.Ttl__statistics , page_statistics);
this.hash = Hash_adp_bry.cs();
}
public void Get_by_ttl(Xoh_page rv, Gfo_url url, Xoa_ttl ttl) {
// Xosp_fbrow_rslt rslt = Xosp_fbrow_special.Gen(url.Qargs(), wiki.Appv().Wiki_mgr());
// rv.Init(wiki, null, ttl, -1);
// rv.Body_(rslt.Html_body());
// rv.Html_head_xtn_(rslt.Html_head());
}
public void Get_by_url1(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
int slash_pos = Bry_find_.Find_fwd(ttl.Page_txt_wo_qargs(), Xoa_ttl.Subpage_spr); // check for slash
byte[] special_name = slash_pos == Bry_find_.Not_found
? ttl.Base_txt_wo_qarg() // no slash found; use base_txt; ignore qry args and just get page_names; EX: Search/Earth?fulltext=y; Allpages?from=Earth...
: Bry_.Mid(ttl.Page_txt_wo_qargs(), 0, slash_pos); // slash found; use root page; EX: Special:ItemByTitle/enwiki/Earth
Object o = hash.Get_by_bry(special_name);
if (o == null) {
Xol_specials_itm special_itm = wiki.Lang().Specials_mgr().Get_by_alias(special_name);
if (special_itm != null)
o = hash.Get_by_bry(special_itm.Special());
}
if (o != null) {
// Xow_special_page special = (Xow_special_page)o;
// page.Revision_data().Modified_on_(DateAdp_.Now());
// special.Special__gen(wiki, page, url, ttl);
}
}
}

View File

@@ -16,16 +16,16 @@ 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.movePage; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*; import gplx.core.net.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*; import gplx.core.net.*; import gplx.core.net.qargs.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.langs.msgs.*;
import gplx.xowa.htmls.hrefs.*;
import gplx.xowa.wikis.nss.*;
import gplx.xowa.parsers.utils.*;
public class Move_page implements Xows_page {
public class Move_page implements Xow_special_page {
private Move_trg_ns_list_fmtr ns_list_fmtr = new Move_trg_ns_list_fmtr();
private Move_url_args args = new Move_url_args();
private Xoa_ttl src_ttl;
public Xows_special_meta Special__meta() {return Xows_special_meta_.Itm__move_page;}
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__move_page;}
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
args.Parse(url);
@@ -121,7 +121,7 @@ public class Move_page implements Xows_page {
, "</form>"
), "move-page-legend", "src_href", "src_title", "src_text", "newtitle", "trg_ns_list", "trg_title", "move-leave-redirect", "movepagebtn");
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}
class Move_trg_ns_list_fmtr implements gplx.core.brys.Bfr_arg {
private Xowe_wiki wiki; private Xoa_ttl ttl;

View File

@@ -18,18 +18,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.specials.nearby; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
import gplx.core.brys.fmtrs.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*;
public class Nearby_mgr implements Xows_page {
public class Nearby_mgr implements Xow_special_page {
Xowe_wiki wiki; byte[] trg;
private Hash_adp_bry excluded = Hash_adp_bry.ci_a7();
private Hash_adp_bry visited = Hash_adp_bry.ci_a7();
List_adp trail = List_adp_.new_();
List_adp results = List_adp_.new_();
List_adp trail = List_adp_.New();
List_adp results = List_adp_.New();
int results_cur = 0;
// int depth_max = 5;
// int pages_count = 0;
Bry_bfr tmp_bfr = Bry_bfr.new_();
Bry_bfr tmp_bfr = Bry_bfr_.New();
public int Results_max() {return results_max;} public Nearby_mgr Results_max_(int v) {results_max = v; return this;} private int results_max = 1;
public Xows_special_meta Special__meta() {return Xows_special_meta_.Itm__nearby;}
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__nearby;}
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
page.Data_raw_(Bld_html(wiki));
@@ -94,7 +94,7 @@ public class Nearby_mgr implements Xows_page {
if (excluded.Has(ttl_bry)) continue;
if (visited.Has(ttl_bry)) continue;
visited.Add_bry_bry(ttl_bry);
Xoae_page page = wiki.Data_mgr().Get_page(ttl, false);
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(ttl);
if (page.Missing()) continue;
wiki.Parser_mgr().Parse(page, true);
Ordered_hash lnkis = Ordered_hash_.New_bry();
@@ -124,7 +124,7 @@ public class Nearby_mgr implements Xows_page {
// if (Bry_.Eq(lnki_ttl.Page_db(), trg)) continue; // skip trg page
// trail.Add(lnki_ttl);
// Examine_page(wiki, lnki_ttl, trail);
// List_adp_.DelAt_last(trail);
// List_adp_.Del_at_last(trail);
// if (results_cur == results_max) return;
// }
}
@@ -151,7 +151,7 @@ public class Nearby_mgr implements Xows_page {
// if (Bry_.Eq(lnki_ttl.Page_db(), trg)) continue; // skip trg page
// trail.Add(lnki_ttl);
// Examine_page(wiki, lnki_ttl, trail);
// List_adp_.DelAt_last(trail);
// List_adp_.Del_at_last(trail);
// if (results_cur == results_max) return;
// }
// }
@@ -171,7 +171,7 @@ public class Nearby_mgr implements Xows_page {
}
}
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}
class Nearby_rslt {
public Nearby_rslt(List_adp trail, Xoa_ttl trg_ttl) {
@@ -184,7 +184,7 @@ class Nearby_rslt {
}
public int Len() {return list.Count();}
public Xoa_ttl Get_at(int i) {return (Xoa_ttl)list.Get_at(i);}
List_adp list = List_adp_.new_();
List_adp list = List_adp_.New();
}
class Nearby_itmx {
public Nearby_itmx(List_adp v, Xoa_ttl ttl) {
@@ -197,5 +197,5 @@ class Nearby_itmx {
this.ttl = ttl;
}
public Xoa_ttl Ttl() {return ttl;} private Xoa_ttl ttl;
public List_adp Trail() {return trail;} List_adp trail = List_adp_.new_();
public List_adp Trail() {return trail;} List_adp trail = List_adp_.New();
}

View File

@@ -47,7 +47,7 @@ class Nearby_mgr_fxt {
fxt = new Xop_fxt();
nearby_mgr = new Nearby_mgr();
excluded = Hash_adp_bry.ci_a7();
tmp_bfr = Bry_bfr.new_();
tmp_bfr = Bry_bfr_.New();
}
fxt.Reset();
Io_mgr.Instance.InitEngine_mem();

View File

@@ -1,31 +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.specials.randoms; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
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(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
Xow_ns ns = wiki.Ns_mgr().Names_get_or_main(ttl.Rest_txt());
byte[] random_ttl_bry = wiki.Db_mgr().Load_mgr().Find_random_ttl(ns);
byte[] root_bry = Xoa_ttl.parse(wiki, random_ttl_bry).Root_txt();
wiki.Data_mgr().Redirect(page, ns.Gen_ttl(root_bry));
}
public Xows_page Special__clone() {return this;}
}

View File

@@ -1,55 +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.specials.randoms; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
import org.junit.*;
public class Xop_randomRootPage_page_tst {
@Before public void init() {fxt.Clear();} private Xop_randomRootPage_page_fxt fxt = new Xop_randomRootPage_page_fxt();
@Test public void Ns_main() {
fxt.Init_create_page("A");
fxt.Init_create_page("A/B/C");
fxt.Test_open("Special:RandomRootPage/Main", "A");
}
@Test public void Ns_help() {
fxt.Init_create_page("Help:A");
fxt.Init_create_page("Help:A/B/C");
fxt.Test_open("Special:RandomRootPage/Help", "Help:A");
}
}
class Xop_randomRootPage_page_fxt {
public void Clear() {
parser_fxt = new Xop_fxt();
parser_fxt.Reset();
wiki = parser_fxt.Wiki();
special_page = wiki.Special_mgr().Page_randomRootPage();
} private Xop_fxt parser_fxt; private Xop_randomRootPage_page special_page; private Xowe_wiki wiki;
public void Init_create_page(String page) {parser_fxt.Init_page_create(page, page);}
public void Test_open(String special_url, String expd) {
Xoae_page page = Test_special_open(wiki, special_page, special_url);
Tfds.Eq(expd, String_.new_a7(page.Url().Page_bry()));
Tfds.Eq(expd, String_.new_a7(page.Data_raw()));
}
public static Xoae_page Test_special_open(Xowe_wiki wiki, Xows_page special_page, String special_url) {
Xoae_page page = wiki.Parser_mgr().Ctx().Page();
Xoa_url url = wiki.Utl__url_parser().Parse(Bry_.new_u8(special_url));
page.Url_(url);
Xoa_ttl ttl = Xoa_ttl.parse(wiki, Bry_.new_a7(special_url));
page.Ttl_(ttl);
special_page.Special__gen(wiki, page, url, ttl);
return page;
}
}

View File

@@ -1,32 +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.specials.randoms; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
import gplx.xowa.wikis.nss.*;
public class Xows_page_random implements Xows_page {
public Xows_page_random(Xowe_wiki wiki) {}
// public Rndm_mgr Mgr() {return mgr;} private final Rndm_mgr mgr = new Rndm_mgr();
public Xows_special_meta Special__meta() {return Xows_special_meta_.Itm__random;}
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
Xow_ns ns = wiki.Ns_mgr().Names_get_or_main(ttl.Rest_txt());
byte[] random_ttl_bry = wiki.Db_mgr().Load_mgr().Find_random_ttl(ns);
wiki.Data_mgr().Redirect(page, ns.Gen_ttl(random_ttl_bry));
}
public Xows_page Special__clone() {return this;}
}

View File

@@ -19,11 +19,11 @@ package gplx.xowa.specials.statistics; import gplx.*; import gplx.xowa.*; import
import gplx.core.brys.fmtrs.*;
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 {
public class Xop_statistics_page implements Xow_special_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();
private Xop_statistics_stats_ns_grp stats_ns = new Xop_statistics_stats_ns_grp();
public Xows_special_meta Special__meta() {return Xows_special_meta_.Itm__statistics;}
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__statistics;}
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
byte[] html = Build_html(wiki);
@@ -45,7 +45,7 @@ public class Xop_statistics_page implements Xows_page {
, "</div>"
), "page_stats", "ns_stats");
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}
class Xop_statistics_stats_page_grp implements gplx.core.brys.Bfr_arg {
public void Wiki_(Xowe_wiki v) {this.wiki = v;} private Xowe_wiki wiki;

View File

@@ -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.xowa.default_tab; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
public class Default_tab_page implements Xows_page {
public Xows_special_meta Special__meta() {return Xows_special_meta_.Itm__default_tab;}
public class Default_tab_page implements Xow_special_page {
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__default_tab;}
public void Special__gen(Xow_wiki wiki, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xoae_page page = (Xoae_page)pagei;
page.Data_raw_(Bry_.Empty);
@@ -26,5 +26,5 @@ public class Default_tab_page implements Xows_page {
}
public static final byte[] Tab_name_bry = Bry_.new_a7("New Tab");
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}

View File

@@ -41,7 +41,7 @@ class Db_rdr_utl {
return qry_set;
}
public static Object[][] Load(Db_conn conn, String sql) {
List_adp list = List_adp_.new_();
List_adp list = List_adp_.New();
DataRdr rdr = conn.Exec_sql_as_old_rdr(sql);
try {
int fld_count = rdr.FieldCount();

View File

@@ -16,13 +16,13 @@ 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.diags; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
import gplx.core.net.*; import gplx.core.envs.*;
import gplx.core.net.*; import gplx.core.net.qargs.*; import gplx.core.envs.*;
import gplx.fsdb.*; import gplx.fsdb.meta.*;
import gplx.xowa.files.origs.*;
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) {
public void Exec(Bry_bfr bfr, Xoa_app app, Xoa_url url, Gfo_qarg_mgr_old arg_hash) {
byte[] wiki_bry = arg_hash.Get_val_bry_or(Arg_wiki, null); if (wiki_bry == null) {Xoa_app_.Usr_dlg().Warn_many("", "", "special.cmd; no wiki: url=~{0}", url.Raw()); return;}
byte[] file_bry = arg_hash.Get_val_bry_or(Arg_file, null); if (file_bry == null) {Xoa_app_.Usr_dlg().Warn_many("", "", "special.cmd; no file: url=~{0}", url.Raw()); return;}
Xow_wiki wiki = app.Wiki_mgri().Get_by_or_make_init_y(wiki_bry);
@@ -89,7 +89,7 @@ class Xows_cmd__file_check {
}
private void Export_bins(Bry_bfr bfr, byte[] file_bry, Object[][] rows, int owner_id_ordinal, int bin_data_ordinal) {
int rows_len = rows.length;
Bry_bfr tmp_bfr = Bry_bfr.new_();
Bry_bfr tmp_bfr = Bry_bfr_.New();
for (int i = 0; i < rows_len; ++i) {
Object[] row = rows[i];
int owner_id = Int_.cast(row[owner_id_ordinal]);
@@ -114,8 +114,8 @@ class Xows_cmd__file_check {
bfr.Add_str_u8(key).Add_str_a7(": ").Add_obj(val).Add_byte_nl();
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 Instance = new Xows_cmd__file_check(); Xows_cmd__file_check() {}
private static final byte[] Arg_wiki = Bry_.new_a7("wiki"), Arg_file = Bry_.new_a7("file");
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 Instance = 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 Instance = 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() {}
}

View File

@@ -16,11 +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.specials.xowa.diags; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
import gplx.core.ios.*; import gplx.core.net.*;
import gplx.core.ios.*; import gplx.core.net.*; import gplx.core.net.qargs.*;
import gplx.fsdb.meta.*;
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) {
public void Exec(Bry_bfr bfr, Xoa_app app, Xoa_url url, Gfo_qarg_mgr_old arg_hash) {
byte[] dir_bry = arg_hash.Get_val_bry_or(Arg_dir, null);
if (dir_bry != null) {
Write_dir(bfr, Io_url_.new_dir_(String_.new_u8(dir_bry)));
@@ -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 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");
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");
}

View File

@@ -16,12 +16,12 @@ 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.diags; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
import gplx.core.ios.*; import gplx.core.primitives.*; import gplx.core.net.*;
import gplx.core.ios.*; import gplx.core.primitives.*; import gplx.core.net.*; import gplx.core.net.qargs.*;
import gplx.dbs.*;
import gplx.fsdb.meta.*;
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) {
public void Exec(Bry_bfr bfr, Xoa_app app, Xoa_url url, Gfo_qarg_mgr_old arg_hash) {
Db_conn conn = null;
byte[] sql_bry = arg_hash.Get_val_bry_or(Arg_sql, null); if (sql_bry == null) {Xoa_app_.Usr_dlg().Warn_many("", "", "special.cmd; no sql: url=~{0}", url.Raw()); return;}
byte[] wiki_bry = arg_hash.Get_val_bry_or(Arg_wiki, null);
@@ -41,10 +41,10 @@ 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 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");
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()
private static final Hash_adp_bry db_type_hash = Hash_adp_bry.cs()
.Add_str_byte("fsdb.abc" , Db_type_fsdb_abc)
.Add_str_byte("fsdb.atr" , Db_type_fsdb_atr)
.Add_str_byte("wiki.core" , Db_type_wiki_core)

View File

@@ -16,11 +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.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.core.primitives.*; import gplx.core.net.*; import gplx.core.net.qargs.*;
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;}
public class Xows_diag_page implements Xow_special_page {
private Gfo_qarg_mgr_old arg_hash = new Gfo_qarg_mgr_old();
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__diag;}
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
arg_hash.Load(url.Qargs_ary());
@@ -44,5 +44,5 @@ public class Xows_diag_page implements Xows_page {
.Add_str_byte("sql.dump" , Type_sql_dump)
;
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}

View File

@@ -18,8 +18,8 @@ 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.core.brys.fmtrs.*;
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 class Popup_history_page implements Xow_special_page {
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__popup_history;}
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
Xoae_page cur_page = wiki.Appe().Gui_mgr().Browser_win().Active_page(); if (cur_page == null) return;
@@ -37,8 +37,8 @@ public class Popup_history_page implements Xows_page {
private Bry_fmtr fmtr_main = Bry_fmtr.new_("<a href='~{href}'>~{ttl}</a>\n\n", "href", "ttl"); // NOTE: need to use anchor (as opposed to lnki or lnke) b/c xwiki will not work on all wikis
public static boolean Ttl_chk(Xoa_ttl ttl) {
return ttl.Ns().Id_is_special()
&& Bry_.Eq(ttl.Page_db(), Xows_special_meta_.Itm__popup_history.Key_bry());
&& Bry_.Eq(ttl.Page_db(), Xow_special_meta_.Itm__popup_history.Key_bry());
}
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}

View File

@@ -16,12 +16,12 @@ 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.system_data; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*; import gplx.xowa.specials.xowa.*;
import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*; import gplx.core.net.*;
import gplx.core.primitives.*; import gplx.core.brys.fmtrs.*; import gplx.core.net.*; import gplx.core.net.qargs.*;
import gplx.xowa.langs.*;
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;}
public class System_data_page implements Xow_special_page {
private Gfo_qarg_mgr_old arg_hash = new Gfo_qarg_mgr_old();
public Xow_special_meta Special__meta() {return Xow_special_meta_.Itm__system_data;}
public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
arg_hash.Load(url.Qargs_ary());
@@ -64,5 +64,5 @@ public class System_data_page implements Xows_page {
, "~{text}</pre>"
), "path", "text");
public Xows_page Special__clone() {return this;}
public Xow_special_page Special__clone() {return this;}
}