mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.1.1
This commit is contained in:
@@ -34,7 +34,7 @@ public class Xoue_user implements Xou_user, GfoEvMgrOwner, GfoInvkAble {
|
||||
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 Xow_wiki Wikii() {return wiki;}
|
||||
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 Xol_lang Lang() {if (lang == null) {lang = app.Lang_mgr().Get_by_key_or_new(app.Sys_cfg().Lang()); lang.Init_by_load();} return lang;} private Xol_lang lang;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Xous_window_mgr implements GfoInvkAble {
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (i != 0) bfr.Add_byte_nl();
|
||||
Xog_tab_itm tab = tab_mgr.Tabs_get_at(i);
|
||||
bfr.Add_str(tab.Page().Url().Xto_full_str_safe());
|
||||
bfr.Add_str(tab.Page().Url().To_str());
|
||||
}
|
||||
return bfr.Xto_str_and_clear();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Xoud_bmk_mgr {
|
||||
if (!conn.Meta_tbl_exists(tbl__itm.Tbl_name())) tbl__itm.Create_tbl();
|
||||
}
|
||||
public void Itms__add(int owner, Xoa_url url) {
|
||||
tbl__itm.Insert(owner, tbl__itm.Select_sort_next(owner), Xoa_ttl.Replace_unders(url.Page_bry()), url.Wiki_bry(), url.Raw(), Bry_.Empty);
|
||||
tbl__itm.Insert(owner, tbl__itm.Select_sort_next(owner), Xoa_ttl.Replace_unders(url.Page_bry()), url.Wiki_bry(), url.To_bry(Bool_.Y, Bool_.Y), Bry_.Empty);
|
||||
}
|
||||
public static final int Owner_root = -1;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class Xoud_opt_scope_parser {
|
||||
usr_dlg.Warn_many("", "", fmt, String_.new_u8(src, bgn, end));
|
||||
return Xoud_opt_scope.App;
|
||||
}
|
||||
private static final Btrie_slim_mgr btrie_by_type = Btrie_slim_mgr.cs_()
|
||||
private static final Btrie_slim_mgr btrie_by_type = Btrie_slim_mgr.cs()
|
||||
.Add_str_int("w" , Xow_domain_type_.Tid_wikipedia)
|
||||
.Add_str_int("d" , Xow_domain_type_.Tid_wiktionary)
|
||||
.Add_str_int("s" , Xow_domain_type_.Tid_wikisource)
|
||||
|
||||
@@ -18,12 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.users.history; import gplx.*; import gplx.xowa.*; import gplx.xowa.users.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Xou_history_itm {
|
||||
private Xou_history_itm() {}
|
||||
public Xou_history_itm(byte[] wiki, byte[] page) {
|
||||
this.wiki = wiki;
|
||||
this.page = page;
|
||||
this.key = key_(wiki, page);
|
||||
this.view_bgn = DateAdp_.Now();
|
||||
} private Xou_history_itm() {}
|
||||
}
|
||||
public byte[] Key() {return key;} private byte[] key;
|
||||
public byte[] Wiki() {return wiki;} private byte[] wiki;
|
||||
public byte[] Page() {return page;} private byte[] page;
|
||||
|
||||
@@ -16,12 +16,13 @@ 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.users.history; import gplx.*; import gplx.xowa.*; import gplx.xowa.users.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.html.hrefs.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*; import gplx.xowa.html.hrefs.*;
|
||||
public class Xou_history_mgr implements GfoInvkAble {
|
||||
private final Xou_history_html html_mgr = new Xou_history_html(); private Xou_history_sorter sorter = new Xou_history_sorter().Sort_fld_(Xou_history_itm.Fld_view_end).Ascending_(false);
|
||||
private final Io_url history_fil;
|
||||
private Ordered_hash itms = Ordered_hash_.new_bry_();
|
||||
private boolean load_chk = false;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
public Xou_history_mgr(Io_url history_fil) {this.history_fil = history_fil;}
|
||||
public int Len() {return itms.Count();}
|
||||
public void Clear() {itms.Clear();}
|
||||
@@ -30,7 +31,7 @@ public class Xou_history_mgr implements GfoInvkAble {
|
||||
if (!load_chk) Load();
|
||||
int len = itms.Count(); if (len == 0) return String_.new_a7(Xoa_page_.Main_page_bry); // if no history, return Main_page (which should go to home/wiki/Main_page)
|
||||
Xou_history_itm itm = (Xou_history_itm)itms.Get_at(0);
|
||||
return String_.new_u8(Bry_.Add(itm.Wiki(), Xoh_href_parser.Href_wiki_bry, itm.Page()));
|
||||
return String_.new_u8(Bry_.Add(itm.Wiki(), Xoh_href_.Bry__wiki, itm.Page()));
|
||||
}
|
||||
public Xou_history_itm Get_or_null(byte[] wiki, byte[] page) {
|
||||
if (!load_chk) Load();
|
||||
@@ -51,8 +52,8 @@ public class Xou_history_mgr implements GfoInvkAble {
|
||||
page_ttl = page.Redirected_ttls__itm_0();
|
||||
else {
|
||||
page_ttl = Bry_.Add(ttl.Ns().Name_db_w_colon(), ttl.Page_txt()); // use ttl.Page_txt() b/c it normalizes space/casing (url.Page_txt does not)
|
||||
if (url.Args().length > 0)
|
||||
page_ttl = Bry_.Add(page_ttl, url.Args_all_as_bry());
|
||||
if (url.Qargs_ary().length > 0)
|
||||
page_ttl = Bry_.Add(page_ttl, url.Qargs_mgr().To_bry());
|
||||
}
|
||||
Add(url, ttl, page_ttl);
|
||||
}
|
||||
@@ -62,11 +63,18 @@ public class Xou_history_mgr implements GfoInvkAble {
|
||||
byte[] key = Xou_history_itm.key_(url.Wiki_bry(), page_ttl);
|
||||
Xou_history_itm itm = (Xou_history_itm)itms.Get_by(key);
|
||||
if (itm == null) {
|
||||
itm = new Xou_history_itm(url.Wiki_bry(), page_ttl);
|
||||
itm = new Xou_history_itm(url.Wiki_bry(), To_full_db_w_qargs(url, ttl));
|
||||
itms.Add(key, itm);
|
||||
}
|
||||
itm.Tally();
|
||||
}
|
||||
private byte[] To_full_db_w_qargs(Xoa_url url, Xoa_ttl ttl) {
|
||||
byte[] page = Xoa_ttl.Replace_spaces(ttl.Full_txt_wo_qarg());
|
||||
tmp_bfr.Add(page);
|
||||
Gfo_qarg_mgr qarg_mgr = url.Qargs_mgr();
|
||||
qarg_mgr.To_bry(tmp_bfr, Xoa_app_.Utl__encoder_mgr().Href(), Bool_.N);
|
||||
return tmp_bfr.Xto_bry_and_clear();
|
||||
}
|
||||
public void Sort() {itms.Sort_by(sorter);}
|
||||
public void Load() {
|
||||
if (load_chk) return;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Xou_history_mgr_tst {
|
||||
@Test public void Normalize() {
|
||||
fxt.Clear();
|
||||
fxt.Add_many("Category:A_B", "Category:A B", "Category:a B", "Category:_A B_");
|
||||
fxt.List_tst("Category:A B");
|
||||
fxt.List_tst("Category:A_B");
|
||||
}
|
||||
@Test public void Args() {
|
||||
fxt.Clear();
|
||||
@@ -70,10 +70,8 @@ class Xou_history_mgr_fxt {
|
||||
page.Revision_data().Modified_on_(DateAdp_.Now());
|
||||
byte[] url_bry = ttl_bry;
|
||||
if (arg_str != null) url_bry = Bry_.Add(url_bry, Bry_.new_u8(arg_str));
|
||||
Xoa_url url = app.Utl__url_parser().Parse(url_bry);
|
||||
url.Wiki_bry_(wiki.Domain_bry());
|
||||
Xoa_url url = wiki.Utl__url_parser().Parse(url_bry);
|
||||
page.Url_(url); // set url b/c history_mgr.Add uses url
|
||||
// page.Url_(Xoa_url.new_(wiki.Key_bry(), url_bry)); // set url b/c history_mgr.Add uses url
|
||||
under.Add(page);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -16,12 +16,13 @@ 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.users.prefs; import gplx.*; import gplx.xowa.*; import gplx.xowa.users.*;
|
||||
import gplx.core.primitives.*; import gplx.html.*; import gplx.gfui.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*; import gplx.html.*; import gplx.gfui.*;
|
||||
import gplx.xowa.gui.views.*;
|
||||
import gplx.xowa.urls.*;
|
||||
public class Prefs_mgr implements GfoInvkAble {
|
||||
public Prefs_mgr(Xoae_app app) {
|
||||
this.app = app;
|
||||
atrs_hash = Hash_adp_bry.cs_();
|
||||
atrs_hash = Hash_adp_bry.cs();
|
||||
atrs_hash.Add(Bry_prop, Byte_obj_val.new_(Tid_prop));
|
||||
atrs_hash.Add(Bry_prop_get, Byte_obj_val.new_(Tid_prop_get));
|
||||
atrs_hash.Add(Bry_prop_set, Byte_obj_val.new_(Tid_prop_set));
|
||||
@@ -143,11 +144,11 @@ public class Prefs_mgr implements GfoInvkAble {
|
||||
public static final byte Elem_tid_null = 0, Elem_tid_input_text = 1, Elem_tid_textarea = 2, Elem_tid_input_checkbox = 3, Elem_tid_select = 4, Elem_tid_input_combo = 5, Elem_tid_input_xowa_io = 6;
|
||||
}
|
||||
class Prefs_trg_mgr {
|
||||
private Xoa_url_arg_hash arg_hash = new Xoa_url_arg_hash();
|
||||
private Gfo_qarg_mgr arg_hash = new Gfo_qarg_mgr();
|
||||
public byte[] Trg_type() {return trg_type;} private byte[] trg_type;
|
||||
public byte[] Trg_val() {return trg_val;} private byte[] trg_val;
|
||||
public void Init(Xoa_url url) {
|
||||
arg_hash.Load(url);
|
||||
arg_hash.Load(url.Qargs_ary());
|
||||
trg_type = arg_hash.Get_val_bry_or(Prefs_trg_mgr.Arg_option_trg_type_bry, null);
|
||||
trg_val = arg_hash.Get_val_bry_or(Prefs_trg_mgr.Arg_option_trg_val_bry, null);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class Xofs_url_itm_parser {
|
||||
private static final byte[] Xowa_fs_protocol = Bry_.new_a7("xowa-fs://");
|
||||
private static final int Xowa_fa_protocol_len = Xowa_fs_protocol.length;
|
||||
private Bry_bfr url_bfr = Bry_bfr.reset_(16);
|
||||
private Hash_adp_bry names = Hash_adp_bry.cs_();
|
||||
private Hash_adp_bry names = Hash_adp_bry.cs();
|
||||
public byte Dir_spr() {return dir_spr;} public void Dir_spr_(byte v) {dir_spr = v;} private byte dir_spr = Op_sys.Cur().Fsys_dir_spr_byte();
|
||||
public void Names_add(String key_str, String val_str) {
|
||||
byte[] key_bry = Bry_.new_u8(key_str);
|
||||
|
||||
Reference in New Issue
Block a user