mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.2.1'
This commit is contained in:
@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.pages.tags.*;
|
||||
import gplx.xowa.wikis.pages.tags.*; import gplx.xowa.wikis.pages.htmls.*;
|
||||
public class Xopage_html_data {
|
||||
public Xopage_html_data(byte[] display_ttl, byte[] body) {
|
||||
this.display_ttl = display_ttl;
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.htmls.core.makes.imgs.*; import gplx.xowa.files.*;
|
||||
import gplx.xowa.wikis.pages.lnkis.*;
|
||||
public class Xopg_hdump_data {
|
||||
public byte[] Body() {return body;} public void Body_(byte[] v) {body = v;} private byte[] body;
|
||||
public List_adp Imgs() {return imgs;} private final List_adp imgs = List_adp_.New();
|
||||
public void Imgs_add(Xohd_img_itm itm) {imgs.Add(itm);}
|
||||
public void Imgs_add_img(Xohd_img_itm__base img, Xof_file_itm xfer, int tid) {
|
||||
img.Data_init_base
|
||||
( xfer.Lnki_ttl(), xfer.Lnki_type(), xfer.Lnki_upright(), xfer.Lnki_w(), xfer.Lnki_h(), xfer.Lnki_time(), xfer.Lnki_page()
|
||||
, xfer.Orig_repo_id(), xfer.Orig_ext().Id(), xfer.File_is_orig(), xfer.File_w()
|
||||
, xfer.Html_uid(), xfer.Html_w(), xfer.Html_h()
|
||||
);
|
||||
imgs.Add(img);
|
||||
}
|
||||
public void Clear() {
|
||||
body = null;
|
||||
imgs.Clear();
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.brys.*; import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.wikis.pages.htmls.*;
|
||||
public class Xopg_page_heading implements Bfr_arg {
|
||||
private Xopg_html_data html_data;
|
||||
private byte[] display_title;
|
||||
|
||||
@@ -19,6 +19,7 @@ package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xo
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.vnts.*;
|
||||
import gplx.xowa.guis.views.*; import gplx.xowa.parsers.utils.*;
|
||||
import gplx.xowa.wikis.pages.redirects.*;
|
||||
public class Xow_page_mgr implements Gfo_invk {
|
||||
private final Xowe_wiki wiki;
|
||||
public Xow_page_mgr(Xowe_wiki wiki) {this.wiki = wiki;}
|
||||
@@ -35,11 +36,10 @@ public class Xow_page_mgr implements Gfo_invk {
|
||||
switch (ns.Id()) {
|
||||
case Xow_ns_.Tid__special: // Special pages are built (not loaded from db)
|
||||
wiki.Special_mgr().Special__gen(wiki.App(), wiki, rv, url, ttl);
|
||||
if (rv.Redirect_to_ttl() != null) {
|
||||
ttl = wiki.Ttl_parse(rv.Redirect_to_ttl());
|
||||
url = wiki.Utl__url_parser().Parse(ttl.Raw());
|
||||
rv.Redirect_to_ttl_(null);
|
||||
Load_by_ns(rv, url, ttl, called_from_msg);
|
||||
Xopg_redirect_itm redirect_itm = rv.Redirect().Itms__get_at_nth_or_null();
|
||||
if (redirect_itm != null) {
|
||||
rv.Redirect().Clear(); // clear needed; EX: Special:Random -> [[Redirected_page]] -> {must clear here} -> [[Page]]
|
||||
Load_by_ns(rv, redirect_itm.Url(), redirect_itm.Ttl(), called_from_msg);
|
||||
}
|
||||
return;
|
||||
case Xow_ns_.Tid__mediawiki: // MediaWiki msgs can either be loaded from memory, or from database
|
||||
@@ -51,7 +51,7 @@ public class Xow_page_mgr implements Gfo_invk {
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
msg_key = lang.Case_mgr().Case_build_1st_lower(tmp_bfr, msg_key, 0, msg_key.length);
|
||||
byte[] msg_val = Xol_msg_mgr_.Get_msg_itm(tmp_bfr, wiki, wiki.Lang(), msg_key).Val(); // NOTE: do not change to Get_msg_val; Get_msg_val, also replaces $1 with values, and $1 needs to be preserved for callers;
|
||||
rv.Data_raw_(msg_val);
|
||||
rv.Db().Text().Text_bry_(msg_val);
|
||||
tmp_bfr.Mkr_rls();
|
||||
return;
|
||||
}
|
||||
@@ -59,20 +59,21 @@ public class Xow_page_mgr implements Gfo_invk {
|
||||
}
|
||||
Load_from_db(rv, ns, ttl, url.Qargs_mgr().Match(Xoa_url_.Qarg__redirect, Xoa_url_.Qarg__redirect__no));
|
||||
}
|
||||
private void Load_from_db(Xoae_page rv, Xow_ns ns, Xoa_ttl ttl, boolean redirect_force) {
|
||||
public void Load_from_db(Xoae_page rv, Xow_ns ns, Xoa_ttl ttl, boolean redirect_force) {
|
||||
int redirects = 0;
|
||||
Xowd_page_itm page_row = Xowd_page_itm.new_tmp();
|
||||
while (true) { // loop until (a) no more redirects or (b) page not found
|
||||
// load from page table
|
||||
boolean exists = wiki.Db_mgr().Load_mgr().Load_by_ttl(page_row, ns, ttl.Page_db());
|
||||
if (!exists) {rv.Missing_(); return;}
|
||||
if (!exists) {rv.Db().Page().Exists_n_(); return;}
|
||||
if (wiki.App().Mode().Tid_is_gui()) // NOTE: must check if gui, else will write during mass build; DATE:2014-05-03
|
||||
wiki.Appe().Usr_dlg().Prog_many("", "", "loading page for ~{0}", ttl.Raw());
|
||||
|
||||
// load from text table
|
||||
wiki.Db_mgr().Load_mgr().Load_page(page_row, ns);
|
||||
byte[] wtxt = page_row.Text();
|
||||
rv.Data_raw_(wtxt).Revision_data().Modified_on_(page_row.Modified_on()).Id_(page_row.Id()).Html_db_id_(page_row.Html_db_id());
|
||||
rv.Db().Text().Text_bry_(wtxt);
|
||||
rv.Db().Page().Id_(page_row.Id()).Modified_on_(page_row.Modified_on()).Html_db_id_(page_row.Html_db_id());
|
||||
if (redirect_force) return; // redirect_force passed; return page now, even if page is a redirect elsewhere
|
||||
|
||||
// handle redirects
|
||||
@@ -82,8 +83,7 @@ public class Xow_page_mgr implements Gfo_invk {
|
||||
return;
|
||||
|
||||
// redirect; do some bookkeeping and reset ns / ttl
|
||||
rv.Redirected_ttls().Add(ttl.Full_url()); // NOTE: must be url_encoded; EX: "en.wikipedia.org/?!" should generate link of "en.wikipedia.org/%3F!?redirect=no"
|
||||
if (rv.Redirected_src() == null) rv.Redirected_src_(wtxt); // only add src for first redirect; DATE:2014-07-11
|
||||
rv.Redirect().Itms__add__article(Xoa_url.New(wiki, redirect_ttl), redirect_ttl, wtxt); // NOTE: must be url_encoded; EX: "en.wikipedia.org/?!" should generate link of "en.wikipedia.org/%3F!?redirect=no"
|
||||
rv.Ttl_(redirect_ttl);
|
||||
ns = redirect_ttl.Ns();
|
||||
ttl = redirect_ttl;
|
||||
@@ -93,17 +93,17 @@ public class Xow_page_mgr implements Gfo_invk {
|
||||
public Xoae_page Load_page_and_parse(Xoa_url url, Xoa_ttl ttl, Xol_lang_itm lang, Xog_tab_itm tab, boolean parse_page) {
|
||||
wiki.Init_assert();
|
||||
Xoae_page page = Xoae_page.New(wiki, ttl); page.Tab_data().Tab_(tab);
|
||||
// COMMENT: breaks bookmark; if (tab != null) tab.Page_ref_(page); // HACK: (1) null check for http server; (2) Page_ref_(page) needed for log in xobc
|
||||
// COMMENT: breaks position-restore when moving back from history; if (tab != null) tab.Page_ref_(page); // HACK: (1) null check for http server; (2) Page_ref_(page) needed for log in xobc
|
||||
this.Load_by_ns(page, url, ttl, false);
|
||||
if (page.Missing()) { // page doesn't exist; try variants
|
||||
if (page.Db().Page().Exists_n()) { // page doesn't exist; try variants
|
||||
boolean vnt_missing = true;
|
||||
Xol_vnt_mgr vnt_mgr = lang.Vnt_mgr();
|
||||
if (vnt_mgr.Enabled()) { // if vnt enabled, then try to load by vnt form; DATE:2015-09-15
|
||||
gplx.xowa.wikis.data.tbls.Xowd_page_itm page_itm = vnt_mgr.Convert_mgr().Convert_ttl(wiki, ttl);
|
||||
if (page_itm != null && page_itm.Exists()) {
|
||||
Xoa_ttl vnt_ttl = Xoa_ttl.parse(wiki, ttl.Ns().Id(), page_itm.Ttl_page_db());
|
||||
Xoa_ttl vnt_ttl = Xoa_ttl.Parse(wiki, ttl.Ns().Id(), page_itm.Ttl_page_db());
|
||||
page = this.Load_page(vnt_ttl, false);
|
||||
vnt_missing = page.Missing();
|
||||
vnt_missing = page.Db().Page().Exists_n();
|
||||
}
|
||||
}
|
||||
if (vnt_missing) {
|
||||
@@ -112,23 +112,25 @@ public class Xow_page_mgr implements Gfo_invk {
|
||||
if (commons_wiki != null) { // commons exists
|
||||
if (!Bry_.Eq(wiki.Domain_bry(), commons_wiki.Domain_bry())) { // !Bry_.Eq is recursion guard
|
||||
Xoae_page rv = commons_wiki.Data_mgr().Load_page_and_parse(url, ttl, wiki.Lang(), tab, true);
|
||||
if (rv.Exists()) {
|
||||
if (rv.Db().Page().Exists()) {
|
||||
rv.Commons_mgr().Source_wiki_(wiki);
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
page.Missing_(false);
|
||||
rv.Db().Page().Exists_y_();
|
||||
page.Commons_mgr().Xowa_mockup_(true);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return page.Missing_();
|
||||
else {
|
||||
page.Db().Page().Exists_n_();
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (page.Missing()) return page; // NOTE: commons can return null page
|
||||
if (page.Db().Page().Exists_n()) return page; // NOTE: commons can return null page
|
||||
page.Tab_data().Tab_(tab);
|
||||
page.Lang_(lang);
|
||||
if (parse_page)
|
||||
@@ -136,9 +138,10 @@ public class Xow_page_mgr implements Gfo_invk {
|
||||
return page;
|
||||
}
|
||||
public void Redirect(Xoae_page page, byte[] page_bry) {
|
||||
Xoa_ttl trg_ttl = Xoa_ttl.parse(wiki, page_bry);
|
||||
Xoa_url trg_url = Xoa_url.new_(wiki.Domain_bry(), page_bry);
|
||||
page.Ttl_(trg_ttl).Url_(trg_url).Redirected_(true);
|
||||
Xoa_ttl trg_ttl = Xoa_ttl.Parse(wiki, page_bry);
|
||||
Xoa_url trg_url = Xoa_url.New(wiki.Domain_bry(), page_bry);
|
||||
page.Ttl_(trg_ttl).Url_(trg_url);
|
||||
page.Redirect().Itms__add__special(trg_url, trg_ttl);
|
||||
wiki.Data_mgr().Load_from_db(page, trg_ttl.Ns(), trg_ttl, trg_url.Qargs_mgr().Match(Xoa_url_.Qarg__redirect, Xoa_url_.Qarg__redirect__no));
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Xowe_page_mgr {
|
||||
|
||||
// load page meta; wait_for_popups
|
||||
Xoae_page page = wiki.Data_mgr().Load_page_and_parse(url, ttl, wiki.Lang(), tab, false);
|
||||
boolean hdump_exists = page.Revision_data().Html_db_id() != -1 && wiki.Appe().Api_root().Wiki().Hdump().Read_preferred();
|
||||
boolean hdump_exists = page.Db().Page().Html_db_id() != -1 && wiki.Appe().Api_root().Wiki().Hdump().Read_preferred();
|
||||
page.Html_data().Hdump_exists_(hdump_exists);
|
||||
Wait_for_popups(wiki.App());
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Xowe_page_mgr {
|
||||
boolean parse = true;
|
||||
if (hdump_exists) {
|
||||
wiki.Html__hdump_mgr().Load_mgr().Load_by_edit(page);
|
||||
parse = Bry_.Len_eq_0(page.Hdump_data().Body()); // NOTE: need to check if actually empty for archive.org wikis which included html_db_id without html_dbs; DATE:2016-06-22
|
||||
parse = Bry_.Len_eq_0(page.Db().Html().Html_bry()); // NOTE: need to check if actually empty for archive.org wikis which included html_db_id without html_dbs; DATE:2016-06-22
|
||||
}
|
||||
if (parse)
|
||||
wiki.Parser_mgr().Parse(page, false);
|
||||
|
||||
30
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_data.java
Normal file
30
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_data.java
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xopg_db_data {
|
||||
public Xopg_db_page Page() {return page;} private final Xopg_db_page page = new Xopg_db_page();
|
||||
public Xopg_db_text Text() {return text;} private final Xopg_db_text text = new Xopg_db_text();
|
||||
public Xopg_db_html Html() {return html;} private final Xopg_db_html html = new Xopg_db_html();
|
||||
public Xopg_db_protection Protection() {return protection;} private final Xopg_db_protection protection = new Xopg_db_protection();
|
||||
public void Clear() {
|
||||
page.Clear();
|
||||
html.Clear();
|
||||
// text.Clear();
|
||||
// protection.Clear();
|
||||
}
|
||||
}
|
||||
28
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_html.java
Normal file
28
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_html.java
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xopg_db_html {
|
||||
public byte[] Html_bry() {return html_bry;} private byte[] html_bry = Bry_.Empty; // NOTE: if null, will cause NullPointer exception on Special pages like Special:XowaDownloadCentral; DATE:2016-07-05
|
||||
public void Html_bry_(byte[] v) {this.html_bry = v;}
|
||||
public int Zip_tid() {return zip_tid;} private int zip_tid;
|
||||
public int Hzip_tid() {return hzip_tid;} private int hzip_tid;
|
||||
public void Zip_tids_(int zip_tid, int hzip_tid) {this.zip_tid = zip_tid; this.hzip_tid = hzip_tid;}
|
||||
public void Clear() {
|
||||
html_bry = null; zip_tid = -1; hzip_tid = -1;
|
||||
}
|
||||
}
|
||||
60
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_page.java
Normal file
60
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_page.java
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
import gplx.xowa.wikis.nss.*;
|
||||
public class Xopg_db_page {
|
||||
// from page table
|
||||
public boolean Exists() {return exists;} private boolean exists = true;
|
||||
public boolean Exists_n() {return !exists;}
|
||||
public int Id() {return id;} private int id;
|
||||
public int Ns_id() {return ns_id;} private int ns_id;
|
||||
public byte[] Ttl_bry() {return ttl_bry;} private byte[] ttl_bry;
|
||||
public DateAdp Modified_on() {return modified_on;} private DateAdp modified_on = DateAdp_.MinValue; // NOTE: must set to MinValue else some tests will fail
|
||||
public int Text_len() {return text_len;} private int text_len;
|
||||
public int Text_db_id() {return text_db_id;} private int text_db_id;
|
||||
public int Html_db_id() {return html_db_id;} private int html_db_id;
|
||||
public int Redirect_to_id() {return redirect_to_id;} private int redirect_to_id;
|
||||
public int Score() {return score;} private int score;
|
||||
|
||||
public void Exists_y_() {this.Exists_(Bool_.Y);}
|
||||
public void Exists_n_() {this.Exists_(Bool_.N);}
|
||||
public void Exists_(boolean v) {this.exists = v;}
|
||||
public Xopg_db_page Id_(int v) {this.id = v; return this;}
|
||||
public Xopg_db_page Modified_on_(DateAdp v) {this.modified_on = v; return this;}
|
||||
public Xopg_db_page Html_db_id_(int v) {this.html_db_id = v; return this;}
|
||||
|
||||
// wiki-related
|
||||
public Xow_ns Ns() {return ns;} private Xow_ns ns;
|
||||
public Xoa_ttl Ttl() {return ttl;} private Xoa_ttl ttl;
|
||||
|
||||
// init methods
|
||||
public Xopg_db_page Init_by_db(int id, int ns_id, byte[] ttl_bry, DateAdp modified_on, int text_len, int text_db_id, int html_db_id, int redirect_to_id, int score) {
|
||||
this.id = id; this.ns_id = ns_id; this.ttl_bry = ttl_bry; this.modified_on = modified_on;
|
||||
this.text_len = text_len; this.text_db_id = text_db_id; this.html_db_id = html_db_id; this.redirect_to_id = redirect_to_id; this.score = score;
|
||||
this.ns = null; this.ttl = null;
|
||||
return this;
|
||||
}
|
||||
public Xopg_db_page Init_by_wiki(Xow_wiki wiki) {
|
||||
this.ns = wiki.Ns_mgr().Ids_get_or_null(ns_id);
|
||||
this.ttl = wiki.Ttl_parse(ns_id, ttl_bry);
|
||||
return this;
|
||||
}
|
||||
public void Clear() {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,11 @@ GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
public class Xopg_revision_data {
|
||||
public int Id() {return id;} public Xopg_revision_data Id_(int v) {id = v; return this;} private int id;
|
||||
public DateAdp Modified_on() {return modified_on;} public Xopg_revision_data Modified_on_(DateAdp v) {modified_on = v; return this;} private DateAdp modified_on = DateAdp_.MinValue;
|
||||
public byte[] User() {return user;} public Xopg_revision_data User_(byte[] v) {user = v; return this;} private byte[] user = Bry_.Empty;
|
||||
public byte[] Protection_level() {return protection_level;} public Xopg_revision_data Protection_level_(byte[] v) {protection_level = v; return this;} private byte[] protection_level = Bry_.Empty;
|
||||
package gplx.xowa.wikis.pages.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xopg_db_protection {
|
||||
public byte[] User() {return user;} public Xopg_db_protection User_(byte[] v) {user = v; return this;} private byte[] user = Bry_.Empty;
|
||||
public byte[] Protection_level() {return protection_level;} public Xopg_db_protection Protection_level_(byte[] v) {protection_level = v; return this;} private byte[] protection_level = Bry_.Empty;
|
||||
public byte[] Protection_expiry() {return protection_expiry;} private byte[] protection_expiry = Bry__protection_expiry__infinite;
|
||||
public int Html_db_id() {return html_db_id;} public void Html_db_id_(int v) {html_db_id = v;} private int html_db_id = -1;
|
||||
public void Clear() {}// NOTE: do not clear data b/c saving in Edit will call clear and id will be reset to 0
|
||||
public static final byte[] Bry__protection_expiry__infinite = Bry_.new_a7("infinite");
|
||||
|
||||
public static final byte[] Bry__protection_expiry__infinite = Bry_.new_a7("infinite");
|
||||
}
|
||||
22
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_text.java
Normal file
22
400_xowa/src/gplx/xowa/wikis/pages/dbs/Xopg_db_text.java
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xopg_db_text {
|
||||
public byte[] Text_bry() {return text_bry;} private byte[] text_bry = Bry_.Empty; // NOTE: if null, will cause NullPointer exception on Special pages like Special:XowaDownloadCentral; DATE:2016-07-05
|
||||
public void Text_bry_(byte[] v) {this.text_bry = v;}
|
||||
}
|
||||
@@ -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.wikis.pages.hdumps; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
import gplx.xowa.htmls.tocs.*;
|
||||
public class Xopg_hdump_data {
|
||||
public List_adp Imgs() {return imgs;} private final List_adp imgs = List_adp_.New();
|
||||
public Xoh_toc_wtr Toc_wtr() {return toc_wtr;} private final Xoh_toc_wtr toc_wtr = new Xoh_toc_wtr();
|
||||
public void Clear() {
|
||||
imgs.Clear();
|
||||
toc_wtr.Clear();
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,14 @@ GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.heads.*; import gplx.xowa.wikis.pages.skins.*; import gplx.xowa.xtns.indicators.*;
|
||||
import gplx.xowa.xtns.pagebanners.*; import gplx.xowa.wikis.pages.tags.*;
|
||||
package gplx.xowa.wikis.pages.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
import gplx.xowa.wikis.pages.skins.*; import gplx.xowa.wikis.pages.tags.*; import gplx.xowa.wikis.pages.lnkis.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.heads.*;
|
||||
import gplx.xowa.xtns.pagebanners.*; import gplx.xowa.xtns.indicators.*;
|
||||
public class Xopg_html_data {
|
||||
private Ordered_hash ctg_hash;
|
||||
public Xopg_lnki_list Redlink_list() {return redlink_list;} private final Xopg_lnki_list redlink_list = new Xopg_lnki_list();
|
||||
|
||||
public boolean Html_restricted() {return html_restricted;} private boolean html_restricted = true;
|
||||
public void Html_restricted_(boolean v) {html_restricted = v;} public void Html_restricted_n_() {Html_restricted_(Bool_.N);} public void Html_restricted_y_() {Html_restricted_(Bool_.Y);}
|
||||
public byte[] Display_ttl() {
|
||||
@@ -64,6 +67,8 @@ public class Xopg_html_data {
|
||||
public byte[] Custom_body() {return custom_body;} public Xopg_html_data Custom_body_(byte[] v) {custom_body = v; return this;} private byte[] custom_body;
|
||||
public byte[] Custom_tab_name() {return custom_tab_name;} public Xopg_html_data Custom_tab_name_(byte[] v) {custom_tab_name = v; return this;} private byte[] custom_tab_name;
|
||||
public void Clear() {
|
||||
redlink_list.Clear();
|
||||
|
||||
html_restricted = true;
|
||||
display_ttl = content_sub = display_ttl_vnt = null;
|
||||
lang_convert_content = lang_convert_title = true;
|
||||
@@ -89,4 +94,7 @@ public class Xopg_html_data {
|
||||
if (ctg_hash.Has(ttl_bry)) return;
|
||||
ctg_hash.Add(ttl_bry, ttl_bry);
|
||||
}
|
||||
public void Init_by_page(Xoa_ttl ttl) {
|
||||
redlink_list.Disabled_(ttl.Ns().Id_is_module());
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class Xopg_lnki_list {
|
||||
if ( ns.Id_is_file_or_media() // ignore files which will usually not be in local wiki (most are in commons), and whose html is built up separately
|
||||
|| (ns.Id_is_ctg() && !ttl.ForceLiteralLink()) // ignore ctgs which have their own html builder, unless it is literal; EX: [[:Category:A]]; DATE:2014-02-24
|
||||
|| ns.Id_is_special() // ignore special, especially Search; EX: Special:Search/Earth
|
||||
|| ttl.Anch_bgn() == Xoa_ttl.Anch_bgn_anchor_only // anchor only link; EX: [[#anchor]]
|
||||
|| ttl.Anch_bgn() == Anch_bgn_anchor_only // anchor only link; EX: [[#anchor]]
|
||||
|| ttl.Wik_itm() != null // xwiki lnki; EX: simplewiki links in homewiki; [[simplewiki:Earth]]
|
||||
)
|
||||
return;
|
||||
@@ -47,4 +47,5 @@ public class Xopg_lnki_list {
|
||||
}
|
||||
|
||||
public static final String Lnki_id_prefix = "xolnki_";
|
||||
private static final int Anch_bgn_anchor_only = 1; // signifies lnki which is only anchor; EX: [[#anchor]]
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Xopg_redlink_mgr implements Gfo_invk {
|
||||
public Xopg_redlink_mgr(Xoa_page page, Xog_js_wkr js_wkr) {this.page = page; this.js_wkr = js_wkr; }
|
||||
private void Redlink() {
|
||||
// init; exit if redlink disabled (on Module pages)
|
||||
Xopg_lnki_list lnki_list = page.Redlink_list(); if (lnki_list.Disabled()) return;
|
||||
Xopg_lnki_list lnki_list = page.Html_data().Redlink_list(); if (lnki_list.Disabled()) return;
|
||||
Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.Instance;
|
||||
Xow_wiki wiki = page.Wiki();
|
||||
Ordered_hash lnki_hash = Ordered_hash_.New_bry();
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages.redirects; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xopg_redirect_data {
|
||||
private final List_adp itms = List_adp_.New();
|
||||
public int Itms__len() {return itms.Len();}
|
||||
public byte[] Itms__get_at_0th_or_null() {return itms.Len() == 0 ? null : this.Itms__get_at(0).Wikitext();}
|
||||
public Xopg_redirect_itm Itms__get_at_nth_or_null() {return itms.Len() == 0 ? null : (Xopg_redirect_itm)itms.Get_at(itms.Len() - 1);}
|
||||
public Xopg_redirect_itm Itms__get_at(int i) {return (Xopg_redirect_itm)itms.Get_at(i);}
|
||||
public void Itms__add__article(Xoa_url url, Xoa_ttl ttl, byte[] wikitext) {Itms__add(url, ttl, wikitext);}
|
||||
public void Itms__add__special(Xoa_url url, Xoa_ttl ttl) {Itms__add(url, ttl, null);}
|
||||
private void Itms__add(Xoa_url url, Xoa_ttl ttl, byte[] wikitext) {
|
||||
Xopg_redirect_itm itm = new Xopg_redirect_itm(url, ttl, wikitext);
|
||||
itms.Add(itm);
|
||||
}
|
||||
public void Clear() {
|
||||
itms.Clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages.redirects; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.pages.*;
|
||||
public class Xopg_redirect_itm {
|
||||
public Xopg_redirect_itm(Xoa_url url, Xoa_ttl ttl, byte[] wikitext) {
|
||||
this.url = url;
|
||||
this.ttl = ttl;
|
||||
this.wikitext = wikitext;
|
||||
}
|
||||
public Xoa_url Url() {return url;} private final Xoa_url url; // EX: "en.wikipedia.org/wiki/A"
|
||||
public Xoa_ttl Ttl() {return ttl;} private final Xoa_ttl ttl; // EX: "A"
|
||||
public byte[] Wikitext() {return wikitext;} private final byte[] wikitext; // EX: "#REDIRECT [[A]]"
|
||||
public boolean By_wikitext() {return wikitext != null;} // true if by "#REDIRECT [[A]]"; false if by Special:Random, Special:Search, etc.;
|
||||
}
|
||||
Reference in New Issue
Block a user