Edit: Save compiled HTML when editing pages [#699]

staging
gnosygnu 4 years ago
parent dc374fa7fc
commit 0aced904a5

@ -55,6 +55,7 @@ import gplx.xowa.guis.Xoa_gui_mgr;
import gplx.xowa.guis.bnds.Xog_bnd_box_;
import gplx.xowa.guis.history.Xog_history_mgr;
import gplx.xowa.wikis.pages.Xopg_view_mode_;
import gplx.xowa.wikis.pages.dbs.Xopg_db_page;
public class Xog_tab_itm implements Gfo_invk {
private Xog_win_itm win;
@ -248,7 +249,7 @@ public class Xog_tab_itm implements Gfo_invk {
// Xof_fsdb_mgr fsdb_mgr = wiki.File_mgr().Fsdb_mgr();
// async_wkr = new Xof_file_wkr(wiki.File__orig_mgr(), fsdb_mgr.Bin_mgr(), fsdb_mgr.Mnt_mgr(), app.Usere().User_db_mgr().Cache_mgr(), wiki.File__repo_mgr(), html_itm, page, page.Hdump_mgr().Imgs());
async_wkr = new Load_files_wkr(this);
if (wiki.Html__hdump_enabled() && page.Db().Page().Html_db_id() == -1) {
if (wiki.Html__hdump_enabled() && page.Db().Page().Html_db_id() == Xopg_db_page.HTML_DB_ID_NULL) {
wiki.Html__hdump_mgr().Save_mgr().Save(page);
}
}

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,10 +13,28 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.guis.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*;
import gplx.gfui.*; import gplx.gfui.controls.standards.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.wikis.pages.*;
import gplx.xowa.wikis.nss.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
package gplx.xowa.guis.views;
import gplx.Bry_;
import gplx.Bry_bfr;
import gplx.Datetime_now;
import gplx.Err_;
import gplx.Gfo_usr_dlg_;
import gplx.String_;
import gplx.gfui.controls.standards.Gfui_html;
import gplx.xowa.Xoa_page_;
import gplx.xowa.Xoa_ttl;
import gplx.xowa.Xoa_url;
import gplx.xowa.Xoae_page;
import gplx.xowa.Xowe_wiki;
import gplx.xowa.htmls.Xoh_page_wtr_wkr;
import gplx.xowa.htmls.core.htmls.Xoh_wtr_ctx;
import gplx.xowa.parsers.Xop_ctx;
import gplx.xowa.parsers.tmpls.Xot_defn_trace_dbg;
import gplx.xowa.wikis.data.tbls.Xowd_page_itm;
import gplx.xowa.wikis.nss.Xow_ns_;
import gplx.xowa.wikis.pages.Xopg_view_mode_;
public class Xog_tab_itm_edit_mgr {
public static void Save(Xog_tab_itm tab, boolean quick_save) {
if (tab.View_mode() != Xopg_view_mode_.Tid__edit) return; // exit if not edit; handles ctrl+s being pressed in read/html modes
@ -58,8 +76,13 @@ public class Xog_tab_itm_edit_mgr {
Gfo_usr_dlg_.Instance.Warn_many("", "", "failed to update categories; err=~{0}", Err_.Message_gplx_log(e));
}
// TODO: save html copy
//wiki.Db_mgr().Hdump_mgr().Save(page);
// reload html_db_id b/c it gets cleared in Xopg_db_page; ISSUE#:699; DATE:2020-08-06
Xowd_page_itm rv = new Xowd_page_itm();
wiki.Data__core_mgr().Tbl__page().Select_by_ttl(rv, page.Ttl().Ns(), page.Ttl().Page_db());
page.Db().Page().Html_db_id_(rv.Html_db_id());
// save html
wiki.Html__hdump_mgr().Save_mgr().Save(page, true);
// parse page and show it
page.Html_data().Edit_preview_(Bry_.Empty);

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,10 +13,24 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.htmls.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.wkrs.*; import gplx.xowa.htmls.core.hzips.*; import gplx.xowa.htmls.heads.*; import gplx.xowa.htmls.core.dbs.*;
import gplx.core.ios.*; import gplx.core.primitives.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.pages.*;
import gplx.xowa.addons.wikis.pages.syncs.core.parsers.*;
package gplx.xowa.htmls.core;
import gplx.core.ios.Io_stream_zip_mgr;
import gplx.core.primitives.Bool_obj_ref;
import gplx.xowa.Xoae_page;
import gplx.xowa.Xow_wiki;
import gplx.xowa.htmls.Xoh_page;
import gplx.xowa.htmls.core.dbs.Xowd_html_tbl;
import gplx.xowa.htmls.core.htmls.Xoh_wtr_ctx;
import gplx.xowa.htmls.core.hzips.Xoh_hzip_dict_;
import gplx.xowa.htmls.core.hzips.Xoh_hzip_mgr;
import gplx.xowa.htmls.core.wkrs.Xoh_hzip_bfr;
import gplx.xowa.wikis.data.Xow_db_file;
import gplx.xowa.wikis.data.Xow_db_file_;
import gplx.xowa.wikis.data.Xow_db_mgr;
import gplx.xowa.wikis.pages.Xopg_view_mode_;
import gplx.xowa.wikis.pages.dbs.Xopg_db_page;
public class Xow_hdump_mgr__save {
private final Xow_wiki wiki; private final Xoh_hzip_mgr hzip_mgr; private final Io_stream_zip_mgr zip_mgr;
private final Xoh_page tmp_hpg; private final Xoh_hzip_bfr tmp_bfr = Xoh_hzip_bfr.New_txt(32); private Bool_obj_ref html_db_is_new = Bool_obj_ref.n_();
@ -28,11 +42,12 @@ public class Xow_hdump_mgr__save {
this.dflt_zip_tid = dflt_zip_tid; this.dflt_hzip_tid = dflt_hzip_tid; tmp_bfr.Mode_is_b256_(mode_is_b256);
}
public byte[] Src_as_hzip() {return src_as_hzip;} private byte[] src_as_hzip;
public int Save(Xoae_page page) {
public int Save(Xoae_page page) {return Save(page, false);}
public int Save(Xoae_page page, boolean isEdit) {
synchronized (tmp_hpg) {
Bld_hdump(page);
tmp_hpg.Ctor_by_hdiff(tmp_bfr, page, page.Wikie().Msg_mgr().Val_by_id(gplx.xowa.langs.msgs.Xol_msg_itm_.Id_toc));
Xow_db_file html_db = Get_html_db(wiki, page, html_db_is_new.Val_n_());
Xow_db_file html_db = Get_html_db(wiki, page, html_db_is_new.Val_n_(), isEdit);
return Save(page, tmp_hpg, html_db.Tbl__html(), html_db_is_new.Val(), true);
}
}
@ -66,14 +81,31 @@ public class Xow_hdump_mgr__save {
src = zip_mgr.Zip((byte)zip_tid, src);
return src;
}
private static Xow_db_file Get_html_db(Xow_wiki wiki, Xoae_page page, Bool_obj_ref html_db_is_new) {
private static Xow_db_file Get_html_db(Xow_wiki wiki, Xoae_page page, Bool_obj_ref html_db_is_new, boolean isEdit) {
Xow_db_file rv = Xow_db_file.Null;
Xow_db_mgr core_data_mgr = wiki.Data__core_mgr();
int html_db_id = page.Db().Page().Html_db_id();
if (html_db_id == -1) {
if (html_db_id == Xopg_db_page.HTML_DB_ID_NULL) {
html_db_is_new.Val_y_();
rv = core_data_mgr.Db__html();
if (rv == null) rv = core_data_mgr.Dbs__make_by_tid(Xow_db_file_.Tid__html_data);
// get htmlDbTid; NOTE: probably do not need Tid__html_data b/c xomp_wkr and sync_mgr should be building the databases; ISSUE#:699; DATE:2020-08-06
byte htmlDbTid = isEdit ? Xow_db_file_.Tid__html_user : Xow_db_file_.Tid__html_data;
// get htmlDb
if (isEdit) {
rv = core_data_mgr.Dbs__get_by_tid_or_null(htmlDbTid);
}
else {
rv = core_data_mgr.Db__html();
}
// make htmlDb if not available
if (rv == null) {
rv = core_data_mgr.Dbs__make_by_tid(htmlDbTid);
Xowd_html_tbl html_tbl = new Xowd_html_tbl(rv.Conn());
html_tbl.Create_tbl();
}
html_db_id = rv.Id();
page.Db().Page().Html_db_id_(html_db_id);
core_data_mgr.Tbl__page().Update__html_db_id(page.Db().Page().Id(), html_db_id);

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,9 +13,22 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.htmls.hxtns.blobs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.hxtns.*;
import gplx.dbs.*;
import gplx.core.ios.*;
package gplx.xowa.htmls.hxtns.blobs;
import gplx.Bry_bfr;
import gplx.Hash_adp_bry;
import gplx.Rls_able;
import gplx.String_;
import gplx.core.ios.Io_stream_zip_mgr;
import gplx.dbs.Db_conn;
import gplx.dbs.Db_rdr;
import gplx.dbs.Db_rdr_;
import gplx.dbs.Db_stmt;
import gplx.dbs.Db_stmt_;
import gplx.dbs.Dbmeta_fld_list;
import gplx.dbs.Dbmeta_idx_itm;
import gplx.dbs.Dbmeta_tbl_itm;
public class Hxtn_blob_tbl implements Rls_able {
private static final String tbl_name = "hxtn_blob"; private static final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private static final String
@ -56,6 +69,19 @@ public class Hxtn_blob_tbl implements Rls_able {
.Val_bry(fld_blob_data , blob_data)
.Exec_insert();
}
public boolean Exists(int blob_tid, int wiki_id, int blob_id) {
Db_rdr rdr = Db_rdr_.Empty;
try {
rdr = conn.Stmt_select(tbl_name, flds, fld_blob_tid, fld_wiki_id, fld_blob_id)
.Crt_int(fld_blob_tid, blob_tid)
.Crt_int(fld_wiki_id, wiki_id)
.Crt_int(fld_blob_id, blob_id)
.Exec_select__rls_auto();
return rdr.Move_next();
} finally {
rdr.Rls();
}
}
public void Select_to_regy(Bry_bfr temp_bfr, Hash_adp_bry blob_data_hash) {
Db_rdr rdr = conn.Stmt_select(tbl_name, String_.Ary(fld_wiki_id, fld_blob_id, fld_blob_tid))
.Exec_select__rls_auto();

@ -31,13 +31,14 @@ import gplx.xowa.htmls.Xoh_page;
import gplx.xowa.htmls.hxtns.blobs.Hxtn_blob_tbl;
import gplx.xowa.htmls.hxtns.wikis.Hxtn_wiki_mgr;
import gplx.xowa.htmls.hxtns.wkrs.Hxtn_wkr_mgr;
public class Hxtn_page_mgr {
private Hxtn_page_tbl page_tbl;
private Hxtn_blob_tbl blob_tbl;
private Hash_adp_bry blob_hash;
private final Hash_adp__int wkrs = new Hash_adp__int();
private Hash_adp_bry blob_hash = Hash_adp_bry.cs();
private final Hash_adp__int wkrs = new Hash_adp__int();
private boolean dbs_missing = true;
private Bry_bfr temp_bfr;
private Bry_bfr temp_bfr = Bry_bfr_.New();
public Hxtn_page_tbl Page_tbl() {return page_tbl;}
public Hxtn_blob_tbl Blob_tbl() {return blob_tbl;}
@ -45,8 +46,6 @@ public class Hxtn_page_mgr {
// init tbls and other members
this.page_tbl = new Hxtn_page_tbl(wkr_db_conn);
this.blob_tbl = new Hxtn_blob_tbl(wkr_db_conn, zip_tid);
this.blob_hash = Hash_adp_bry.cs();
this.temp_bfr = Bry_bfr_.New();
// if tbl exists, xomp_resume has run; load known blobs to prevent dupes
if (wkr_db_conn.Meta_tbl_exists(page_tbl.Tbl_name())) {
@ -88,13 +87,16 @@ public class Hxtn_page_mgr {
blob_tbl.Stmt_end();
}
public void Page_tbl__insert(int page_id, int wkr_id, int data_id) {
page_tbl.Insert_exec(page_id, wkr_id, data_id);
if (!page_tbl.Exists(page_id, wkr_id, data_id))
page_tbl.Insert_exec(page_id, wkr_id, data_id);
}
public void Blob_tbl__insert(int blob_tid, int wiki_id, int blob_id, byte[] blob_text) {
byte[] key = Hxtn_blob_tbl.Make_key(temp_bfr, blob_tid, wiki_id, blob_id);
if (!blob_hash.Has(key)) {// multiple pages can refer to same template; only insert if not seen
blob_hash.Add_as_key_and_val(key);
blob_tbl.Insert_exec(blob_tid, wiki_id, blob_id, blob_text);
if (!blob_tbl.Exists(blob_tid, wiki_id, blob_id)) {
blob_tbl.Insert_exec(blob_tid, wiki_id, blob_id, blob_text);
}
}
}
public void Reg_wkr(Hxtn_page_wkr wkr) {

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,8 +13,20 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.htmls.hxtns.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.hxtns.*;
import gplx.dbs.*;
package gplx.xowa.htmls.hxtns.pages;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.Rls_able;
import gplx.dbs.Db_conn;
import gplx.dbs.Db_rdr;
import gplx.dbs.Db_rdr_;
import gplx.dbs.Db_stmt;
import gplx.dbs.Db_stmt_;
import gplx.dbs.Dbmeta_fld_list;
import gplx.dbs.Dbmeta_idx_itm;
import gplx.dbs.Dbmeta_tbl_itm;
public class Hxtn_page_tbl implements Rls_able {
private static final String tbl_name = "hxtn_page"; private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
private final String fld_page_id, fld_wkr_id, fld_data_id;
@ -51,6 +63,19 @@ public class Hxtn_page_tbl implements Rls_able {
.Val_int(fld_data_id , data_id)
.Exec_insert();
}
public boolean Exists(int page_id, int wkr_id, int data_id) {
Db_rdr rdr = Db_rdr_.Empty;
try {
rdr = conn.Stmt_select(tbl_name, flds, fld_page_id, fld_wkr_id, fld_data_id)
.Crt_int(fld_page_id, page_id)
.Crt_int(fld_wkr_id, wkr_id)
.Crt_int(fld_data_id, data_id)
.Exec_select__rls_auto();
return rdr.Move_next();
} finally {
rdr.Rls();
}
}
public List_adp Select_by_page(int page_id) {
List_adp rv = List_adp_.New();
Db_rdr rdr = conn.Stmt_select(tbl_name, flds, fld_page_id)

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.wikis.data; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
package gplx.xowa.wikis.data;
import gplx.Err_;
public class Xow_db_file_ {
public static final int Uid__core = 0;
public static final byte

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,10 +13,32 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.wikis.data; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.dbs.*; import gplx.dbs.cfgs.*; import gplx.core.lists.hashs.*;
import gplx.xowa.wikis.dbs.*; import gplx.xowa.wikis.data.tbls.*;
import gplx.xowa.wikis.domains.*; import gplx.xowa.bldrs.infos.*; import gplx.xowa.wikis.metas.*;
package gplx.xowa.wikis.data;
import gplx.Byte_;
import gplx.DateAdp;
import gplx.Err_;
import gplx.Guid_adp_;
import gplx.Int_;
import gplx.Int_ary_;
import gplx.Io_mgr;
import gplx.Io_url;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.Ordered_hash;
import gplx.Ordered_hash_;
import gplx.String_;
import gplx.dbs.Db_cmd_mode;
import gplx.dbs.Db_conn;
import gplx.dbs.Db_conn_bldr;
import gplx.dbs.cfgs.Db_cfg_tbl;
import gplx.xowa.Xoa_app_;
import gplx.xowa.Xow_wiki;
import gplx.xowa.bldrs.infos.Xob_info_file;
import gplx.xowa.bldrs.infos.Xob_info_session;
import gplx.xowa.wikis.data.tbls.Xowd_page_tbl;
import gplx.xowa.wikis.data.tbls.Xowd_text_tbl;
public class Xow_db_mgr {
private final Io_url wiki_root_dir;
private final String domain_str; // needed for generating new files; EX: en.wikipedia.org-text.ns.001.xowa

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,9 +13,23 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.wikis.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.ios.*; import gplx.dbs.*; import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.dbs.qrys.*;
import gplx.xowa.wikis.*;
package gplx.xowa.wikis.dbs;
import gplx.DateAdp;
import gplx.Datetime_now;
import gplx.String_;
import gplx.dbs.Db_rdr;
import gplx.dbs.Dbmeta_fld_itm;
import gplx.xowa.Xoa_ttl;
import gplx.xowa.Xoae_page;
import gplx.xowa.Xowe_wiki;
import gplx.xowa.wikis.data.Xow_db_file;
import gplx.xowa.wikis.data.Xow_db_mgr;
import gplx.xowa.wikis.data.Xowd_cfg_key_;
import gplx.xowa.wikis.data.tbls.Xowd_page_itm;
import gplx.xowa.wikis.data.tbls.Xowd_page_tbl;
import gplx.xowa.wikis.data.tbls.Xowd_text_tbl;
public class Xodb_save_mgr_sql implements Xodb_save_mgr {
private final Xodb_mgr_sql db_mgr;
public Xodb_save_mgr_sql(Xodb_mgr_sql db_mgr) {this.db_mgr = db_mgr;}
@ -67,9 +81,10 @@ public class Xodb_save_mgr_sql implements Xodb_save_mgr {
db_mgr.Load_mgr().Load_by_id(db_page, page_id);
Xowd_text_tbl text_tbl = db_mgr.Core_data_mgr().Dbs__get_by_id_or_fail(db_page.Text_db_id()).Tbl__text();
text_tbl.Update(page_id, text_raw);
// int html_db_id = db_page.Html_db_id();
// if (html_db_id != -1)
// db_mgr.Core_data_mgr().Tbl__page().Update__html_db_id(page_id, -1); // zap html_db_id so that next load will repopulate it
// TOMBSTONE: do not set html_db_id to -1; editing wtxt will now save html; ISSUE#:699; DATE:2020-08-06
// if (db_page.Html_db_id() != -1)
// db_mgr.Core_data_mgr().Tbl__page().Update__html_db_id(page_id, -1); // zap html_db_id so that next load will repopulate it
}
public void Data_rename(Xoae_page page, int trg_ns, byte[] trg_ttl) {
db_mgr.Core_data_mgr().Tbl__page().Update__ns__ttl(page.Db().Page().Id(), trg_ns, trg_ttl);

@ -33,6 +33,7 @@ import gplx.xowa.Xowe_wiki_;
import gplx.xowa.addons.wikis.pages.syncs.core.Xosync_read_mgr;
import gplx.xowa.guis.views.Xog_tab_itm;
import gplx.xowa.wikis.data.tbls.Xowd_page_itm;
import gplx.xowa.wikis.pages.dbs.Xopg_db_page;
public class Xowe_page_mgr {
private final Xowe_wiki wiki;
@ -90,7 +91,7 @@ public class Xowe_page_mgr {
}
// load from html_db
boolean from_html_db = page.Db().Page().Html_db_id() != -1;
boolean from_html_db = page.Db().Page().Html_db_id() != Xopg_db_page.HTML_DB_ID_NULL;
boolean read_from_html_db_preferred = wiki.Html__hdump_mgr().Load_mgr().Read_preferred();
boolean isCategoryPage = ttl.Ns().Id_is_ctg();
if (from_html_db) {

@ -1,6 +1,6 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
@ -13,34 +13,41 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
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.*;
package gplx.xowa.wikis.pages.dbs;
import gplx.Bool_;
import gplx.DateAdp;
import gplx.DateAdp_;
import gplx.xowa.Xoa_ttl;
import gplx.xowa.Xow_wiki;
import gplx.xowa.wikis.nss.Xow_ns;
public class Xopg_db_page {
public Xopg_db_page() {this.Clear();}
// from page table
public boolean Exists() {return exists;} private boolean exists;
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;
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 boolean Exists() {return exists;} private boolean exists;
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;
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 Score_(int v) {this.score = 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;}
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 Score_(int v) {this.score = 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;
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) {
@ -61,6 +68,10 @@ public class Xopg_db_page {
public void Clear() {
this.exists = true;
this.modified_on = DateAdp_.MinValue; // NOTE: must set to MinValue else some tests will fail
this.html_db_id = -1; // NOTE: must set to -1 b/c code checks for -1 to indicate no html; DATE:2016-07-14
// NOTE: must set to -1 b/c code checks for -1 to indicate no html; DATE:2016-07-14;
// NOTE: this should probably be removed, but would need to change all the checks; DATE:2020-08-06
this.html_db_id = Xopg_db_page.HTML_DB_ID_NULL;
}
public static final int HTML_DB_ID_NULL = -1;
}

Loading…
Cancel
Save