1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.3.4.1'

This commit is contained in:
gnosygnu
2016-03-27 23:44:59 -04:00
parent de67253a9c
commit baaef32df2
903 changed files with 13339 additions and 8695 deletions

View File

@@ -52,7 +52,7 @@ class Enm_mgr {
private Int_obj_ref tmp_val_ref = Int_obj_ref.zero_();
public Enm_mgr Add(byte val, String str) {
Int_obj_ref val_ref = Int_obj_ref.new_(val);
KeyVal kv = KeyVal_.new_(str, val_ref);
Keyval kv = Keyval_.new_(str, val_ref);
str_hash.Add(str, kv);
val_hash.Add(val_ref, kv);
return this;
@@ -60,14 +60,14 @@ class Enm_mgr {
public String Get_str(byte val) {
Object o = val_hash.Get_by(tmp_val_ref.Val_(val));
if (o == null) return null;
return ((KeyVal)o).Val_to_str_or_null();
return ((Keyval)o).Val_to_str_or_null();
}
public KeyVal[] Get_kv_ary() {
public Keyval[] Get_kv_ary() {
int len = val_hash.Count();
KeyVal[] rv = new KeyVal[len];
Keyval[] rv = new Keyval[len];
for (int i = 0; i < len; i++) {
KeyVal trg = (KeyVal)str_hash.Get_at(i);
rv[i] = KeyVal_.new_(trg.Val_to_str_or_null(), trg.Key());
Keyval trg = (Keyval)str_hash.Get_at(i);
rv[i] = Keyval_.new_(trg.Val_to_str_or_null(), trg.Key());
}
return rv;
}

View File

@@ -38,7 +38,7 @@ public class Xou_user_tst {
}
}
class Xou_user_fxt {
public Xoae_app App() {return app;} private Xoae_app app = Xoa_app_fxt.app_();
public Xoae_app App() {return app;} private Xoae_app app = Xoa_app_fxt.Make__app__edit();
public String Make_xwiki(boolean offline, String name) {return String_.Concat_with_str("|", Yn.To_str(offline), name);}
public void Test_fil(Io_url url, String expd) {
Tfds.Eq_str_lines(expd, Io_mgr.Instance.LoadFilStr(url));

View File

@@ -39,7 +39,7 @@ public class Xouc_window_mgr implements GfoInvkAble {
}
public static final String Invk_mode = "mode", Invk_mode_ = "mode_", Invk_mode_list = "mode_list"
, Invk_rect = "rect", Invk_rect_ = "rect_", Invk_safe_mode = "safe_mode", Invk_safe_mode_ = "safe_mode_", Invk_previous_adj = "previous_adj", Invk_previous_adj_ = "previous_adj_";
private static KeyVal[] Options_mode_list = KeyVal_.Ary(KeyVal_.new_("previous"), KeyVal_.new_("maximized"), KeyVal_.new_("absolute"), KeyVal_.new_("relative"), KeyVal_.new_("default"));
private static Keyval[] Options_mode_list = Keyval_.Ary(Keyval_.new_("previous"), Keyval_.new_("maximized"), Keyval_.new_("absolute"), Keyval_.new_("relative"), Keyval_.new_("default"));
public void Init_window(GfuiWin win) {
boolean init_is_maximized = false;
switch (mode_tid) {

View File

@@ -33,12 +33,12 @@ public class Xoue_user implements Xou_user, GfoEvMgrOwner, GfoInvkAble {
this.cfg_mgr = new Xou_cfg(this);
this.session_mgr = new Xou_session(this);
}
public GfoEvMgr EvMgr() {return ev_mgr;} private final GfoEvMgr ev_mgr;
public GfoEvMgr EvMgr() {return ev_mgr;} private final GfoEvMgr ev_mgr;
public String Key() {return key;} private String key;
public Xou_db_mgr User_db_mgr() {return user_db_mgr;} private final Xou_db_mgr user_db_mgr;
public Xou_db_mgr User_db_mgr() {return user_db_mgr;} private final Xou_db_mgr user_db_mgr;
public Xow_wiki Wikii() {return this.Wiki();}
public int Gender() {return Xol_gender_.Tid_unknown;}
public Xoae_app Appe() {return app;} private final Xoae_app app;
public Xoae_app Appe() {return app;} private final Xoae_app app;
public Xol_lang_itm Lang() {if (lang == null) {lang = app.Lang_mgr().Get_by_or_new(app.Sys_cfg().Lang()); lang.Init_by_load();} return lang;} private Xol_lang_itm lang;
public void Lang_(Xol_lang_itm v) {
lang = v;
@@ -109,12 +109,10 @@ public class Xoue_user implements Xou_user, GfoEvMgrOwner, GfoInvkAble {
for (int i = 0; i < dirs_len; i++) {
Io_url dir = dirs[i];
String name = dir.NameOnly();
if (String_.Eq(name, gplx.xowa.bldrs.cmds.utils.Xob_core_batch_utl.Dir_dump)
// || !Io_mgr.Instance.ExistsDir(dir.GenSubFil_nest("ns"))
) continue;
if (String_.Eq(name, gplx.xowa.bldrs.cmds.utils.Xob_core_batch_utl.Dir_dump)) continue; // ignore "#dump"
byte[] dir_name_as_bry = Bry_.new_u8(name);
Xow_xwiki_itm xwiki = Available_add(usr_wiki, dir_name_as_bry);
if (xwiki != null) // Add_full can return null if adding invalid lang; should not apply here, but guard against null ref
if (xwiki != null) // Add_full can return null if adding invalid lang; should not apply here, but guard against null ref
xwiki.Offline_(true); // mark xwiki as offline; needed for available wikis sidebar; DATE:2014-09-21
app.Setup_mgr().Maint_mgr().Wiki_mgr().Add(dir_name_as_bry);
}

View File

@@ -21,13 +21,13 @@ import gplx.langs.jsons.*; import gplx.langs.htmls.*;
import gplx.xowa.users.data.*; import gplx.xowa.users.bmks.*;
import gplx.xowa.htmls.bridges.*; import gplx.xowa.htmls.bridges.dbuis.*; import gplx.xowa.htmls.bridges.dbuis.tbls.*; import gplx.xowa.htmls.bridges.dbuis.fmtrs.*;
public class Dbui_tbl_itm__bmk implements Dbui_tbl_itm {
private final Xoa_app app; private final Xoud_bmk_itm_tbl tbl;
private final Dbui_tbl_fmtr tbl_fmtr = new Dbui_tbl_fmtr();
private final Dbui_cells_fmtr cells_fmtr = new Dbui_cells_fmtr(); private final Dbui_val_fmtr edit_val_fmtr = Dbui_val_fmtr_.new_edit(); private final Dbui_val_fmtr view_val_fmtr = Dbui_val_fmtr_.new_view();
private final Bry_bfr tmp_bfr = Bry_bfr.new_(255);
private final Bridge_msg_bldr msg_bldr;
private final Xoa_app app; private final Xoud_bmk_itm_tbl tbl;
private final Dbui_tbl_fmtr tbl_fmtr = new Dbui_tbl_fmtr();
private final Dbui_cells_fmtr cells_fmtr = new Dbui_cells_fmtr(); private final Dbui_val_fmtr edit_val_fmtr = Dbui_val_fmtr_.new_edit(); private final Dbui_val_fmtr view_val_fmtr = Dbui_val_fmtr_.new_view();
private final Bry_bfr tmp_bfr = Bry_bfr.new_(255);
private final Bridge_msg_bldr msg_bldr;
public Dbui_tbl_itm__bmk(Xoa_app app, Xoud_bmk_itm_tbl tbl) {this.app = app; this.tbl = tbl; this.msg_bldr = app.Html__bridge_mgr().Msg_bldr();}
public byte[] Key() {return key;} private static final byte[] key = Bry_.new_a7("bmk");
public byte[] Key() {return key;} private static final byte[] key = Bry_.new_a7("bmk");
public Dbui_btn_itm[] View_btns() {return view_btns;}
public Dbui_btn_itm[] Edit_btns() {return edit_btns;}
public Dbui_col_itm[] Cols() {return cols;}
@@ -38,10 +38,10 @@ public class Dbui_tbl_itm__bmk implements Dbui_tbl_itm {
}
public void Select(Bry_bfr bfr, int owner) {
Xoud_bmk_itm_row[] db_rows = tbl.Select_grp(owner);
byte[] option_link = app.Html__lnki_bldr().Href_(Bry_.new_a7("home"), app.User().Wikii().Ttl_parse(Bry_.new_a7("Help:Options/Bookmarks"))).Img_16x16(gplx.xowa.htmls.core.htmls.utls.Xoh_img_path.Img_option).Bld_to_bry();
byte[] option_link = app.Html__lnki_bldr().Href_(Bry_.new_a7("home"), app.User().Wikii().Ttl_parse(Bry_.new_a7("Options/Bookmarks"))).Img_16x16(gplx.xowa.htmls.core.htmls.utls.Xoh_img_path.Img_option).Bld_to_bry();// HOME
byte[] delete_confirm_msg = app.Api_root().Usr().Bookmarks().Delete_confirm() ? Msg__delete_confirm : Bry_.Empty;
tbl_fmtr.Write(bfr, this, option_link, delete_confirm_msg, To_ui_rows(db_rows));
} private static final byte[] Msg__delete_confirm = Bry_.new_a7(" data-dbui-delete_confirm_msg='Are you sure you want to delete this bookmark?'");
} private static final byte[] Msg__delete_confirm = Bry_.new_a7(" data-dbui-delete_confirm_msg='Are you sure you want to delete this bookmark?'");
public String Del(byte[] row_id, byte[] row_pkey) {
Xoud_bmk_itm_row db_row = Get_db_row(row_pkey); if (db_row == null) return Fail_missing_row(row_pkey);
tbl.Delete(db_row.Id());
@@ -102,20 +102,20 @@ public class Dbui_tbl_itm__bmk implements Dbui_tbl_itm {
private String Fail_missing_row(byte[] row_pkey) {
return msg_bldr.Clear().Notify_fail_(Err_msg.To_str("Item has been deleted", "key", row_pkey)).Notify_hint_("Please reload the page").To_json_str();
}
private static final Dbui_col_itm[] cols = new Dbui_col_itm[]
private static final Dbui_col_itm[] cols = new Dbui_col_itm[]
{ new Dbui_col_itm(Dbui_col_itm.Type_id_str , 150, "name" , "Name")
, new Dbui_col_itm(Dbui_col_itm.Type_id_str , 300, "url" , "Url")
, new Dbui_col_itm(Dbui_col_itm.Type_id_text , 300, "comment" , "Comment")
};
private static final Dbui_btn_itm[] view_btns = new Dbui_btn_itm[]
private static final Dbui_btn_itm[] view_btns = new Dbui_btn_itm[]
{ new Dbui_btn_itm("rows__edit" , "edit.png" , "edit")
, new Dbui_btn_itm("rows__delete" , "delete.png" , "delete")
};
private static final Dbui_btn_itm[] edit_btns = new Dbui_btn_itm[]
private static final Dbui_btn_itm[] edit_btns = new Dbui_btn_itm[]
{ new Dbui_btn_itm("rows__save" , "save.png" , "save")
, new Dbui_btn_itm("rows__cancel" , "cancel.png" , "cancel")
};
private static final Bry_fmtr url_fmtr = Bry_fmtr.new_("<a href='/site/~{url}'>~{url}</a>", "url");
private static final Bry_fmtr url_fmtr = Bry_fmtr.new_("<a href='/site/~{url}'>~{url}</a>", "url");
public static Dbui_tbl_itm__bmk get_or_new(Xoa_app app, Xoud_bmk_itm_tbl db_tbl) {
if (I == null) {
I = new Dbui_tbl_itm__bmk(app, db_tbl);

View File

@@ -30,7 +30,7 @@ public class Xoud_bmk_dir_tbl implements Rls_able {
}
public Db_conn Conn() {return conn;} private final Db_conn conn;
public String Tbl_name() {return tbl_name;}
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds.To_fld_ary()));}
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds.To_fld_ary()));}
public void Insert(int owner, int sort, byte[] name) {
Db_stmt stmt_insert = conn.Stmt_insert(tbl_name, flds);
stmt_insert.Clear()

View File

@@ -34,7 +34,7 @@ public class Xoud_bmk_itm_tbl implements Rls_able {
}
public Db_conn Conn() {return conn;} private final Db_conn conn;
public String Tbl_name() {return tbl_name;}
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds.To_fld_ary()));}
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds.To_fld_ary()));}
public void Insert(int owner, int sort, byte[] name, byte[] wiki, byte[] url, byte[] comment) {
Db_stmt stmt_insert = conn.Stmt_insert(tbl_name, flds);
stmt_insert.Clear()

View File

@@ -38,4 +38,4 @@ public class Xou_db_file {
tbl__cache.Create_tbl();
}
}
}
}

View File

@@ -35,7 +35,7 @@ public class Xoud_regy_tbl {
if (created) {
Schema_update_cmd cmd = Schema_update_cmd_.Make_tbl_create(Xoud_regy_tbl.Tbl_name , Xoud_regy_tbl.Tbl_sql , Xoud_regy_tbl.Idx_core);
cmd.Exec(null, conn);
// conn.Ddl_create_tbl(meta);
// conn.Meta_tbl_create(meta);
}
return this;
} private Db_conn conn;

View File

@@ -31,7 +31,7 @@ public class Xoud_site_tbl implements Rls_able {
fld_site_xtn = flds.Add_text("site_xtn");
conn.Rls_reg(this);
}
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds));}
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds));}
public void Rls() {}
public void Insert(int site_id, int priority, String domain, String name, String path, String xtn) {
Db_stmt stmt = conn.Stmt_insert(tbl_name, flds);

View File

@@ -41,7 +41,7 @@ class Xoud_user_tbl {
Dbmeta_tbl_itm meta = Dbmeta_tbl_itm.New(tbl_name, flds
, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "name", fld_name)
);
conn.Ddl_create_tbl(meta);
conn.Meta_tbl_create(meta);
}
}
public void Insert(int id, String name) {

View File

@@ -21,12 +21,12 @@ import gplx.langs.jsons.*; import gplx.langs.htmls.*;
import gplx.xowa.users.data.*; import gplx.xowa.users.bmks.*;
import gplx.xowa.htmls.bridges.*; import gplx.xowa.htmls.bridges.dbuis.*; import gplx.xowa.htmls.bridges.dbuis.tbls.*; import gplx.xowa.htmls.bridges.dbuis.fmtrs.*;
public class Dbui_tbl_itm__history implements Dbui_tbl_itm {
private final Xoa_app app; private final Xoud_history_tbl tbl;
private final Dbui_tbl_fmtr tbl_fmtr = new Dbui_tbl_fmtr();
private final Bry_bfr tmp_bfr = Bry_bfr.new_(255);
private final Bridge_msg_bldr msg_bldr;
private final Xoa_app app; private final Xoud_history_tbl tbl;
private final Dbui_tbl_fmtr tbl_fmtr = new Dbui_tbl_fmtr();
private final Bry_bfr tmp_bfr = Bry_bfr.new_(255);
private final Bridge_msg_bldr msg_bldr;
public Dbui_tbl_itm__history(Xoa_app app, Xoud_history_tbl tbl) {this.app = app; this.tbl = tbl; this.msg_bldr = app.Html__bridge_mgr().Msg_bldr();}
public byte[] Key() {return key;} private static final byte[] key = Bry_.new_a7("history");
public byte[] Key() {return key;} private static final byte[] key = Bry_.new_a7("history");
public Dbui_btn_itm[] View_btns() {return view_btns;}
public Dbui_btn_itm[] Edit_btns() {return Dbui_btn_itm.Ary_empty;}
public Dbui_col_itm[] Cols() {return cols;}
@@ -35,14 +35,14 @@ public class Dbui_tbl_itm__history implements Dbui_tbl_itm {
dbui_mgr.Init_by_bridge(bridge_mgr);
dbui_mgr.Add(this);
}
private final List_adp select_list = List_adp_.new_();
private final List_adp select_list = List_adp_.new_();
public void Select(Bry_bfr bfr, int top) {
tbl.Select_by_top(select_list, 100);
Xoud_history_row[] db_rows = (Xoud_history_row[])select_list.To_ary_and_clear(Xoud_history_row.class);
byte[] option_link = app.Html__lnki_bldr().Href_(Bry_.new_a7("home"), app.User().Wikii().Ttl_parse(Bry_.new_a7("Help:Options/PageHistory"))).Img_16x16(gplx.xowa.htmls.core.htmls.utls.Xoh_img_path.Img_option).Bld_to_bry();
byte[] option_link = app.Html__lnki_bldr().Href_(Bry_.new_a7("home"), app.User().Wikii().Ttl_parse(Bry_.new_a7("Options/PageHistory"))).Img_16x16(gplx.xowa.htmls.core.htmls.utls.Xoh_img_path.Img_option).Bld_to_bry();// HOME
byte[] delete_confirm_msg = app.Api_root().Usr().Bookmarks().Delete_confirm() ? Msg__delete_confirm : Bry_.Empty;
tbl_fmtr.Write(bfr, this, option_link, delete_confirm_msg, To_ui_rows(db_rows));
} private static final byte[] Msg__delete_confirm = Bry_.new_a7(" data-dbui-delete_confirm_msg='Are you sure you want to delete this row?'");
} private static final byte[] Msg__delete_confirm = Bry_.new_a7(" data-dbui-delete_confirm_msg='Are you sure you want to delete this row?'");
public String Del(byte[] row_id, byte[] row_pkey) {
Xoud_history_row db_row = Get_db_row(row_pkey); if (db_row == null) return Fail_missing_row(row_pkey);
tbl.Delete(db_row.Id());
@@ -76,16 +76,16 @@ public class Dbui_tbl_itm__history implements Dbui_tbl_itm {
private String Fail_missing_row(byte[] row_pkey) {
return msg_bldr.Clear().Notify_fail_(Err_msg.To_str("Item has been deleted", "key", row_pkey)).Notify_hint_("Please reload the page").To_json_str();
}
private static final Dbui_col_itm[] cols = new Dbui_col_itm[]
private static final Dbui_col_itm[] cols = new Dbui_col_itm[]
{ new Dbui_col_itm(Dbui_col_itm.Type_id_str , 300, "page" , "Page")
, new Dbui_col_itm(Dbui_col_itm.Type_id_str , 150, "wiki" , "Wiki")
, new Dbui_col_itm(Dbui_col_itm.Type_id_int , 80, "views" , "Views")
, new Dbui_col_itm(Dbui_col_itm.Type_id_datetime, 100, "time" , "Time")
};
private static final Dbui_btn_itm[] view_btns = new Dbui_btn_itm[]
private static final Dbui_btn_itm[] view_btns = new Dbui_btn_itm[]
{ new Dbui_btn_itm("rows__delete" , "delete.png" , "delete")
};
private static final Bry_fmtr url_fmtr = Bry_fmtr.new_("<a href='/site/~{url}'>~{url}</a>", "url");
private static final Bry_fmtr url_fmtr = Bry_fmtr.new_("<a href='/site/~{url}'>~{url}</a>", "url");
public static Dbui_tbl_itm__history get_or_new(Xoa_app app, Xoud_history_tbl db_tbl) {
if (I == null) {
I = new Dbui_tbl_itm__history(app, db_tbl);

View File

@@ -48,8 +48,8 @@ class Xou_history_mgr_fxt {
Xou_history_mgr under;
public void Clear() {
if (app == null) {
app = Xoa_app_fxt.app_();
wiki = Xoa_app_fxt.wiki_tst_(app);
app = Xoa_app_fxt.Make__app__edit();
wiki = Xoa_app_fxt.Make__wiki__edit(app);
under = app.Usere().History_mgr();
}
Io_mgr.Instance.DeleteDirDeep(Io_url_.new_dir_("mem/xowa/user/test_user/app/data/history/"));

View File

@@ -32,7 +32,7 @@ public class Xoud_history_tbl implements Rls_able {
conn.Rls_reg(this);
}
public String Tbl_name() {return tbl_name;}
public void Create_tbl() {conn.Ddl_create_tbl(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_wiki, fld_url)));}
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_wiki, fld_url)));}
public void Rls() {
stmt_insert = Db_stmt_.Rls(stmt_insert);
stmt_update = Db_stmt_.Rls(stmt_update);

View File

@@ -95,7 +95,7 @@ public class Prefs_converter {
bfr.Add_byte(Byte_ascii.Paren_bgn);
for (int i = 0; i < args_count; i++) {
if (i != 0) bfr.Add_byte(Byte_ascii.Comma);
KeyVal kv = m.Args_getAt(i);
Keyval kv = m.Args_getAt(i);
bfr.Add_byte(Byte_ascii.Quote);
bfr.Add_str_u8(kv.Val_to_str_or_empty());
bfr.Add_byte(Byte_ascii.Quote);

View File

@@ -51,13 +51,13 @@ class Prefs_html_wtr {
Write__nde_end(bfr); // ">"
}
private void Write_select(Bry_bfr bfr, Gfh_nde hnde, int prop_idx, Object prop_val) {
KeyVal[] options_list = Get_select_options(hnde);
Keyval[] options_list = Get_select_options(hnde);
Write__id(bfr, prop_idx); // " id='xowa_prop_123'"
Write__nde_end(bfr); // ">"
bfr.Add_byte_nl(); // "\n"
int len = options_list.length;
for (int i = 0; i < len; i++) {
KeyVal option = options_list[i];
Keyval option = options_list[i];
bfr.Add(Nde_stub_option_bgn); // " <option value='"
bfr.Add_str_u8(option.Key()); // "option_key"
bfr.Add_byte(Byte_ascii.Apos); // "'"
@@ -99,11 +99,11 @@ class Prefs_html_wtr {
try {return prefs_mgr.Eval(tmp_bfr.To_bry_and_clear());}
catch (Exception e) {return Err_.Message_gplx_full(e);}
}
KeyVal[] Get_select_options(Gfh_nde hnde) {
Keyval[] Get_select_options(Gfh_nde hnde) {
byte[] options_list_key = hnde.Atrs_val_by_key_bry(Atr_key_xowa_prop_list);
tmp_bfr.Add(options_list_key).Add_byte(Byte_ascii.Semic);
try {return (KeyVal[])prefs_mgr.Eval(tmp_bfr.To_bry_and_clear());}
catch (Exception e) {Err_.Noop(e); return KeyVal_.Ary_empty;}
try {return (Keyval[])prefs_mgr.Eval(tmp_bfr.To_bry_and_clear());}
catch (Exception e) {Err_.Noop(e); return Keyval_.Ary_empty;}
}
private void Write__nde_end(Bry_bfr bfr) {bfr.Add_byte(Byte_ascii.Gt);}
private void Write__id(Bry_bfr bfr, int prop_idx) {

View File

@@ -135,7 +135,7 @@ class Prefs_mgr_fxt {
if (app == null) {
GfsCore.Instance.Clear(); // NOTE: clear GfsCore, else Props test will fail for mass run
Xoa_gfs_mgr.Msg_parser_init();
app = Xoa_app_fxt.app_();
app = Xoa_app_fxt.Make__app__edit();
prefs_mgr = new Prefs_mgr(app);
html_box = new Gfui_html_mok();
prefs_mgr.Html_box_mok_(html_box);