mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.8.5.1'
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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.addons.wikis.pages.syncs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*;
|
||||
import gplx.xowa.bldrs.wkrs.*;
|
||||
import gplx.xowa.specials.*;
|
||||
import gplx.xowa.addons.wikis.pages.syncs.specials.*;
|
||||
public class Sync_addon implements Xoax_addon_itm, Xoax_addon_itm__special {
|
||||
public Xow_special_page[] Special_pages() {
|
||||
return new Xow_special_page[]
|
||||
{ Sync_html_special.Prototype
|
||||
};
|
||||
}
|
||||
|
||||
public static Sync_addon Get(Xow_wiki wiki) {
|
||||
Sync_addon rv = (Sync_addon)wiki.Addon_mgr().Itms__get_or_null(ADDON_KEY);
|
||||
if (rv == null) {
|
||||
rv = new Sync_addon();
|
||||
wiki.Addon_mgr().Itms__add(rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
public String Addon__key() {return ADDON_KEY;} private static final String ADDON_KEY = "xowa.pages.syncs";
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
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.addons.wikis.pages.syncs.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.pages.*; import gplx.xowa.addons.wikis.pages.syncs.*;
|
||||
import gplx.core.net.qargs.*;
|
||||
import gplx.xowa.specials.*; import gplx.xowa.wikis.nss.*;
|
||||
import gplx.xowa.htmls.*;
|
||||
public class Sync_html_special implements Xow_special_page {
|
||||
public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
Gfo_qarg_mgr url_args = new Gfo_qarg_mgr().Init(url.Qargs_ary());
|
||||
|
||||
// get args
|
||||
byte[] redirect_bry = url_args.Read_bry_or(Bry_.new_a7("page"), null);
|
||||
Xoa_ttl redirect_ttl = wiki.Ttl_parse(redirect_bry);
|
||||
// Xoa_url redirect_url = wiki.Utl__url_parser().Parse(redirect_bry);
|
||||
|
||||
// update
|
||||
gplx.xowa.apps.wms.apis.parses.Wm_page_updater updater = new gplx.xowa.apps.wms.apis.parses.Wm_page_updater();
|
||||
updater.Init_by_app(wiki.App());
|
||||
Xoh_page hpg = new Xoh_page();
|
||||
updater.Init_by_page(wiki, hpg);
|
||||
updater.Update(wiki.App().Wmf_mgr().Download_wkr(), wiki, redirect_ttl);
|
||||
((Xowe_wiki)wiki).Data_mgr().Redirect((Xoae_page)page, redirect_bry); // HACK: should call page.Redirect_trail() below, but need to handle Display_ttl
|
||||
// page.Redirect_trail().Itms__add__article(redirect_url, redirect_ttl, null);
|
||||
}
|
||||
|
||||
public static final String SPECIAL_KEY = "XowaSyncHtml"; // NOTE: needs to match lang.gfs
|
||||
public static final byte[] Display_ttl = Bry_.new_a7("Sync HTML");
|
||||
public Xow_special_meta Special__meta() {return new Xow_special_meta(Xow_special_meta_.Src__mw, SPECIAL_KEY);}
|
||||
public static final Xow_special_page Prototype = new Sync_html_special();
|
||||
public Xow_special_page Special__clone() {return this;}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class Srch_html_page_bldr {
|
||||
private Xoh_lnki_bldr lnki_bldr; private Xoh_anchor_kv_bldr self_lnkr = new Xoh_anchor_kv_bldr(); private Srch_html_row_bldr html_row_bldr;
|
||||
public void Init_by_wiki(Xow_wiki wiki, Xol_num_mgr num_mgr, Srch_search_qry qry) {
|
||||
this.wiki = wiki; this.num_mgr = num_mgr; this.qry = qry;
|
||||
this.lnki_bldr = wiki.App().Html__lnki_bldr();
|
||||
this.lnki_bldr = wiki.Html__lnki_bldr();
|
||||
int slab_len = qry.Slab_end - qry.Slab_bgn;
|
||||
this.slab_idx = qry.Slab_bgn / slab_len;
|
||||
this.html_row_bldr = new Srch_html_row_bldr(lnki_bldr);
|
||||
|
||||
@@ -67,7 +67,7 @@ class Srch_html_page_bldr_fxt {
|
||||
}
|
||||
public void Test_rows(Srch_rslt_row[] rows, String expd) {
|
||||
Srch_rslt_list rslts = new Srch_rslt_list();
|
||||
Srch_html_row_bldr row_bldr = new Srch_html_row_bldr(wiki.App().Html__lnki_bldr());
|
||||
Srch_html_row_bldr row_bldr = new Srch_html_row_bldr(wiki.Html__lnki_bldr());
|
||||
row_bldr.Init(rslts, 0, rows.length);
|
||||
for (int i = 0; i < rows.length; ++i)
|
||||
rslts.Add(rows[i]);
|
||||
|
||||
@@ -39,7 +39,7 @@ class Srch_rslt_cbk_fxt {
|
||||
public void Clear() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app, "w");
|
||||
html_row = new Srch_html_row_bldr(wiki.App().Html__lnki_bldr());
|
||||
html_row = new Srch_html_row_bldr(wiki.Html__lnki_bldr());
|
||||
html_row.Fmtr().Fmt_("~{page_key}");
|
||||
async = new Srch_html_row_wkr(html_row, js_wkr, 5, Bry_enwiki);
|
||||
page_id = 0;
|
||||
|
||||
Reference in New Issue
Block a user