mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Category: Pass count into category msg [#316]
This commit is contained in:
parent
e250331e97
commit
9e5a13f54f
@ -18,7 +18,30 @@ import org.junit.*;
|
|||||||
import gplx.xowa.wikis.data.tbls.*;
|
import gplx.xowa.wikis.data.tbls.*;
|
||||||
public class Xoctg_double_box__tst {
|
public class Xoctg_double_box__tst {
|
||||||
@Before public void init() {fxt.Clear();} private Xoctg_double_box__fxt fxt = new Xoctg_double_box__fxt();
|
@Before public void init() {fxt.Clear();} private Xoctg_double_box__fxt fxt = new Xoctg_double_box__fxt();
|
||||||
@Test public void Basic() {
|
@Test public void Single() {
|
||||||
|
fxt.Init_ctg_hidden("Category:A");
|
||||||
|
fxt.Init_ctg_normal("Category:D");
|
||||||
|
fxt.Test_print_hidden(String_.Concat_lines_nl
|
||||||
|
( "<div id=\"catlinks\" class=\"catlinks\">"
|
||||||
|
, "<div id=\"mw-normal-catlinks\" class=\"mw-normal-catlinks\">"
|
||||||
|
, "<a href=\"/wiki/Special:Categories\" title=\"Special:Categories\">Category</a>:"
|
||||||
|
, "<ul>"
|
||||||
|
, "<li>"
|
||||||
|
, "<a href=\"/wiki/Category:D\" title=\"Category:D\">D</a>"
|
||||||
|
, "</li>"
|
||||||
|
, "</ul>"
|
||||||
|
, "</div>"
|
||||||
|
, "<div id=\"mw-hidden-catlinks\" class=\"mw-hidden-catlinks mw-hidden-cats-user-shown\">Hidden categories:"
|
||||||
|
, "<ul>"
|
||||||
|
, "<li>"
|
||||||
|
, "<a href=\"/wiki/Category:A\" title=\"Category:A\">A</a>"
|
||||||
|
, "</li>"
|
||||||
|
, "</ul>"
|
||||||
|
, "</div>"
|
||||||
|
, "</div>"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
@Test public void Plural() {
|
||||||
fxt.Init_ctg_hidden("Category:A", "Category:B", "Category:C");
|
fxt.Init_ctg_hidden("Category:A", "Category:B", "Category:C");
|
||||||
fxt.Init_ctg_normal("Category:D", "Category:E", "Category:F");
|
fxt.Init_ctg_normal("Category:D", "Category:E", "Category:F");
|
||||||
fxt.Test_print_hidden(String_.Concat_lines_nl
|
fxt.Test_print_hidden(String_.Concat_lines_nl
|
||||||
|
@ -19,24 +19,32 @@ import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*;
|
|||||||
import gplx.xowa.htmls.core.htmls.*;
|
import gplx.xowa.htmls.core.htmls.*;
|
||||||
import gplx.xowa.users.history.*;
|
import gplx.xowa.users.history.*;
|
||||||
public class Xoctg_double_grp implements Bfr_arg {
|
public class Xoctg_double_grp implements Bfr_arg {
|
||||||
private byte[] lbl_ctg_help, lbl_ctg_text, lbl_hidden;
|
private Xow_wiki wiki;
|
||||||
|
private byte[] lbl_ctg_help;
|
||||||
public boolean Type_is_normal() {return type_is_normal;} private boolean type_is_normal;
|
public boolean Type_is_normal() {return type_is_normal;} private boolean type_is_normal;
|
||||||
public Xoctg_double_itm Itms() {return itms;} private final Xoctg_double_itm itms = new Xoctg_double_itm();
|
public Xoctg_double_itm Itms() {return itms;} private final Xoctg_double_itm itms = new Xoctg_double_itm();
|
||||||
public void Init_by_wiki(Xow_wiki wiki, Xou_history_mgr history_mgr, boolean type_is_normal) {
|
public void Init_by_wiki(Xow_wiki wiki, Xou_history_mgr history_mgr, boolean type_is_normal) {
|
||||||
this.type_is_normal = type_is_normal;
|
this.type_is_normal = type_is_normal;
|
||||||
lbl_ctg_text = wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_ctg_tbl_hdr);
|
this.wiki = wiki;
|
||||||
lbl_ctg_help = Xol_msg_mgr_.Get_msg_val(wiki, wiki.Lang(), Key_pagecategorieslink, Bry_.Ary_empty);
|
this.lbl_ctg_help = Xol_msg_mgr_.Get_msg_val(wiki, wiki.Lang(), Key_pagecategorieslink, Bry_.Ary_empty);
|
||||||
lbl_hidden = wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_ctg_tbl_hidden);
|
|
||||||
itms.Init_by_wiki(wiki, history_mgr);
|
itms.Init_by_wiki(wiki, history_mgr);
|
||||||
}
|
}
|
||||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||||
if (type_is_normal)
|
int count = itms.Itms__count();
|
||||||
|
if (type_is_normal) {
|
||||||
|
byte[] lbl_ctg_text = wiki.Msg_mgr().Val_by_key_args(Key_pagecategories, count);
|
||||||
Fmt__normal.Bld_many(bfr, lbl_ctg_help, lbl_ctg_text, itms);
|
Fmt__normal.Bld_many(bfr, lbl_ctg_help, lbl_ctg_text, itms);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
|
byte[] lbl_hidden = wiki.Msg_mgr().Val_by_id_args(Xol_msg_itm_.Id_ctg_tbl_hidden, count);
|
||||||
Fmt__hidden.Bld_many(bfr, lbl_hidden, itms);
|
Fmt__hidden.Bld_many(bfr, lbl_hidden, itms);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final byte[] Key_pagecategorieslink = Bry_.new_a7("pagecategorieslink");
|
private static final byte[]
|
||||||
|
Key_pagecategorieslink = Bry_.new_a7("pagecategorieslink")
|
||||||
|
, Key_pagecategories = Bry_.new_a7("pagecategories")
|
||||||
|
;
|
||||||
private static final Bry_fmt
|
private static final Bry_fmt
|
||||||
Fmt__normal = Bry_fmt.Auto_nl_skip_last
|
Fmt__normal = Bry_fmt.Auto_nl_skip_last
|
||||||
( ""
|
( ""
|
||||||
|
@ -27,6 +27,7 @@ public class Xoctg_double_itm implements gplx.core.brys.Bfr_arg {
|
|||||||
this.history_mgr = history_mgr;
|
this.history_mgr = history_mgr;
|
||||||
}
|
}
|
||||||
public void Itms__clear() {itms.Clear();}
|
public void Itms__clear() {itms.Clear();}
|
||||||
|
public int Itms__count() {return itms.Count();}
|
||||||
public void Itms__add(Xoctg_pagebox_itm page) {itms.Add(page);}
|
public void Itms__add(Xoctg_pagebox_itm page) {itms.Add(page);}
|
||||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||||
int len = itms.Count();
|
int len = itms.Count();
|
||||||
|
Loading…
Reference in New Issue
Block a user