mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.5.1.1
This commit is contained in:
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
public class Gfo_async_cmd_itm implements GfoInvkAble {
|
||||
private GfoInvkAble invk; private String invk_key; private GfoMsg msg = GfoMsg_.new_cast_("");
|
||||
public Gfo_async_cmd_itm Init(GfoInvkAble invk, String invk_key, Object... args) {
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
class Gfo_async_cmd_mkr {
|
||||
// private Gfo_async_cmd_itm[] free = Gfo_async_cmd_itm.Ary_empty, used = Gfo_async_cmd_itm.Ary_empty;
|
||||
// private int free_bgn = 0, free_end = 0, ary_len = 0;
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Gfo_async_mgr implements GfoInvkAble {
|
||||
private ListAdp queue = ListAdp_.new_();
|
||||
@@ -29,7 +29,7 @@ public class Gfo_async_mgr implements GfoInvkAble {
|
||||
synchronized (running) {
|
||||
if (running.Val_n()) {
|
||||
running.Val_y_();
|
||||
gplx.threads.ThreadAdp_.invk_(Invk_run, this, Invk_run).Start();
|
||||
gplx.core.threads.Thread_adp_.invk_(Invk_run, this, Invk_run).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
public interface Gfo_thread_cmd extends GfoInvkAble {
|
||||
void Cmd_ctor();
|
||||
String Async_key();
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
public class Gfo_thread_cmd_ {
|
||||
public static final int Async_sleep_interval_1_second = 1000;
|
||||
public static final byte Init_ok = 0, Init_cancel_step = 1, Init_cancel_all = 2;
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
import gplx.gfui.*;
|
||||
public class Gfo_thread_cmd_base implements Gfo_thread_cmd {
|
||||
@gplx.Virtual public String Async_key() {return "undefined";}
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
import gplx.gfui.*;
|
||||
public class Gfo_thread_cmd_download implements Gfo_thread_cmd {
|
||||
public Gfo_thread_cmd Ctor(Gfo_usr_dlg usr_dlg, Gfui_kit kit) {this.usr_dlg = usr_dlg; this.kit = kit; xrg.Prog_dlg_(usr_dlg); return this;}
|
||||
@@ -50,7 +50,7 @@ public class Gfo_thread_cmd_download implements Gfo_thread_cmd {
|
||||
}
|
||||
public void Async_prog_run(int async_sleep_sum) {}
|
||||
public boolean Async_running() {return xrg.Prog_running();}
|
||||
public void Async_run() {ThreadAdp_.invk_(gplx.xowa.apps.Xoa_thread_.Key_bldr_download, this, Invk_async_bgn).Start();}
|
||||
public void Async_run() {Thread_adp_.invk_(gplx.xowa.apps.Xoa_thread_.Key_bldr_download, this, Invk_async_bgn).Start();}
|
||||
private void Download() {
|
||||
download_pass = true;
|
||||
if (!xrg.Exec()) {
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
import gplx.gfui.*;
|
||||
public class Gfo_thread_cmd_replace implements Gfo_thread_cmd {
|
||||
public Gfo_thread_cmd Init(Gfo_usr_dlg usr_dlg, Gfui_kit kit, Io_url fil) {
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
import gplx.gfui.*; import gplx.xowa.bldrs.cmds.utils.*;
|
||||
public class Gfo_thread_cmd_unzip implements Gfo_thread_cmd {
|
||||
public Gfo_thread_cmd_unzip Init(Gfo_usr_dlg usr_dlg, Gfui_kit kit, ProcessAdp bzip2_process, ProcessAdp zip_process, ProcessAdp gz_process, Io_url src, Io_url trg) {
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
public class Gfo_thread_pool implements GfoInvkAble {
|
||||
private Object thread_lock = new Object();
|
||||
private ListAdp queue = ListAdp_.new_();
|
||||
@@ -41,7 +41,7 @@ public class Gfo_thread_pool implements GfoInvkAble {
|
||||
running = true;
|
||||
wkr = (Gfo_thread_wkr)ListAdp_.Pop_first(queue);
|
||||
}
|
||||
ThreadAdp_.Run_invk_msg(wkr.Name(), this, run_msg.Clear().Add("v", wkr));
|
||||
Thread_adp_.Run_invk_msg(wkr.Name(), this, run_msg.Clear().Add("v", wkr));
|
||||
}
|
||||
private void Run_wkr(Gfo_thread_wkr wkr) {
|
||||
try {wkr.Exec();}
|
||||
@@ -15,7 +15,7 @@ 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.threads; import gplx.*;
|
||||
package gplx.core.threads; import gplx.*; import gplx.core.*;
|
||||
public interface Gfo_thread_wkr {
|
||||
String Name();
|
||||
void Exec();
|
||||
@@ -62,7 +62,6 @@ class Fsdb_db_mgr__v1_bldr {
|
||||
Fsdb_db_file db_abc = new_db(mnt_dir.GenSubFil(Fsdb_db_mgr__v1.Abc_name));
|
||||
Db_cfg_tbl cfg_tbl = new Db_cfg_tbl(db_abc.Conn(), "fsdb_cfg"); cfg_tbl.Create_tbl();
|
||||
Fsm_mnt_mgr.Patch(cfg_tbl);
|
||||
Fsm_mnt_mgr.Patch_core(cfg_tbl);
|
||||
Fsm_atr_tbl dba_tbl = new Fsm_atr_tbl(db_abc.Conn(), schema_is_1); dba_tbl.Create_tbl();
|
||||
dba_tbl.Insert(mnt_id, mnt_name);
|
||||
Fsm_bin_tbl dbb_tbl = new Fsm_bin_tbl(db_abc.Conn(), schema_is_1, mnt_id); dbb_tbl.Create_tbl();
|
||||
|
||||
@@ -61,10 +61,8 @@ public class Fsdb_db_mgr__v2_bldr {
|
||||
Fsdb_db_file rv = new Fsdb_db_file(core_url, core_conn);
|
||||
Db_cfg_tbl cfg_tbl = rv.Tbl__cfg();
|
||||
cfg_tbl.Create_tbl();
|
||||
cfg_tbl.Insert_int(Fsm_cfg_mgr.Grp_core, Fsm_cfg_mgr.Key_next_id , 1); // start next_id at 1
|
||||
cfg_tbl.Insert_yn(Fsm_cfg_mgr.Grp_core, Fsm_cfg_mgr.Key_schema_thm_page , Bool_.Y); // new dbs automatically have page and time in fsdb_xtn_tm
|
||||
cfg_tbl.Insert_yn(Fsm_cfg_mgr.Grp_core, Fsm_cfg_mgr.Key_patch_next_id , Bool_.Y); // new dbs automatically have correct next_id
|
||||
Fsm_mnt_mgr.Patch(cfg_tbl);
|
||||
Fsm_mnt_mgr.Patch_core(cfg_tbl);
|
||||
Xof_orig_tbl orig_tbl = new Xof_orig_tbl(core_conn, schema_is_1); orig_tbl.Create_tbl();
|
||||
if (mnt_id == Fsm_mnt_mgr.Mnt_idx_main) {
|
||||
Fsm_mnt_tbl mnt_tbl = new Fsm_mnt_tbl(core_conn, schema_is_1); mnt_tbl.Create_tbl();
|
||||
|
||||
@@ -26,18 +26,21 @@ public class Fsm_cfg_mgr {
|
||||
Db_cfg_hash hash = Grps_get_or_load(Grp_core);
|
||||
this.next_id = hash.Get(Key_next_id).To_int_or(-1); if (next_id == -1) throw Err_.new_("next_id not found in cfg");
|
||||
this.schema_thm_page = hash.Get(Key_schema_thm_page).To_yn_or_n();
|
||||
this.patch_next_id = hash.Get(Key_patch_next_id).To_yn_or_n();
|
||||
this.patch__next_id = hash.Get(Key_patch__next_id).To_yn_or_n();
|
||||
this.patch__page_gt_1 = hash.Get(Key_patch__page_gt_1).To_yn_or_n();
|
||||
}
|
||||
public Db_cfg_tbl Tbl() {return tbl;}
|
||||
public int Next_id() {return next_id++;} private int next_id = 1;
|
||||
public void Next_id_commit() {tbl.Update_int("core", "next_id", next_id);}
|
||||
public boolean Schema_thm_page() {return schema_thm_page;} private boolean schema_thm_page = true;
|
||||
public boolean Patch_next_id() {return patch_next_id;} private boolean patch_next_id = true;
|
||||
public boolean Patch_next_id() {return patch__next_id;} private boolean patch__next_id = true;
|
||||
public void Patch_next_id_exec(int last_id) {
|
||||
if (last_id >= next_id)
|
||||
next_id = last_id + 1;
|
||||
tbl.Insert_yn(Grp_core, Key_patch_next_id, Bool_.Y);
|
||||
tbl.Insert_yn(Grp_core, Key_patch__next_id, Bool_.Y);
|
||||
}
|
||||
public boolean Patch__page_gt_1() {return patch__page_gt_1;} private boolean patch__page_gt_1 = false;
|
||||
public void Patch__save(String cfg_key) {tbl.Insert_yn(Fsm_cfg_mgr.Grp_core, cfg_key, Bool_.Y);}
|
||||
public Db_cfg_hash Grps_get_or_load(String grp_key) {
|
||||
Db_cfg_hash rv = (Db_cfg_hash)grp_hash.Fetch(grp_key);
|
||||
if (rv == null) {
|
||||
@@ -47,5 +50,5 @@ public class Fsm_cfg_mgr {
|
||||
return rv;
|
||||
}
|
||||
public static final String Grp_core = "core";
|
||||
public static final String Key_next_id = "next_id", Key_schema_thm_page = "schema.thm.page", Key_patch_next_id = "patch.next_id";
|
||||
public static final String Key_next_id = "next_id", Key_schema_thm_page = "schema.thm.page", Key_patch__next_id = "patch.next_id", Key_patch__page_gt_1 = "patch.page_gt_1";
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Fsm_mnt_mgr implements GfoInvkAble {
|
||||
public static void Patch_core(Db_cfg_tbl cfg_tbl) {
|
||||
cfg_tbl.Insert_int (Fsm_cfg_mgr.Grp_core, Fsm_cfg_mgr.Key_next_id , 1); // start next_id at 1
|
||||
cfg_tbl.Insert_yn (Fsm_cfg_mgr.Grp_core, Fsm_cfg_mgr.Key_schema_thm_page , Bool_.Y); // new dbs automatically have page and time in fsdb_xtn_tm
|
||||
cfg_tbl.Insert_yn (Fsm_cfg_mgr.Grp_core, Fsm_cfg_mgr.Key_patch_next_id , Bool_.Y); // new dbs automatically have correct next_id
|
||||
cfg_tbl.Insert_yn (Fsm_cfg_mgr.Grp_core, Fsm_cfg_mgr.Key_patch__next_id , Bool_.Y); // new dbs automatically have correct next_id
|
||||
}
|
||||
public static final String Cfg_grp_core = "core", Cfg_key_mnt_insert_idx = "mnt.insert_idx"; // SERIALIZED
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Gfui_bnd_parser {
|
||||
private void Process_sym(boolean src_is_gfui, Gfui_bnd_tkn sym_tkn, int itm_bgn, int itm_end) {
|
||||
Hash_adp_bry regy = src_is_gfui ? gfui_regy : norm_regy;
|
||||
Gfui_bnd_tkn tkn = (Gfui_bnd_tkn)regy.Get_by_mid(src, itm_bgn, itm_end);
|
||||
if (tkn == null) throw Err_.new_fmt_("unknown key: key={0}", String_.new_utf8_(src, itm_bgn, itm_end));
|
||||
if (tkn == null) return;
|
||||
int mod_adj = Mod_val_null;
|
||||
switch (tkn.Tid()) {
|
||||
case Gfui_bnd_tkn.Tid_mod_c: mod_adj = Gfui_bnd_tkn.Tid_mod_c; break;
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.json; import gplx.*;
|
||||
public class Json_doc {
|
||||
public void Ctor(byte[] src, Json_itm_nde root) {this.src = src; this.root = root;}
|
||||
public Bry_bfr Bfr() {return bfr;} Bry_bfr bfr = Bry_bfr.new_();
|
||||
public NumberParser Utl_num_parser() {return utl_num_parser;} NumberParser utl_num_parser = new NumberParser();
|
||||
public Number_parser Utl_num_parser() {return utl_num_parser;} Number_parser utl_num_parser = new Number_parser();
|
||||
public byte[] Str_utf8_bry() {return str_utf8_bry;} private byte[] str_utf8_bry = new byte[6];
|
||||
public byte[] Src() {return src;} private byte[] src;
|
||||
public Json_itm_nde Root() {return root;} Json_itm_nde root;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Json_itm_int extends Json_itm_base {
|
||||
@Override public byte Tid() {return Json_itm_.Tid_int;}
|
||||
public int Data_as_int() {
|
||||
if (data_is_null) {
|
||||
data = doc.Utl_num_parser().Parse(doc.Src(), Src_bgn(), Src_end()).AsInt();
|
||||
data = doc.Utl_num_parser().Parse(doc.Src(), Src_bgn(), Src_end()).Rv_as_int();
|
||||
data_is_null = false;
|
||||
}
|
||||
return data;
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.json; import gplx.*;
|
||||
public class Json_parser {
|
||||
public Json_factory Factory() {return factory;} private Json_factory factory = new Json_factory();
|
||||
private byte[] src; private int src_len, pos; private NumberParser num_parser = new NumberParser();
|
||||
private byte[] src; private int src_len, pos; private Number_parser num_parser = new Number_parser();
|
||||
private static final byte[] Bry_bool_rue = Bry_.new_ascii_("rue"), Bry_bool_alse = Bry_.new_ascii_("alse"), Bry_null_ull = Bry_.new_ascii_("ull");
|
||||
public Json_doc Parse(byte[] src) {
|
||||
Json_doc doc = new Json_doc();
|
||||
@@ -127,7 +127,7 @@ public class Json_parser {
|
||||
}
|
||||
}
|
||||
num_parser.Parse(src, num_bgn, pos);
|
||||
return num_parser.HasFrac()
|
||||
return num_parser.Has_frac()
|
||||
? factory.Decimal(doc, num_bgn, pos)
|
||||
: factory.Int(doc, num_bgn, pos);
|
||||
}
|
||||
|
||||
@@ -16,18 +16,22 @@ 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; import gplx.*;
|
||||
import gplx.xowa.apps.fsys.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*;
|
||||
import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.xowa.urls.encoders.*;
|
||||
import gplx.xowa.wmfs.*;
|
||||
import gplx.xowa.html.wtrs.*;
|
||||
public interface Xoa_app {
|
||||
Xoa_app_type App_type();
|
||||
Xoa_fsys_mgr Fsys_mgr();
|
||||
Xof_cache_mgr File_mgr__cache_mgr();
|
||||
Xof_img_mgr File_mgr__img_mgr();
|
||||
Xof_cache_mgr File__cache_mgr();
|
||||
Xof_img_mgr File__img_mgr();
|
||||
Xowmf_mgr Wmf_mgr();
|
||||
Gfo_usr_dlg Usr_dlg();
|
||||
Bry_bfr_mkr Utl__bfr_mkr();
|
||||
Url_encoder_mgr Utl__encoder_mgr();
|
||||
Xoh_href_parser Html__href_parser();
|
||||
Xoh_lnki_bldr Html__lnki_bldr();
|
||||
Xoa_css_extractor Html__css_installer();
|
||||
boolean Xwiki_mgr__missing(byte[] domain);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Xoa_app_ {
|
||||
boot_mgr.Run(args);
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final String Version = "2.4.4.1";
|
||||
public static final String Version = "2.5.1.1";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Op_sys;
|
||||
public static String User_agent = "";
|
||||
@@ -38,19 +38,12 @@ public class Xoa_app_ {
|
||||
rv.Log_wtr().Queue_enabled_(true);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte Mode() {return mode;} public static void Mode_(byte v) {mode = v;} private static byte mode = Xoa_app_.Mode_console;
|
||||
public static boolean Mode_is_gui() {return mode == Xoa_app_.Mode_gui;}
|
||||
public static Gfo_usr_dlg Usr_dlg() {return usr_dlg;} public static void Usr_dlg_(Gfo_usr_dlg v) {usr_dlg = v;} private static Gfo_usr_dlg usr_dlg;
|
||||
public static Bry_bfr_mkr Utl__bfr_mkr() {return utl__bry_bfr_mkr;} private static final Bry_bfr_mkr utl__bry_bfr_mkr = new Bry_bfr_mkr();
|
||||
public static Url_encoder_mgr Utl__encoder_mgr() {return utl__encoder_mgr;} private static final Url_encoder_mgr utl__encoder_mgr = new Url_encoder_mgr();
|
||||
public static Io_stream_zip_mgr Utl__zip_mgr() {return utl__zip_mgr;} private static final Io_stream_zip_mgr utl__zip_mgr = new Io_stream_zip_mgr();
|
||||
// public static Xof_url_bldr Utl__url_bldr() {return utl__url_bldr;} private static final Xof_url_bldr utl__url_bldr = Xof_url_bldr.new_v2_();
|
||||
|
||||
public static Xoa_gfs_mgr Gfs_mgr() {return gfs_mgr;} public static void Gfs_mgr_(Xoa_gfs_mgr v) {gfs_mgr = v;} private static Xoa_gfs_mgr gfs_mgr;
|
||||
|
||||
public static final byte Mode_console = 0, Mode_gui = 1, Mode_http = 2;
|
||||
}
|
||||
}
|
||||
class Xoa_app_boot_mgr {
|
||||
private Gfo_usr_dlg usr_dlg; private Gfo_log_wtr log_wtr; private String chkpoint = "null";
|
||||
public void Run(String[] args) {
|
||||
@@ -125,7 +118,7 @@ class Xoa_app_boot_mgr {
|
||||
return rv;
|
||||
}
|
||||
private void Run_app(App_cmd_mgr args_mgr) {
|
||||
boolean app_mode_gui = false;
|
||||
boolean app_type_is_gui = false;
|
||||
Xoae_app app = null;
|
||||
try {
|
||||
// init vars
|
||||
@@ -143,12 +136,13 @@ class Xoa_app_boot_mgr {
|
||||
Xoa_app_.Op_sys = args_mgr.Args_get("bin_dir_name").Val_as_str_or(Bin_dir_name());
|
||||
Xoa_app_.User_agent = String_.Format("XOWA/{0} ({1}) [gnosygnu@gmail.com]", Xoa_app_.Version, Xoa_app_.Op_sys);
|
||||
String cmd_text = args_mgr.Args_get("cmd_text").Val_as_str_or(null);
|
||||
app_mode_gui = String_.Eq(app_mode, "gui");
|
||||
Xoa_app_type app_type = Xoa_app_type.parse(app_mode);
|
||||
app_type_is_gui = app_type.Uid_is_gui();
|
||||
|
||||
// init app
|
||||
Db_conn_bldr.I.Reg_default_sqlite();
|
||||
app = new Xoae_app(usr_dlg, root_dir, user_dir, Xoa_app_.Op_sys); usr_dlg.Log_wtr().Queue_enabled_(false); log_wtr.Log_msg_to_session_fmt("app.init");
|
||||
app.Fsys_mgr().Wiki_dir_(wiki_dir);
|
||||
app = new Xoae_app(usr_dlg, app_type, root_dir, wiki_dir, root_dir.GenSubDir("file"), user_dir, root_dir.GenSubDir_nest("user", "anonymous", "wiki"), Xoa_app_.Op_sys);
|
||||
usr_dlg.Log_wtr().Queue_enabled_(false); log_wtr.Log_msg_to_session_fmt("app.init");
|
||||
try {
|
||||
app.Sys_cfg().Lang_(System_lang());
|
||||
if (launch_url != null)
|
||||
@@ -166,26 +160,23 @@ class Xoa_app_boot_mgr {
|
||||
try {app.Gfs_mgr().Run_url(cmd_file); chkpoint = "run_url";}
|
||||
catch (Exception e) {
|
||||
usr_dlg.Warn_many("", "", "script file failed: ~{0} ~{1} ~{2}", chkpoint, cmd_file.Raw(), Err_.Message_gplx(e));
|
||||
if (app_mode_gui)
|
||||
if (app_type_is_gui)
|
||||
GfuiEnv_.ShowMsg(Err_.Message_gplx(e));
|
||||
}
|
||||
gplx.xowa.apps.setups.Xoa_setup_mgr.Delete_old_files(app);
|
||||
|
||||
// launch
|
||||
app.Launch(); chkpoint = "launch";
|
||||
if (String_.Eq(app_mode, "server")) {
|
||||
Xoa_app_.Mode_(Xoa_app_.Mode_http);
|
||||
if (app_type.Uid_is_tcp())
|
||||
app.Tcp_server().Run();
|
||||
}
|
||||
else if (String_.Eq(app_mode, "http_server")) {
|
||||
Xoa_app_.Mode_(Xoa_app_.Mode_http);
|
||||
else if (app_type.Uid_is_http())
|
||||
app.Http_server().Run();
|
||||
}
|
||||
else {
|
||||
if (cmd_text != null)
|
||||
if (cmd_text != null) {
|
||||
gplx.xowa.servers.Gxw_html_server.Init_gui_for_server(app, null); // NOTE: must init kit else "app.shell.fetch_page" will fail; DATE:2015-04-30
|
||||
ConsoleAdp._.WriteLine_utf8(Object_.Xto_str_strict_or_empty(app.Gfs_mgr().Run_str(cmd_text)));
|
||||
if (app_mode_gui) {
|
||||
Xoa_app_.Mode_(Xoa_app_.Mode_gui);
|
||||
}
|
||||
if (app_type_is_gui) {
|
||||
app.Gui_mgr().Run(); chkpoint = "run";
|
||||
}
|
||||
else // teardown app, else lua will keep process running
|
||||
@@ -194,7 +185,7 @@ class Xoa_app_boot_mgr {
|
||||
}
|
||||
catch (Exception e) {usr_dlg.Warn_many("", "", "app launch failed: ~{0} ~{1}", chkpoint, Err_.Message_gplx(e));}
|
||||
finally {
|
||||
if (app != null && app_mode_gui) // only cancel if app_mode_gui is true; (force cmd_line to end process)
|
||||
if (app != null && app_type_is_gui) // only cancel if app_type_is_gui is true; (force cmd_line to end process)
|
||||
app.Setup_mgr().Cmd_mgr().Canceled_y_();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Xoa_app_fxt {
|
||||
public static Xoae_app app_(String op_sys, Io_url root_dir) {
|
||||
Io_url user_dir = root_dir.GenSubDir_nest("user", "test_user");
|
||||
Gfo_log_wtr_base._.Log_dir_(user_dir.GenSubDir_nest("tmp", "current"));
|
||||
Xoae_app app = new Xoae_app(Gfo_usr_dlg_base.test_(), root_dir, user_dir, op_sys);
|
||||
Xoae_app app = new Xoae_app(Gfo_usr_dlg_base.test_(), Xoa_app_type.Itm_cmd, root_dir, root_dir.GenSubDir("wiki"), root_dir.GenSubDir("file"), user_dir, root_dir.GenSubDir_nest("user", "anonymous", "wiki"), op_sys);
|
||||
app.Setup_mgr().Dump_mgr().Data_storage_format_(gplx.ios.Io_stream_.Tid_raw); // TEST: set data_storage_format to file, else bldr tests will fails (expects plain text)
|
||||
GfsCore._.Clear(); // NOTE: must clear
|
||||
GfsCore._.AddCmd(app, Xoae_app.Invk_app); // NOTE: must add app to GfsCore; app.Gfs_mgr() always adds current app to GfsCore; note this causes old test to leave behind GfsCore for new test
|
||||
|
||||
@@ -16,20 +16,22 @@ 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; import gplx.*;
|
||||
import gplx.core.btries.*; import gplx.core.flds.*; import gplx.ios.*; import gplx.threads.*;
|
||||
import gplx.core.btries.*; import gplx.core.flds.*; import gplx.ios.*; import gplx.core.threads.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.caches.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.apis.*; import gplx.xowa.urls.encoders.*; import gplx.xowa.apps.progs.*;
|
||||
import gplx.xowa.langs.*; import gplx.xowa.specials.*; import gplx.xowa.cfgs2.*;
|
||||
import gplx.xowa.files.caches.*; import gplx.xowa.files.imgs.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.users.*; import gplx.xowa.gui.*; import gplx.xowa.cfgs.*; import gplx.xowa.ctgs.*; import gplx.xowa.html.tocs.*; import gplx.xowa.fmtrs.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.html.wtrs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.tblws.*;
|
||||
import gplx.xowa.xtns.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.math.*;
|
||||
import gplx.xowa.parsers.logs.*; import gplx.xowa.servers.tcp.*; import gplx.xowa.servers.http.*;
|
||||
import gplx.xowa.wmfs.*;
|
||||
public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
public Xoae_app(Gfo_usr_dlg usr_dlg, Io_url root_dir, Io_url user_dir, String bin_dir_name) {
|
||||
Xoa_app_.Usr_dlg_(usr_dlg);
|
||||
public Xoae_app(Gfo_usr_dlg usr_dlg, Xoa_app_type app_type, Io_url root_dir, Io_url wiki_dir, Io_url file_dir, Io_url user_dir, Io_url css_dir, String bin_dir_name) {
|
||||
Xoa_app_.Usr_dlg_(usr_dlg);
|
||||
this.app_type = app_type;
|
||||
Io_url.Http_file_str_encoder = Xoa_app_.Utl__encoder_mgr().Fsys();
|
||||
fsys_mgr = new Xoa_fsys_mgr(bin_dir_name, root_dir);
|
||||
fsys_mgr = new Xoa_fsys_mgr(bin_dir_name, root_dir, wiki_dir, file_dir, css_dir);
|
||||
log_wtr = usr_dlg.Log_wtr();
|
||||
cfg_mgr = new Xoa_cfg_mgr(this);
|
||||
api_root = new Xoapi_root(this);
|
||||
@@ -58,19 +60,19 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
http_server = new Http_server_mgr(this);
|
||||
cfg_regy = new Xocfg_regy(this);
|
||||
html_mgr = new Xoh_html_mgr(this);
|
||||
// queue_file = new Xop_queue_mgr(this);
|
||||
this.html__lnki_bldr = new Xoh_lnki_bldr(this, href_parser);
|
||||
}
|
||||
public byte Mode() {return Xoa_app_.Mode();}
|
||||
public Xoa_app_type App_type() {return app_type;} private final Xoa_app_type app_type;
|
||||
public Xoa_fsys_mgr Fsys_mgr() {return fsys_mgr;} private final Xoa_fsys_mgr fsys_mgr;
|
||||
public Xof_cache_mgr File_mgr__cache_mgr() {return file_mgr.Cache_mgr();}
|
||||
public Xof_img_mgr File_mgr__img_mgr() {return file_mgr.Img_mgr();}
|
||||
public Xof_cache_mgr File__cache_mgr() {return file_mgr.Cache_mgr();}
|
||||
public Xof_img_mgr File__img_mgr() {return file_mgr.Img_mgr();}
|
||||
public Xoh_href_parser Html__href_parser() {return href_parser;} private Xoh_href_parser href_parser;
|
||||
public Xoh_lnki_bldr Html__lnki_bldr() {return html__lnki_bldr;} private final Xoh_lnki_bldr html__lnki_bldr;
|
||||
public Xoa_css_extractor Html__css_installer() {return html__css_installer;} private final Xoa_css_extractor html__css_installer = new Xoa_css_extractor();
|
||||
public Xowmf_mgr Wmf_mgr() {return wmf_mgr;} private final Xowmf_mgr wmf_mgr = new Xowmf_mgr();
|
||||
public Bry_bfr_mkr Utl__bfr_mkr() {return Xoa_app_.Utl__bfr_mkr();}
|
||||
public Url_encoder_mgr Utl__encoder_mgr() {return Xoa_app_.Utl__encoder_mgr();}
|
||||
|
||||
|
||||
public Xoa_css_extractor Css_installer() {return css_installer;} private final Xoa_css_extractor css_installer = new Xoa_css_extractor();
|
||||
public Xoa_wiki_mgr Wiki_mgr() {return wiki_mgr;} private Xoa_wiki_mgr wiki_mgr;
|
||||
public Xou_user_mgr User_mgr() {return user_mgr;} private Xou_user_mgr user_mgr;
|
||||
public Xof_file_mgr File_mgr() {return file_mgr;} private Xof_file_mgr file_mgr = new Xof_file_mgr();
|
||||
@@ -124,7 +126,7 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
public Xop_amp_mgr Parser_amp_mgr() {return parser_amp_mgr;} private Xop_amp_mgr parser_amp_mgr = new Xop_amp_mgr();
|
||||
|
||||
private Xoa_fmtr_mgr fmtr_mgr;
|
||||
public NumberParser Utl_num_parser() {return utl_num_parser;} private NumberParser utl_num_parser = new NumberParser();
|
||||
public Number_parser Utl_num_parser() {return utl_num_parser;} private Number_parser utl_num_parser = new Number_parser();
|
||||
public void Init_by_app() {
|
||||
stage = Xoa_stage_.Tid_init;
|
||||
prog_mgr.Init_by_app(url_cmd_eval);
|
||||
@@ -133,7 +135,7 @@ public class Xoae_app implements Xoa_app, GfoInvkAble {
|
||||
gui_mgr.Init_by_app();
|
||||
user.Init_by_app(this);
|
||||
file_mgr.Init_by_app(this);
|
||||
css_installer.Init_by_app(this);
|
||||
html__css_installer.Init_by_app(this);
|
||||
wiki_mgr.Init_by_app();
|
||||
gplx.xowa.utls.upgrades.Xoa_upgrade_mgr.Check(this);
|
||||
ctg_mgr.Init_by_app(this);
|
||||
|
||||
35
400_xowa/src/gplx/xowa/apps/Xoa_app_type.java
Normal file
35
400_xowa/src/gplx/xowa/apps/Xoa_app_type.java
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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.apps; import gplx.*; import gplx.xowa.*;
|
||||
public class Xoa_app_type {
|
||||
Xoa_app_type(int uid) {this.uid = uid;}
|
||||
public int Uid() {return uid;} private final int uid;
|
||||
public boolean Uid_is_gui() {return uid == Uid_gui;}
|
||||
public boolean Uid_is_tcp() {return uid == Uid_tcp;}
|
||||
public boolean Uid_is_http() {return uid == Uid_http;}
|
||||
private static final int Uid_cmd = 1, Uid_gui = 2, Uid_tcp = 3, Uid_http = 4;
|
||||
private static final String Key_cmd = "cmd", Key_gui = "gui", Key_tcp = "server", Key_http = "http_server";
|
||||
public static final Xoa_app_type Itm_cmd = new Xoa_app_type(Uid_cmd), Itm_gui = new Xoa_app_type(Uid_gui), Itm_tcp = new Xoa_app_type(Uid_tcp), Itm_http = new Xoa_app_type(Uid_http);
|
||||
public static Xoa_app_type parse(String s) {
|
||||
if (String_.Eq(s, Key_cmd)) return Itm_cmd;
|
||||
else if (String_.Eq(s, Key_gui)) return Itm_gui;
|
||||
else if (String_.Eq(s, Key_tcp)) return Itm_tcp;
|
||||
else if (String_.Eq(s, Key_http)) return Itm_http;
|
||||
else return Itm_cmd; // default to cmd as per early behaviour; handles mistaken "--app_mode wrong"
|
||||
}
|
||||
}
|
||||
@@ -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.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.threads.*;
|
||||
import gplx.core.threads.*;
|
||||
public class Xoa_thread_mgr {
|
||||
public Gfo_thread_pool Page_load_mgr() {return page_load_mgr;} private Gfo_thread_pool page_load_mgr = new Gfo_thread_pool();
|
||||
public Gfo_thread_pool File_load_mgr() {return file_load_mgr;} private Gfo_thread_pool file_load_mgr = new Gfo_thread_pool();
|
||||
|
||||
@@ -17,35 +17,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.apps.fsys; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
public class Xoa_fsys_mgr implements GfoInvkAble {
|
||||
public Xoa_fsys_mgr(String plat_name, Io_url root_dir) {
|
||||
Init_by_boot(plat_name, root_dir);
|
||||
public Xoa_fsys_mgr(String plat_name, Io_url root_dir, Io_url wiki_dir, Io_url file_dir, Io_url css_dir) {
|
||||
this.root_dir = root_dir;
|
||||
this.wiki_dir = wiki_dir;
|
||||
this.file_dir = file_dir;
|
||||
this.css_dir = css_dir;
|
||||
this.bin_plat_dir = root_dir.GenSubDir("bin").GenSubDir(plat_name);
|
||||
this.bin_any_dir = root_dir.GenSubDir("bin").GenSubDir("any");
|
||||
this.bin_xowa_dir = bin_any_dir.GenSubDir("xowa");
|
||||
this.bin_xtns_dir = bin_any_dir.GenSubDir_nest("xowa", "xtns");
|
||||
this.cfg_lang_core_dir = bin_any_dir.GenSubDir_nest("xowa", "cfg", "lang", "core");
|
||||
this.cfg_wiki_core_dir = bin_any_dir.GenSubDir_nest("xowa", "cfg", "wiki", "core");
|
||||
}
|
||||
public Io_url Root_dir() {return root_dir;} private Io_url root_dir;
|
||||
public byte[] Root_dir_bry() {return root_dir_bry;} private byte[] root_dir_bry;
|
||||
public Io_url File_dir() {return file_dir;} private Io_url file_dir;
|
||||
public Io_url Wiki_dir() {return wiki_dir;} public void Wiki_dir_(Io_url v) {wiki_dir = v;} private Io_url wiki_dir;
|
||||
public Io_url Bin_plat_dir() {return bin_plat_dir;} private Io_url bin_plat_dir;
|
||||
public Io_url Bin_any_dir() {return bin_any_dir;} private Io_url bin_any_dir;
|
||||
public Io_url Bin_xowa_dir() {return bin_xowa_dir;} private Io_url bin_xowa_dir;
|
||||
public Io_url Bin_xtns_dir() {return bin_xtns_dir;} private Io_url bin_xtns_dir;
|
||||
public Io_url Cfg_lang_core_dir() {return cfg_lang_core_dir;} private Io_url cfg_lang_core_dir;
|
||||
public Io_url Cfg_wiki_core_dir() {return cfg_wiki_core_dir;} private Io_url cfg_wiki_core_dir;
|
||||
public Io_url Bin_data_os_cfg_fil() {return bin_plat_dir.GenSubFil_nest("xowa", "cfg", Xoa_gfs_mgr.Cfg_os);}
|
||||
private void Init_by_boot(String plat_name, Io_url root_dir) {
|
||||
this.root_dir = root_dir;
|
||||
root_dir_bry = root_dir.To_http_file_bry();
|
||||
file_dir = root_dir.GenSubDir("file");
|
||||
bin_plat_dir = root_dir.GenSubDir("bin").GenSubDir(plat_name);
|
||||
bin_any_dir = root_dir.GenSubDir("bin").GenSubDir("any");
|
||||
bin_xowa_dir = bin_any_dir.GenSubDir("xowa");
|
||||
bin_xtns_dir = bin_any_dir.GenSubDir_nest("xowa", "xtns");
|
||||
cfg_lang_core_dir = bin_any_dir.GenSubDir_nest("xowa", "cfg", "lang", "core");
|
||||
cfg_wiki_core_dir = bin_any_dir.GenSubDir_nest("xowa", "cfg", "wiki", "core");
|
||||
Wiki_dir_ (root_dir.GenSubDir("wiki"));
|
||||
}
|
||||
public void Init_by_app(GfoInvkAble app_mgr_invk) {// for gfs and app.launcher
|
||||
this.app_mgr_invk = app_mgr_invk;
|
||||
} private GfoInvkAble app_mgr_invk;
|
||||
public Io_url Root_dir() {return root_dir;} private final Io_url root_dir;
|
||||
public Io_url Wiki_dir() {return wiki_dir;} private final Io_url wiki_dir;
|
||||
public Io_url File_dir() {return file_dir;} private final Io_url file_dir;
|
||||
public Io_url Css_dir() {return css_dir;} private final Io_url css_dir;
|
||||
public Io_url Bin_plat_dir() {return bin_plat_dir;} private final Io_url bin_plat_dir;
|
||||
public Io_url Bin_any_dir() {return bin_any_dir;} private final Io_url bin_any_dir;
|
||||
public Io_url Bin_xowa_dir() {return bin_xowa_dir;} private final Io_url bin_xowa_dir;
|
||||
public Io_url Bin_xtns_dir() {return bin_xtns_dir;} private final Io_url bin_xtns_dir;
|
||||
public Io_url Cfg_lang_core_dir() {return cfg_lang_core_dir;} private final Io_url cfg_lang_core_dir;
|
||||
public Io_url Cfg_wiki_core_dir() {return cfg_wiki_core_dir;} private final Io_url cfg_wiki_core_dir;
|
||||
public Io_url Bin_data_os_cfg_fil() {return bin_plat_dir.GenSubFil_nest("xowa", "cfg", Xoa_gfs_mgr.Cfg_os);}
|
||||
public Io_url Wiki_css_dir(String wiki) {return css_dir.GenSubDir_nest(wiki, "html");} // EX: /xowa/temp/simple.wikipedia.org/html/xowa_common.css
|
||||
public Io_url Wiki_file_dir(String wiki) {return file_dir.GenSubDir_nest(wiki);} // EX: /xowa/temp/simple.wikipedia.org/orig/
|
||||
public void Init_by_app(GfoInvkAble app_mgr_invk) {this.app_mgr_invk = app_mgr_invk;} private GfoInvkAble app_mgr_invk; // for gfs and app.launcher
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_apps)) return app_mgr_invk;
|
||||
else if (ctx.Match(k, Invk_root_dir)) return root_dir;
|
||||
|
||||
@@ -31,6 +31,7 @@ public class Xob_db_file {
|
||||
public static Xob_db_file new__wiki_image(Io_url dir) {return new_(dir, Name__wiki_image);}
|
||||
public static Xob_db_file new__wiki_redirect(Io_url dir) {return new_(dir, Name__wiki_redirect);}
|
||||
public static Xob_db_file new__temp_log(Io_url dir) {return new_(dir, Name__temp_log);}
|
||||
public static Xob_db_file new__redlink(Io_url dir) {return new_(dir, Name__redlink);}
|
||||
public static Xob_db_file new_(Io_url dir, String name) {
|
||||
Io_url url = dir.GenSubFil(name);
|
||||
Db_conn_bldr_data conn_data = Db_conn_bldr.I.Get_or_new(url);
|
||||
@@ -43,6 +44,6 @@ public class Xob_db_file {
|
||||
public static final String
|
||||
Name__wiki_image = "xowa.wiki.image.sqlite3", Name__wiki_redirect = "xowa.wiki.redirect.sqlite3"
|
||||
, Name__file_make = "xowa.file.make.sqlite3", Name__temp_log = "xowa.temp.log.sqlite3"
|
||||
, Name__page_regy = "xowa.file.page_regy.sqlite3"
|
||||
, Name__page_regy = "xowa.file.page_regy.sqlite3", Name__redlink = "xowa.temp.redlink.sqlite3"
|
||||
;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class Xob_dump_mgr_base extends Xob_itm_basic_base implements Xo
|
||||
root = ctx.Tkn_mkr().Root(Bry_.Empty);
|
||||
wiki.Init_assert(); // NOTE: must init wiki for db_mgr_as_sql
|
||||
wiki.Db_mgr_as_sql().Core_data_mgr().Init_by_load(gplx.xowa.wikis.Xow_fsys_mgr.Find_core_fil(wiki)); // NOTE: must reinit providers as previous steps may have rls'd (and left member variable conn which is closed)
|
||||
wiki.File_mgr__orig_mgr().Wkrs_del(Xof_orig_wkr_.Tid_wmf_api);
|
||||
wiki.File__orig_mgr().Wkrs_del(Xof_orig_wkr_.Tid_wmf_api);
|
||||
db_fsys_mgr = wiki.Db_mgr_as_sql().Core_data_mgr();
|
||||
db_ary = Xob_dump_mgr_base_.Init_text_files_ary(db_fsys_mgr);
|
||||
poll_interval = poll_mgr.Poll_interval();
|
||||
@@ -247,8 +247,12 @@ class Xob_dump_mgr_base_ {
|
||||
if (len == 1) return new Xowd_db_file[] {core_data_mgr.Dbs__get_at(0)}; // single file: return core; note that there are no Tid = Text
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xowd_db_file file = core_data_mgr.Dbs__get_at(i);
|
||||
if (file.Tid() == Xowd_db_file_.Tid_text)
|
||||
text_files_list.Add(file);
|
||||
switch (file.Tid()) {
|
||||
case Xowd_db_file_.Tid_text:
|
||||
case Xowd_db_file_.Tid_text_solo:
|
||||
text_files_list.Add(file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (Xowd_db_file[])text_files_list.Xto_ary_and_clear(Xowd_db_file.class);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
private Xof_bin_mgr src_bin_mgr; private Xof_bin_wkr__fsdb_sql src_fsdb_wkr; private boolean src_bin_mgr__cache_enabled = Bool_.N; private String src_bin_mgr__fsdb_version; private String[] src_bin_mgr__fsdb_skip_wkrs; private boolean src_bin_mgr__wmf_enabled;
|
||||
private Fsm_mnt_itm trg_mnt_itm; private Fsm_cfg_mgr trg_cfg_mgr; private Fsm_atr_fil trg_atr_fil; private Fsm_bin_fil trg_bin_fil; private long trg_bin_db_max;
|
||||
private final Xof_bin_updater trg_bin_updater = new Xof_bin_updater(); private Xob_tier_namer tier_namer; private int[] ns_ids; private int prv_lnki_tier_id = -1;
|
||||
private long download_size_max = Io_mgr.Len_mb_long; private int[] download_keep_tier_ids = Int_.Ary(0);
|
||||
private long download_size_max = Io_mgr.Len_mb_long * 5; private int[] download_keep_tier_ids = Int_.Ary(0);
|
||||
private Xobu_poll_mgr poll_mgr; private int poll_interval; private long time_bgn;
|
||||
private int select_interval = 2500, progress_interval = 1, commit_interval = 1, delete_interval = 5000;
|
||||
private boolean exec_done, resume_enabled; private int exec_count, exec_count_max = Int_.MaxValue, exec_fail, exec_fail_max = 10000; // 115 errors over 900k images
|
||||
@@ -34,8 +34,8 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public Xob_fsdb_make_cmd(Xob_bldr bldr, Xowe_wiki wiki) {
|
||||
this.Cmd_ctor(bldr, wiki);
|
||||
this.poll_mgr = new Xobu_poll_mgr(bldr.App());
|
||||
wiki.File_mgr__fsdb_mode().Tid_make_y_();
|
||||
this.src_bin_mgr = new Xof_bin_mgr(new Fsm_mnt_mgr(), wiki.File_mgr__repo_mgr(), app.File_mgr__cache_mgr(), app.File_mgr__img_mgr().Wkr_resize_img());
|
||||
wiki.File__fsdb_mode().Tid_make_y_();
|
||||
this.src_bin_mgr = new Xof_bin_mgr(new Fsm_mnt_mgr(), wiki.File__repo_mgr(), app.File__cache_mgr(), app.File__img_mgr().Wkr_resize_img());
|
||||
}
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_file_fsdb_make;}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {
|
||||
@@ -44,12 +44,12 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
this.tier_namer = new Xob_tier_namer(wiki.Domain_str(), ns_ids);
|
||||
// src_bin_mgr
|
||||
if (src_bin_mgr__fsdb_version != null) {
|
||||
this.src_fsdb_wkr = Xof_bin_wkr__fsdb_sql.new_(wiki.File_mgr__mnt_mgr());
|
||||
this.src_fsdb_wkr = Xof_bin_wkr__fsdb_sql.new_(wiki.File__mnt_mgr());
|
||||
src_bin_mgr.Wkrs__add(src_fsdb_wkr);
|
||||
src_fsdb_wkr.Mnt_mgr().Ctor_by_load(new_src_bin_db_mgr(wiki, src_bin_mgr__fsdb_version));
|
||||
src_fsdb_wkr.Mnt_mgr().Mnts__get_main().Txn_bgn(); // NOTE: txn on atr speeds up from 50 -> 300; DATE:2015-03-21
|
||||
if (src_bin_mgr__fsdb_skip_wkrs != null) {
|
||||
src_fsdb_wkr.Skip_mgr_init(src_bin_mgr__fsdb_skip_wkrs);
|
||||
src_fsdb_wkr.Skip_mgr_init(src_fsdb_wkr.Mnt_mgr().Mnts__get_main().Cfg_mgr(), src_bin_mgr__fsdb_skip_wkrs);
|
||||
}
|
||||
if (src_bin_mgr__cache_enabled) {
|
||||
usr_dlg.Prog_many("", "", "src_bin_mgr.cache.bgn");
|
||||
@@ -255,6 +255,9 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
bldr_cfg_tbl.Conn().Txn_sav();
|
||||
trg_cfg_mgr.Next_id_commit();
|
||||
trg_atr_fil.Conn().Txn_sav();
|
||||
if (src_bin_mgr__fsdb_version != null && src_bin_mgr__fsdb_skip_wkrs != null) {
|
||||
src_fsdb_wkr.Skip_mgr().Skip_term(src_fsdb_wkr.Mnt_mgr().Mnts__get_main().Cfg_mgr());
|
||||
}
|
||||
if (!trg_mnt_itm.Db_mgr().File__solo_file())
|
||||
trg_bin_fil.Conn().Txn_sav();
|
||||
if (exit_after_commit) exit_now = true;
|
||||
|
||||
@@ -47,8 +47,8 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
|
||||
@Override protected void Cmd_bgn_end() {
|
||||
ns_file_is_case_match_all = Ns_file_is_case_match_all(wiki); // NOTE: must call after wiki.init
|
||||
wiki.Html_mgr().Page_wtr_mgr().Wkr(Xopg_view_mode.Tid_read).Ctgs_enabled_(false); // disable categories else progress messages written (also for PERF)
|
||||
if (wiki.File_mgr__bin_mgr() != null)
|
||||
wiki.File_mgr__bin_mgr().Wkrs__del(gplx.xowa.files.bins.Xof_bin_wkr_.Key_http_wmf); // remove wmf wkr, else will try to download images during parsing
|
||||
if (wiki.File__bin_mgr() != null)
|
||||
wiki.File__bin_mgr().Wkrs__del(gplx.xowa.files.bins.Xof_bin_wkr_.Key_http_wmf); // remove wmf wkr, else will try to download images during parsing
|
||||
commons_wiki = app.Wiki_mgr().Get_by_key_or_make(Xow_domain_.Domain_bry_commons);
|
||||
Xop_log_mgr log_mgr = ctx.App().Log_mgr();
|
||||
log_mgr.Log_dir_(wiki.Fsys_mgr().Root_dir()); // put log in wiki dir, instead of user.temp
|
||||
@@ -64,13 +64,13 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
|
||||
gplx.xowa.xtns.scores.Score_xnde.Log_wkr = log_mgr.Make_wkr();
|
||||
gplx.xowa.xtns.hieros.Hiero_xnde.Log_wkr = log_mgr.Make_wkr();
|
||||
Xof_fsdb_mgr__sql trg_fsdb_mgr = new Xof_fsdb_mgr__sql();
|
||||
wiki.File_mgr__fsdb_mode().Tid_make_y_();
|
||||
wiki.File__fsdb_mode().Tid_make_y_();
|
||||
Fsdb_db_mgr__v2 fsdb_core = Fsdb_db_mgr__v2_bldr.I.Make(wiki, Bool_.Y);
|
||||
trg_fsdb_mgr.Init_by_wiki(wiki);
|
||||
Fsm_mnt_mgr trg_mnt_mgr = trg_fsdb_mgr.Mnt_mgr();
|
||||
wiki.File_mgr().Init_file_mgr_by_load(wiki); // must happen after fsdb.make
|
||||
wiki.File_mgr__bin_mgr().Wkrs__del(gplx.xowa.files.bins.Xof_bin_wkr_.Key_http_wmf); // must happen after init_file_mgr_by_load; remove wmf wkr, else will try to download images during parsing
|
||||
wiki.File_mgr__orig_mgr().Wkrs_del(gplx.xowa.files.origs.Xof_orig_wkr_.Tid_wmf_api);
|
||||
wiki.File__bin_mgr().Wkrs__del(gplx.xowa.files.bins.Xof_bin_wkr_.Key_http_wmf); // must happen after init_file_mgr_by_load; remove wmf wkr, else will try to download images during parsing
|
||||
wiki.File__orig_mgr().Wkrs_del(gplx.xowa.files.origs.Xof_orig_wkr_.Tid_wmf_api);
|
||||
trg_mnt_mgr = new Fsm_mnt_mgr(); trg_mnt_mgr.Ctor_by_load(fsdb_core);
|
||||
trg_mnt_mgr.Mnts__get_insert_idx_(Fsm_mnt_mgr.Mnt_idx_main);
|
||||
Fsm_mnt_mgr.Patch(trg_mnt_mgr.Mnts__get_main().Cfg_mgr().Tbl()); // NOTE: see fsdb_make; DATE:2014-04-26
|
||||
|
||||
@@ -33,14 +33,15 @@ public class Xob_xfer_regy_update_cmd extends Xob_itm_basic_base implements Xob_
|
||||
private void Copy_atrs_to_make_db(Db_conn make_db_provider) {
|
||||
wiki.File_mgr().Init_file_mgr_by_load(wiki);
|
||||
Fsm_mnt_itm fsdb_abc_mgr = wiki.File_mgr().Fsdb_mgr().Mnt_mgr().Mnts__get_main(); // 0 = fsdb.main
|
||||
Db_conn conn = fsdb_abc_mgr.Atr_mgr().Db__core().Conn(); // 0 = fsdb.atr.00
|
||||
Db_conn conn = fsdb_abc_mgr.Atr_mgr().Db__core().Conn(); // 0 = fsdb.atr.00
|
||||
Io_url fsdb_atr_url = ((gplx.dbs.engines.sqlite.Sqlite_conn_info)conn.Conn_info()).Url();
|
||||
Sqlite_engine_.Tbl_create_and_delete(make_db_provider, Xob_fsdb_regy_tbl.Tbl_name, Xob_fsdb_regy_tbl.Tbl_sql);
|
||||
Sqlite_engine_.Db_attach(make_db_provider, "fsdb_db", fsdb_atr_url.Raw());
|
||||
make_db_provider.Txn_bgn();
|
||||
make_db_provider.Exec_sql(Xob_fsdb_regy_tbl.Insert_fsdb_fil);
|
||||
String fsdb_thm_tbl = "fsdb_thm";
|
||||
String insert_sql_fsdb_thm = wiki.File_mgr().Fsdb_mgr().Mnt_mgr().Mnts__get_main().Cfg_mgr().Schema_thm_page() // Cfg_get(Fsm_cfg_mgr.Grp_core).Get_yn_or_n(Fsm_cfg_mgr.Key_schema_thm_page)
|
||||
? Xob_fsdb_regy_tbl.Insert_fsdb_thm
|
||||
? String_.Format(Xob_fsdb_regy_tbl.Insert_fsdb_thm, fsdb_thm_tbl)
|
||||
: Xob_fsdb_regy_tbl.Insert_fsdb_thm_v0
|
||||
;
|
||||
make_db_provider.Exec_sql(insert_sql_fsdb_thm);
|
||||
@@ -110,7 +111,7 @@ class Xob_fsdb_regy_tbl {
|
||||
, ", f.fil_id"
|
||||
, ", t.thm_id"
|
||||
, "FROM fsdb_db.fsdb_fil f"
|
||||
, " JOIN fsdb_db.fsdb_xtn_thm t ON f.fil_id = t.thm_owner_id"
|
||||
, " JOIN fsdb_db.{0} t ON f.fil_id = t.thm_owner_id"
|
||||
, " JOIN fsdb_db.fsdb_dir d ON f.fil_owner_id = d.dir_id"
|
||||
, ";"
|
||||
)
|
||||
@@ -128,18 +129,18 @@ class Xob_fsdb_regy_tbl {
|
||||
, ", f.fil_id"
|
||||
, ", t.thm_id"
|
||||
, "FROM fsdb_db.fsdb_fil f"
|
||||
, " JOIN fsdb_db.fsdb_xtn_thm t ON f.fil_id = t.thm_owner_id"
|
||||
, " JOIN fsdb_db.{0} t ON f.fil_id = t.thm_owner_id"
|
||||
, " JOIN fsdb_db.fsdb_dir d ON f.fil_owner_id = d.dir_id"
|
||||
, ";"
|
||||
)
|
||||
, Update_regy_fil = String_.Concat_lines_nl
|
||||
( "REPLACE INTO xfer_regy "
|
||||
, "( lnki_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, "( lnki_id, lnki_tier_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, ", file_is_orig, orig_w, orig_h, file_w, file_h, lnki_time, lnki_page, lnki_count"
|
||||
, ", xfer_status"
|
||||
, ")"
|
||||
, "SELECT "
|
||||
, " lnki_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, " lnki_id, lnki_tier_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, ", file_is_orig, orig_w, orig_h, file_w, file_h, lnki_time, lnki_page, lnki_count"
|
||||
, ", CASE WHEN f.fsdb_name IS NOT NULL THEN 1 ELSE 0 END"
|
||||
, "FROM xfer_regy x"
|
||||
@@ -150,12 +151,12 @@ class Xob_fsdb_regy_tbl {
|
||||
)
|
||||
, Update_regy_thm = String_.Concat_lines_nl
|
||||
( "REPLACE INTO xfer_regy "
|
||||
, "( lnki_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, "( lnki_id, lnki_tier_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, ", file_is_orig, orig_w, orig_h, file_w, file_h, lnki_time, lnki_page, lnki_count"
|
||||
, ", xfer_status"
|
||||
, ")"
|
||||
, "SELECT "
|
||||
, " lnki_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, " lnki_id, lnki_tier_id, lnki_page_id, orig_page_id, orig_repo, lnki_ttl, orig_redirect_src, lnki_ext, orig_media_type"
|
||||
, ", file_is_orig, orig_w, orig_h, file_w, file_h, lnki_time, lnki_page, lnki_count"
|
||||
, ", CASE WHEN f.fsdb_name IS NOT NULL THEN 1 ELSE 0 END"
|
||||
, "FROM xfer_regy x"
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class Xob_init_base implements Xob_cmd, GfoInvkAble {
|
||||
public void Cmd_end() {
|
||||
wiki.Appe().Gui_mgr().Html_mgr().Portal_mgr().Wikis().Itms_reset(); // dirty wiki list so that next refresh will load itm
|
||||
if (wiki.Appe().Setup_mgr().Dump_mgr().Css_wiki_update()) {
|
||||
Io_url url = wiki.Appe().User().Fsys_mgr().Wiki_html_dir(wiki.Domain_str()).GenSubFil(Xoa_css_extractor.Css_wiki_name);
|
||||
Io_url url = wiki.Appe().Fsys_mgr().Wiki_css_dir(wiki.Domain_str()).GenSubFil(Xoa_css_extractor.Css_wiki_name);
|
||||
usr_dlg.Log_many("", "", "deleting css: ~{0}", url.Raw());
|
||||
Io_mgr._.DeleteFil_args(url).MissingFails_off().Exec();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import gplx.core.primitives.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.dbs.*; import gplx.xowa.tdbs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public abstract class Xob_search_base extends Xob_itm_dump_base implements Xobd_wkr, GfoInvkAble {
|
||||
private final OrderedHash list = OrderedHash_.new_(); private Xol_lang lang;
|
||||
public abstract String Wkr_key();
|
||||
public abstract Io_make_cmd Make_cmd_site();
|
||||
public void Wkr_ini(Xob_bldr bldr) {}
|
||||
@@ -35,7 +36,7 @@ public abstract class Xob_search_base extends Xob_itm_dump_base implements Xobd_
|
||||
// if (page.Ns_id() != Xow_ns_.Id_main) return; // limit to main ns for now
|
||||
try {
|
||||
byte[] ttl = page.Ttl_page_db();
|
||||
byte[][] words = Split(lang, list, dump_bfr, ttl);
|
||||
byte[][] words = Split_ttl_into_words(lang, list, dump_bfr, ttl);
|
||||
Xob_tmp_wtr wtr = tmp_wtr_mgr.Get_or_new(ns_main == null ? page.Ns() : ns_main);
|
||||
int words_len = words.length;
|
||||
int row_len = 0;
|
||||
@@ -60,9 +61,8 @@ public abstract class Xob_search_base extends Xob_itm_dump_base implements Xobd_
|
||||
if (delete_temp) Io_mgr._.DeleteDirDeep(temp_dir);
|
||||
}
|
||||
public void Wkr_print() {}
|
||||
OrderedHash list = OrderedHash_.new_(); Xol_lang lang;
|
||||
static final int row_fixed_len = 5 + 1 + 1 + 1; // 5=rowId; 1=|; 1=NmsOrd; 1=|
|
||||
public static byte[][] Split(Xol_lang lang, OrderedHash list, Bry_bfr bfr, byte[] ttl) {
|
||||
// private static final int row_fixed_len = 5 + 1 + 1 + 1; // 5=rowId; 1=|; 1=NmsOrd; 1=|
|
||||
public static byte[][] Split_ttl_into_words(Xol_lang lang, OrderedHash list, Bry_bfr bfr, byte[] ttl) {
|
||||
if (lang != null) // null lang passed in by searcher
|
||||
ttl = lang.Case_mgr().Case_build_lower(ttl);
|
||||
int ttl_len = ttl.length; Bry_obj_ref word_ref = Bry_obj_ref.new_(Bry_.Empty);
|
||||
@@ -70,17 +70,19 @@ public abstract class Xob_search_base extends Xob_itm_dump_base implements Xobd_
|
||||
while (true) {
|
||||
if (word_done || i == ttl_len) {
|
||||
if (bfr.Len() > 0) {
|
||||
byte[] word = bfr.Xto_bry();
|
||||
byte[] word = bfr.Xto_bry_and_clear();
|
||||
word_ref.Val_(word);
|
||||
if (!list.Has(word_ref)) list.Add(word_ref, word);
|
||||
bfr.ClearAndReset();
|
||||
if (!list.Has(word_ref)) list.Add(word_ref, word); // don't add same word twice; EX: Title of "Can Can" should only have "Can" in index
|
||||
}
|
||||
if (i == ttl_len) break;
|
||||
word_done = false;
|
||||
}
|
||||
byte b = ttl[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Tab: case Byte_ascii.NewLine: case Byte_ascii.CarriageReturn: case Byte_ascii.Space: case Byte_ascii.Underline:
|
||||
case Byte_ascii.Underline: // underline is word-breaking; EX: A_B -> A, B
|
||||
case Byte_ascii.Space: // should not occur, but just in case (only underscores)
|
||||
case Byte_ascii.Tab: case Byte_ascii.NewLine: case Byte_ascii.CarriageReturn: // should not occur in titles, but just in case
|
||||
|
||||
case Byte_ascii.Dash: // treat hypenated words separately
|
||||
case Byte_ascii.Dot: // treat abbreviations as separate words; EX: A.B.C.
|
||||
case Byte_ascii.Bang: case Byte_ascii.Hash: case Byte_ascii.Dollar: case Byte_ascii.Percent:
|
||||
@@ -100,7 +102,6 @@ public abstract class Xob_search_base extends Xob_itm_dump_base implements Xobd_
|
||||
break;
|
||||
}
|
||||
}
|
||||
bfr.ClearAndReset();
|
||||
byte[][] rv = (byte[][])list.Xto_ary(byte[].class);
|
||||
list.Clear(); list.ResizeBounds(16);
|
||||
return rv;
|
||||
|
||||
118
400_xowa/src/gplx/xowa/bldrs/cmds/texts/Xob_word_parser.java
Normal file
118
400_xowa/src/gplx/xowa/bldrs/cmds/texts/Xob_word_parser.java
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
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.bldrs.cmds.texts; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.langs.cases.*;
|
||||
class Xob_word_parser {
|
||||
private final Btrie_slim_mgr trie = Btrie_slim_mgr.cs_();
|
||||
private final Bry_bfr bfr = Bry_bfr.new_(32);
|
||||
private Xob_word_mgr word_mgr; private Xol_case_mgr case_mgr;
|
||||
private byte[] src; // private int bgn, end, src_len;
|
||||
private boolean dirty; private int word_bgn;
|
||||
public void Init_for_ttl(Xob_word_mgr word_mgr, Xol_case_mgr case_mgr) {
|
||||
this.word_mgr = word_mgr; this.case_mgr = case_mgr;
|
||||
trie.Clear();
|
||||
Init_tkn(Xob_word_tkn.new_(" ").Split_y_());
|
||||
Init_tkn(Xob_word_tkn.new_("_").Split_y_());
|
||||
Init_tkn(Xob_word_tkn.new_("..").Split_y_().Extend_y_());
|
||||
}
|
||||
private void Init_tkn(Xob_word_tkn tkn) {trie.Add_obj(tkn.Key(), tkn);}
|
||||
private void Mgr__add(int word_end) {
|
||||
byte[] word = dirty ? bfr.Xto_bry_and_clear() : Bry_.Mid(src, word_bgn, word_end);
|
||||
word_mgr.Add(word);
|
||||
word_bgn = -1;
|
||||
}
|
||||
public void Parse(byte[] src, int bgn, int end, int src_len) {
|
||||
this.src = src; // this.bgn = bgn; this.end = end; this.src_len = src_len;
|
||||
this.dirty = false; this.word_bgn = -1;
|
||||
this.src = case_mgr.Case_build_lower(src);
|
||||
int pos = bgn;
|
||||
while (true) {
|
||||
boolean add_to_word = false;
|
||||
boolean is_last = pos == end;
|
||||
if (is_last) { // do split
|
||||
Mgr__add(end);
|
||||
break;
|
||||
}
|
||||
byte b = src[pos];
|
||||
Object o = trie.Match_bgn_w_byte(b, src, pos, end);
|
||||
int new_pos = -1;
|
||||
if (o == null) { // unknown sequence; word-char
|
||||
add_to_word = true;
|
||||
new_pos = pos + 1;
|
||||
}
|
||||
else {
|
||||
int tkn_end = trie.Match_pos();
|
||||
Xob_word_tkn tkn = (Xob_word_tkn)o;
|
||||
if (tkn.Split()) { // "A b" -> "A", "b"
|
||||
add_to_word = false;
|
||||
if (word_bgn != -1) // handle sequences like "... " where "..." sets word_bgn to -1
|
||||
Mgr__add(pos);
|
||||
tkn_end = Bry_finder.Find_fwd_while(src, tkn_end, end, tkn.Key_last_byte());
|
||||
if (tkn.Extend()) {
|
||||
word_bgn = pos;
|
||||
Mgr__add(tkn_end);
|
||||
}
|
||||
pos = tkn_end;
|
||||
continue;
|
||||
}
|
||||
add_to_word = true;
|
||||
new_pos = tkn_end;
|
||||
}
|
||||
if (add_to_word) {
|
||||
if (dirty)
|
||||
bfr.Add_byte(src[pos]);
|
||||
else {
|
||||
if (word_bgn == -1)
|
||||
word_bgn = pos;
|
||||
}
|
||||
}
|
||||
pos = new_pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
class Xob_word_tkn {
|
||||
public Xob_word_tkn(byte[] key) {this.key = key; this.key_last_byte = key[key.length - 1];}
|
||||
public byte[] Key() {return key;} private final byte[] key;
|
||||
public byte Key_last_byte() {return key_last_byte;} private final byte key_last_byte;
|
||||
public boolean Split() {return split;} public Xob_word_tkn Split_y_() {split = true; return this;} private boolean split;
|
||||
public boolean Extend() {return extend;} public Xob_word_tkn Extend_y_() {extend = true; return this;} private boolean extend;
|
||||
public static Xob_word_tkn new_(String v) {return new Xob_word_tkn(Bry_.new_utf8_(v));}
|
||||
}
|
||||
class Xob_word_mgr {
|
||||
private final OrderedHash hash = OrderedHash_.new_bry_();
|
||||
public void Clear() {hash.Clear();}
|
||||
public int Len() {return hash.Count();}
|
||||
public Xob_word_itm Get_at(int i) {return (Xob_word_itm)hash.FetchAt(i);}
|
||||
public void Add(byte[] word) {
|
||||
Xob_word_itm itm = (Xob_word_itm)hash.Fetch(word);
|
||||
if (itm == null) {
|
||||
itm = new Xob_word_itm(word);
|
||||
hash.Add(word, itm);
|
||||
}
|
||||
itm.Count_add_1_();
|
||||
}
|
||||
}
|
||||
class Xob_word_itm {
|
||||
public Xob_word_itm(byte[] word) {
|
||||
this.word = word;
|
||||
this.count = 0;
|
||||
}
|
||||
public byte[] Word() {return word;} private final byte[] word;
|
||||
public int Count() {return count;} private int count; public void Count_add_1_() {++count;}
|
||||
@gplx.Internal protected Xob_word_itm Count_(int v) {this.count = v; return this;}
|
||||
}
|
||||
102
400_xowa/src/gplx/xowa/bldrs/cmds/texts/Xob_word_parser_tst.java
Normal file
102
400_xowa/src/gplx/xowa/bldrs/cmds/texts/Xob_word_parser_tst.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
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.bldrs.cmds.texts; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import org.junit.*; import gplx.xowa.langs.cases.*;
|
||||
public class Xob_word_parser_tst {
|
||||
private final Xob_word_parser_fxt fxt = new Xob_word_parser_fxt();
|
||||
@Before public void init() {fxt.Init();}
|
||||
@Test public void Basic_1() {
|
||||
fxt.Clear().Test_split("abcd", "abcd");
|
||||
}
|
||||
@Test public void Basic_many() {
|
||||
fxt.Clear().Test_split("abc d ef", "abc", "d", "ef");
|
||||
}
|
||||
@Test public void Split_many() {
|
||||
fxt.Clear().Test_split("a b", "a", "b");
|
||||
}
|
||||
@Test public void Lowercase() {
|
||||
fxt.Clear().Test_split("A B C", "a", "b", "c");
|
||||
}
|
||||
@Test public void Dupe() {
|
||||
fxt.Clear().Test_split("a a a", fxt.Make_word("a", 3));
|
||||
}
|
||||
@Test public void Dupe_lowercase() {
|
||||
fxt.Clear().Test_split("a A", fxt.Make_word("a", 2));
|
||||
}
|
||||
@Test public void Dot_acronym() { // EX: "History of U.S.A. Science "
|
||||
fxt.Clear().Test_split("abc D.E.F. ghi", "abc", "d.e.f.", "ghi");
|
||||
}
|
||||
@Test public void Dot_name() { // EX: "H. G. Wells"
|
||||
fxt.Clear().Test_split("a. b. last", "a.", "b.", "last");
|
||||
}
|
||||
@Test public void Dot_internet() { // EX: "en.wikipedia.org"
|
||||
fxt.Clear().Test_split("a.com", "a.com");
|
||||
}
|
||||
@Test public void Dot_ellipsis() { // EX: "Nights into Dreams..."
|
||||
fxt.Clear().Test_split("a... bc d", "a", "...", "bc", "d");
|
||||
}
|
||||
// tst_Split("a-b.c", "a", "b", "c");
|
||||
// tst_Split("a A", "a");
|
||||
// tst_Split("a_b", "a", "b");
|
||||
// tst_Split("a (b)", "a", "b");
|
||||
}
|
||||
class Xob_word_parser_fxt {
|
||||
private final Xob_word_parser word_parser = new Xob_word_parser();
|
||||
private final Xob_word_mgr word_mgr = new Xob_word_mgr();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_(32);
|
||||
private Xol_case_mgr case_mgr;
|
||||
public void Init() {
|
||||
case_mgr = Xol_case_mgr_.Ascii();
|
||||
word_parser.Init_for_ttl(word_mgr, case_mgr);
|
||||
}
|
||||
public Xob_word_parser_fxt Clear() {
|
||||
word_mgr.Clear();
|
||||
return this;
|
||||
}
|
||||
public Xob_word_itm Make_word(String raw, int count) {return new Xob_word_itm(Bry_.new_utf8_(raw)).Count_(count);}
|
||||
public void Test_split(String src, String... expd_words) {
|
||||
int len = expd_words.length;
|
||||
Xob_word_itm[] ary = new Xob_word_itm[len];
|
||||
for (int i = 0; i < len; ++i) {
|
||||
ary[i] = Make_word(expd_words[i], 1);
|
||||
}
|
||||
Test_split(src, ary);
|
||||
}
|
||||
public void Test_split(String src, Xob_word_itm... expd_words) {
|
||||
byte[] src_bry = Bry_.new_utf8_(src);
|
||||
word_parser.Parse(src_bry, 0, src_bry.length, src_bry.length);
|
||||
Tfds.Eq_str_lines(To_str(expd_words), To_str(word_mgr));
|
||||
}
|
||||
private String To_str(Xob_word_itm[] word_ary) {
|
||||
int len = word_ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (i != 0) tmp_bfr.Add_byte_nl();
|
||||
Xob_word_itm word = word_ary[i];
|
||||
tmp_bfr.Add(word.Word()).Add_byte_pipe();
|
||||
tmp_bfr.Add_int_variable(word.Count());
|
||||
}
|
||||
return tmp_bfr.Xto_str_and_clear();
|
||||
}
|
||||
private String To_str(Xob_word_mgr word_mgr) {
|
||||
int len = word_mgr.Len();
|
||||
Xob_word_itm[] ary = new Xob_word_itm[len];
|
||||
for (int i = 0; i < len; ++i)
|
||||
ary[i] = word_mgr.Get_at(i);
|
||||
return To_str(ary);
|
||||
}
|
||||
}
|
||||
@@ -16,29 +16,37 @@ 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.bldrs.cmds.texts.sqls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*; import gplx.xowa.bldrs.cmds.texts.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.xowa.bldrs.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*; import gplx.xowa.html.css.*;
|
||||
public class Xob_css_cmd implements Xob_cmd {
|
||||
private final Xob_bldr bldr; private final Xowe_wiki wiki; private final Gfo_usr_dlg usr_dlg;
|
||||
private Io_url css_dir; private String css_key;
|
||||
public Xob_css_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.bldr = bldr; this.wiki = wiki; this.usr_dlg = wiki.Appe().Usr_dlg();}
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_text_css;}
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {}
|
||||
public void Cmd_init(Xob_bldr bldr) {
|
||||
if (css_dir == null) css_dir = wiki.App().Fsys_mgr().Wiki_css_dir(wiki.Domain_str()); // EX: /xowa/user/anonymous/wiki/en.wikipedia.org
|
||||
if (css_key == null) css_key = Xowd_css_core_mgr.Key_default;
|
||||
}
|
||||
public void Cmd_run() {
|
||||
usr_dlg.Plog_many("", "", Cmd_key() + ":bgn;");
|
||||
Io_url css_dir = bldr.App().User().Fsys_mgr().Wiki_html_dir(wiki.Domain_str()); // EX: /xowa/user/anonymous/wiki/en.wikipedia.org
|
||||
bldr.App().Css_installer().Install_assert(Bool_.N, wiki, css_dir);
|
||||
bldr.App().Html__css_installer().Install(wiki, null); // download from wmf
|
||||
usr_dlg.Plog_many("", "", Cmd_key() + ":css_dir; dir=~{0}", css_dir.Raw());
|
||||
wiki.Init_db_mgr();// NOTE: must follow Install_assert b/c Init_assert also calls Install_assert; else will download any css from db
|
||||
wiki.Init_db_mgr(); // NOTE: must follow Install b/c Init_assert also calls Install; else will download any css from db
|
||||
Xowd_db_file core_db = wiki.Db_mgr_as_sql().Core_data_mgr().Db__core();
|
||||
core_db.Conn().Txn_bgn();
|
||||
core_db.Tbl__css_core().Create_tbl();
|
||||
core_db.Tbl__css_file().Create_tbl();
|
||||
gplx.xowa.html.css.Xowd_css_core_mgr.Set(core_db.Tbl__css_core(), core_db.Tbl__css_file(), css_dir);
|
||||
core_db.Tbl__cfg().Insert_yn(Xow_cfg_consts.Grp__wiki_schema, Xowd_db_file_schema_props.Key__tbl_css_core, Bool_.Y);
|
||||
gplx.xowa.html.css.Xowd_css_core_mgr.Set(core_db.Tbl__css_core(), core_db.Tbl__css_file(), css_dir, css_key);
|
||||
core_db.Tbl__cfg().Update_yn(Xow_cfg_consts.Grp__wiki_schema, Xowd_db_file_schema_props.Key__tbl_css_core, Bool_.Y);
|
||||
core_db.Conn().Txn_end();
|
||||
usr_dlg.Plog_many("", "", Cmd_key() + ":end;");
|
||||
}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {}
|
||||
public void Cmd_end() {}
|
||||
public void Cmd_term() {}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {return GfoInvkAble_.Rv_unhandled;}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_css_dir_)) css_dir = m.ReadIoUrl("v");
|
||||
else if (ctx.Match(k, Invk_css_key_)) css_key = m.ReadStr("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_css_dir_ = "css_dir_", Invk_css_key_ = "css_key_";
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Xob_search_sql_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
while (page_rdr.Move_next()) {
|
||||
int page_id = page_rdr.Read_int(fld_page_id);
|
||||
byte[] ttl = page_rdr.Read_bry_by_str(fld_page_ttl);
|
||||
byte[][] words = Xob_search_base.Split(lang, hash, bfr, ttl);
|
||||
byte[][] words = Xob_search_base.Split_ttl_into_words(lang, hash, bfr, ttl);
|
||||
int words_len = words.length;
|
||||
for (int i = 0; i < words_len; i++) {
|
||||
byte[] word = words[i];
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Xob_search_base_tst {
|
||||
} private Xob_fxt fxt = new Xob_fxt().Ctor_mem();
|
||||
private void tst_Split(String raw, String... expd) {
|
||||
OrderedHash list = OrderedHash_.new_(); Bry_bfr bfr = Bry_bfr.new_();
|
||||
byte[][] actl_bry = Xob_search_base.Split(fxt.App().Lang_mgr().Lang_en(), list, bfr, Bry_.new_utf8_(raw));
|
||||
byte[][] actl_bry = Xob_search_base.Split_ttl_into_words(fxt.App().Lang_mgr().Lang_en(), list, bfr, Bry_.new_utf8_(raw));
|
||||
String[] actl = new String[actl_bry.length];
|
||||
for (int i = 0; i < actl_bry.length; i++)
|
||||
actl[i] = String_.new_utf8_(actl_bry[i]);
|
||||
|
||||
@@ -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.bldrs.cmds.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.ios.*; import gplx.threads.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.ios.*; import gplx.core.threads.*; import gplx.xowa.bldrs.*;
|
||||
public class Xob_decompress_bz2_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public Xob_decompress_bz2_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki);}
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_decompress_bz2;}
|
||||
@@ -47,7 +47,7 @@ public class Xob_decompress_bz2_cmd extends Xob_itm_basic_base implements Xob_cm
|
||||
while (decompress.Exit_code() == ProcessAdp.Exit_init) {
|
||||
String size = gplx.ios.Io_size_.Xto_str(Io_mgr._.QueryFil(trg_fil).Size());
|
||||
app.Usr_dlg().Prog_many(GRP_KEY, "decompress", "decompressing: ~{0}", size);
|
||||
ThreadAdp_.Sleep(1000);
|
||||
Thread_adp_.Sleep(1000);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Xob_import_marker {
|
||||
Io_mgr._.DeleteFil_args(url_(wiki)).MissingFails_off().Exec();
|
||||
}
|
||||
public boolean Chk(Xowe_wiki wiki) {
|
||||
if (!Xoa_app_.Mode_is_gui()) return true; // NOTE: ignore during Server / Console modes; DATE:2015-04-01
|
||||
if (!wiki.App().App_type().Uid_is_gui()) return true; // NOTE: ignore during Server / Console modes; DATE:2015-04-01
|
||||
if (in_progress_hash.Has(wiki.Domain_bry())) return true; // NOTE: ignore if currently building; different bldr commands call wiki.Init_assert() which may lead to fals checks;
|
||||
Io_url url = url_(wiki);
|
||||
if (!Io_mgr._.ExistsFil(url)) return true;
|
||||
|
||||
@@ -51,14 +51,19 @@ public class Xocfg_bnd_mgr implements GfoInvkAble, Gfo_sort_able {
|
||||
app.Usr_dlg().Warn_many("", "", "failed to set bnds; src=~{0} err=~{1}", String_.new_utf8_(src), Err_.Message_gplx_brief(e));
|
||||
}
|
||||
}
|
||||
private void Show_shortcut_win(String uid, String name, String binding) {
|
||||
Xog_bnd_win win = new Xog_bnd_win();
|
||||
win.Show(app.Gui_mgr().Kit(), app.Gui_mgr().Browser_win().Win_box(), bnd_mgr.Bnd_parser(), name, binding);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Xoa_fmtr_itm.Invk_get_at)) return this.Get_at(m.ReadInt("v"));
|
||||
else if (ctx.Match(k, Xoa_fmtr_itm.Invk_len)) return this.Len();
|
||||
else if (ctx.Match(k, Xoa_fmtr_itm.Invk_sorter)) return sorter;
|
||||
else if (ctx.Match(k, Invk_set_bulk)) Set_bulk(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_init)) return Init(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_show_shortcut_win)) Show_shortcut_win(m.ReadStr("uid"), m.ReadStr("name"), m.ReadStr("binding"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_set_bulk = "set_bulk", Invk_init = "init";
|
||||
private static final String Invk_set_bulk = "set_bulk", Invk_init = "init", Invk_show_shortcut_win = "show_shortcut_win";
|
||||
}
|
||||
|
||||
@@ -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.files; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.threads.*; import gplx.ios.*;
|
||||
import gplx.core.threads.*; import gplx.ios.*;
|
||||
import gplx.fsdb.*; import gplx.fsdb.meta.*; import gplx.fsdb.data.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.files.repos.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.xowa.files.caches.*; import gplx.xowa.files.gui.*;
|
||||
import gplx.xowa.html.hdumps.core.*;
|
||||
@@ -57,6 +57,7 @@ public class Xof_file_wkr implements Gfo_thread_wkr {
|
||||
fsdb.Ctor_by_lnki(hdump.Lnki_ttl(), hdump.Lnki_type(), hdump.Lnki_w(), hdump.Lnki_h(), Xof_patch_upright_tid_.Tid_all, hdump.Lnki_upright(), hdump.Lnki_time(), hdump.Lnki_page());
|
||||
fsdb.Lnki_ext_(Xof_ext_.new_by_id_(hdump.Lnki_ext()));
|
||||
fsdb.Html_uid_(hdump.Html_uid());
|
||||
fsdb.Html_elem_tid_(hdump.Html_elem_tid());
|
||||
fsdb.Orig_exists_n_();
|
||||
Xof_orig_itm orig = orig_mgr.Find_by_ttl_or_null(fsdb.Lnki_ttl()); if (orig == Xof_orig_itm.Null) return;
|
||||
Eval_orig(exec_tid, orig, fsdb, url_bldr, repo_mgr, img_size);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Xof_lnki_file_mgr {
|
||||
page_init_needed = false;
|
||||
wiki.File_mgr().Init_file_mgr_by_load(wiki); // NOTE: fsdb_mgr may not be init'd for wiki; assert that that it is
|
||||
Make_fsdb_list(page.Lnki_list(), wiki.File_mgr().Patch_upright()); // NOTE: Patch_upright check must occur after Init_by_wiki; DATE:2014-05-31
|
||||
wiki.File_mgr__orig_mgr().Find_by_list(orig_regy, fsdb_list, exec_tid);
|
||||
wiki.File__orig_mgr().Find_by_list(orig_regy, fsdb_list, exec_tid);
|
||||
Make_fsdb_hash();
|
||||
}
|
||||
Xof_fsdb_itm fsdb = (Xof_fsdb_itm)fsdb_hash.Fetch(xfer.Lnki_ttl());
|
||||
|
||||
@@ -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.files; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.threads.*; import gplx.xowa.files.gui.*;
|
||||
import gplx.core.threads.*; import gplx.xowa.files.gui.*;
|
||||
public class Xog_redlink_thread implements Gfo_thread_wkr {
|
||||
private final int[] redlink_ary; private final Xog_js_wkr js_wkr;
|
||||
public Xog_redlink_thread(int[] redlink_ary, Xog_js_wkr js_wkr) {this.redlink_ary = redlink_ary; this.js_wkr = js_wkr;}
|
||||
|
||||
@@ -59,7 +59,8 @@ public class Xow_file_mgr implements GfoInvkAble {
|
||||
version = Version_2;
|
||||
}
|
||||
public int Patch_upright() {
|
||||
return this.Version() == Version_1
|
||||
Fsm_mnt_mgr mnt_mgr = fsdb_mgr.Mnt_mgr();
|
||||
return this.Version() == Version_1 || mnt_mgr == null
|
||||
? Xof_patch_upright_tid_.Tid_all
|
||||
: fsdb_mgr.Mnt_mgr().Patch_upright()
|
||||
;
|
||||
@@ -119,7 +120,7 @@ public class Xow_file_mgr implements GfoInvkAble {
|
||||
if (db_core == null ) return; // no fsdb_core found; exit
|
||||
this.version = Version_2;
|
||||
this.fsdb_mode = Xof_fsdb_mode.new_view();
|
||||
orig_mgr.Init_by_wiki(fsdb_mode, db_core.File__orig_tbl_ary(), wiki.Domain_bry(), wiki.App().Wmf_mgr().Download_wkr(), wiki.File_mgr__repo_mgr(), Xof_url_bldr.new_v2_());
|
||||
orig_mgr.Init_by_wiki(fsdb_mode, db_core.File__orig_tbl_ary(), wiki.Domain_bry(), wiki.App().Wmf_mgr().Download_wkr(), wiki.File__repo_mgr(), Xof_url_bldr.new_v2_());
|
||||
fsdb_mgr.Init_by_wiki(wiki);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,47 +17,64 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.bins; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.xowa.files.fsdb.*;
|
||||
import gplx.fsdb.meta.*; import gplx.xowa.files.fsdb.*;
|
||||
public class Xof_bin_skip_mgr {
|
||||
private Xof_bin_skip_wkr[] wkrs = new Xof_bin_skip_wkr[0]; private int wkrs_len;
|
||||
public Xof_bin_skip_mgr(String[] wkr_keys) {
|
||||
this.wkrs_len = wkr_keys.length;
|
||||
this.wkrs = new Xof_bin_skip_wkr[wkrs_len];
|
||||
for (int i = 0; i < wkrs_len; ++i)
|
||||
wkrs[i] = New_wkr(wkr_keys[i]);
|
||||
public Xof_bin_skip_mgr(Fsm_cfg_mgr cfg_mgr, String[] wkr_keys) {
|
||||
ListAdp list = ListAdp_.new_();
|
||||
for (int i = 0; i < wkrs_len; ++i) {
|
||||
Xof_bin_skip_wkr wkr = New_wkr(cfg_mgr, wkr_keys[i]);
|
||||
if (wkr != null) list.Add(wkr);
|
||||
}
|
||||
this.wkrs = (Xof_bin_skip_wkr[])list.Xto_ary_and_clear(Xof_bin_skip_wkr.class);
|
||||
this.wkrs_len = wkrs.length;
|
||||
}
|
||||
public boolean Skip(Xof_fsdb_itm fsdb, Io_stream_rdr src_rdr) {
|
||||
for (int i = 0; i < wkrs_len; ++i) {
|
||||
if (wkrs[i].Skip(fsdb, src_rdr)) return true;
|
||||
if (wkrs[i].Skip_exec(fsdb, src_rdr)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private Xof_bin_skip_wkr New_wkr(String key) {
|
||||
if (String_.Eq(key, Xof_bin_skip_wkr_.Key__page_gt_1)) return Xof_bin_skip_wkr__page_gt_1.I;
|
||||
else if (String_.Eq(key, Xof_bin_skip_wkr_.Key__small_size)) return Xof_bin_skip_wkr__small_size.I;
|
||||
private Xof_bin_skip_wkr New_wkr(Fsm_cfg_mgr cfg_mgr, String key) {
|
||||
Xof_bin_skip_wkr rv = null;
|
||||
if (String_.Eq(key, Xof_bin_skip_wkr_.Key__page_gt_1)) rv = Xof_bin_skip_wkr__page_gt_1.I;
|
||||
else if (String_.Eq(key, Xof_bin_skip_wkr_.Key__small_size)) rv =Xof_bin_skip_wkr__small_size.I;
|
||||
else throw Err_.unhandled(key);
|
||||
if (!rv.Skip_init(cfg_mgr)) return null;
|
||||
return rv;
|
||||
}
|
||||
public void Skip_term(Fsm_cfg_mgr cfg_mgr) {
|
||||
for (int i = 0; i < wkrs_len; ++i)
|
||||
wkrs[i].Skip_term(cfg_mgr);
|
||||
}
|
||||
}
|
||||
interface Xof_bin_skip_wkr {
|
||||
String Key();
|
||||
boolean Skip(Xof_fsdb_itm fsdb, Io_stream_rdr src_rdr);
|
||||
boolean Skip_init(Fsm_cfg_mgr cfg_mgr);
|
||||
boolean Skip_exec(Xof_fsdb_itm fsdb, Io_stream_rdr src_rdr);
|
||||
void Skip_term(Fsm_cfg_mgr cfg_mgr);
|
||||
}
|
||||
class Xof_bin_skip_wkr_ {
|
||||
public static final String Key__page_gt_1 = "page_gt_1", Key__small_size = "small_size";
|
||||
}
|
||||
class Xof_bin_skip_wkr__page_gt_1 implements Xof_bin_skip_wkr { // prior to v2.4.3; lnkis with page > 1 was mistakenly bringing down page 1; EX: [[A.pdf|page=5]] -> page1; DATE:2015-04-21
|
||||
public String Key() {return Xof_bin_skip_wkr_.Key__page_gt_1;}
|
||||
public boolean Skip(Xof_fsdb_itm fsdb, Io_stream_rdr src_rdr) {
|
||||
public boolean Skip_init(Fsm_cfg_mgr cfg_mgr) {return !cfg_mgr.Patch__page_gt_1();}
|
||||
public boolean Skip_exec(Xof_fsdb_itm fsdb, Io_stream_rdr src_rdr) {
|
||||
boolean rv = fsdb.Lnki_page() > 1;
|
||||
if (rv)
|
||||
Xoa_app_.Usr_dlg().Note_many("", "", "src_bin_mgr:skip page gt 1: file=~{0} width=~{1} page=~{2}", fsdb.Lnki_ttl(), fsdb.File_w(), fsdb.Lnki_page());
|
||||
return rv;
|
||||
}
|
||||
public void Skip_term(Fsm_cfg_mgr cfg_mgr) {
|
||||
cfg_mgr.Patch__save(Fsm_cfg_mgr.Key_patch__page_gt_1);
|
||||
}
|
||||
public static final Xof_bin_skip_wkr__page_gt_1 I = new Xof_bin_skip_wkr__page_gt_1(); Xof_bin_skip_wkr__page_gt_1() {}
|
||||
}
|
||||
class Xof_bin_skip_wkr__small_size implements Xof_bin_skip_wkr {// downloads can randomly be broken; assume that anything with a small size is broken and redownload again; DATE:2015-04-21
|
||||
public String Key() {return Xof_bin_skip_wkr_.Key__small_size;}
|
||||
public boolean Skip(Xof_fsdb_itm fsdb, Io_stream_rdr src_rdr) {
|
||||
public boolean Skip_init(Fsm_cfg_mgr cfg_mgr) {return true;}
|
||||
public boolean Skip_exec(Xof_fsdb_itm fsdb, Io_stream_rdr src_rdr) {
|
||||
boolean rv =
|
||||
src_rdr.Len() < 500 // file is small (< 500 bytes)
|
||||
&& fsdb.Html_w() > 50 // only apply to images larger than 50 px (arbitrarily chosen); needed to ignore 1x1 images as well as icon-sized images
|
||||
@@ -67,5 +84,6 @@ class Xof_bin_skip_wkr__small_size implements Xof_bin_skip_wkr {// downloads can
|
||||
Xoa_app_.Usr_dlg().Note_many("", "", "src_bin_mgr:skip small file: file=~{0} width=~{1} ext=~{2} len=~{3}", fsdb.Lnki_ttl(), fsdb.Lnki_w(), fsdb.Orig_ext(), src_rdr.Len());
|
||||
return rv;
|
||||
}
|
||||
public void Skip_term(Fsm_cfg_mgr cfg_mgr) {}
|
||||
public static final Xof_bin_skip_wkr__small_size I = new Xof_bin_skip_wkr__small_size(); Xof_bin_skip_wkr__small_size() {}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ public class Xof_bin_wkr__fsdb_sql implements Xof_bin_wkr {
|
||||
public String Key() {return Xof_bin_wkr_.Key_fsdb_wiki;}
|
||||
public Fsm_mnt_mgr Mnt_mgr() {return mnt_mgr;} private final Fsm_mnt_mgr mnt_mgr;
|
||||
public boolean Resize_allowed() {return bin_wkr_resize;} public void Resize_allowed_(boolean v) {bin_wkr_resize = v;} private boolean bin_wkr_resize = false;
|
||||
public void Skip_mgr_init(String[] wkrs) {this.skip_mgr = new Xof_bin_skip_mgr(wkrs);}
|
||||
public Xof_bin_skip_mgr Skip_mgr() {return skip_mgr;}
|
||||
public void Skip_mgr_init(Fsm_cfg_mgr cfg_mgr, String[] wkrs) {this.skip_mgr = new Xof_bin_skip_mgr(cfg_mgr, wkrs);}
|
||||
public Io_stream_rdr Get_as_rdr(Xof_fsdb_itm fsdb, boolean is_thumb, int w) {
|
||||
Find_ids(fsdb, is_thumb, w);
|
||||
int bin_db_id = tmp_ids.Bin_db_id(); if (bin_db_id == Fsd_bin_tbl.Bin_db_id_null) return Io_stream_rdr_.Null;
|
||||
|
||||
@@ -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.files.bins; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.ios.*; import gplx.threads.*; import gplx.xowa.files.fsdb.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.ios.*; import gplx.core.threads.*; import gplx.xowa.files.fsdb.*; import gplx.xowa.files.repos.*;
|
||||
public class Xof_bin_wkr__http_wmf implements Xof_bin_wkr {
|
||||
private final Xow_repo_mgr repo_mgr; private final IoEngine_xrg_downloadFil download_wkr;
|
||||
private final Xof_url_bldr url_bldr = new Xof_url_bldr();
|
||||
@@ -46,7 +46,7 @@ public class Xof_bin_wkr__http_wmf implements Xof_bin_wkr {
|
||||
}
|
||||
private void Handle_error() {
|
||||
if (fail_timeout > 0)
|
||||
ThreadAdp_.Sleep(fail_timeout); // as per WMF policy, pause 1 second for every cache miss; http://lists.wikimedia.org/pipermail/wikitech-l/2013-September/071948.html
|
||||
Thread_adp_.Sleep(fail_timeout); // as per WMF policy, pause 1 second for every cache miss; http://lists.wikimedia.org/pipermail/wikitech-l/2013-September/071948.html
|
||||
}
|
||||
private void Download_init(byte[] orig_repo, byte[] orig_ttl, byte[] orig_md5, Xof_ext orig_ext, boolean lnki_is_thumb, int file_w, double lnki_time, int lnki_page, Io_url file_url) {
|
||||
byte mode = lnki_is_thumb ? Xof_repo_itm.Mode_thumb : Xof_repo_itm.Mode_orig;
|
||||
@@ -60,5 +60,5 @@ public class Xof_bin_wkr__http_wmf implements Xof_bin_wkr {
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_fail_timeout_ = "fail_timeout_";
|
||||
public static Xof_bin_wkr__http_wmf new_(Xow_wiki wiki) {return new Xof_bin_wkr__http_wmf(wiki.File_mgr__repo_mgr(), wiki.App().Wmf_mgr().Download_wkr().Download_xrg());}
|
||||
public static Xof_bin_wkr__http_wmf new_(Xow_wiki wiki) {return new Xof_bin_wkr__http_wmf(wiki.File__repo_mgr(), wiki.App().Wmf_mgr().Download_wkr().Download_xrg());}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class Xof_cache_mgr2 {
|
||||
// byte mode_id = itm.File_is_orig() ? gplx.xowa.files.repos.Xof_repo_itm.Mode_orig : gplx.xowa.files.repos.Xof_repo_itm.Mode_thumb;
|
||||
// byte[] wiki_domain = Xow_domain_tid_.To_domain(itm.Lnki_site()).Domain_bry();
|
||||
// Xow_wiki wiki = wiki_mgr.Get_by_key_or_make(wiki_domain);
|
||||
// gplx.xowa.files.repos.Xof_repo_itm trg_repo = wiki.File_mgr__repo_mgr().Repos_get_by_wiki(wiki_domain).Trg();
|
||||
// gplx.xowa.files.repos.Xof_repo_itm trg_repo = wiki.File__repo_mgr().Repos_get_by_wiki(wiki_domain).Trg();
|
||||
// byte[] ttl = itm.Lnki_ttl();
|
||||
// byte[] md5 = Xof_xfer_itm_.Md5_(ttl);
|
||||
// Xof_ext itm_ext = Xof_ext_.new_by_id_(itm.Orig_ext());
|
||||
|
||||
@@ -29,10 +29,10 @@ public class Xof_fsdb_mgr__sql implements Xof_fsdb_mgr, GfoInvkAble {
|
||||
if (init) return;
|
||||
try {
|
||||
init = true;
|
||||
if (wiki.File_mgr__fsdb_mode().Tid_wmf()) return;
|
||||
if (wiki.File__fsdb_mode().Tid_wmf()) return;
|
||||
Xoa_app app = wiki.App();
|
||||
this.cache_mgr = app.File_mgr__cache_mgr(); this.url_bldr = Xof_url_bldr.new_v2_();
|
||||
this.repo_mgr = wiki.File_mgr__repo_mgr(); Xof_img_mgr img_mgr = app.File_mgr__img_mgr();
|
||||
this.cache_mgr = app.File__cache_mgr(); this.url_bldr = Xof_url_bldr.new_v2_();
|
||||
this.repo_mgr = wiki.File__repo_mgr(); Xof_img_mgr img_mgr = app.File__img_mgr();
|
||||
Fsdb_db_mgr core = Fsdb_db_mgr_.new_detect(wiki, wiki.Fsys_mgr().Root_dir(), wiki.Fsys_mgr().File_dir());
|
||||
if (core == null) return;
|
||||
fsdb_enabled = true;
|
||||
|
||||
@@ -44,6 +44,6 @@ public class Fs_root_fsdb_mgr implements Xof_fsdb_mgr, GfoInvkAble { // read ima
|
||||
return this;
|
||||
} private static final String Invk_root_dir_ = "root_dir_", Invk_orig_dir_ = "orig_dir_", Invk_thumb_dir_ = "thumb_dir_";
|
||||
public Xof_bin_mgr Bin_mgr() {throw Err_.not_implemented_();}
|
||||
public Fsm_mnt_mgr Mnt_mgr() {throw Err_.not_implemented_();}
|
||||
public Fsm_mnt_mgr Mnt_mgr() {return null;}
|
||||
public void Rls() {}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ class Xof_file_fxt {
|
||||
Xoa_test_.Db_init(root_url);
|
||||
app = Xoa_app_fxt.app_(Op_sys.Cur().Os_name(), root_url);
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
wiki.File_mgr__fsdb_mode().Tid_make_y_();
|
||||
wiki.File__fsdb_mode().Tid_make_y_();
|
||||
this.fsdb_mgr = (Xof_fsdb_mgr__sql)wiki.File_mgr().Fsdb_mgr();
|
||||
this.orig_mgr = wiki.File_mgr__orig_mgr();
|
||||
this.orig_mgr = wiki.File__orig_mgr();
|
||||
Xof_repo_fxt.Repos_init(app.File_mgr(), true, wiki);
|
||||
Xowe_wiki_bldr.Create(wiki, 1, "dump.xml");
|
||||
Xowd_db_file text_db = wiki.Data_mgr__core_mgr().Dbs__make_by_tid(Xowd_db_file_.Tid_text); text_db.Tbl__text().Create_tbl();
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Js_img_mgr {
|
||||
html_itm.Html_elem_atr_set_append(html_id, "class", " new");
|
||||
}
|
||||
private static void Update_img(Xoa_page page, Xog_js_wkr js_wkr, Js_img_wkr img_wkr, int uid, byte lnki_type, byte elem_tid, int html_w, int html_h, String html_src, int orig_w, int orig_h, String orig_src, byte[] lnki_ttl, int gallery_mgr_h) {
|
||||
if (!Xoa_app_.Mode_is_gui()) return; // do not update html widget unless app is gui; null ref on http server; DATE:2014-09-17
|
||||
if (!page.Wiki().App().App_type().Uid_is_gui()) return; // do not update html widget unless app is gui; null ref on http server; DATE:2014-09-17
|
||||
switch (elem_tid) {
|
||||
case Xof_html_elem.Tid_gallery_v2:
|
||||
img_wkr.Html_update(page, js_wkr, uid, html_w, html_h, html_src, orig_w, orig_h, orig_src, lnki_ttl);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Xob_orig_tbl_bldr extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_file_orig_reg;}
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {
|
||||
Xof_fsdb_mode fsdb_mode = wiki.File_mgr__fsdb_mode();
|
||||
Xof_fsdb_mode fsdb_mode = wiki.File__fsdb_mode();
|
||||
fsdb_mode.Tid_make_y_();
|
||||
wiki.Init_assert();
|
||||
Fsdb_db_mgr db_core_mgr = Fsdb_db_mgr_.new_detect(wiki, wiki.Fsys_mgr().Root_dir(), wiki.Fsys_mgr().File_dir());
|
||||
|
||||
90
400_xowa/src/gplx/xowa/gui/bnds/Xog_bnd_win.java
Normal file
90
400_xowa/src/gplx/xowa/gui/bnds/Xog_bnd_win.java
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
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.gui.bnds; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*;
|
||||
import gplx.gfui.*;
|
||||
public class Xog_bnd_win implements GfoInvkAble {
|
||||
private GfuiWin win;
|
||||
private GfuiTextBox shortcut_txt, binding_txt, keycode_txt;
|
||||
private GfuiBtn ok_btn, cxl_btn;
|
||||
private Gfui_bnd_parser bnd_parser;
|
||||
public void Show(Gfui_kit kit, GfuiWin owner_win, Gfui_bnd_parser bnd_parser, String shortcut_text, String binding_text) {
|
||||
// create controls
|
||||
this.win = kit.New_win_utl("shortcut_win", owner_win); win.BackColor_(ColorAdp_.White).Size_(200, 120);
|
||||
this.bnd_parser = bnd_parser;
|
||||
GfuiLbl shortcut_lbl = Make_lbl(kit, win, "shortcut_lbl" , "Shortcut:");
|
||||
GfuiLbl binding_lbl = Make_lbl(kit, win, "binding_lbl" , "Binding:");
|
||||
GfuiLbl keycode_lbl = Make_lbl(kit, win, "keycode_lbl" , "Keycode:");
|
||||
this.shortcut_txt = Make_txt(kit, win, "shortcut_txt" , shortcut_text);
|
||||
this.binding_txt = Make_txt(kit, win, "binding_txt" , binding_text);
|
||||
this.keycode_txt = Make_txt(kit, win, "keycode_txt" , "");
|
||||
this.ok_btn = Make_btn(kit, win, "ok_btn" , "Ok");
|
||||
this.cxl_btn = Make_btn(kit, win, "cxl_btn" , "Cancel");
|
||||
// layout controls
|
||||
Layout( 0, shortcut_lbl , shortcut_txt);
|
||||
Layout(20, binding_lbl , binding_txt);
|
||||
Layout(40, keycode_lbl , keycode_txt);
|
||||
ok_btn.Pos_(110, 70); cxl_btn.Pos_(150, 70);
|
||||
// hookup events
|
||||
IptCfg null_cfg = IptCfg_.Null; IptEventType btn_event_type = IptEventType_.add_(IptEventType_.MouseDown, IptEventType_.KeyDown); IptArg[] btn_args = IptArg_.Ary(IptMouseBtn_.Left, IptKey_.Enter, IptKey_.Space);
|
||||
IptBnd_.ipt_to_(null_cfg , binding_txt , this, Invk_when_key_down , IptEventType_.KeyDown, IptArg_.Wildcard);
|
||||
IptBnd_.ipt_to_(null_cfg , binding_txt , this, Invk_when_key_up , IptEventType_.KeyUp, IptArg_.Wildcard);
|
||||
IptBnd_.ipt_to_(null_cfg , ok_btn , this, "when_ok" , btn_event_type, btn_args);
|
||||
IptBnd_.ipt_to_(null_cfg , cxl_btn , this, "when_cxl" , btn_event_type, btn_args);
|
||||
// open
|
||||
win.Pos_(SizeAdp_.center_(ScreenAdp_.Primary.Size(), win.Size()));
|
||||
win.Show();
|
||||
binding_txt.Focus();
|
||||
}
|
||||
private void When_key_down(GfoMsg m) {
|
||||
IptEventData event_data = (IptEventData)m.Args_getAt(0).Val();
|
||||
int keycode = event_data.Key().Val();
|
||||
binding_txt.Text_(bnd_parser.Xto_norm(IptKey_.To_str(keycode)));
|
||||
keycode_txt.Text_(Int_.Xto_str(keycode));
|
||||
event_data.Handled_on();
|
||||
}
|
||||
private void When_key_up(GfoMsg m) {
|
||||
IptEventData event_data = (IptEventData)m.Args_getAt(0).Val();
|
||||
event_data.Handled_on();
|
||||
}
|
||||
private GfuiLbl Make_lbl(Gfui_kit kit, GfuiWin owner_win, String key, String text) {
|
||||
return (GfuiLbl)kit.New_lbl(key, owner_win).Text_(text).Size_(80, 20).BackColor_(ColorAdp_.White);
|
||||
}
|
||||
private GfuiTextBox Make_txt(Gfui_kit kit, GfuiWin owner_win, String key, String text) {
|
||||
return (GfuiTextBox)kit.New_text_box(key, owner_win).Text_(text).Size_(120, 20).Border_on_();
|
||||
}
|
||||
private GfuiBtn Make_btn(Gfui_kit kit, GfuiWin owner_win, String key, String text) {
|
||||
return (GfuiBtn)kit.New_btn(key, owner_win).Text_(text).Size_(40, 20).Focus_able_(true);
|
||||
}
|
||||
private void Layout(int y, GfuiElem elem_1, GfuiElem elem_2) {
|
||||
elem_1.Y_(y);
|
||||
elem_2.Y_(y);
|
||||
elem_2.X_(elem_1.X_max());
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_when_key_down)) When_key_down(m);
|
||||
else if (ctx.Match(k, Invk_when_key_press)) When_key_up(m);
|
||||
else if (ctx.Match(k, Invk_when_key_up)) When_key_up(m);
|
||||
else if (ctx.Match(k, Invk_when_ok)) {win.Close();}
|
||||
else if (ctx.Match(k, Invk_when_cxl)) {win.Close();}
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_when_key_down = "when_key_down", Invk_when_key_press = "when_key_press", Invk_when_key_up = "when_key_up"
|
||||
, Invk_when_ok = "when_ok", Invk_when_cxl = "when_cxl"
|
||||
;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class Xog_menu_mgr implements GfoInvkAble {
|
||||
}
|
||||
public void Init_by_kit() {
|
||||
try {
|
||||
if (!Xoa_app_.Mode_is_gui()) return; // NOTE: do not try to initialize menu if http_server; will fail in headless mode when it tries to load SWT images; DATE:2015-03-27
|
||||
if (!app.App_type().Uid_is_gui()) return; // NOTE: do not try to initialize menu if http_server; will fail in headless mode when it tries to load SWT images; DATE:2015-03-27
|
||||
popup_mnu_mgr.Init_by_kit();
|
||||
window_mnu_mgr.Init_by_kit();
|
||||
Lang_changed(app.User().Lang());
|
||||
|
||||
81
400_xowa/src/gplx/xowa/gui/views/Load_page_wkr.java
Normal file
81
400_xowa/src/gplx/xowa/gui/views/Load_page_wkr.java
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
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.gui.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*;
|
||||
import gplx.core.threads.*;
|
||||
public class Load_page_wkr implements Gfo_thread_wkr {
|
||||
private Xog_tab_itm tab;
|
||||
public Load_page_wkr(Xog_tab_itm tab, Xowe_wiki wiki, Xoa_url url, Xoa_ttl ttl) {this.tab = tab; this.wiki = wiki; this.url = url; this.ttl = ttl;}
|
||||
public String Name() {return "xowa.load_page_wkr";}
|
||||
public boolean Resume() {return false;}
|
||||
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
|
||||
public Xoae_page Page() {return page;} private Xoae_page page;
|
||||
public Xoa_url Url() {return url;} private Xoa_url url;
|
||||
public Xoa_ttl Ttl() {return ttl;} private Xoa_ttl ttl;
|
||||
public boolean Hdump_enabled() {return hdump_enabled;} private boolean hdump_enabled;
|
||||
public Exception Exc() {return exc;} private Exception exc;
|
||||
private final static Object thread_lock = new Object();
|
||||
public static boolean Running() {
|
||||
boolean rv = false;
|
||||
synchronized (thread_lock) {
|
||||
rv = running;
|
||||
}
|
||||
return rv;
|
||||
} private static boolean running = false;
|
||||
private static void Running_(boolean v) {
|
||||
synchronized (thread_lock) {
|
||||
running = v;
|
||||
}
|
||||
}
|
||||
public void Exec() {
|
||||
try {
|
||||
Running_(true);
|
||||
int wait_count = 0;
|
||||
while (gplx.xowa.html.modules.popups.Xow_popup_mgr.Running() && ++wait_count < 100) {
|
||||
Thread_adp_.Sleep(10);
|
||||
}
|
||||
Xoae_app app = wiki.Appe();
|
||||
app.Usr_dlg().Log_many("", "", "page.load: url=~{0}", url.Xto_full_str_safe());
|
||||
if (Env_.System_memory_free() < app.Sys_cfg().Free_mem_when()) // check if low in memory
|
||||
app.Free_mem(false); // clear caches (which will clear bry_bfr_mk)
|
||||
else // not low in memory
|
||||
app.Utl__bfr_mkr().Clear(); // clear bry_bfr_mk only; NOTE: call before page parse, not when page is first added, else threading errors; DATE:2014-05-30
|
||||
this.page = wiki.GetPageByTtl(url, ttl, wiki.Lang(), tab, false);
|
||||
int html_db_id = page.Revision_data().Html_db_id();
|
||||
if (wiki.Html__hdump_enabled())
|
||||
hdump_enabled = true;
|
||||
wait_count = 0;
|
||||
while (gplx.xowa.html.modules.popups.Xow_popup_mgr.Running() && ++wait_count < 100) {
|
||||
Thread_adp_.Sleep(10);
|
||||
}
|
||||
if (wiki.Html__hdump_enabled() && html_db_id != -1) {
|
||||
wiki.ParsePage(page, false);
|
||||
// wiki.Html__hdump_rdr().Get_by_ttl(page);
|
||||
}
|
||||
else
|
||||
wiki.ParsePage(page, false);
|
||||
GfoInvkAble_.InvkCmd_val(tab.Cmd_sync(), Xog_tab_itm.Invk_show_url_loaded_swt, this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.exc = e;
|
||||
GfoInvkAble_.InvkCmd_val(tab.Cmd_sync(), Xog_tab_itm.Invk_show_url_failed_swt, this);
|
||||
}
|
||||
finally {
|
||||
Running_(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class Xog_html_itm implements Xog_js_wkr, GfoInvkAble, GfoEvObj {
|
||||
html_box.Html_doc_body_focus(); // NOTE: only focus if read so up / down will scroll box; edit / html should focus edit-box; DATE:2014-06-05
|
||||
page.Root().Data_htm_(html_src);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Html_src_(Xoae_page page, byte[] html_bry) {
|
||||
String html_str = String_.new_utf8_(html_bry);
|
||||
if (owner_tab.Tab_mgr().Html_load_tid__url()) {
|
||||
@@ -92,32 +92,26 @@ public class Xog_html_itm implements Xog_js_wkr, GfoInvkAble, GfoEvObj {
|
||||
public String Get_elem_value_for_edit_box() {return html_box.Html_elem_atr_get_str(Elem_id__xowa_edit_data_box, Gfui_html.Atr_value);}
|
||||
public String Get_elem_value(String elem_id) {return html_box.Html_elem_atr_get_str(elem_id, Gfui_html.Atr_value);}
|
||||
public void Html_img_update(String elem_id, String elem_src, int elem_width, int elem_height) {
|
||||
synchronized (thread_lock) {
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_img_update).Add("elem_id", elem_id).Add("elem_src", elem_src).Add("elem_width", elem_width).Add("elem_height", elem_height);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_img_update, m);
|
||||
}
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_img_update).Add("elem_id", elem_id).Add("elem_src", elem_src).Add("elem_width", elem_width).Add("elem_height", elem_height);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_img_update, m);
|
||||
}
|
||||
public void Html_elem_delete(String elem_id) {
|
||||
synchronized (thread_lock) {
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_elem_delete).Add("elem_id", elem_id);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_elem_delete, m);
|
||||
}
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_elem_delete).Add("elem_id", elem_id);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_elem_delete, m);
|
||||
}
|
||||
public void Html_atr_set(String elem_id, String atr_key, String atr_val) {
|
||||
synchronized (thread_lock) {
|
||||
synchronized (thread_lock) { // needed for Special:Search and async cancel; DATE:2015-05-02
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_elem_atr_set).Add("elem_id", elem_id).Add("atr_key", atr_key).Add("atr_val", atr_val);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_elem_atr_set, m);
|
||||
}
|
||||
}
|
||||
public void Html_redlink(String html_uid) {Html_elem_atr_set_append(html_uid, "class", "new");}
|
||||
public void Html_elem_atr_set_append(String elem_id, String atr_key, String atr_val) {
|
||||
synchronized (thread_lock) {
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_elem_atr_set_append).Add("elem_id", elem_id).Add("atr_key", atr_key).Add("atr_val", atr_val);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_elem_atr_set_append, m);
|
||||
}
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_elem_atr_set_append).Add("elem_id", elem_id).Add("atr_key", atr_key).Add("atr_val", atr_val);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_elem_atr_set_append, m);
|
||||
}
|
||||
public void Html_elem_replace_html(String id, String html) {
|
||||
synchronized (thread_lock) {
|
||||
synchronized (thread_lock) { // needed for Special:Search and async; DATE:2015-04-23
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_elem_replace_html).Add("id", id).Add("html", html);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_elem_replace_html, m);
|
||||
}
|
||||
@@ -129,27 +123,23 @@ public class Xog_html_itm implements Xog_js_wkr, GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
}
|
||||
public void Html_gallery_packed_exec() {
|
||||
synchronized (thread_lock) {
|
||||
if (!String_.Eq(owner_tab.Tab_key(), owner_tab.Tab_mgr().Active_tab().Tab_key())) return; // do not exec unless active;
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_gallery_packed_exec);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_gallery_packed_exec, m);
|
||||
module_packed_done = true;
|
||||
}
|
||||
if (!String_.Eq(owner_tab.Tab_key(), owner_tab.Tab_mgr().Active_tab().Tab_key())) return; // do not exec unless active;
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_gallery_packed_exec);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_gallery_packed_exec, m);
|
||||
module_packed_done = true;
|
||||
}
|
||||
public void Html_popups_bind_hover_to_doc() {
|
||||
synchronized (thread_lock) {
|
||||
if (!String_.Eq(owner_tab.Tab_key(), owner_tab.Tab_mgr().Active_tab().Tab_key())) return; // do not exec unless active;
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_popups_bind_hover_to_doc);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_popups_bind_hover_to_doc, m);
|
||||
module_popups_done = true;
|
||||
}
|
||||
if (!String_.Eq(owner_tab.Tab_key(), owner_tab.Tab_mgr().Active_tab().Tab_key())) return; // do not exec unless active;
|
||||
GfoMsg m = GfoMsg_.new_cast_(Invk_html_popups_bind_hover_to_doc);
|
||||
GfoInvkAble_.InvkCmd_msg(cmd_sync, Invk_html_popups_bind_hover_to_doc, m);
|
||||
module_popups_done = true;
|
||||
}
|
||||
private boolean module_packed_done = false, module_popups_done = false;
|
||||
public void Tab_selected(Xoae_page page) {
|
||||
Xoh_module_mgr module_mgr = page.Html_data().Module_mgr();
|
||||
if (module_mgr.Itm_gallery().Enabled() && !module_packed_done)
|
||||
if (module_mgr.Itm__gallery().Enabled() && !module_packed_done)
|
||||
this.Html_gallery_packed_exec();
|
||||
if (module_mgr.Itm_popups().Enabled() && !module_popups_done)
|
||||
if (module_mgr.Itm__popups().Enabled() && !module_popups_done)
|
||||
this.Html_popups_bind_hover_to_doc();
|
||||
}
|
||||
public void Scroll_page_by_bmk_gui() {GfoInvkAble_.InvkCmd(cmd_async, Invk_scroll_page_by_bmk);}
|
||||
|
||||
@@ -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.gui.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*;
|
||||
import gplx.threads.*; import gplx.xowa.xtns.pfuncs.ifs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.core.threads.*; import gplx.xowa.xtns.pfuncs.ifs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xog_html_js_cbk implements GfoInvkAble {
|
||||
private Xoae_app app;
|
||||
private Xog_html_itm html_itm;
|
||||
@@ -126,7 +126,7 @@ public class Xog_html_js_cbk implements GfoInvkAble {
|
||||
}
|
||||
private String[] Wikidata_get_label(GfoMsg m) {
|
||||
try {
|
||||
ThreadAdp_.Sleep(10); // slow down calls to prevent random crashing in XulRunner; DATE:2014-04-23
|
||||
Thread_adp_.Sleep(10); // slow down calls to prevent random crashing in XulRunner; DATE:2014-04-23
|
||||
gplx.xowa.xtns.wdatas.Wdata_wiki_mgr wdata_mgr = app.Wiki_mgr().Wdata_mgr();
|
||||
wdata_mgr.Wdata_wiki().Init_assert(); // NOTE: must assert else ns_mgr won't load Property
|
||||
int len = m.Args_count();
|
||||
|
||||
@@ -17,5 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.gui.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*;
|
||||
public interface Xog_tab_close_lnr {
|
||||
boolean When_close(Xog_tab_itm tab);
|
||||
boolean When_close(Xog_tab_itm tab, Xoa_url url);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ public class Xog_tab_close_mgr {
|
||||
public void Add(Xog_tab_close_lnr lnr) {list.Add(lnr);}
|
||||
public int Len() {return list.Count();}
|
||||
public Xog_tab_close_lnr Get_at(int i) {return (Xog_tab_close_lnr)list.FetchAt(i);}
|
||||
public boolean When_close(Xog_tab_itm tab) {
|
||||
public boolean When_close(Xog_tab_itm tab, Xoa_url url) {
|
||||
int len = list.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xog_tab_close_lnr lnr = Get_at(i);
|
||||
if (!lnr.When_close(tab)) return false;
|
||||
if (!lnr.When_close(tab, url)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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.gui.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*;
|
||||
import gplx.threads.*; import gplx.gfui.*; import gplx.xowa.gui.history.*; import gplx.xowa.gui.bnds.*;
|
||||
import gplx.core.threads.*; import gplx.gfui.*; import gplx.xowa.gui.history.*; import gplx.xowa.gui.bnds.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.cfgs2.*;
|
||||
import gplx.xowa.pages.*; import gplx.xowa.pages.skins.*;
|
||||
@@ -37,7 +37,7 @@ public class Xog_tab_itm implements GfoInvkAble {
|
||||
html_box.Html_js_enabled_(gui_mgr.Html_mgr().Javascript_enabled());
|
||||
html_box.Html_invk_src_(win);
|
||||
html_itm.Html_box_(html_box);
|
||||
if (app.Mode() == Xoa_app_.Mode_gui) { // NOTE: only run for gui; will cause firefox addon to fail; DATE:2014-05-03
|
||||
if (app.App_type().Uid_is_gui()) { // NOTE: only run for gui; will cause firefox addon to fail; DATE:2014-05-03
|
||||
html_box.Html_doc_html_load_by_mem(""); // NOTE: must set source, else control will be empty, and key events will not be raised; DATE:2014-04-30
|
||||
IptBnd_.ipt_to_(IptCfg_.Null, html_box, this, "popup", IptEventType_.MouseDown, IptMouseBtn_.Right);
|
||||
GfoEvMgr_.SubSame(html_box, GfuiElemKeys.Evt_menu_detected, html_itm);
|
||||
@@ -111,13 +111,14 @@ public class Xog_tab_itm implements GfoInvkAble {
|
||||
wiki.Lang().Vnt_mgr().Cur_vnt_(url.Xowa_vnt());
|
||||
if (win.Page__async__working(url)) return;
|
||||
app.Gui_mgr().Search_suggest_mgr().Cancel(); // cancel pending search_suggest calls
|
||||
if (page != null) page.Tab_data().Close_mgr().When_close(this); // cancel any current search cmds
|
||||
if (page != null) page.Tab_data().Close_mgr().When_close(this, url); // cancel any current search cmds
|
||||
app.Log_wtr().Queue_enabled_(true);
|
||||
usr_dlg.Clear();
|
||||
this.wiki = app.Wiki_mgr().Get_by_key_or_null(url.Wiki_bry()); // NOTE: must update wiki
|
||||
wiki.Init_assert(); // NOTE: assert wiki.Init before parsing; needed b/c lang (with lang-specific ns) is only loaded on init, and parse Xoa_ttl.parse_ will fail below; EX:pt.wikipedia.org/wiki/Wikipedia:P<>gina principal
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, url.Page_bry());
|
||||
if (ttl == null) {usr_dlg.Prog_one("", "", "title is invalid: ~{0}", String_.new_utf8_(url.Raw())); return;}
|
||||
Tab_name_(String_.new_utf8_(ttl.Full_txt()));
|
||||
usr_dlg.Prog_one("", "", "loading: ~{0}", String_.new_utf8_(ttl.Raw()));
|
||||
if (app.Api_root().Html().Modules().Popups().Enabled())
|
||||
this.Html_box().Html_js_eval_script("if (window.xowa_popups_hide_all != null) window.xowa_popups_hide_all();"); // should be more configurable; DATE:2014-07-09
|
||||
@@ -159,14 +160,15 @@ public class Xog_tab_itm implements GfoInvkAble {
|
||||
app.User().Data_mgr().History_mgr().Update_async(app.Async_mgr(), ttl, url);
|
||||
}
|
||||
usr_dlg.Prog_none("", "", "rendering html");
|
||||
html_itm.Html_box().Size_(tab_mgr.Tab_mgr().Size()); // NOTE: must resize tab here, else scrolling to anchor in background tab doesn't work (html_box has size of 0, 0) DATE:2015-05-03
|
||||
// win.Page__async__bgn(this);
|
||||
Gfo_thread_wkr async_wkr = null;
|
||||
if (wkr.Hdump_enabled()) {
|
||||
wiki.File_mgr().Init_file_mgr_by_load(wiki);
|
||||
Xof_fsdb_mgr fsdb_mgr = wiki.File_mgr().Fsdb_mgr();
|
||||
async_wkr = new Xof_file_wkr(wiki.File_mgr__orig_mgr(), fsdb_mgr.Bin_mgr(), fsdb_mgr.Mnt_mgr(), app.File_mgr__cache_mgr(), wiki.File_mgr__repo_mgr(), html_itm, page, page.Hdump_data().Imgs(), gplx.xowa.files.Xof_exec_tid.Tid_wiki_page);
|
||||
if (wiki.Html_mgr__hdump_enabled()) {
|
||||
wiki.Html_mgr__hdump_wtr().Save(page);
|
||||
async_wkr = new Xof_file_wkr(wiki.File__orig_mgr(), fsdb_mgr.Bin_mgr(), fsdb_mgr.Mnt_mgr(), app.File__cache_mgr(), wiki.File__repo_mgr(), html_itm, page, page.Hdump_data().Imgs(), gplx.xowa.files.Xof_exec_tid.Tid_wiki_page);
|
||||
if (wiki.Html__hdump_enabled()) {
|
||||
wiki.Html__hdump_wtr().Save(page);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -179,11 +181,11 @@ public class Xog_tab_itm implements GfoInvkAble {
|
||||
this.tab_is_loading = false;
|
||||
}
|
||||
}
|
||||
public void Exec_async_hdump(Xoa_app app, Xow_wiki wiki, gplx.xowa.files.gui.Xog_js_wkr js_wkr, gplx.threads.Gfo_thread_pool thread_pool, Xoa_page page, ListAdp imgs, int[] redlink_ary) {
|
||||
public void Exec_async_hdump(Xoa_app app, Xow_wiki wiki, gplx.xowa.files.gui.Xog_js_wkr js_wkr, gplx.core.threads.Gfo_thread_pool thread_pool, Xoa_page page, ListAdp imgs, int[] redlink_ary) {
|
||||
if (imgs.Count() > 0) {
|
||||
Xof_file_wkr file_thread = new Xof_file_wkr
|
||||
( wiki.File_mgr__orig_mgr(), wiki.File_mgr__bin_mgr(), wiki.File_mgr__mnt_mgr()
|
||||
, app.File_mgr__cache_mgr(), wiki.File_mgr__repo_mgr(), html_itm, page, imgs
|
||||
( wiki.File__orig_mgr(), wiki.File__bin_mgr(), wiki.File__mnt_mgr()
|
||||
, app.File__cache_mgr(), wiki.File__repo_mgr(), html_itm, page, imgs
|
||||
, gplx.xowa.files.Xof_exec_tid.Tid_wiki_page);
|
||||
thread_pool.Add_at_end(file_thread); thread_pool.Run();
|
||||
}
|
||||
@@ -215,7 +217,7 @@ public class Xog_tab_itm implements GfoInvkAble {
|
||||
if (page.Html_data().Xtn_gallery_packed_exists()) // packed_gallery exists; fire js once; PAGE:en.w:National_Sculpture_Museum_(Valladolid); DATE:2014-07-21
|
||||
html_itm.Html_gallery_packed_exec();
|
||||
if ( page.Html_data().Xtn_imap_exists() // imap exists; DATE:2014-08-07
|
||||
&& page.Html_data().Module_mgr().Itm_popups().Enabled()
|
||||
&& page.Html_data().Module_mgr().Itm__popups().Enabled()
|
||||
)
|
||||
html_itm.Html_popups_bind_hover_to_doc(); // rebind all elements to popup
|
||||
}
|
||||
@@ -245,7 +247,7 @@ public class Xog_tab_itm implements GfoInvkAble {
|
||||
try {
|
||||
if (page.Tab_data().Tab() != null) { // needed b/c Preview has page.Tab of null which causes null_ref error in redlinks
|
||||
Xog_redlink_mgr redlinks_wkr = new Xog_redlink_mgr(win_itm, page, app.User().Cfg_mgr().Log_mgr().Log_redlinks());
|
||||
ThreadAdp_.invk_(gplx.xowa.apps.Xoa_thread_.Key_page_redlink, redlinks_wkr, gplx.xowa.parsers.lnkis.redlinks.Xog_redlink_mgr.Invk_run).Start();
|
||||
Thread_adp_.invk_(gplx.xowa.apps.Xoa_thread_.Key_page_redlink, redlinks_wkr, gplx.xowa.parsers.lnkis.redlinks.Xog_redlink_mgr.Invk_run).Start();
|
||||
usr_dlg.Prog_none("", "imgs.done", "");
|
||||
}
|
||||
} catch (Exception e) {usr_dlg.Warn_many("", "", "page.thread.redlinks: page=~{0} err=~{1}", page_ttl_str, Err_.Message_gplx_brief(e));}
|
||||
@@ -261,43 +263,6 @@ public class Xog_tab_itm implements GfoInvkAble {
|
||||
}
|
||||
public static final String Invk_show_url_loaded_swt = "show_url_loaded_swt", Invk_show_url_failed_swt = "show_url_failed_swt";
|
||||
}
|
||||
class Load_page_wkr implements Gfo_thread_wkr {
|
||||
private Xog_tab_itm tab;
|
||||
public Load_page_wkr(Xog_tab_itm tab, Xowe_wiki wiki, Xoa_url url, Xoa_ttl ttl) {this.tab = tab; this.wiki = wiki; this.url = url; this.ttl = ttl;}
|
||||
public String Name() {return "xowa.load_page_wkr";}
|
||||
public boolean Resume() {return false;}
|
||||
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
|
||||
public Xoae_page Page() {return page;} private Xoae_page page;
|
||||
public Xoa_url Url() {return url;} private Xoa_url url;
|
||||
public Xoa_ttl Ttl() {return ttl;} private Xoa_ttl ttl;
|
||||
public boolean Hdump_enabled() {return hdump_enabled;} private boolean hdump_enabled;
|
||||
public Exception Exc() {return exc;} private Exception exc;
|
||||
public void Exec() {
|
||||
try {
|
||||
Xoae_app app = wiki.Appe();
|
||||
app.Usr_dlg().Log_many("", "", "page.load: url=~{0}", url.Xto_full_str_safe());
|
||||
if (Env_.System_memory_free() < app.Sys_cfg().Free_mem_when()) // check if low in memory
|
||||
app.Free_mem(false); // clear caches (which will clear bry_bfr_mk)
|
||||
else // not low in memory
|
||||
app.Utl__bfr_mkr().Clear(); // clear bry_bfr_mk only; NOTE: call before page parse, not when page is first added, else threading errors; DATE:2014-05-30
|
||||
this.page = wiki.GetPageByTtl(url, ttl, wiki.Lang(), tab, false);
|
||||
int html_db_id = page.Revision_data().Html_db_id();
|
||||
if (wiki.Html_mgr__hdump_enabled())
|
||||
hdump_enabled = true;
|
||||
if (wiki.Html_mgr__hdump_enabled() && html_db_id != -1) {
|
||||
wiki.ParsePage(page, false);
|
||||
// wiki.Html_mgr__hdump_rdr().Get_by_ttl(page);
|
||||
}
|
||||
else
|
||||
wiki.ParsePage(page, false);
|
||||
GfoInvkAble_.InvkCmd_val(tab.Cmd_sync(), Xog_tab_itm.Invk_show_url_loaded_swt, this);
|
||||
}
|
||||
catch (Exception e) {
|
||||
this.exc = e;
|
||||
GfoInvkAble_.InvkCmd_val(tab.Cmd_sync(), Xog_tab_itm.Invk_show_url_failed_swt, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
class Load_files_wkr implements Gfo_thread_wkr {
|
||||
private Xog_tab_itm tab;
|
||||
public Load_files_wkr(Xog_tab_itm tab) {this.tab = tab;}
|
||||
|
||||
@@ -16,9 +16,10 @@ 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.gui.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*;
|
||||
import gplx.gfui.*; import gplx.threads.*;
|
||||
import gplx.gfui.*; import gplx.core.threads.*;
|
||||
import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.gui.history.*; import gplx.xowa.pages.*;
|
||||
public class Xog_tab_itm_read_mgr {
|
||||
private static final Xoa_url_parser url_parser = new Xoa_url_parser(); // NOTE: separate url_parser to reduce threading issues
|
||||
public static void Async(Xog_tab_itm tab) {tab.Async();}
|
||||
public static void Show_page(Xog_tab_itm tab, Xoae_page new_page, boolean reset_to_read) {Show_page(tab, new_page, reset_to_read, false, false, Xog_history_stack.Nav_fwd);}
|
||||
public static void Show_page(Xog_tab_itm tab, Xoae_page new_page, boolean reset_to_read, boolean new_page_is_same, boolean show_is_err, byte history_nav_type) {
|
||||
@@ -45,7 +46,7 @@ public class Xog_tab_itm_read_mgr {
|
||||
}
|
||||
tab.Page_(new_page);
|
||||
if (tab == tab.Tab_mgr().Active_tab())
|
||||
Update_selected_tab(win.App().Url_parser(), win, new_page.Url(), new_page.Ttl());
|
||||
Update_selected_tab(win, new_page.Url(), new_page.Ttl());
|
||||
Xol_font_info lang_font = wiki.Lang().Gui_font();
|
||||
if (lang_font.Name() == null) lang_font = win.Gui_mgr().Win_cfg().Font();
|
||||
Xog_win_itm_.Font_update(win, lang_font);
|
||||
@@ -57,8 +58,8 @@ public class Xog_tab_itm_read_mgr {
|
||||
else
|
||||
GfoInvkAble_.InvkCmd_val(tab.Html_itm().Cmd_async(), Xog_html_itm.Invk_html_elem_focus, Xog_html_itm.Elem_id__xowa_edit_data_box); // NOTE: must be async, else won't work; DATE:2014-06-05
|
||||
}
|
||||
public static void Update_selected_tab_blank(Xoa_url_parser url_parser, Xog_win_itm win) {Update_selected_tab(url_parser, win, null, null);} // called when all tabs are null
|
||||
public static void Update_selected_tab(Xoa_url_parser url_parser, Xog_win_itm win, Xoa_url url, Xoa_ttl ttl) {
|
||||
public static void Update_selected_tab_blank(Xog_win_itm win) {Update_selected_tab(win, null, null);} // called when all tabs are null
|
||||
public static void Update_selected_tab(Xog_win_itm win, Xoa_url url, Xoa_ttl ttl) {
|
||||
String url_str = "", win_str = Win_text_blank;
|
||||
if (url != null && ttl != null) {
|
||||
try {url_str = url_parser.Build_str(url);}
|
||||
@@ -78,7 +79,7 @@ public class Xog_tab_itm_read_mgr {
|
||||
win.App().Log_wtr().Queue_enabled_(false);
|
||||
Xoae_page fail_page = wiki.Data_mgr().Get_page(ttl, false);
|
||||
tab.View_mode_(Xopg_view_mode.Tid_edit);
|
||||
Update_selected_tab(win.App().Url_parser(), win, url, ttl);
|
||||
Update_selected_tab(win, url, ttl);
|
||||
Show_page(tab, fail_page, false, false, true, Xog_history_stack.Nav_fwd);
|
||||
win.Win_box().Text_(err_msg);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class Xog_tab_mgr implements GfoEvObj {
|
||||
Xog_tab_itm tab = Tabs_get_by_key_or_warn(key); if (tab == null) return;
|
||||
active_tab = tab;
|
||||
Xoae_page page = tab.Page();
|
||||
Xog_tab_itm_read_mgr.Update_selected_tab(win.App().Url_parser(), win, page.Url(), page.Ttl());
|
||||
Xog_tab_itm_read_mgr.Update_selected_tab(win, page.Url(), page.Ttl());
|
||||
tab.Html_itm().Tab_selected(page);
|
||||
}
|
||||
public void Tabs_close_cur() {
|
||||
@@ -149,7 +149,7 @@ public class Xog_tab_mgr implements GfoEvObj {
|
||||
return rv;
|
||||
}
|
||||
public boolean Tabs__pub_close(Xog_tab_itm tab) {
|
||||
return tab.Page().Tab_data().Close_mgr().When_close(tab);
|
||||
return tab.Page().Tab_data().Close_mgr().When_close(tab, Xoa_url.Null);
|
||||
}
|
||||
public void Tabs_close_undo() {
|
||||
if (closed_undo_list.Count() == 0) return;
|
||||
@@ -165,7 +165,7 @@ public class Xog_tab_mgr implements GfoEvObj {
|
||||
tab_regy.Del(key);
|
||||
if (tab_regy.Count() == 0) {
|
||||
active_tab = Xog_tab_itm_.Null;
|
||||
Xog_tab_itm_read_mgr.Update_selected_tab_blank(win.App().Url_parser(), win);
|
||||
Xog_tab_itm_read_mgr.Update_selected_tab_blank(win);
|
||||
}
|
||||
else
|
||||
Tabs_recalc_idx();
|
||||
@@ -217,10 +217,8 @@ public class Xog_tab_mgr implements GfoEvObj {
|
||||
}
|
||||
public void Tabs_new_link(String link, boolean focus) {
|
||||
Xowe_wiki wiki = active_tab.Wiki();
|
||||
Xog_tab_itm new_tab = Tabs_new(focus, false, wiki, Xoae_page.new_(wiki, active_tab.Page().Ttl())); // NOTE: do not use ttl from link, else middle-clicking pages with anchors won't work; DATE:2015-05-03
|
||||
Xoa_url url = Xoa_url_parser.Parse_from_url_bar(win.App(), wiki, link); // NOTE: link must be of form domain/wiki/page; DATE:2014-05-27
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, url.Page_bry());
|
||||
Xog_tab_itm new_tab = Tabs_new(focus, false, wiki, Xoae_page.new_(wiki, ttl));
|
||||
new_tab.Tab_name_(String_.new_utf8_(Xoa_ttl.Replace_unders(url.Page_bry())));
|
||||
new_tab.Show_url_bgn(url);
|
||||
if (focus)
|
||||
tab_mgr.Tabs_select_by_idx(new_tab.Tab_idx());
|
||||
|
||||
@@ -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.gui.views; import gplx.*; import gplx.xowa.*; import gplx.xowa.gui.*;
|
||||
import gplx.threads.*; import gplx.gfui.*; import gplx.xowa.gui.*; import gplx.xowa.gui.history.*; import gplx.xowa.xtns.math.*; import gplx.xowa.files.*;
|
||||
import gplx.core.threads.*; import gplx.gfui.*; import gplx.xowa.gui.*; import gplx.xowa.gui.history.*; import gplx.xowa.xtns.math.*; import gplx.xowa.files.*;
|
||||
import gplx.xowa.gui.urls.*; import gplx.xowa.gui.views.*; import gplx.xowa.pages.*;
|
||||
import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.specials.*;
|
||||
public class Xog_win_itm implements GfoInvkAble, GfoEvObj {
|
||||
@@ -205,21 +205,21 @@ public class Xog_win_itm implements GfoInvkAble, GfoEvObj {
|
||||
Page__async__bgn(tab);
|
||||
}
|
||||
public void Page__async__bgn(Xog_tab_itm tab) {
|
||||
page__async__thread = ThreadAdp_.invk_msg_(gplx.xowa.apps.Xoa_thread_.Key_page_async, this, GfoMsg_.new_cast_(Invk_page_async_exec).Add("v", tab)).Start();
|
||||
} private ThreadAdp page__async__thread = ThreadAdp.Null;
|
||||
page__async__thread = Thread_adp_.invk_msg_(gplx.xowa.apps.Xoa_thread_.Key_page_async, this, GfoMsg_.new_cast_(Invk_page_async_exec).Add("v", tab)).Start();
|
||||
} private Thread_adp page__async__thread = Thread_adp.Null;
|
||||
public boolean Page__async__working(Xoa_url url) {
|
||||
if (page__async__thread.IsAlive()) { // cancel pending image downloads
|
||||
page__async__restart_url = url;
|
||||
this.Usr_dlg().Canceled_y_();
|
||||
app.Wmf_mgr().Download_wkr().Download_xrg().Prog_cancel_y_();
|
||||
ThreadAdp_.invk_(this, Invk_page_async_cancel_wait).Start();
|
||||
Thread_adp_.invk_(this, Invk_page_async_cancel_wait).Start();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private void Page__async__cancel__wait() {
|
||||
while (page__async__thread.IsAlive()) {
|
||||
ThreadAdp_.Sleep(10);
|
||||
Thread_adp_.Sleep(10);
|
||||
}
|
||||
this.Active_page().File_queue().Clear();
|
||||
this.Usr_dlg().Canceled_n_(); // NOTE: must mark "uncanceled", else one cancelation will stop all future downloads; DATE:2014-05-04
|
||||
@@ -302,7 +302,7 @@ public class Xog_win_itm implements GfoInvkAble, GfoEvObj {
|
||||
GfoEvMgr_.Sub(app.Gui_mgr().Win_cfg().Font(), Xol_font_info.Font_changed, this, Invk_window_font_changed);
|
||||
|
||||
if ( !Env_.Mode_testing()
|
||||
&& app.Mode() == Xoa_app_.Mode_gui) // only run for gui; do not run for tcp/http server; DATE:2014-05-03
|
||||
&& app.App_type().Uid_is_gui()) // only run for gui; do not run for tcp/http server; DATE:2014-05-03
|
||||
app.Usr_dlg().Ui_wkr_(new Gfo_usr_dlg_ui_swt(kit, prog_box, info_box, info_box, app.Api_root().Gui().Browser().Info()));
|
||||
}
|
||||
}
|
||||
|
||||
26
400_xowa/src/gplx/xowa/html/Xoh_page_wtr_mgr_base.java
Normal file
26
400_xowa/src/gplx/xowa/html/Xoh_page_wtr_mgr_base.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
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.html; import gplx.*; import gplx.xowa.*;
|
||||
public abstract class Xoh_page_wtr_mgr_base {
|
||||
public byte[] Css_common_bry() {return css_common_bry;} private byte[] css_common_bry;
|
||||
public byte[] Css_wiki_bry() {return css_wiki_bry;} private byte[] css_wiki_bry;
|
||||
public void Init_css_urls(Io_url css_common_url, Io_url css_wiki_url) {
|
||||
this.css_common_bry = css_common_url.To_http_file_bry();
|
||||
this.css_wiki_bry = css_wiki_url.To_http_file_bry();
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class Xoh_page_wtr_mgr_tst {
|
||||
Xow_portal_mgr portal_mgr = wiki.Html_mgr().Portal_mgr();
|
||||
GfoInvkAble_.InvkCmd_val(portal_mgr, Xow_portal_mgr.Invk_div_logo_, Bry_.new_ascii_("~{portal_nav_main_href}"));
|
||||
portal_mgr.Init_assert();
|
||||
Xoh_page_wtr_mgr page_wtr_mgr = new Xoh_page_wtr_mgr(true);
|
||||
Xohe_page_wtr_mgr page_wtr_mgr = new Xohe_page_wtr_mgr(true);
|
||||
page_wtr_mgr.Gen(wiki.Ctx().Cur_page(), Xopg_view_mode.Tid_read);
|
||||
Tfds.Eq(String_.new_ascii_(portal_mgr.Div_logo_bry()), "/site/en.wikipedia.org/wiki/");
|
||||
}
|
||||
|
||||
@@ -20,12 +20,13 @@ import gplx.html.*; import gplx.xowa.html.portal.*; import gplx.xowa.pages.skins
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.gui.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.langs.vnts.*;
|
||||
public class Xoh_page_wtr_wkr implements Bry_fmtr_arg {
|
||||
private Xop_ctx ctx; private Xoae_page page; private Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
private byte[] root_dir_bry;
|
||||
public Xoh_page_wtr_wkr(byte page_mode) {this.page_mode = page_mode;} private byte page_mode;
|
||||
public Wdata_xwiki_link_wtr Wdata_lang_wtr() {return wtr_page_lang;} private Wdata_xwiki_link_wtr wtr_page_lang = new Wdata_xwiki_link_wtr();
|
||||
public Xoh_page_wtr_wkr Page_(Xoae_page v) {this.page = v; return this;}
|
||||
public Xoh_page_wtr_wkr Mgr_(Xoh_page_wtr_mgr v) {this.mgr = v; return this;} private Xoh_page_wtr_mgr mgr;
|
||||
public Xoh_page_wtr_wkr Mgr_(Xohe_page_wtr_mgr v) {this.mgr = v; return this;} private Xohe_page_wtr_mgr mgr;
|
||||
public boolean Ctgs_enabled() {return ctgs_enabled;} public Xoh_page_wtr_wkr Ctgs_enabled_(boolean v) {ctgs_enabled = v; return this;} private boolean ctgs_enabled = true;
|
||||
public byte[] Write(Xoh_page_wtr_mgr mgr, Xoae_page page, Xop_ctx ctx, Bry_bfr html_bfr) {
|
||||
public byte[] Write(Xohe_page_wtr_mgr mgr, Xoae_page page, Xop_ctx ctx, Bry_bfr html_bfr) {
|
||||
this.mgr = mgr; this.page = page; this.ctx = ctx;
|
||||
Xowe_wiki wiki = page.Wikie(); Xoae_app app = wiki.Appe();
|
||||
ctx.Cur_page_(page); // HACK: must update page for toc_mgr; WHEN: Xoae_page rewrite
|
||||
@@ -50,12 +51,13 @@ public class Xoh_page_wtr_wkr implements Bry_fmtr_arg {
|
||||
this.page = null;
|
||||
return html_bfr.Xto_bry_and_clear();
|
||||
}
|
||||
private void Write_page(Bry_bfr html_bfr, Xoae_app app, Xowe_wiki wiki, Xoh_page_wtr_mgr mgr, Xoae_page page, byte view_tid, Bry_fmtr fmtr, Object page_data) {
|
||||
private void Write_page(Bry_bfr html_bfr, Xoae_app app, Xowe_wiki wiki, Xohe_page_wtr_mgr mgr, Xoae_page page, byte view_tid, Bry_fmtr fmtr, Object page_data) {
|
||||
byte[] custom_html = page.Html_data().Custom_html();
|
||||
if (custom_html != null) {
|
||||
html_bfr.Add(custom_html);
|
||||
return;
|
||||
}
|
||||
if (root_dir_bry == null) this.root_dir_bry = app.Fsys_mgr().Root_dir().To_http_file_bry();
|
||||
DateAdp page_modified_on_dte = page.Revision_data().Modified_on();
|
||||
Xoa_ttl page_ttl = page.Ttl(); int page_ns_id = page_ttl.Ns().Id();
|
||||
byte page_tid = Xow_page_tid.Identify(wiki.Domain_tid(), page_ns_id, page_ttl.Page_db());
|
||||
@@ -66,7 +68,7 @@ public class Xoh_page_wtr_wkr implements Bry_fmtr_arg {
|
||||
byte[] js_edit_toolbar_bry = view_tid == Xopg_view_mode.Tid_edit ? wiki.Fragment_mgr().Html_js_edit_toolbar() : Bry_.Empty;
|
||||
Xow_portal_mgr portal_mgr = wiki.Html_mgr().Portal_mgr().Init_assert();
|
||||
fmtr.Bld_bfr_many(html_bfr
|
||||
, app.Fsys_mgr().Root_dir_bry(), Xoa_app_.Version, Xoa_app_.Build_date, app.Tcp_server().Running_str()
|
||||
, root_dir_bry, Xoa_app_.Version, Xoa_app_.Build_date, app.Tcp_server().Running_str()
|
||||
, page.Revision_data().Id()
|
||||
, Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, page_ttl, null) // NOTE: page_name does not show display_title (<i>). always pass in null
|
||||
, Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, page_ttl, page.Html_data().Display_ttl())
|
||||
|
||||
@@ -57,7 +57,7 @@ class Xoh_page_wtr_wkr_fxt {
|
||||
wiki.Html_mgr().Page_wtr_mgr().Html_capable_(true);
|
||||
Xoae_page page = wiki.Ctx().Cur_page();
|
||||
page.Data_raw_(Bry_.new_utf8_(raw));
|
||||
Xoh_page_wtr_mgr mgr = wiki.Html_mgr().Page_wtr_mgr();
|
||||
Xohe_page_wtr_mgr mgr = wiki.Html_mgr().Page_wtr_mgr();
|
||||
Xoh_page_wtr_wkr wkr = mgr.Wkr(Xopg_view_mode.Tid_edit).Page_(page).Mgr_(mgr);
|
||||
wkr.XferAry(tmp_bfr, 0);
|
||||
Tfds.Eq(expd, tmp_bfr.Xto_str_and_clear());
|
||||
@@ -67,7 +67,7 @@ class Xoh_page_wtr_wkr_fxt {
|
||||
Xoae_page page = wiki.Ctx().Cur_page();
|
||||
page.Ttl_(Xoa_ttl.parse_(wiki, Bry_.new_ascii_(page_name)));
|
||||
page.Data_raw_(Bry_.new_utf8_(page_text));
|
||||
Xoh_page_wtr_mgr mgr = wiki.Html_mgr().Page_wtr_mgr();
|
||||
Xohe_page_wtr_mgr mgr = wiki.Html_mgr().Page_wtr_mgr();
|
||||
Xoh_page_wtr_wkr wkr = mgr.Wkr(Xopg_view_mode.Tid_read).Page_(page).Mgr_(mgr);
|
||||
wkr.XferAry(tmp_bfr, 0);
|
||||
Tfds.Eq(expd, tmp_bfr.Xto_str_and_clear());
|
||||
|
||||
@@ -17,63 +17,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.html; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.gui.*; import gplx.xowa.pages.*;
|
||||
public class Xoh_page_wtr_mgr implements GfoInvkAble {
|
||||
public class Xohe_page_wtr_mgr extends Xoh_page_wtr_mgr_base implements GfoInvkAble {
|
||||
private Xoh_page_wtr_wkr edit_wtr, html_wtr, read_wtr;
|
||||
public Xoh_page_wtr_mgr(boolean html_capable) {
|
||||
page_edit_fmtr.Fmt_(String_.Concat_lines_nl_skip_last
|
||||
( "<html>"
|
||||
, "<head>"
|
||||
, " <meta http-equiv=\"content-type\" content=\"text/html;charset=UTF-8\" />"
|
||||
, " <script language='javascript'>"
|
||||
, " window.onload = function() {"
|
||||
, " var elem = document.getElementById('wikiText');"
|
||||
, " elem.selectionStart = 0;"
|
||||
, " elem.selectionEnd = 0;"
|
||||
, " window.setTimeout(function(){elem.focus();}, 100);"
|
||||
, " }"
|
||||
, " </script>"
|
||||
, "</head>"
|
||||
, "<body spellcheck='false'>"
|
||||
, " <textarea id='wikiText' style='width:99%;height:99%;border:0;'>"
|
||||
, "~{page_data}</textarea>"
|
||||
, "</body>"
|
||||
, "</html>"
|
||||
));
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public Xohe_page_wtr_mgr(boolean html_capable) {
|
||||
// page_edit_fmtr.Fmt_(String_.Concat_lines_nl_skip_last
|
||||
// ( "<html>"
|
||||
// , "<head>"
|
||||
// , " <meta http-equiv=\"content-type\" content=\"text/html;charset=UTF-8\" />"
|
||||
// , " <script language='javascript'>"
|
||||
// , " window.onload = function() {"
|
||||
// , " var elem = document.getElementById('wikiText');"
|
||||
// , " elem.selectionStart = 0;"
|
||||
// , " elem.selectionEnd = 0;"
|
||||
// , " window.setTimeout(function(){elem.focus();}, 100);"
|
||||
// , " }"
|
||||
// , " </script>"
|
||||
// , "</head>"
|
||||
// , "<body spellcheck='false'>"
|
||||
// , " <textarea id='wikiText' style='width:99%;height:99%;border:0;'>"
|
||||
// , "~{page_data}</textarea>"
|
||||
// , "</body>"
|
||||
// , "</html>"
|
||||
// ));
|
||||
this.html_capable = html_capable;
|
||||
read_wtr = new Xoh_page_wtr_wkr(Xopg_view_mode.Tid_read);
|
||||
edit_wtr = new Xoh_page_wtr_wkr(Xopg_view_mode.Tid_edit);
|
||||
html_wtr = new Xoh_page_wtr_wkr(Xopg_view_mode.Tid_html);
|
||||
}
|
||||
public boolean Html_capable() {return html_capable;} public Xoh_page_wtr_mgr Html_capable_(boolean v) {html_capable = v; return this;} private boolean html_capable;
|
||||
public Bry_fmtr Page_read_fmtr() {return page_read_fmtr;}
|
||||
public byte[] Css_common_bry() {return css_common_bry;} public Xoh_page_wtr_mgr Css_common_bry_(Io_url v) {css_common_bry = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(v); return this;} private byte[] css_common_bry;
|
||||
public byte[] Css_wiki_bry() {return css_wiki_bry;} public Xoh_page_wtr_mgr Css_wiki_bry_(Io_url v) {css_wiki_bry = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(v); return this;} private byte[] css_wiki_bry;
|
||||
private static final String[] Fmtr_keys = new String[]
|
||||
{ "app_root_dir", "app_version", "app_build_date", "xowa_mode_is_server"
|
||||
, "page_id", "page_name", "page_title", "page_modified_on_msg"
|
||||
, "html_css_common_path", "html_css_wiki_path", "xowa_head"
|
||||
, "page_lang_ltr", "page_indicators", "page_content_sub", "page_jumpto", "page_body_cls", "html_content_editable"
|
||||
, "page_data", "page_langs"
|
||||
, "portal_div_personal", "portal_div_ns", "portal_div_view"
|
||||
, "portal_div_logo", "portal_div_home", "portal_div_xtn"
|
||||
, "portal_div_wikis", "portal_sidebar"
|
||||
, "edit_div_rename", "edit_div_preview", "js_edit_toolbar"
|
||||
};
|
||||
private Bry_fmtr page_read_fmtr = Bry_fmtr.new_("", Fmtr_keys);
|
||||
public boolean Html_capable() {return html_capable;} public Xohe_page_wtr_mgr Html_capable_(boolean v) {html_capable = v; return this;} private boolean html_capable;
|
||||
public Bry_fmtr Page_read_fmtr() {return page_read_fmtr;} private Bry_fmtr page_read_fmtr = Bry_fmtr.new_("", Fmtr_keys);
|
||||
public Bry_fmtr Page_edit_fmtr() {return page_edit_fmtr;} private Bry_fmtr page_edit_fmtr = Bry_fmtr.new_("", Fmtr_keys);
|
||||
public Bry_fmtr Page_html_fmtr() {return page_html_fmtr;} private Bry_fmtr page_html_fmtr = Bry_fmtr.new_("", Fmtr_keys);
|
||||
private Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public byte[] Edit_rename_div_bry(Xoa_ttl ttl) {
|
||||
return div_edit_rename_fmtr.Bld_bry_many(tmp_bfr, ttl.Full_db());
|
||||
} private Bry_fmtr div_edit_rename_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl
|
||||
( " <input id='xowa_edit_rename_box' width='120' height='20' />"
|
||||
, " <a href='xowa-cmd:app.gui.main_win.page_edit_rename;' class='xowa_anchor_button' style='width:100px;max-width:1024px;'>"
|
||||
, " Rename page"
|
||||
, " </a>"
|
||||
, " <a href='/wiki/Special:MovePage?wpOldTitle=~{src_full_db}' class='xowa_anchor_button' style='width:100px;max-width:1024px;'>"
|
||||
, " Special:MovePage"
|
||||
, " </a>"
|
||||
), "src_full_db");
|
||||
public byte[] Edit_rename_div_bry(Xoa_ttl ttl) {return div_edit_rename_fmtr.Bld_bry_many(tmp_bfr, ttl.Full_db());}
|
||||
public void Init_(boolean v) {init = v;} private boolean init = true;
|
||||
public byte[] Gen(Xoae_page page, byte output_tid) {
|
||||
Xoh_page_wtr_wkr wtr = Wkr(output_tid);
|
||||
@@ -105,7 +81,27 @@ public class Xoh_page_wtr_mgr implements GfoInvkAble {
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private Bry_fmtr div_edit_rename_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl
|
||||
( " <input id='xowa_edit_rename_box' width='120' height='20' />"
|
||||
, " <a href='xowa-cmd:app.gui.main_win.page_edit_rename;' class='xowa_anchor_button' style='width:100px;max-width:1024px;'>"
|
||||
, " Rename page"
|
||||
, " </a>"
|
||||
, " <a href='/wiki/Special:MovePage?wpOldTitle=~{src_full_db}' class='xowa_anchor_button' style='width:100px;max-width:1024px;'>"
|
||||
, " Special:MovePage"
|
||||
, " </a>"
|
||||
), "src_full_db");
|
||||
public static final String Invk_page_read_ = "page_read_", Invk_page_edit_ = "page_edit_", Invk_page_html_ = "page_html_", Invk_xowa_div_edit_rename_ = "xowa_div_edit_rename_";
|
||||
private static final String[] Fmtr_keys = new String[]
|
||||
{ "app_root_dir", "app_version", "app_build_date", "xowa_mode_is_server"
|
||||
, "page_id", "page_name", "page_title", "page_modified_on_msg"
|
||||
, "html_css_common_path", "html_css_wiki_path", "xowa_head"
|
||||
, "page_lang_ltr", "page_indicators", "page_content_sub", "page_jumpto", "page_body_cls", "html_content_editable"
|
||||
, "page_data", "page_langs"
|
||||
, "portal_div_personal", "portal_div_ns", "portal_div_view"
|
||||
, "portal_div_logo", "portal_div_home", "portal_div_xtn"
|
||||
, "portal_div_wikis", "portal_sidebar"
|
||||
, "edit_div_rename", "edit_div_preview", "js_edit_toolbar"
|
||||
};
|
||||
}
|
||||
/*
|
||||
NOTE_1:xowa_anchor_button
|
||||
20
400_xowa/src/gplx/xowa/html/Xohv_page_wtr_mgr.java
Normal file
20
400_xowa/src/gplx/xowa/html/Xohv_page_wtr_mgr.java
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
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.html; import gplx.*; import gplx.xowa.*;
|
||||
public class Xohv_page_wtr_mgr extends Xoh_page_wtr_mgr_base {
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class Xow_html_mgr implements GfoInvkAble {
|
||||
this.wiki = wiki;
|
||||
html_wtr = new Xoh_html_wtr(wiki, this);
|
||||
Xoae_app app = wiki.Appe();
|
||||
page_wtr_mgr = new Xoh_page_wtr_mgr(app.Gui_mgr().Kit().Tid() != gplx.gfui.Gfui_kit_.Swing_tid); // reverse logic to handle swt,drd but not mem
|
||||
page_wtr_mgr = new Xohe_page_wtr_mgr(app.Gui_mgr().Kit().Tid() != gplx.gfui.Gfui_kit_.Swing_tid); // reverse logic to handle swt,drd but not mem
|
||||
Io_url file_dir = app.User().Fsys_mgr().App_img_dir().GenSubDir_nest("file");
|
||||
img_media_play_btn = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(file_dir.GenSubFil("play.png"));
|
||||
img_media_info_btn = Xoa_app_.Utl__encoder_mgr().Fsys().Encode_http(file_dir.GenSubFil("info.png"));
|
||||
@@ -43,7 +43,7 @@ public class Xow_html_mgr implements GfoInvkAble {
|
||||
}
|
||||
public Xowe_wiki Wiki() {return wiki;} private Xowe_wiki wiki;
|
||||
public Xoh_html_wtr Html_wtr() {return html_wtr;} private Xoh_html_wtr html_wtr;
|
||||
public Xoh_page_wtr_mgr Page_wtr_mgr() {return page_wtr_mgr;} private Xoh_page_wtr_mgr page_wtr_mgr;
|
||||
public Xohe_page_wtr_mgr Page_wtr_mgr() {return page_wtr_mgr;} private Xohe_page_wtr_mgr page_wtr_mgr;
|
||||
public Xow_portal_mgr Portal_mgr() {return portal_mgr;} private Xow_portal_mgr portal_mgr;
|
||||
public Xow_toc_mgr Toc_mgr() {return toc_mgr;} private Xow_toc_mgr toc_mgr = new Xow_toc_mgr();
|
||||
public Xow_module_mgr Module_mgr() {return module_mgr;} private Xow_module_mgr module_mgr;
|
||||
|
||||
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.css; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.dbs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xowd_css_core_mgr {
|
||||
public static void Set(Xowd_css_core_tbl core_tbl, Xowd_css_file_tbl file_tbl, Io_url css_dir) {Set(core_tbl, file_tbl, css_dir, Key_default);}
|
||||
public static void Set(Xowd_css_core_tbl core_tbl, Xowd_css_file_tbl file_tbl, Io_url css_dir, String key) {
|
||||
Db_conn conn = core_tbl.Conn();
|
||||
Io_url[] file_list = Io_mgr._.QueryDir_args(css_dir).Recur_().ExecAsUrlAry();
|
||||
@@ -41,7 +40,6 @@ public class Xowd_css_core_mgr {
|
||||
}
|
||||
catch (Exception e) {conn.Txn_cxl(); throw Err_.err_(e);}
|
||||
}
|
||||
public static void Get(Xowd_css_core_tbl core_tbl, Xowd_css_file_tbl file_tbl, Io_url css_dir) {Get(core_tbl, file_tbl, css_dir, Key_default);}
|
||||
public static void Get(Xowd_css_core_tbl core_tbl, Xowd_css_file_tbl file_tbl, Io_url css_dir, String key) {
|
||||
int css_id = core_tbl.Select_id_by_key(key); if (css_id == Xowd_css_core_tbl.Id_null) throw Err_.new_("skin:unknown key: {0}", key);
|
||||
Xowd_css_file_itm[] file_list = file_tbl.Select_by_owner(css_id);
|
||||
@@ -53,5 +51,5 @@ public class Xowd_css_core_mgr {
|
||||
Io_mgr._.SaveFilBry(file_url, file.Data());
|
||||
}
|
||||
}
|
||||
public static final String Key_default = "xowa.default";
|
||||
public static final String Key_default = "xowa.default", Key_mobile = "xowa.mobile";
|
||||
}
|
||||
|
||||
@@ -23,8 +23,9 @@ public class Xohd_hdump_rdr {
|
||||
private final Bry_bfr_mkr bfr_mkr; private final Xow_hzip_mgr hzip_mgr;
|
||||
private final Xohd_abrv_mgr abrv_mgr; private final Xohd_page_html_mgr__load load_mgr;
|
||||
private Xowd_db_mgr core_data_mgr; private final Xowd_page_itm dbpg = new Xowd_page_itm();
|
||||
public Xohd_hdump_rdr(Xoa_app app, Xow_wiki wiki) {
|
||||
this.bfr_mkr = app.Utl__bfr_mkr(); this.hzip_mgr = wiki.Html_mgr__hzip_mgr();
|
||||
private final Xow_wiki wiki;
|
||||
public Xohd_hdump_rdr(Xoa_app app, Xow_wiki wiki) {
|
||||
this.bfr_mkr = app.Utl__bfr_mkr(); this.hzip_mgr = wiki.Html__hzip_mgr(); this.wiki = wiki;
|
||||
abrv_mgr = new Xohd_abrv_mgr(app.Usr_dlg(), app.Fsys_mgr(), app.Utl__encoder_mgr().Fsys(), wiki.Domain_bry());
|
||||
load_mgr = new Xohd_page_html_mgr__load(); // TODO: get db_id
|
||||
}
|
||||
@@ -60,9 +61,9 @@ public class Xohd_hdump_rdr {
|
||||
core_data_mgr.Tbl__page().Select_by_ttl(dbpg, ttl.Ns(), ttl.Page_db()); // get rows from db
|
||||
if (dbpg.Redirect_id() != -1) Get_by_ttl__resolve_redirect(dbpg, rv);
|
||||
if (dbpg.Html_db_id() == -1) return false; // dbpg does not hdump; exit;
|
||||
rv.Init(dbpg.Id(), null, ttl); // FIXME
|
||||
rv.Init(wiki, dbpg.Id(), null, ttl); // FIXME
|
||||
Xowd_db_file html_db = core_data_mgr.Dbs__get_at(dbpg.Html_db_id());
|
||||
load_mgr.Load_page(rv, html_db.Tbl__html(), dbpg.Id(), ttl);
|
||||
load_mgr.Load_page(wiki, rv, html_db.Tbl__html(), dbpg.Id(), ttl);
|
||||
return true;
|
||||
}
|
||||
private void Get_by_ttl__resolve_redirect(Xowd_page_itm dbpg, Xog_page hpg) {
|
||||
@@ -75,9 +76,9 @@ public class Xohd_hdump_rdr {
|
||||
}
|
||||
public static void Load_module_mgr(Xoh_module_mgr page_module_mgr, Xog_page hpg) {
|
||||
Xopg_module_mgr dump_module_mgr = hpg.Module_mgr();
|
||||
page_module_mgr.Itm_mathjax().Enabled_ (dump_module_mgr.Math_exists());
|
||||
page_module_mgr.Itm_popups().Bind_hover_area_ (dump_module_mgr.Imap_exists());
|
||||
page_module_mgr.Itm_gallery().Enabled_ (dump_module_mgr.Gallery_packed_exists());
|
||||
page_module_mgr.Itm_hiero().Enabled_ (dump_module_mgr.Hiero_exists());
|
||||
page_module_mgr.Itm__mathjax().Enabled_ (dump_module_mgr.Math_exists());
|
||||
page_module_mgr.Itm__popups().Bind_hover_area_ (dump_module_mgr.Imap_exists());
|
||||
page_module_mgr.Itm__gallery().Enabled_ (dump_module_mgr.Gallery_packed_exists());
|
||||
page_module_mgr.Itm__hiero().Enabled_ (dump_module_mgr.Hiero_exists());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import gplx.xowa.html.hdumps.data.*; import gplx.xowa.html.hzips.*; import gplx.
|
||||
import gplx.xowa.pages.*; import gplx.xowa.pages.skins.*; import gplx.xowa.dbs.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa2.gui.*;
|
||||
public class Xohd_hdump_wtr {
|
||||
private final Bry_bfr_mkr bfr_mkr; private final Xoh_page_wtr_mgr page_wtr_mgr;
|
||||
private final Bry_bfr_mkr bfr_mkr; private final Xohe_page_wtr_mgr page_wtr_mgr;
|
||||
private final Xohd_page_html_mgr__save save_mgr; private Xowd_db_mgr core_data_mgr;
|
||||
public Xohd_hdump_wtr(Xoa_app app, Xowe_wiki wiki) {
|
||||
this.bfr_mkr = app.Utl__bfr_mkr(); this.page_wtr_mgr = wiki.Html_mgr().Page_wtr_mgr();
|
||||
|
||||
@@ -89,7 +89,11 @@ public class Xohd_hdump_wtr_tst {
|
||||
( "<ul id=\"xowa_gallery_ul_0\" class=\"gallery mw-gallery-traditional\" xowa_gly_box_max='0'>"
|
||||
, " <li id=\"xowa_gallery_li_0\" class=\"gallerybox\" xowa_gly_box_w='0'>"
|
||||
, " <div xowa_gly_box_w='0'>"
|
||||
, " <div class=\"thumb\" style=\"height: 150px;\">A.png</div>"
|
||||
, " <div class=\"thumb\" style=\"width: 150px;\">"
|
||||
, " <div xowa_gly_img_pad='0'>"
|
||||
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xowa_file_img_0\" alt=\"\" xowa_img='0' /></a>"
|
||||
, " </div>"
|
||||
, " </div>"
|
||||
, " <div class=\"gallerytext\"><p>A1"
|
||||
, "</p>"
|
||||
, ""
|
||||
|
||||
@@ -19,40 +19,65 @@ package gplx.xowa.html.hdumps.bldrs; import gplx.*; import gplx.xowa.*; import g
|
||||
import gplx.dbs.*; import gplx.xowa.bldrs.*; import gplx.xowa.html.hdumps.data.*;
|
||||
import gplx.xowa.wikis.data.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xob_redlink_mkr_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
private Xob_link_dump_tbl link_dump_tbl; private Xowd_html_tbl html_dump_tbl;
|
||||
private int commit_interval = 10000, commit_count = 0;
|
||||
public Xob_redlink_mkr_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki);}
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_html_redlinks;}
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {
|
||||
this.link_dump_tbl = Xob_link_dump_tbl.Get_or_new(wiki);
|
||||
this.html_dump_tbl = wiki.Data_mgr__core_mgr().Db__core().Tbl__html(); // FIXME: need to get by html_db_id
|
||||
}
|
||||
public void Cmd_run() {
|
||||
Db_rdr rdr = link_dump_tbl.Select_missing();
|
||||
int cur_page_id = -1; Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
html_dump_tbl.Conn().Txn_bgn();
|
||||
while (rdr.Move_next()) {
|
||||
int src_page_id = rdr.Read_int(Xob_link_dump_tbl.Fld_src_page_id);
|
||||
if (cur_page_id != src_page_id) {
|
||||
if (cur_page_id != -1) Commit(cur_page_id, bfr);
|
||||
cur_page_id = src_page_id;
|
||||
public void Cmd_run() {Read_data();}
|
||||
private void Read_data() {
|
||||
Bry_bfr bfr = Bry_bfr.reset_(255);
|
||||
wiki.Init_assert();
|
||||
Xowd_db_file core_db = wiki.Data_mgr__core_mgr().Db__core();
|
||||
Xob_db_file link_dump_db = Xob_db_file.new__redlink(wiki.Fsys_mgr().Root_dir());
|
||||
Db_attach_rdr attach_rdr = new Db_attach_rdr(link_dump_db.Conn(), "page_db", core_db.Url());
|
||||
attach_rdr.Attach();
|
||||
Xowd_page_tbl page_tbl = core_db.Tbl__page();
|
||||
int cur_html_db_id = -1, cur_page_id = -1; Xowd_html_tbl html_dump_tbl = null;
|
||||
Db_rdr rdr = attach_rdr.Exec_as_rdr(Sql_select);
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
// switch html_db if needed
|
||||
int html_db_id = rdr.Read_int(page_tbl.Fld_html_db_id().Name());
|
||||
if (html_db_id != cur_html_db_id) {
|
||||
if (html_dump_tbl != null) html_dump_tbl.Conn().Txn_end();
|
||||
html_dump_tbl = wiki.Data_mgr__core_mgr().Dbs__get_at(html_db_id).Tbl__html();
|
||||
html_dump_tbl.Conn().Txn_bgn();
|
||||
cur_html_db_id = html_db_id;
|
||||
}
|
||||
// commit page_id if needed
|
||||
int page_id = rdr.Read_int(page_tbl.Fld_page_id());
|
||||
if (cur_page_id != page_id) {
|
||||
if (cur_page_id != -1) Commit(html_dump_tbl, cur_page_id, bfr);
|
||||
cur_page_id = page_id;
|
||||
}
|
||||
// add html_uid to cur_page's bfr
|
||||
int html_uid = rdr.Read_int(Xob_link_dump_tbl.Fld_src_html_uid);
|
||||
bfr.Add_int_variable(html_uid).Add_byte_pipe();
|
||||
}
|
||||
bfr.Add_int_variable(rdr.Read_int(Xob_link_dump_tbl.Fld_src_html_uid)).Add_byte_pipe();
|
||||
}
|
||||
Commit(cur_page_id, bfr);
|
||||
html_dump_tbl.Conn().Txn_end();
|
||||
finally {rdr.Rls();}
|
||||
Commit(html_dump_tbl, cur_page_id, bfr); // commit cur page
|
||||
html_dump_tbl.Conn().Txn_end(); // close cur tbl
|
||||
attach_rdr.Detach();
|
||||
}
|
||||
private void Commit(int cur_page_id, Bry_bfr bfr) {
|
||||
private void Commit(Xowd_html_tbl html_dump_tbl, int cur_page_id, Bry_bfr bfr) {
|
||||
html_dump_tbl.Insert(cur_page_id, Xowd_html_row.Tid_redlink, bfr.Xto_bry_and_clear());
|
||||
++commit_count;
|
||||
if ((commit_count % commit_interval ) == 0)
|
||||
html_dump_tbl.Conn().Txn_sav();
|
||||
}
|
||||
public void Cmd_end() {
|
||||
html_dump_tbl.Conn().Rls_conn();
|
||||
link_dump_tbl.Conn().Rls_conn();
|
||||
}
|
||||
private static final String Sql_select = String_.Concat_lines_nl_skip_last
|
||||
( "SELECT p.page_html_db_id"
|
||||
, ", p.page_id"
|
||||
, ", ld.src_html_uid"
|
||||
, "FROM link_dump ld"
|
||||
, " JOIN <attach_db>page p ON p.page_id = ld.src_page_id "
|
||||
, "WHERE ld.trg_page_id = -1"
|
||||
, "ORDER BY p.page_html_db_id, p.page_id"
|
||||
, ";"
|
||||
);
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {}
|
||||
public void Cmd_end() {}
|
||||
public void Cmd_term() {}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_commit_interval_)) commit_interval = m.ReadInt("v");
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class Xohd_data_itm__base implements Xohd_data_itm {
|
||||
// public byte[] Orig_ttl() {return orig_ttl;} private byte[] orig_ttl;
|
||||
// public int Orig_ext() {return orig_ext;} private int orig_ext;
|
||||
// public byte[] Orig_redirect() {return orig_redirect;} private byte[] orig_redirect = Bry_.Empty;
|
||||
// public byte Html_elem_tid() {return html_elem_tid;} public void Html_elem_tid_(byte v) {html_elem_tid = v;} private byte html_elem_tid;
|
||||
public abstract byte Html_elem_tid();
|
||||
// public Io_url Html_orig_url() {return html_orig_url;} public void Html_orig_url_(Io_url v) {html_orig_url = v;} private Io_url html_orig_url = Io_url_.Null;
|
||||
// public int Gallery_mgr_h() {return gallery_mgr_h;} public void Gallery_mgr_h_(int v) {gallery_mgr_h = v;} private int gallery_mgr_h = Int_.Neg1;
|
||||
public Xohd_data_itm__base Data_init_base
|
||||
|
||||
@@ -16,9 +16,10 @@ 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.html.hdumps.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*; import gplx.xowa.html.hdumps.*;
|
||||
import gplx.core.brys.*;
|
||||
import gplx.core.brys.*; import gplx.xowa.files.*;
|
||||
public class Xohd_data_itm__gallery_itm extends Xohd_data_itm__base {
|
||||
@Override public int Img_tid() {return Xohd_data_itm__base.Tid_gallery;}
|
||||
@Override public byte Html_elem_tid() {return Xof_html_elem.Tid_img;}
|
||||
public int Box_w() {return box_w;} private int box_w;
|
||||
public int Img_w() {return img_w;} private int img_w;
|
||||
public int Img_pad() {return img_pad;} private int img_pad;
|
||||
|
||||
@@ -16,6 +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.html.hdumps.core; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*; import gplx.xowa.html.hdumps.*;
|
||||
import gplx.xowa.files.*;
|
||||
public class Xohd_data_itm__img extends Xohd_data_itm__base {
|
||||
@Override public int Img_tid() {return Xohd_data_itm__base.Tid_basic;}
|
||||
@Override public byte Html_elem_tid() {return Xof_html_elem.Tid_img;}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class Xohd_page_html_mgr__load {
|
||||
private final Bry_rdr rdr = new Bry_rdr(); private final ListAdp rows = ListAdp_.new_(), imgs = ListAdp_.new_();
|
||||
private static final int redlink_list_max = 1024;
|
||||
private final int[] redlink_list = new int[redlink_list_max];
|
||||
public void Load_page(Xog_page hpg, Xowd_html_tbl tbl, int page_id, Xoa_ttl page_ttl) {
|
||||
public void Load_page(Xow_wiki wiki, Xog_page hpg, Xowd_html_tbl tbl, int page_id, Xoa_ttl page_ttl) {
|
||||
tbl.Select_by_page(rows, page_id);
|
||||
Parse_rows(hpg, page_id, Xoa_url.blank_(), page_ttl, rows);
|
||||
Parse_rows(wiki, hpg, page_id, Xoa_url.blank_(), page_ttl, rows);
|
||||
}
|
||||
public void Parse_rows(Xog_page hpg, int page_id, Xoa_url page_url, Xoa_ttl page_ttl, ListAdp rows) { // TEST:
|
||||
hpg.Init(page_id, page_url, page_ttl);
|
||||
public void Parse_rows(Xow_wiki wiki, Xog_page hpg, int page_id, Xoa_url page_url, Xoa_ttl page_ttl, ListAdp rows) { // TEST:
|
||||
hpg.Init(wiki, page_id, page_url, page_ttl);
|
||||
imgs.Clear();
|
||||
int len = rows.Count();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
@@ -38,7 +38,7 @@ public class Xohd_page_html_mgr__load {
|
||||
case Xowd_html_row.Tid_html: srl_mgr.Load(hpg, row.Data()); break;
|
||||
case Xowd_html_row.Tid_img:
|
||||
case Xowd_html_row.Tid_redlink:
|
||||
Parse_data(hpg, row); break;
|
||||
Parse_data(hpg, row); break;
|
||||
}
|
||||
}
|
||||
rows.Clear();
|
||||
@@ -61,13 +61,16 @@ public class Xohd_page_html_mgr__load {
|
||||
switch (tid) {
|
||||
case Xohd_data_itm__base.Tid_basic : img_itm = new Xohd_data_itm__img(); break;
|
||||
case Xohd_data_itm__base.Tid_gallery : img_itm = new Xohd_data_itm__gallery_itm(); break;
|
||||
default: return null; // TODO: remove; needed for redlink
|
||||
}
|
||||
img_itm.Data_parse(rdr);
|
||||
rdr.Pos_add_one();
|
||||
return img_itm;
|
||||
}
|
||||
private void Load_data_img() {
|
||||
imgs.Add(Load_img(rdr));
|
||||
Xohd_data_itm__base img = Load_img(rdr);
|
||||
if (img == null) return;
|
||||
imgs.Add(img);
|
||||
}
|
||||
private void Load_data_redlink(Xog_page hpg) {
|
||||
int len = 0;
|
||||
|
||||
@@ -32,7 +32,8 @@ public class Xodump_stats_tbl implements RlsAble {
|
||||
private final Db_conn conn; private Db_stmt stmt_insert;
|
||||
public Xodump_stats_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
this.Create_tbl(); // always zap table
|
||||
this.Create_tbl();
|
||||
conn.Stmt_delete(tbl_name); // always zap table
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Create_tbl() {conn.Ddl_create_tbl(Db_meta_tbl.new_(tbl_name, flds, Db_meta_idx.new_unique_by_tbl(tbl_name, "pkey", fld_page_id)));}
|
||||
|
||||
@@ -73,6 +73,10 @@ public class Xow_hzip_itm__anchor {
|
||||
ttl_bgn += Href_bry_len;
|
||||
int ttl_end = Bry_finder.Find_fwd(src, Byte_ascii.Quote, ttl_bgn , src_len); if (ttl_end == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.ttl_end_missing", bgn, ttl_bgn);
|
||||
Xoa_ttl ttl = ttl_parser.Ttl_parse(Bry_.Mid(src, ttl_bgn, ttl_end)); if (ttl == null) return hzip_mgr.Warn_by_pos("a.ttl_invalid", ttl_bgn, ttl_end);
|
||||
// int id_bgn = Bry_finder.Find_fwd(src, Find_id_bry, ttl_end, src_len); if (id_bgn == Bry_finder.Not_found) return Xow_hzip_mgr.Unhandled;
|
||||
// id_bgn += Find_id_bry.length;
|
||||
// int id_end = Bry_finder.Find_fwd(src, Byte_ascii.Quote, id_bgn, src_len); if (id_end == Bry_finder.Not_found) return Xow_hzip_mgr.Unhandled;
|
||||
// int id = Bry_.Xto_int_or(src, id_bgn, id_end, -1); if (id == Bry_finder.Not_found) return Xow_hzip_mgr.Unhandled;
|
||||
int a_lhs_end = Bry_finder.Find_fwd(src, Byte_ascii.Gt, ttl_end, src_len); if (a_lhs_end == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.a_lhs_end_missing", bgn, ttl_end);
|
||||
++a_lhs_end; // skip >
|
||||
int a_rhs_bgn = Bry_finder.Find_fwd(src, Find_a_rhs_bgn_bry, a_lhs_end, src_len); if (a_rhs_bgn == Bry_finder.Not_found) return hzip_mgr.Warn_by_pos_add_dflt("a.a_rhs_bgn_missing", bgn, ttl_end);
|
||||
@@ -196,7 +200,8 @@ public class Xow_hzip_itm__anchor {
|
||||
);
|
||||
}
|
||||
private static final byte[]
|
||||
Find_href_bry = Bry_.new_ascii_("href=\"")
|
||||
Find_href_bry = Bry_.new_ascii_(" href=\"")
|
||||
// , Find_id_bry = Bry_.new_ascii_(" id=\"")
|
||||
, Find_a_rhs_bgn_bry = Bry_.new_ascii_("</a>")
|
||||
, Find_img_xatrs = Bry_.new_ascii_("xatrs='")
|
||||
;
|
||||
|
||||
35
400_xowa/src/gplx/xowa/html/modules/Xoh_module_itm_.java
Normal file
35
400_xowa/src/gplx/xowa/html/modules/Xoh_module_itm_.java
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
public class Xoh_module_itm_ {
|
||||
public static final byte[] // SRL: navframe, toc, title_rewrite are in wiki.cfg
|
||||
Key_collapsible = Bry_.new_ascii_("collapsible")
|
||||
, Key_css = Bry_.new_ascii_("css")
|
||||
, Key_gallery = Bry_.new_ascii_("gallery")
|
||||
, Key_globals = Bry_.new_ascii_("globals")
|
||||
, Key_hiero = Bry_.new_ascii_("hiero")
|
||||
, Key_mathjax = Bry_.new_ascii_("mathjax")
|
||||
, Key_navframe = Bry_.new_ascii_("navframe")
|
||||
, Key_popups = Bry_.new_ascii_("popups")
|
||||
, Key_search_suggest = Bry_.new_ascii_("xowa.search_suggest")
|
||||
, Key_timeline = Bry_.new_ascii_("xowa.timeline")
|
||||
, Key_title_rewrite = Bry_.new_ascii_("title_rewrite")
|
||||
, Key_toc = Bry_.new_ascii_("toc")
|
||||
, Key_top_icon = Bry_.new_ascii_("top_icon")
|
||||
;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
public class Xoh_module_itm__collapsible implements Xoh_module_itm {
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("collapsible");
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_collapsible;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
public class Xoh_module_itm__css implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_css;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("css");
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_css_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
if (!enabled) return;
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
public class Xoh_module_itm__gallery implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_gallery;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("gallery");
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_css_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
|
||||
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.langs.numbers.*;
|
||||
public class Xoh_module_itm__globals implements Xoh_module_itm {
|
||||
private Xoh_module_wtr tmp_wtr = new Xoh_module_wtr();
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("globals");
|
||||
private final Xoh_module_wtr tmp_wtr = new Xoh_module_wtr();
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_globals;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_n_() {enabled = false;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
@@ -46,8 +46,8 @@ public class Xoh_module_itm__globals implements Xoh_module_itm {
|
||||
public void Write_js_tail_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_head_global(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
if (!enabled) return;
|
||||
wtr.Write_js_global_ini_atr_val(Key_mode_is_gui , app.Mode() == Xoa_app_.Mode_gui);
|
||||
wtr.Write_js_global_ini_atr_val(Key_mode_is_http , app.Mode() == Xoa_app_.Mode_http);
|
||||
wtr.Write_js_global_ini_atr_val(Key_mode_is_gui , app.App_type().Uid_is_gui());
|
||||
wtr.Write_js_global_ini_atr_val(Key_mode_is_http , app.App_type().Uid_is_http());
|
||||
wtr.Write_js_global_ini_atr_val(Key_http_port , app.Http_server().Port());
|
||||
wtr.Write_js_global_ini_atr_msg(wiki, Key_sort_ascending);
|
||||
wtr.Write_js_global_ini_atr_msg(wiki, Key_sort_descending);
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
public class Xoh_module_itm__hiero implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_hiero;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("hiero");
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
if (!enabled) return;
|
||||
if (Url_css == null) Url_css = app.Fsys_mgr().Bin_any_dir().GenSubFil_nest("xowa", "xtns", "Wikihiero", "modules", "ext.wikihiero.css").To_http_file_bry();
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
public class Xoh_module_itm__mathjax implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_mathjax;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("mathjax");
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_css_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
public class Xoh_module_itm__navframe implements Xoh_module_itm {
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("navframe");
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_navframe;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
@@ -28,7 +28,7 @@ public class Xoh_module_itm__navframe implements Xoh_module_itm {
|
||||
public void Write_js_head_global(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
if (!enabled) return;
|
||||
wtr.Write_js_global_ini_atr_val(Key_enabled , true);
|
||||
wtr.Write_js_global_ini_atr_val(Key_collapsed , app.Api_root().Html().Modules().Navframe().Collapsed() || wiki.Html_mgr().Module_mgr().Itm_navframe().Enabled_n());
|
||||
wtr.Write_js_global_ini_atr_val(Key_collapsed , app.Api_root().Html().Modules().Navframe().Collapsed() || wiki.Html_mgr().Module_mgr().Itm__navframe().Enabled_n());
|
||||
wtr.Write_js_global_ini_atr_msg(wiki , Key_show);
|
||||
wtr.Write_js_global_ini_atr_msg(wiki , Key_hide);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.x
|
||||
import gplx.xowa.gui.*;
|
||||
import gplx.xowa.apis.xowa.html.modules.*;
|
||||
public class Xoh_module_itm__popups implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_popups;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public boolean Bind_hover_area() {return bind_hover_area;} public void Bind_hover_area_(boolean v) {bind_hover_area = v;} private boolean bind_hover_area;
|
||||
public void Clear() {enabled = false; bind_hover_area = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("popups");
|
||||
public void Write_css_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
public class Xoh_module_itm__search_suggest implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_search_suggest;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled = false;
|
||||
public void Clear() {enabled = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("xowa.search_suggest");
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
if (!enabled) return;
|
||||
if (Url_css == null) Url_css = app.Fsys_mgr().Bin_any_dir().GenSubFil_nest("xowa", "html", "res", "src", "xowa", "search-suggest", "search-suggest.css").To_http_file_bry();
|
||||
|
||||
@@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
public class Xoh_module_itm__timeline implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_timeline;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled = false;
|
||||
public void Clear() {enabled = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("xowa.timeline");
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
if (!enabled) return;
|
||||
if (Url_js == null) Url_js = app.Fsys_mgr().Bin_any_dir().GenSubFil_nest("xowa", "html", "res", "src", "xowa", "timeline", "timeline.js").To_http_file_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.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
import gplx.xowa.apis.xowa.html.modules.*;
|
||||
public class Xoh_module_itm__title_rewrite implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_title_rewrite;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public void Write_css_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_head_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_tail_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
if (!enabled) return;
|
||||
wtr.Write_js_tail_load_lib(app.Fsys_mgr().Bin_any_dir().GenSubFil_nest("xowa", "html", "res", "src", "gadgets", "titleRewrite", "titleRewrite.js"));
|
||||
}
|
||||
public void Write_js_head_global(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.gui.*;
|
||||
public class Xoh_module_itm__toc implements Xoh_module_itm {
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("toc");
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_toc;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
|
||||
@@ -19,9 +19,9 @@ package gplx.xowa.html.modules; import gplx.*; import gplx.xowa.*; import gplx.x
|
||||
import gplx.xowa.gui.*;
|
||||
import gplx.xowa.apis.xowa.html.modules.*;
|
||||
public class Xoh_module_itm__top_icon implements Xoh_module_itm {
|
||||
public byte[] Key() {return Xoh_module_itm_.Key_top_icon;}
|
||||
public boolean Enabled() {return enabled;} public void Enabled_y_() {enabled = true;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
|
||||
public void Clear() {enabled = false;}
|
||||
public byte[] Key() {return Key_const;} private static final byte[] Key_const = Bry_.new_ascii_("top_icon");
|
||||
public void Write_css_script(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_js_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {}
|
||||
public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_module_wtr wtr) {
|
||||
|
||||
@@ -20,33 +20,35 @@ public class Xoh_module_mgr implements Bry_fmtr_arg {
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Xoae_page page; private Xoh_module_itm[] itms; private int itms_len;
|
||||
private Xoh_module_wtr wtr = new Xoh_module_wtr();
|
||||
public Xoh_module_mgr() {
|
||||
Itms_add(itm_css, itm_globals, itm_popups, itm_toc, itm_collapsible, itm_navframe, itm_gallery, itm_mathjax, itm_hiero, itm_top_icon, itm_search_suggest, itm_timeline);
|
||||
Itms_add(itm__css, itm__globals, itm__popups, itm__toc, itm__collapsible, itm__navframe, itm__gallery, itm__mathjax, itm__hiero, itm__top_icon, itm__title_rewrite, itm__search_suggest, itm__timeline);
|
||||
}
|
||||
public Xoh_module_itm__css Itm_css() {return itm_css;} private Xoh_module_itm__css itm_css = new Xoh_module_itm__css();
|
||||
public Xoh_module_itm__globals Itm_globals() {return itm_globals;} private Xoh_module_itm__globals itm_globals = new Xoh_module_itm__globals();
|
||||
public Xoh_module_itm__popups Itm_popups() {return itm_popups;} private Xoh_module_itm__popups itm_popups = new Xoh_module_itm__popups();
|
||||
public Xoh_module_itm__toc Itm_toc() {return itm_toc;} private Xoh_module_itm__toc itm_toc = new Xoh_module_itm__toc();
|
||||
public Xoh_module_itm__collapsible Itm_collapsible() {return itm_collapsible;} private Xoh_module_itm__collapsible itm_collapsible = new Xoh_module_itm__collapsible();
|
||||
public Xoh_module_itm__navframe Itm_navframe() {return itm_navframe;} private Xoh_module_itm__navframe itm_navframe = new Xoh_module_itm__navframe();
|
||||
public Xoh_module_itm__gallery Itm_gallery() {return itm_gallery;} private Xoh_module_itm__gallery itm_gallery = new Xoh_module_itm__gallery();
|
||||
public Xoh_module_itm__mathjax Itm_mathjax() {return itm_mathjax;} private Xoh_module_itm__mathjax itm_mathjax = new Xoh_module_itm__mathjax();
|
||||
public Xoh_module_itm__hiero Itm_hiero() {return itm_hiero;} private Xoh_module_itm__hiero itm_hiero = new Xoh_module_itm__hiero();
|
||||
public Xoh_module_itm__top_icon Itm_top_icon() {return itm_top_icon;} private Xoh_module_itm__top_icon itm_top_icon = new Xoh_module_itm__top_icon();
|
||||
public Xoh_module_itm__search_suggest Itm_search_suggest() {return itm_search_suggest;} private Xoh_module_itm__search_suggest itm_search_suggest = new Xoh_module_itm__search_suggest();
|
||||
public Xoh_module_itm__timeline Itm_timeline() {return itm_timeline;} private Xoh_module_itm__timeline itm_timeline = new Xoh_module_itm__timeline();
|
||||
public Xoh_module_itm__css Itm__css() {return itm__css;} private Xoh_module_itm__css itm__css = new Xoh_module_itm__css();
|
||||
public Xoh_module_itm__globals Itm__globals() {return itm__globals;} private Xoh_module_itm__globals itm__globals = new Xoh_module_itm__globals();
|
||||
public Xoh_module_itm__popups Itm__popups() {return itm__popups;} private Xoh_module_itm__popups itm__popups = new Xoh_module_itm__popups();
|
||||
public Xoh_module_itm__toc Itm__toc() {return itm__toc;} private Xoh_module_itm__toc itm__toc = new Xoh_module_itm__toc();
|
||||
public Xoh_module_itm__collapsible Itm__collapsible() {return itm__collapsible;} private Xoh_module_itm__collapsible itm__collapsible = new Xoh_module_itm__collapsible();
|
||||
public Xoh_module_itm__navframe Itm__navframe() {return itm__navframe;} private Xoh_module_itm__navframe itm__navframe = new Xoh_module_itm__navframe();
|
||||
public Xoh_module_itm__gallery Itm__gallery() {return itm__gallery;} private Xoh_module_itm__gallery itm__gallery = new Xoh_module_itm__gallery();
|
||||
public Xoh_module_itm__mathjax Itm__mathjax() {return itm__mathjax;} private Xoh_module_itm__mathjax itm__mathjax = new Xoh_module_itm__mathjax();
|
||||
public Xoh_module_itm__hiero Itm__hiero() {return itm__hiero;} private Xoh_module_itm__hiero itm__hiero = new Xoh_module_itm__hiero();
|
||||
public Xoh_module_itm__top_icon Itm__top_icon() {return itm__top_icon;} private Xoh_module_itm__top_icon itm__top_icon = new Xoh_module_itm__top_icon();
|
||||
public Xoh_module_itm__search_suggest Itm__search_suggest() {return itm__search_suggest;} private Xoh_module_itm__search_suggest itm__search_suggest = new Xoh_module_itm__search_suggest();
|
||||
public Xoh_module_itm__timeline Itm__timeline() {return itm__timeline;} private Xoh_module_itm__timeline itm__timeline = new Xoh_module_itm__timeline();
|
||||
public Xoh_module_itm__title_rewrite Itm__title_rewrite() {return itm__title_rewrite;} private Xoh_module_itm__title_rewrite itm__title_rewrite = new Xoh_module_itm__title_rewrite();
|
||||
public Xoh_module_mgr Init(Xoae_app app, Xowe_wiki wiki, Xoae_page page) {
|
||||
this.app = app; this.wiki = wiki; this.page = page;
|
||||
return this;
|
||||
}
|
||||
public Xoh_module_mgr Init_dflts() {
|
||||
if (page.Hdr_mgr().Toc_enabled()) itm_toc.Enabled_y_();
|
||||
if (wiki.Html_mgr().Module_mgr().Itm_top_icon().Enabled_y()) itm_top_icon.Enabled_y_();
|
||||
if (app.Gui_mgr().Search_suggest_mgr().Enabled()) itm_search_suggest.Enabled_y_();
|
||||
itm_css.Enabled_y_();
|
||||
itm_globals.Enabled_y_(); // for now, always mark this and rest as exists; DATE:2014-06-09
|
||||
itm_collapsible.Enabled_y_();
|
||||
itm_navframe.Enabled_y_();
|
||||
itm_popups.Enabled_(app.Api_root().Html().Modules().Popups().Enabled());
|
||||
if (page.Hdr_mgr().Toc_enabled()) itm__toc.Enabled_y_();
|
||||
if (wiki.Html_mgr().Module_mgr().Itm__top_icon().Enabled_y()) itm__top_icon.Enabled_y_();
|
||||
if (wiki.Html_mgr().Module_mgr().Itm__title_rewrite().Enabled_y()) itm__title_rewrite.Enabled_y_();
|
||||
if (app.Gui_mgr().Search_suggest_mgr().Enabled()) itm__search_suggest.Enabled_y_();
|
||||
itm__css.Enabled_y_();
|
||||
itm__globals.Enabled_y_(); // for now, always mark this and rest as exists; DATE:2014-06-09
|
||||
itm__collapsible.Enabled_y_();
|
||||
itm__navframe.Enabled_y_();
|
||||
itm__popups.Enabled_(app.Api_root().Html().Modules().Popups().Enabled());
|
||||
return this;
|
||||
}
|
||||
public void Clear() {
|
||||
|
||||
@@ -21,7 +21,7 @@ import gplx.xowa.gui.*;
|
||||
public class Xoh_module_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xoh_module_mgr_fxt fxt = new Xoh_module_mgr_fxt();
|
||||
@Test public void Css() {
|
||||
fxt.Mgr().Itm_css().Enabled_y_();
|
||||
fxt.Mgr().Itm__css().Enabled_y_();
|
||||
fxt.Test_write(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <style type=\"text/css\">"
|
||||
@@ -32,7 +32,7 @@ public class Xoh_module_mgr_tst {
|
||||
@Test public void Toc() {
|
||||
fxt.Init_msg(Xoh_module_itm__toc.Key_showtoc, "Sh\"ow");
|
||||
fxt.Init_msg(Xoh_module_itm__toc.Key_hidetoc, "Hi'de");
|
||||
fxt.Mgr().Itm_toc().Enabled_y_();
|
||||
fxt.Mgr().Itm__toc().Enabled_y_();
|
||||
fxt.Test_write(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <script type='text/javascript'>"
|
||||
@@ -47,7 +47,7 @@ public class Xoh_module_mgr_tst {
|
||||
}
|
||||
@Test public void Globals() {
|
||||
fxt.Init_msg(Xol_msg_itm_.Id_dte_month_name_january, "Jan'uary" ); // add apos to simulate apostrophes in Hebrew months; DATE:2014-07-28
|
||||
fxt.Mgr().Itm_globals().Enabled_y_();
|
||||
fxt.Mgr().Itm__globals().Enabled_y_();
|
||||
fxt.Test_write(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <link rel=\"stylesheet\" href=\"file:///mem/xowa/bin/any/xowa/html/res/src/xowa/core/core.css\" type='text/css'>"
|
||||
@@ -78,7 +78,7 @@ public class Xoh_module_mgr_tst {
|
||||
gplx.xowa.langs.numbers.Xol_transform_mgr separators_mgr = la_lang.Num_mgr().Separators_mgr();
|
||||
separators_mgr.Clear();
|
||||
separators_mgr.Set(gplx.xowa.langs.numbers.Xol_num_mgr.Separators_key__grp, Bry_.new_ascii_(" "));
|
||||
fxt.Mgr().Itm_globals().Enabled_y_();
|
||||
fxt.Mgr().Itm__globals().Enabled_y_();
|
||||
fxt.Test_write(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <link rel=\"stylesheet\" href=\"file:///mem/xowa/bin/any/xowa/html/res/src/xowa/core/core.css\" type='text/css'>"
|
||||
|
||||
@@ -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.html.modules.popups; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*; import gplx.xowa.html.modules.*;
|
||||
import gplx.core.primitives.*; import gplx.threads.*;
|
||||
import gplx.core.primitives.*; import gplx.core.threads.*;
|
||||
import gplx.web.js.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.specials.*; import gplx.xowa.specials.search.*;
|
||||
@@ -25,7 +25,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Js_wtr js_wtr = new Js_wtr();
|
||||
private int show_init_word_count = Xoapi_popups.Dflt_show_init_word_count, show_more_word_count = Xoapi_popups.Dflt_show_more_word_count;
|
||||
private Xoh_href temp_href = new Xoh_href();
|
||||
private Object async_thread_guard = new Object(); private Xow_popup_itm async_itm; private GfoInvkAble async_cmd_show; private int async_id_next = 1;
|
||||
private static final Object thread_lock = new Object(); private Xow_popup_itm async_itm; private GfoInvkAble async_cmd_show; private int async_id_next = 1;
|
||||
public Xow_popup_mgr(Xowe_wiki wiki) {
|
||||
this.wiki = wiki; this.app = wiki.Appe();
|
||||
ev_mgr = GfoEvMgr.new_(this);
|
||||
@@ -83,24 +83,37 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
public String Get_async_bgn(byte[] js_cbk, byte[] href) {
|
||||
if (Bry_.HasAtBgn(href, gplx.xowa.parsers.lnkes.Xop_lnke_wkr.Bry_xowa_protocol)) return null; // ignore xowa-cmd
|
||||
synchronized (async_thread_guard) {
|
||||
synchronized (thread_lock) {
|
||||
if (async_itm != null) async_itm.Cancel();
|
||||
async_itm = new Xow_popup_itm(++async_id_next, href, Bry_.Empty, show_init_word_count);
|
||||
String id_str = async_itm.Popup_id();
|
||||
ThreadAdp_.invk_(id_str, this, Invk_show_popup_async).Start();
|
||||
Thread_adp_.invk_(id_str, this, Invk_show_popup_async).Start();
|
||||
return id_str;
|
||||
}
|
||||
}
|
||||
public static boolean Running() {
|
||||
boolean rv = false;
|
||||
synchronized (thread_lock) {
|
||||
rv = running;
|
||||
}
|
||||
return rv;
|
||||
} private static boolean running = false;
|
||||
private static void Running_(boolean v) {
|
||||
synchronized (thread_lock) {
|
||||
running = v;
|
||||
}
|
||||
}
|
||||
private byte[] Get_popup_html(Xowe_wiki cur_wiki, Xoae_page cur_page, Xow_popup_itm itm) {
|
||||
try {
|
||||
synchronized (async_thread_guard) { // queue popups to reduce contention with Load_page_wkr; DATE:2014-08-24
|
||||
synchronized (thread_lock) { // queue popups to reduce contention with Load_page_wkr; DATE:2014-08-24
|
||||
// Load_popup_wkr load_popup_wkr = new Load_popup_wkr(wiki, cur_page, itm, temp_href, ns_allowed_regy, ns_allowed_regy_key);
|
||||
// app.Thread_mgr().Page_load_mgr().Add_at_end(load_popup_wkr);
|
||||
// load_popup_wkr.Exec();
|
||||
// while (!load_popup_wkr.Rslt_done()) {
|
||||
// ThreadAdp_.Sleep(100);
|
||||
// Thread_adp_.Sleep(100);
|
||||
// }
|
||||
// return load_popup_wkr.Rslt_bry();
|
||||
Running_(true);
|
||||
if (itm.Canceled()) return null;
|
||||
cur_page.Popup_mgr().Itms().AddReplace(itm.Popup_id(), itm);
|
||||
app.Href_parser().Parse(temp_href, itm.Page_href(), wiki, cur_page.Ttl().Full_url()); // NOTE: use Full_url, not Page_url, else anchors won't work for non-main ns; PAGE:en.w:Project:Sandbox; DATE:2014-08-07
|
||||
@@ -118,6 +131,10 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
if (ns_allowed_regy.Count() > 0 && !ns_allowed_regy.Has(ns_allowed_regy_key.Val_(popup_ttl.Ns().Id()))) return Bry_.Empty;
|
||||
itm.Init(popup_wiki.Domain_bry(), popup_ttl);
|
||||
int wait_count = 0;
|
||||
while (gplx.xowa.gui.views.Load_page_wkr.Running() && ++wait_count < 100) {
|
||||
Thread_adp_.Sleep(10);
|
||||
}
|
||||
Xoae_page popup_page = popup_wiki.Data_mgr().Get_page(popup_ttl, false);
|
||||
byte[] rv = popup_wiki.Html_mgr().Module_mgr().Popup_mgr().Parser().Parse(wiki, popup_page, cur_page.Tab_data().Tab(), itm);
|
||||
Update_progress_bar(app, cur_wiki, cur_page, itm);
|
||||
@@ -128,6 +145,9 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
app.Usr_dlg().Warn_many("", "", "failed to get popup: href=~{0} err=~{1}", String_.new_utf8_(itm.Page_href()), Err_.Message_gplx_brief(e));
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
Running_(false);
|
||||
}
|
||||
}
|
||||
public static void Update_progress_bar(Xoae_app app, Xowe_wiki cur_wiki, Xoae_page cur_page, Xow_popup_itm itm) {
|
||||
byte[] href = itm.Page_href();
|
||||
@@ -142,7 +162,7 @@ public class Xow_popup_mgr implements GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
private void Show_popup_async() {
|
||||
try {
|
||||
synchronized (async_thread_guard) {
|
||||
synchronized (thread_lock) {
|
||||
Xoae_page cur_page = app.Gui_mgr().Browser_win().Active_page();
|
||||
async_itm.Popup_html_(Get_popup_html(app.Gui_mgr().Browser_win().Active_wiki(), cur_page, async_itm));
|
||||
}
|
||||
@@ -250,17 +270,26 @@ class Load_popup_wkr implements Gfo_thread_wkr {
|
||||
public void Exec() {
|
||||
Xoae_app app = wiki.Appe();
|
||||
try {
|
||||
if (itm.Canceled()) {Rslt_(null); return;}
|
||||
if (itm.Canceled()) return;
|
||||
cur_page.Popup_mgr().Itms().AddReplace(itm.Popup_id(), itm);
|
||||
app.Href_parser().Parse(temp_href, itm.Page_href(), wiki, cur_page.Ttl().Full_url()); // NOTE: use Full_url, not Page_url, else anchors won't work for non-main ns; PAGE:en.w:Project:Sandbox; DATE:2014-08-07
|
||||
app.Href_parser().Parse(temp_href, itm.Page_href(), wiki, cur_page.Ttl().Full_url()); // NOTE: use Full_url, not Page_url, else anchors won't work for non-main ns; PAGE:en.w:Project:Sandbox; DATE:2014-08-07
|
||||
if (temp_href.Protocol_tid() == gplx.xowa.net.Xoo_protocol_itm.Tid_file) return; // NOTE: do not get popups for "file:///"; DATE:2015-04-05
|
||||
Xowe_wiki popup_wiki = app.Wiki_mgr().Get_by_key_or_null(temp_href.Wiki());
|
||||
popup_wiki.Init_assert();
|
||||
Xoa_ttl popup_ttl = Xoa_ttl.parse_(popup_wiki, temp_href.Page_and_anchor());
|
||||
if (ns_allowed_regy.Count() > 0 && !ns_allowed_regy.Has(ns_allowed_regy_key.Val_(popup_ttl.Ns().Id()))) {Rslt_(Bry_.Empty); return;}
|
||||
switch (popup_ttl.Ns().Id()) {
|
||||
case Xow_ns_.Id_media:
|
||||
case Xow_ns_.Id_file:
|
||||
return; // do not popup for media or file
|
||||
case Xow_ns_.Id_special:
|
||||
if (!Xows_special_meta_.Itm__popup_history.Match_ttl(popup_ttl)) return; // do not popup for special, unless popupHistory; DATE:2015-04-20
|
||||
break;
|
||||
}
|
||||
if (ns_allowed_regy.Count() > 0 && !ns_allowed_regy.Has(ns_allowed_regy_key.Val_(popup_ttl.Ns().Id()))) return;
|
||||
itm.Init(popup_wiki.Domain_bry(), popup_ttl);
|
||||
Xoae_page popup_page = popup_wiki.Data_mgr().Get_page(popup_ttl, false);
|
||||
byte[] rv = popup_wiki.Html_mgr().Module_mgr().Popup_mgr().Parser().Parse(wiki, popup_page, cur_page.Tab_data().Tab(), itm);
|
||||
Xow_popup_mgr.Update_progress_bar(app, popup_wiki, cur_page, itm);
|
||||
Xow_popup_mgr.Update_progress_bar(app, wiki, cur_page, itm);
|
||||
Rslt_(rv);
|
||||
}
|
||||
catch(Exception e) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user