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:
@@ -98,7 +98,7 @@ public class Xow_special_mgr {
|
||||
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());
|
||||
page.Db().Page().Modified_on_(DateAdp_.Now());
|
||||
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));}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, Gfo_invk, Xow
|
||||
rslt_list_ttls[i] = null;
|
||||
rslt_list_len = 0;
|
||||
rslt_nxt = rslt_prv = null;
|
||||
Xoa_ttl from_ttl = Xoa_ttl.parse(wiki, from_val); if (from_ttl == null) return false;
|
||||
Xoa_ttl from_ttl = Xoa_ttl.Parse(wiki, from_val); if (from_ttl == null) return false;
|
||||
if (!from_ttl.Ns().Id_is_main()) { // ns specified in title
|
||||
init_ns = from_ttl.Ns();
|
||||
arg_hash.Set_val_by_int(Bry_arg_ns, init_ns.Id());
|
||||
@@ -125,7 +125,7 @@ public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, Gfo_invk, Xow
|
||||
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.To_bry_and_clear());
|
||||
page.Db().Text().Text_bry_(tmp_bfr.To_bry_and_clear());
|
||||
tmp_bfr.Mkr_rls();
|
||||
page.Html_data().Html_restricted_n_();
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class Xows_page_allpages implements gplx.core.brys.Bfr_arg, Gfo_invk, Xow
|
||||
public static Xoa_ttl ttl_(Xowe_wiki wiki, Xow_ns ns, Xowd_page_itm itm) {
|
||||
byte[] ttl_bry = itm.Ttl_page_db();
|
||||
if (!ns.Id_is_main()) ttl_bry = Bry_.Add(ns.Name_db_w_colon(), ttl_bry);
|
||||
return Xoa_ttl.parse(wiki, ttl_bry);
|
||||
return Xoa_ttl.Parse(wiki, ttl_bry);
|
||||
}
|
||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
int len = rslt_list_ttls.length;
|
||||
|
||||
@@ -192,7 +192,7 @@ class Xows_page_allpages_fxt {
|
||||
public Xows_page_allpages_fxt Test_build_html(String expd) {
|
||||
Exec_build();
|
||||
allpages.Build_html(wiki.Parser_mgr().Ctx().Page());
|
||||
Tfds.Eq_str_lines(expd, String_.new_a7(wiki.Parser_mgr().Ctx().Page().Data_raw()));
|
||||
Tfds.Eq_str_lines(expd, String_.new_a7(wiki.Parser_mgr().Ctx().Page().Db().Text().Text_bry()));
|
||||
return this;
|
||||
}
|
||||
private void Exec_build() {
|
||||
@@ -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(Xow_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));}
|
||||
}
|
||||
|
||||
@@ -30,34 +30,33 @@ public class Move_page implements Xow_special_page {
|
||||
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
|
||||
args.Parse(url);
|
||||
byte[] src_ttl_bry = args.Src_ttl();
|
||||
src_ttl = Xoa_ttl.parse(wiki, src_ttl_bry);
|
||||
src_ttl = Xoa_ttl.Parse(wiki, src_ttl_bry);
|
||||
if (args.Submitted()) {
|
||||
Exec_rename(wiki, page);
|
||||
return;
|
||||
}
|
||||
byte[] html = Bld_html(page);
|
||||
page.Html_data().Html_restricted_n_(); // [[Special:]] pages allow all HTML
|
||||
page.Data_raw_(html);
|
||||
page.Db().Text().Text_bry_(html);
|
||||
}
|
||||
private void Exec_rename(Xowe_wiki wiki, Xoae_page page) {
|
||||
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();
|
||||
Xoa_ttl trg_ttl = Xoa_ttl.parse(wiki, trg_ns_id, trg_ttl_bry);
|
||||
Xoa_ttl trg_ttl = Xoa_ttl.Parse(wiki, trg_ns_id, trg_ttl_bry);
|
||||
Xowd_page_itm src_page = new Xowd_page_itm();
|
||||
wiki.Db_mgr().Load_mgr().Load_by_ttl(src_page, src_ttl.Ns(), src_ttl.Page_db());
|
||||
page.Revision_data().Id_(src_page.Id());
|
||||
page.Revision_data().Modified_on_(src_page.Modified_on());
|
||||
page.Data_raw_(src_page.Text());
|
||||
page.Db().Page().Id_(src_page.Id()).Modified_on_(src_page.Modified_on());
|
||||
page.Db().Text().Text_bry_(src_page.Text());
|
||||
if (args.Create_redirect()) { // NOTE: not tested; DATE:2014-02-27
|
||||
save_mgr.Data_update(page, Xop_redirect_mgr.Make_redirect_text(trg_ttl.Full_db()));
|
||||
Xowd_page_itm trg_page = new Xowd_page_itm();
|
||||
boolean trg_page_exists = wiki.Db_mgr().Load_mgr().Load_by_ttl(trg_page, trg_ns, trg_ttl_bry);
|
||||
if (trg_page_exists)
|
||||
save_mgr.Data_update(page, page.Data_raw());
|
||||
save_mgr.Data_update(page, page.Db().Text().Text_bry());
|
||||
else
|
||||
save_mgr.Data_create(trg_ttl, page.Data_raw());
|
||||
save_mgr.Data_create(trg_ttl, page.Db().Text().Text_bry());
|
||||
}
|
||||
else
|
||||
save_mgr.Data_rename(page, trg_ns_id, trg_ttl_bry);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Nearby_mgr implements Xow_special_page {
|
||||
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));
|
||||
page.Db().Text().Text_bry_(Bld_html(wiki));
|
||||
page.Html_data().Html_restricted_n_(); // [[Special:]] pages allow all HTML
|
||||
// wiki.Parser_mgr().Parse(page, false); // do not clear else previous Search_text will be lost
|
||||
}
|
||||
@@ -71,8 +71,8 @@ public class Nearby_mgr implements Xow_special_page {
|
||||
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;
|
||||
trg_ttl = Xoa_ttl.parse(wiki, trg_bry); if (trg_ttl == null) return List_adp_.Noop;
|
||||
Xoa_ttl src_ttl = Xoa_ttl.Parse(wiki, src_bry); if (src_ttl == null) return List_adp_.Noop;
|
||||
trg_ttl = Xoa_ttl.Parse(wiki, trg_bry); if (trg_ttl == null) return List_adp_.Noop;
|
||||
trg = trg_ttl.Page_db();
|
||||
trail.Clear();
|
||||
results.Clear();
|
||||
@@ -95,7 +95,7 @@ public class Nearby_mgr implements Xow_special_page {
|
||||
if (visited.Has(ttl_bry)) continue;
|
||||
visited.Add_bry_bry(ttl_bry);
|
||||
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(ttl);
|
||||
if (page.Missing()) continue;
|
||||
if (page.Db().Page().Exists_n()) continue;
|
||||
wiki.Parser_mgr().Parse(page, true);
|
||||
Ordered_hash lnkis = Ordered_hash_.New_bry();
|
||||
Collect_lnkis(lnkis, page.Root());
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Xop_statistics_page implements Xow_special_page {
|
||||
Xowe_wiki wiki = (Xowe_wiki)wikii; Xoae_page page = (Xoae_page)pagei;
|
||||
byte[] html = Build_html(wiki);
|
||||
page.Html_data().Html_restricted_n_(); // [[Special:]] pages allow all HTML
|
||||
page.Data_raw_(html);
|
||||
page.Db().Text().Text_bry_(html);
|
||||
}
|
||||
public byte[] Build_html(Xowe_wiki wiki) {
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_m001();
|
||||
|
||||
@@ -20,7 +20,7 @@ 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);
|
||||
page.Db().Text().Text_bry_(Bry_.Empty);
|
||||
page.Html_data().Custom_html_(Bry_.Empty);
|
||||
page.Html_data().Custom_tab_name_(Tab_name_bry);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Xows_diag_page implements Xow_special_page {
|
||||
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.To_bry_and_clear());
|
||||
page.Db().Text().Text_bry_(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;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Popup_history_page implements Xow_special_page {
|
||||
if (Ttl_chk(itm.Page_ttl())) continue;
|
||||
fmtr_main.Bld_bfr_many(bfr, itm.Page_href(), itm.Page_ttl().Full_txt_w_ttl_case());
|
||||
}
|
||||
page.Data_raw_(bfr.Trim_end(Byte_ascii.Nl).To_bry_and_rls());
|
||||
page.Db().Text().Text_bry_(bfr.Trim_end(Byte_ascii.Nl).To_bry_and_rls());
|
||||
page.Html_data().Html_restricted_n_();
|
||||
}
|
||||
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
|
||||
|
||||
@@ -32,7 +32,7 @@ public class System_data_page implements Xow_special_page {
|
||||
byte[] file_txt = Io_mgr.Instance.LoadFilBry(file_url);
|
||||
file_txt = gplx.langs.htmls.Gfh_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());
|
||||
page.Db().Text().Text_bry_(tmp_bfr.To_bry_and_rls());
|
||||
}
|
||||
private static Io_url Path_from_type(Xowe_wiki wiki, byte type) {
|
||||
Xoae_app app = wiki.Appe();
|
||||
|
||||
Reference in New Issue
Block a user