mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
v2.8.4.1
This commit is contained in:
parent
df10db140c
commit
ed911e3de5
@ -28,11 +28,12 @@ public class Err_ {
|
||||
return rv;
|
||||
}
|
||||
public static Err new_unhandled(Object val) {return new Err(Bool_.Y, Trace_null, Type__gplx, "val is not in switch/if", "val", val);}
|
||||
public static Err new_unsupported() {return new Err(Bool_.Y, Trace_null, Type__gplx, "method not supported");}
|
||||
public static Err new_unimplemented() {return new Err(Bool_.Y, Trace_null, Type__gplx, "method not implemented");}
|
||||
public static Err new_unimplemented_w_msg(String msg, Object... args) {return new Err(Bool_.Y, Trace_null, Type__gplx, msg, args);}
|
||||
public static Err new_deprecated(String s) {return new Err(Bool_.Y, Trace_null, Type__gplx, "deprecated", "method", s);}
|
||||
public static Err new_parse_type(Class<?> c, String raw) {return new_parse(ClassAdp_.FullNameOf_type(c), raw);}
|
||||
public static Err new_parse_exc(Exception e, Class<?> c, String raw) {return new_parse(ClassAdp_.FullNameOf_type(c), raw).Args_add("e", Err_.Message_lang(e));}
|
||||
public static Err new_parse_type(Class<?> c, String raw) {return new_parse(Type_adp_.FullNameOf_type(c), raw);}
|
||||
public static Err new_parse_exc(Exception e, Class<?> c, String raw) {return new_parse(Type_adp_.FullNameOf_type(c), raw).Args_add("e", Err_.Message_lang(e));}
|
||||
public static Err new_parse(String type, String raw) {return new Err(Bool_.Y, Trace_null, Type__gplx, "parse failed", "type", type, "raw", raw);}
|
||||
public static Err new_null() {return new Err(Bool_.Y, Trace_null, Type__gplx, "null obj");}
|
||||
public static Err new_missing_idx(int idx, int len) {return new Err(Bool_.Y, Trace_null, Type__gplx, "index is out of bounds", "idx", idx, "len", len);}
|
||||
@ -41,12 +42,12 @@ public class Err_ {
|
||||
public static Err new_invalid_arg(String msg, Object... args) {return new Err(Bool_.Y, Trace_null, Type__gplx, msg, args);}
|
||||
public static Err new_op_canceled() {return new Err(Bool_.Y, Trace_null, Type__op_canceled, "canceled by usr");}
|
||||
public static Err new_type_mismatch_w_exc(Exception ignore, Class<?> t, Object o) {return new_type_mismatch(t, o);}
|
||||
public static Err new_type_mismatch(Class<?> t, Object o) {return new Err(Bool_.Y, Trace_null, Type__gplx, "type mismatch", "expdType", ClassAdp_.FullNameOf_type(t), "actlType", ClassAdp_.NameOf_obj(o), "actlObj", Object_.Xto_str_strict_or_null_mark(o));}
|
||||
public static Err new_type_mismatch(Class<?> t, Object o) {return new Err(Bool_.Y, Trace_null, Type__gplx, "type mismatch", "expdType", Type_adp_.FullNameOf_type(t), "actlType", Type_adp_.NameOf_obj(o), "actlObj", Object_.Xto_str_strict_or_null_mark(o));}
|
||||
public static Err new_cast(Exception ignore, Class<?> t, Object o) {
|
||||
String o_str = "";
|
||||
try {o_str = Object_.Xto_str_strict_or_null_mark(o);}
|
||||
catch (Exception e) {o_str = "<ERROR>"; Err_.Noop(e);}
|
||||
return new Err(Bool_.Y, Trace_null, Type__gplx, "cast failed", "type", ClassAdp_.NameOf_type(t), "obj", o_str);
|
||||
return new Err(Bool_.Y, Trace_null, Type__gplx, "cast failed", "type", Type_adp_.NameOf_type(t), "obj", o_str);
|
||||
}
|
||||
|
||||
public static String Message_lang(Exception e) {return e.getMessage();}
|
||||
@ -67,6 +68,6 @@ public class Err_ {
|
||||
}
|
||||
public static String Message_gplx_full(Exception e) {return cast_or_make(e).To_str__full();}
|
||||
public static String Message_gplx_log(Exception e) {return cast_or_make(e).To_str__log();}
|
||||
public static Err cast_or_make(Exception e) {return ClassAdp_.Eq_typeSafe(e, Err.class) ? (Err)e : new Err(Bool_.N, Err_.Trace_lang(e), ClassAdp_.NameOf_obj(e), Err_.Message_lang(e));}
|
||||
public static Err cast_or_make(Exception e) {return Type_adp_.Eq_typeSafe(e, Err.class) ? (Err)e : new Err(Bool_.N, Err_.Trace_lang(e), Type_adp_.NameOf_obj(e), Err_.Message_lang(e));}
|
||||
public static final String Type__op_canceled = "gplx.op_canceled";
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ public class Criteria_eq implements Criteria {
|
||||
public void Val_as_obj_(Object v) {this.val = v;}
|
||||
public void Val_from_args(Hash_adp args) {throw Err_.new_unimplemented();}
|
||||
public boolean Matches(Object comp) {
|
||||
Class<?> val_type = ClassAdp_.ClassOf_obj(val);
|
||||
if (!ClassAdp_.Eq_typeSafe(comp, val_type)) throw Err_.new_type_mismatch(val_type, comp);
|
||||
Class<?> val_type = Type_adp_.ClassOf_obj(val);
|
||||
if (!Type_adp_.Eq_typeSafe(comp, val_type)) throw Err_.new_type_mismatch(val_type, comp);
|
||||
boolean rv = Object_.Eq(val, comp);
|
||||
return negated ? !rv : rv;
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ public class Criteria_in implements Criteria {
|
||||
private void Val_as_obj_ary_(Object[] v) {
|
||||
this.ary = v;
|
||||
ary_len = Array_.Len(ary);
|
||||
ary_type = ary_len == 0 ? Object.class : ClassAdp_.ClassOf_obj(ary[0]);
|
||||
ary_type = ary_len == 0 ? Object.class : Type_adp_.ClassOf_obj(ary[0]);
|
||||
}
|
||||
public void Val_as_obj_(Object v) {Val_as_obj_ary_((Object[])v);}
|
||||
public void Val_from_args(Hash_adp args) {throw Err_.new_unimplemented();}
|
||||
public boolean Matches(Object comp) {
|
||||
if (ary_len == 0) return false; // empty array never matches
|
||||
if (!ClassAdp_.Eq_typeSafe(comp, ary_type)) throw Err_.new_type_mismatch(ary_type, comp);
|
||||
if (!Type_adp_.Eq_typeSafe(comp, ary_type)) throw Err_.new_type_mismatch(ary_type, comp);
|
||||
boolean rv = false;
|
||||
for (int i = 0; i < ary_len; i++) {
|
||||
Object val = ary[i];
|
||||
|
@ -44,9 +44,9 @@ public class Js_wtr {
|
||||
Object itm = ary[i];
|
||||
if (i != 0) bfr.Add_byte(Byte_ascii.Comma);
|
||||
boolean val_needs_quotes = true;
|
||||
if ( ClassAdp_.Eq_typeSafe(itm, Bool_.Cls_ref_type)
|
||||
|| ClassAdp_.Eq_typeSafe(itm, Int_.Cls_ref_type)
|
||||
|| ClassAdp_.Eq_typeSafe(itm, Long_.Cls_ref_type)
|
||||
if ( Type_adp_.Eq_typeSafe(itm, Bool_.Cls_ref_type)
|
||||
|| Type_adp_.Eq_typeSafe(itm, Int_.Cls_ref_type)
|
||||
|| Type_adp_.Eq_typeSafe(itm, Long_.Cls_ref_type)
|
||||
) {
|
||||
val_needs_quotes = false;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package gplx;
|
||||
import java.lang.reflect.Array;
|
||||
import gplx.core.strings.*;
|
||||
public class Array_ {
|
||||
public static Object cast(Object o) {return (Object)o;}
|
||||
public static void Sort(Object[] obj) {List_adp_sorter.new_().Sort(obj, obj.length);}
|
||||
public static void Sort(Object[] obj, gplx.lists.ComparerAble comparer) {List_adp_sorter.new_().Sort(obj, obj.length, true, comparer);}
|
||||
public static List_adp XtoList(Object ary) {
|
||||
|
@ -187,7 +187,7 @@ public class Bry_bfr {
|
||||
bfr_len += utf8_len;
|
||||
return this;
|
||||
}
|
||||
public Bry_bfr Add_bool(boolean v) {return Add(v ? Const_bool_true : Const_bool_false);} public static final byte[] Const_bool_true = Bry_.new_a7("true"), Const_bool_false = Bry_.new_a7("false");
|
||||
public Bry_bfr Add_bool(boolean v) {return Add(v ? Bool_.True_bry : Bool_.False_bry);}
|
||||
public Bry_bfr Add_int_bool(boolean v) {return Add_int_fixed(v ? 1 : 0, 1);}
|
||||
public Bry_bfr Add_int_variable(int val) {
|
||||
int log10 = Int_.Log10(val);
|
||||
|
@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx;
|
||||
public class Char_ {
|
||||
public static final Class<?> Cls_ref_type = Character.class;
|
||||
public static final char Null = '\0', NewLine = '\n';
|
||||
public static final int CharLen = 1;
|
||||
public static final int AsciiZero = 48;
|
||||
|
@ -30,17 +30,17 @@ public class Object_ {
|
||||
public static String Xto_str_strict_or_empty(Object v) {return v == null ? String_.Empty : ToString_lang(v);}
|
||||
private static String ToString_lang(Object v) {
|
||||
Class<?> c = v.getClass();
|
||||
if (ClassAdp_.Eq(c, String_.Cls_ref_type)) return (String)v;
|
||||
else if (ClassAdp_.Eq(c, Bry_.Cls_ref_type)) return String_.new_u8((byte[])v);
|
||||
if (Type_adp_.Eq(c, String_.Cls_ref_type)) return (String)v;
|
||||
else if (Type_adp_.Eq(c, Bry_.Cls_ref_type)) return String_.new_u8((byte[])v);
|
||||
else return v.toString();
|
||||
}
|
||||
public static String Xto_str_loose_or(Object v, String or) { // tries to pretty-print doubles; also standardizes true/false; DATE:2014-07-14
|
||||
if (v == null) return null;
|
||||
Class<?> c = ClassAdp_.ClassOf_obj(v);
|
||||
if (ClassAdp_.Eq(c, String_.Cls_ref_type)) return (String)v;
|
||||
else if (ClassAdp_.Eq(c, Bry_.Cls_ref_type)) return String_.new_u8((byte[])v);
|
||||
else if (ClassAdp_.Eq(c, Bool_.Cls_ref_type)) return Bool_.cast_(v) ? Bool_.True_str : Bool_.False_str; // always return "true" / "false"
|
||||
else if (ClassAdp_.Eq(c, Double_.Cls_ref_type)) return Double_.Xto_str_loose(Double_.cast_(v));
|
||||
Class<?> c = Type_adp_.ClassOf_obj(v);
|
||||
if (Type_adp_.Eq(c, String_.Cls_ref_type)) return (String)v;
|
||||
else if (Type_adp_.Eq(c, Bry_.Cls_ref_type)) return String_.new_u8((byte[])v);
|
||||
else if (Type_adp_.Eq(c, Bool_.Cls_ref_type)) return Bool_.cast_(v) ? Bool_.True_str : Bool_.False_str; // always return "true" / "false"
|
||||
else if (Type_adp_.Eq(c, Double_.Cls_ref_type)) return Double_.Xto_str_loose(Double_.cast_(v));
|
||||
else return v.toString();
|
||||
}
|
||||
}
|
@ -17,14 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx;
|
||||
public class Enm_ {
|
||||
public static int XtoInt(Object enm) {return Ordinal_lang(enm);}
|
||||
public static boolean HasInt(int val, int find) {return find == (val & find);}
|
||||
public static int AddInt(int lhs, int rhs) {return lhs | rhs;}
|
||||
public static int FlipInt(boolean enable, int val, int find) {
|
||||
public static int To_int(Object enm) {return Ordinal_lang(enm);}
|
||||
public static boolean Has_int(int val, int find) {return find == (val & find);}
|
||||
public static int Add_int(int lhs, int rhs) {return lhs | rhs;}
|
||||
public static int Flip_int(boolean enable, int val, int find) {
|
||||
boolean has = find == (val & find);
|
||||
return (has ^ enable) ? val ^ find : val;
|
||||
}
|
||||
public static boolean Has_byte(byte val, byte find) {return find == (val & find);}
|
||||
public static byte Add_byte(byte flag, byte itm) {return (byte)(flag | itm);}
|
||||
static int Ordinal_lang(Object v) {return ((Enum)v).ordinal();}
|
||||
public static boolean Has_byte(byte val, byte find) {return find == (val & find);}
|
||||
public static byte Add_byte(byte flag, byte itm) {return (byte)(flag | itm);}
|
||||
private static int Ordinal_lang(Object v) {return ((Enum)v).ordinal();}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class KeyVal_ {
|
||||
KeyVal itm = ary[i];
|
||||
sb.Add(itm.Key()).Add("=");
|
||||
Object itm_val = itm.Val();
|
||||
if (ClassAdp_.Eq_typeSafe(itm_val, KeyVal[].class))
|
||||
if (Type_adp_.Eq_typeSafe(itm_val, KeyVal[].class))
|
||||
sb.Add(Ary_x_to_str((KeyVal[])itm_val));
|
||||
else
|
||||
sb.Add(Object_.Xto_str_strict_or_null_mark(itm_val));
|
||||
@ -79,13 +79,13 @@ public class KeyVal_ {
|
||||
if (val == null)
|
||||
bfr.Add_str(String_.Null_mark);
|
||||
else {
|
||||
Class<?> val_type = ClassAdp_.ClassOf_obj(val);
|
||||
if (ClassAdp_.Eq(val_type, KeyVal[].class)) { // val is KeyVal[]; recurse
|
||||
Class<?> val_type = Type_adp_.ClassOf_obj(val);
|
||||
if (Type_adp_.Eq(val_type, KeyVal[].class)) { // val is KeyVal[]; recurse
|
||||
bfr.Add_byte_nl(); // add nl : "\n"
|
||||
Ary_xto_str_nested(bfr, indent + 1, (KeyVal[])val);
|
||||
continue; // don't add \n below
|
||||
}
|
||||
else if (ClassAdp_.Eq(val_type, Bool_.Cls_ref_type)) { // val is boolean
|
||||
else if (Type_adp_.Eq(val_type, Bool_.Cls_ref_type)) { // val is boolean
|
||||
boolean val_as_bool = Bool_.cast_(val);
|
||||
bfr.Add(val_as_bool ? Bool_.True_bry : Bool_.False_bry); // add "true" or "false"; don't call toString
|
||||
}
|
||||
|
@ -27,8 +27,9 @@ public class Hash_adp_bry extends gplx.lists.Hash_adp_base implements Hash_adp {
|
||||
@Override protected Object Fetch_base(Object key) {return super.Fetch_base(key_ref.Init((byte[])key));}
|
||||
@Override protected void Del_base(Object key) {super.Del_base(key_ref.Init((byte[])key));}
|
||||
@Override protected boolean Has_base(Object key) {return super.Has_base(key_ref.Init((byte[])key));}
|
||||
public int Get_as_int(byte[] key) {
|
||||
Object o = Get_by_bry(key); if (key == null) throw Err_.new_("core", "unknown key", "key", key);
|
||||
public int Get_as_int(byte[] key) {return Get_as_int(key, 0, key.length);}
|
||||
public int Get_as_int(byte[] key, int bgn, int end) {
|
||||
Object o = Get_by_mid(key, bgn, end); if (o == null) throw Err_.new_("core", "unknown key", "key", key);
|
||||
return ((Int_obj_val)o).Val();
|
||||
}
|
||||
public Object Get_by_bry(byte[] src) {return super.Fetch_base(key_ref.Init(src));}
|
||||
|
@ -360,7 +360,7 @@ public class IoEngine_system extends IoEngine_base {
|
||||
try {closeable.close();}
|
||||
catch (IOException e) {
|
||||
if (throwErr)
|
||||
throw Err_.new_exc(e, "io", "close object failed", "class", ClassAdp_.NameOf_obj(closeable), "url", url_str);
|
||||
throw Err_.new_exc(e, "io", "close object failed", "class", Type_adp_.NameOf_obj(closeable), "url", url_str);
|
||||
// else
|
||||
// UsrDlg_._.Finally("failed to close FileChannel", "url", url, "apiErr", Err_.Message_err_arg(e));
|
||||
}
|
||||
@ -437,8 +437,8 @@ public class IoEngine_system extends IoEngine_base {
|
||||
}
|
||||
catch (Exception exc) {
|
||||
xrg.Rslt_err_(exc);
|
||||
if (ClassAdp_.Eq_typeSafe(exc, java.net.UnknownHostException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_host_not_found);
|
||||
else if (ClassAdp_.Eq_typeSafe(exc, java.io.FileNotFoundException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_file_not_found);
|
||||
if (Type_adp_.Eq_typeSafe(exc, java.net.UnknownHostException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_host_not_found);
|
||||
else if (Type_adp_.Eq_typeSafe(exc, java.io.FileNotFoundException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_file_not_found);
|
||||
else xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_unknown);
|
||||
if (prog_dlg != null && !xrg.Prog_cancel()) {
|
||||
if (session_fil == null) session_fil = prog_dlg.Log_wkr().Session_dir().GenSubFil("internet.txt");
|
||||
@ -624,8 +624,8 @@ class Io_stream_rdr_http implements Io_stream_rdr {
|
||||
read_done = read_failed = true;
|
||||
len = -1;
|
||||
xrg.Rslt_err_(exc);
|
||||
if (ClassAdp_.Eq_typeSafe(exc, java.net.UnknownHostException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_host_not_found);
|
||||
else if (ClassAdp_.Eq_typeSafe(exc, java.io.FileNotFoundException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_file_not_found);
|
||||
if (Type_adp_.Eq_typeSafe(exc, java.net.UnknownHostException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_host_not_found);
|
||||
else if (Type_adp_.Eq_typeSafe(exc, java.io.FileNotFoundException.class)) xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_file_not_found);
|
||||
else xrg.Rslt_(IoEngine_xrg_downloadFil.Rslt_fail_unknown);
|
||||
if (prog_dlg != null && !xrg.Prog_cancel()) {
|
||||
if (session_fil == null) session_fil = prog_dlg.Log_wkr().Session_dir().GenSubFil("internet.txt");
|
||||
|
@ -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;
|
||||
public class ClassAdp_ {
|
||||
public class Type_adp_ {
|
||||
public static boolean Eq(Class<?> lhs, Class<?> rhs) {
|
||||
if (lhs == null && rhs == null) return true;
|
||||
else if (lhs == null || rhs == null) return false;
|
||||
@ -42,5 +42,35 @@ public class ClassAdp_ {
|
||||
public static String FullNameOf_type(Class<?> type) {return type.getCanonicalName();}
|
||||
public static String NameOf_type(Class<?> type) {return type.getName();}
|
||||
public static String NameOf_obj(Object obj) {return obj == null ? String_.Null_mark : obj.getClass().getName();}
|
||||
public static final byte Tid_bool = 1, Tid_byte = 2, Tid_int = 3, Tid_long = 4, Tid_float = 5, Tid_double = 6, Tid_char = 7, Tid_str = 8, Tid_date = 9, Tid_decimal = 10, Tid_bry = 11;
|
||||
public static int To_tid(Object o) {
|
||||
if (o == null) return Tid__null;
|
||||
Class<?> type = o.getClass();
|
||||
if (Type_adp_.Eq(type, Int_.Cls_ref_type)) return Tid__int;
|
||||
else if (Type_adp_.Eq(type, String_.Cls_ref_type)) return Tid__str;
|
||||
else if (Type_adp_.Eq(type, byte[].class)) return Tid__bry;
|
||||
else if (Type_adp_.Eq(type, Bool_.Cls_ref_type)) return Tid__bool;
|
||||
else if (Type_adp_.Eq(type, Byte_.Cls_ref_type)) return Tid__byte;
|
||||
else if (Type_adp_.Eq(type, Long_.Cls_ref_type)) return Tid__long;
|
||||
else if (Type_adp_.Eq(type, Double_.Cls_ref_type)) return Tid__double;
|
||||
else if (Type_adp_.Eq(type, Decimal_adp_.Cls_ref_type)) return Tid__decimal;
|
||||
else if (Type_adp_.Eq(type, DateAdp_.Cls_ref_type)) return Tid__date;
|
||||
else if (Type_adp_.Eq(type, Float_.Cls_ref_type)) return Tid__float;
|
||||
else if (Type_adp_.Eq(type, Char_.Cls_ref_type)) return Tid__char;
|
||||
else return Tid__obj;
|
||||
}
|
||||
public static final int
|
||||
Tid__obj = 0
|
||||
, Tid__null = 1
|
||||
, Tid__bool = 2
|
||||
, Tid__byte = 3
|
||||
, Tid__int = 4
|
||||
, Tid__long = 5
|
||||
, Tid__float = 6
|
||||
, Tid__double = 7
|
||||
, Tid__char = 8
|
||||
, Tid__str = 9
|
||||
, Tid__date = 10
|
||||
, Tid__decimal = 11
|
||||
, Tid__bry = 12
|
||||
;
|
||||
}
|
@ -22,7 +22,7 @@ public abstract class ClassXtn_base {
|
||||
@gplx.Virtual public Object XtoDb(Object obj) {return obj;}
|
||||
@gplx.Virtual public String XtoUi(Object obj, String fmt) {return Object_.Xto_str_strict_or_null_mark(obj);}
|
||||
@gplx.Virtual public boolean MatchesClass(Object obj) {if (obj == null) throw Err_.new_null();
|
||||
return ClassAdp_.Eq_typeSafe(obj, UnderClass());
|
||||
return Type_adp_.Eq_typeSafe(obj, UnderClass());
|
||||
}
|
||||
@gplx.Virtual public int compareTo(Object lhs, Object rhs) {return CompareAble_.Compare_obj(lhs, rhs);}
|
||||
}
|
||||
|
@ -258,11 +258,11 @@ interface XtoStrWkr {
|
||||
class XtoStrWkr_gplx implements XtoStrWkr {
|
||||
public String To_str(Object o) {
|
||||
if (o == null) return "<<NULL>>";
|
||||
Class<?> type = ClassAdp_.ClassOf_obj(o);
|
||||
Class<?> type = Type_adp_.ClassOf_obj(o);
|
||||
String rv = null;
|
||||
if (type == String.class) rv = String_.cast_(o);
|
||||
else if (Int_.TypeMatch(type)) return Int_.Xto_str(Int_.cast_(o));
|
||||
else if (ClassAdp_.Eq(type, Bool_.Cls_ref_type)) return Yn.Xto_str(Bool_.cast_(o));
|
||||
else if (Type_adp_.Eq(type, Bool_.Cls_ref_type)) return Yn.Xto_str(Bool_.cast_(o));
|
||||
else if (type == DateAdp.class) return DateAdp_.cast_(o).XtoStr_gplx();
|
||||
else rv = Object_.Xto_str_strict_or_empty(o);
|
||||
return String_.Replace(rv, "'", "''");
|
||||
|
@ -96,10 +96,10 @@ class GfsCore_ {
|
||||
if (rv == GfoInvkAble_.Rv_cancel) return rv;
|
||||
else if (rv == GfoInvkAble_.Rv_unhandled) {
|
||||
if (ctx.Fail_if_unhandled())
|
||||
throw Err_.new_wo_type("Object does not support key", "key", owner_msg.Key(), "ownerType", ClassAdp_.FullNameOf_obj(owner_invk));
|
||||
throw Err_.new_wo_type("Object does not support key", "key", owner_msg.Key(), "ownerType", Type_adp_.FullNameOf_obj(owner_invk));
|
||||
else {
|
||||
Gfo_usr_dlg usr_dlg = ctx.Usr_dlg();
|
||||
if (usr_dlg != null) usr_dlg.Warn_many(GRP_KEY, "unhandled_key", "Object does not support key: key=~{0} ownerType=~{1}", owner_msg.Key(), ClassAdp_.FullNameOf_obj(owner_invk));
|
||||
if (usr_dlg != null) usr_dlg.Warn_many(GRP_KEY, "unhandled_key", "Object does not support key: key=~{0} ownerType=~{1}", owner_msg.Key(), Type_adp_.FullNameOf_obj(owner_invk));
|
||||
return GfoInvkAble_.Null;
|
||||
}
|
||||
}
|
||||
@ -118,8 +118,8 @@ class GfsCore_ {
|
||||
Class<?> type = rv.getClass();
|
||||
if (type == String.class) invk = String_.Gfs;
|
||||
else if (Int_.TypeMatch(type)) invk = Int_.Gfs;
|
||||
else if (ClassAdp_.Eq(type, Bool_.Cls_ref_type)) invk = Bool_.Gfs;
|
||||
else throw Err_.new_wo_type("unknown primitive", "type", ClassAdp_.NameOf_type(type), "obj", Object_.Xto_str_strict_or_null_mark(rv));
|
||||
else if (Type_adp_.Eq(type, Bool_.Cls_ref_type)) invk = Bool_.Gfs;
|
||||
else throw Err_.new_wo_type("unknown primitive", "type", Type_adp_.NameOf_type(type), "obj", Object_.Xto_str_strict_or_null_mark(rv));
|
||||
primitive = rv;
|
||||
}
|
||||
Object exec_rv = null;
|
||||
|
@ -22,7 +22,7 @@ class GfsRegy implements GfoInvkAble {
|
||||
public boolean Has(String k) {return hash.Has(k);}
|
||||
public GfsRegyItm Get_at(int i) {return (GfsRegyItm)hash.Get_at(i);}
|
||||
public GfsRegyItm Get_by(String key) {return (GfsRegyItm)hash.Get_by(key);}
|
||||
public GfsRegyItm FetchByType(GfoInvkAble invk) {return (GfsRegyItm)typeHash.Get_by(ClassAdp_.FullNameOf_obj(invk));}
|
||||
public GfsRegyItm FetchByType(GfoInvkAble invk) {return (GfsRegyItm)typeHash.Get_by(Type_adp_.FullNameOf_obj(invk));}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
Object rv = (GfsRegyItm)hash.Get_by(k); if (rv == null) throw Err_.new_missing_key(k);
|
||||
return rv;
|
||||
@ -31,7 +31,7 @@ class GfsRegy implements GfoInvkAble {
|
||||
public void AddCmd(GfoInvkAble invk, String key) {Add(key, invk, true);}
|
||||
public void Add(String key, GfoInvkAble invk, boolean typeCmd) {
|
||||
if (hash.Has(key)) return;
|
||||
GfsRegyItm regyItm = new GfsRegyItm().Key_(key).InvkAble_(invk).IsCmd_(typeCmd).TypeKey_(ClassAdp_.FullNameOf_obj(invk));
|
||||
GfsRegyItm regyItm = new GfsRegyItm().Key_(key).InvkAble_(invk).IsCmd_(typeCmd).TypeKey_(Type_adp_.FullNameOf_obj(invk));
|
||||
hash.Add(key, regyItm);
|
||||
typeHash.Add_if_dupe_use_1st(regyItm.TypeKey(), regyItm); // NOTE: changed to allow same Object to be added under different aliases (app, xowa) DATE:2014-06-09;
|
||||
}
|
||||
|
@ -21,10 +21,12 @@ public class Tfds { // URL:doc/gplx.tfds/Tfds.txt
|
||||
public static boolean SkipDb = false;
|
||||
public static void Eq_bool (boolean expd , boolean actl, String fmt, Object... args) {Eq_exec_y(expd, actl, fmt, args);}
|
||||
public static void Eq_byte (byte expd , byte actl, String fmt, Object... args) {Eq_exec_y(expd, actl, fmt, args);}
|
||||
public static void Eq_int (int expd , int actl) {Eq_exec_y(expd, actl, "", Object_.Ary_empty);}
|
||||
public static void Eq_int (int expd , int actl, String fmt, Object... args) {Eq_exec_y(expd, actl, fmt, args);}
|
||||
public static void Eq_str (byte[] expd, byte[] actl, String fmt, Object... args) {Eq_exec_y(String_.new_u8(expd), String_.new_u8(actl), fmt, args);}
|
||||
public static void Eq_str (byte[] expd, String actl, String fmt, Object... args) {Eq_exec_y(String_.new_u8(expd), actl, fmt, args);}
|
||||
public static void Eq_str (String expd, byte[] actl, String fmt, Object... args) {Eq_exec_y(expd, String_.new_u8(actl), fmt, args);}
|
||||
public static void Eq_str (String expd, String actl) {Eq_exec_y(expd, actl, "", Object_.Ary_empty);}
|
||||
public static void Eq_str (String expd, String actl, String fmt, Object... args) {Eq_exec_y(expd, actl, fmt, args);}
|
||||
|
||||
public static void Eq(Object expd, Object actl) {Eq_wkr(expd, actl, true, EmptyStr);}
|
||||
@ -138,8 +140,8 @@ public class Tfds { // URL:doc/gplx.tfds/Tfds.txt
|
||||
list.Add(itm);
|
||||
}
|
||||
public static void Err_classMatch(Exception exc, Class<?> type) {
|
||||
boolean match = ClassAdp_.Eq_typeSafe(exc, type);
|
||||
if (!match) throw Err_.new_("Tfds", "error types do not match", "expdType", ClassAdp_.FullNameOf_type(type), "actlType", ClassAdp_.NameOf_obj(exc), "actlMsg", Err_.Message_lang(exc));
|
||||
boolean match = Type_adp_.Eq_typeSafe(exc, type);
|
||||
if (!match) throw Err_.new_("Tfds", "error types do not match", "expdType", Type_adp_.FullNameOf_type(type), "actlType", Type_adp_.NameOf_obj(exc), "actlMsg", Err_.Message_lang(exc));
|
||||
}
|
||||
public static void Eq_err(Err expd, Exception actlExc) {
|
||||
Tfds.Eq(Err_.Message_gplx_full(expd), Err_.Message_gplx_full(actlExc));
|
||||
|
@ -35,7 +35,7 @@ class GfmlPragmaLxrFrm implements GfmlPragma {
|
||||
bldr.Doc().RootLxr().SubLxr_Add(lxr); // FIXME: always add to cur lxr; should be outside if block; also, auto_add=n to skip adding to rootLxr
|
||||
}
|
||||
else {
|
||||
GfmlLxr_frame frameLxr = GfmlLxr_frame.as_(lxr); if (frameLxr == null) throw Err_.new_wo_type("lxr is not GfmlLxr_frame", "key", key, "type", ClassAdp_.NameOf_obj(lxr));
|
||||
GfmlLxr_frame frameLxr = GfmlLxr_frame.as_(lxr); if (frameLxr == null) throw Err_.new_wo_type("lxr is not GfmlLxr_frame", "key", key, "type", Type_adp_.NameOf_obj(lxr));
|
||||
if (type != null) {
|
||||
// frame = frameLxr.Frame.MakeNew(frameLxr);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class TdbTable {
|
||||
flds = ndeRdr.UnderNde().SubFlds();
|
||||
}
|
||||
else { // XmlRdr needs to load each row again...
|
||||
throw Err_.new_invalid_op("TableLoad not implemented").Args_add("rdrType", ClassAdp_.NameOf_obj(rdr), "rdrName", rdr.NameOfNode());
|
||||
throw Err_.new_invalid_op("TableLoad not implemented").Args_add("rdrType", Type_adp_.NameOf_obj(rdr), "rdrName", rdr.NameOfNode());
|
||||
}
|
||||
isLoaded = true;
|
||||
}
|
||||
|
@ -57,21 +57,21 @@ public class Db_qry_sql implements Db_qry {
|
||||
private static void Gen_sql_arg(Bry_bfr bfr, Object val) {
|
||||
if (val == null) {bfr.Add(Bry_null); return;}
|
||||
Class<?> val_type = val.getClass();
|
||||
if (ClassAdp_.Eq(val_type, Int_.Cls_ref_type))
|
||||
if (Type_adp_.Eq(val_type, Int_.Cls_ref_type))
|
||||
bfr.Add_int_variable(Int_.cast_(val));
|
||||
else if (ClassAdp_.Eq(val_type, Bool_.Cls_ref_type))
|
||||
else if (Type_adp_.Eq(val_type, Bool_.Cls_ref_type))
|
||||
bfr.Add_int_fixed(1, Bool_.Xto_int(Bool_.cast_(val))); // NOTE: save boolean to 0 or 1, b/c (a) db may not support bit datatype (sqllite) and (b) avoid i18n issues with "true"/"false"
|
||||
else if (ClassAdp_.Eq(val_type, Double_.Cls_ref_type))
|
||||
else if (Type_adp_.Eq(val_type, Double_.Cls_ref_type))
|
||||
bfr.Add_double(Double_.cast_(val));
|
||||
else if (ClassAdp_.Eq(val_type, Long_.Cls_ref_type))
|
||||
else if (Type_adp_.Eq(val_type, Long_.Cls_ref_type))
|
||||
bfr.Add_long_variable(Long_.cast_(val));
|
||||
else if (ClassAdp_.Eq(val_type, Float_.Cls_ref_type))
|
||||
else if (Type_adp_.Eq(val_type, Float_.Cls_ref_type))
|
||||
bfr.Add_float(Float_.cast_(val));
|
||||
else if (ClassAdp_.Eq(val_type, Byte_.Cls_ref_type))
|
||||
else if (Type_adp_.Eq(val_type, Byte_.Cls_ref_type))
|
||||
bfr.Add_byte(Byte_.cast_(val));
|
||||
else if (ClassAdp_.Eq(val_type, DateAdp_.Cls_ref_type))
|
||||
else if (Type_adp_.Eq(val_type, DateAdp_.Cls_ref_type))
|
||||
bfr.Add_byte_apos().Add_str(DateAdp_.cast_(val).XtoStr_gplx_long()).Add_byte_apos();
|
||||
else if (ClassAdp_.Eq(val_type, Decimal_adp_.Cls_ref_type))
|
||||
else if (Type_adp_.Eq(val_type, Decimal_adp_.Cls_ref_type))
|
||||
bfr.Add_str(Decimal_adp_.cast_(val).To_str());
|
||||
else {
|
||||
byte[] val_bry = Bry_.new_u8(Object_.Xto_str_strict_or_null(val));
|
||||
|
@ -166,7 +166,7 @@ public class Db_stmt_sql implements Db_stmt {// used for formatting SQL statemen
|
||||
str = "NULL";
|
||||
else {
|
||||
str = Object_.Xto_str_strict_or_null(obj);
|
||||
if (ClassAdp_.Eq(obj.getClass(), String_.Cls_ref_type))
|
||||
if (Type_adp_.Eq(obj.getClass(), String_.Cls_ref_type))
|
||||
str = "'" + String_.Replace(str, "'", "''") + "'";
|
||||
}
|
||||
ary[i] = str;
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.dbs.sqls; import gplx.*; import gplx.dbs.*;
|
||||
public class Db_fld {
|
||||
public Db_fld(String name, byte type_tid) {this.name = name; this.type_tid = type_tid;}
|
||||
public Db_fld(String name, int type_tid) {this.name = name; this.type_tid = type_tid;}
|
||||
public String Name() {return name;} public Db_fld Name_(String v) {name = v; return this;} private String name;
|
||||
public byte Type_tid() {return type_tid;} public Db_fld Type_tid_(byte v) {type_tid = v; return this;} private byte type_tid;
|
||||
public int Type_tid() {return type_tid;} public Db_fld Type_tid_(int v) {type_tid = v; return this;} private int type_tid;
|
||||
}
|
||||
|
@ -20,15 +20,15 @@ import org.junit.*; import gplx.core.strings.*; import gplx.dbs.sqls.*;
|
||||
public class Db_obj_ary_tst {
|
||||
@Before public void init() {} private Db_obj_ary_fxt fxt = new Db_obj_ary_fxt();
|
||||
@Test public void Int() {
|
||||
fxt.Init_fld("fld_0", ClassAdp_.Tid_int).Init_fld("fld_1", ClassAdp_.Tid_int).Init_vals(1, 10).Init_vals(2, 20).Test_sql("(fld_0=1 AND fld_1=10) OR (fld_0=2 AND fld_1=20)");
|
||||
fxt.Init_fld("fld_0", Type_adp_.Tid__int).Init_fld("fld_1", Type_adp_.Tid__int).Init_vals(1, 10).Init_vals(2, 20).Test_sql("(fld_0=1 AND fld_1=10) OR (fld_0=2 AND fld_1=20)");
|
||||
}
|
||||
@Test public void Str() {
|
||||
fxt.Init_fld("fld_0", ClassAdp_.Tid_int).Init_fld("fld_1", ClassAdp_.Tid_str).Init_vals(1, "a").Init_vals(2, "b").Test_sql("(fld_0=1 AND fld_1='a') OR (fld_0=2 AND fld_1='b')");
|
||||
fxt.Init_fld("fld_0", Type_adp_.Tid__int).Init_fld("fld_1", Type_adp_.Tid__str).Init_vals(1, "a").Init_vals(2, "b").Test_sql("(fld_0=1 AND fld_1='a') OR (fld_0=2 AND fld_1='b')");
|
||||
}
|
||||
}
|
||||
class Db_obj_ary_fxt {
|
||||
private Db_obj_ary_crt crt = new Db_obj_ary_crt();
|
||||
public Db_obj_ary_fxt Init_fld(String name, byte tid) {flds_list.Add(new Db_fld(name, tid)); return this;} private List_adp flds_list = List_adp_.new_();
|
||||
public Db_obj_ary_fxt Init_fld(String name, int tid) {flds_list.Add(new Db_fld(name, tid)); return this;} private List_adp flds_list = List_adp_.new_();
|
||||
public Db_obj_ary_fxt Init_vals(Object... ary) {vals_list.Add(ary); return this;} private List_adp vals_list = List_adp_.new_();
|
||||
public Db_obj_ary_fxt Test_sql(String expd) {
|
||||
Sql_qry_wtr_ansi cmd_wtr = (Sql_qry_wtr_ansi)Sql_qry_wtr_.I;
|
||||
|
@ -276,9 +276,9 @@ public class Sql_qry_wtr_ansi implements Sql_qry_wtr {
|
||||
Object val = itm[j];
|
||||
boolean quote = false;
|
||||
switch (fld.Type_tid()) {
|
||||
case ClassAdp_.Tid_str:
|
||||
case ClassAdp_.Tid_char:
|
||||
case ClassAdp_.Tid_date:
|
||||
case Type_adp_.Tid__str:
|
||||
case Type_adp_.Tid__char:
|
||||
case Type_adp_.Tid__date:
|
||||
quote = true;
|
||||
break;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class DbMaprWtr extends DataWtr_base implements DataWtr {
|
||||
}
|
||||
void WriteDataVal(String fld, Object val) {
|
||||
if (insertCmd == null) insertCmd = Db_qry_.insert_(curTableName);
|
||||
if (ClassAdp_.Eq_typeSafe(val, String.class))
|
||||
if (Type_adp_.Eq_typeSafe(val, String.class))
|
||||
insertCmd.Arg_obj_type_(fld, val, Db_val_type.Tid_varchar);
|
||||
else
|
||||
insertCmd.Arg_obj_(fld, val);
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiBorderEdge {
|
||||
public int Val() {return val;} int val;
|
||||
public boolean Has(GfuiBorderEdge comp) {return Enm_.HasInt(val, comp.val);}
|
||||
public boolean Has(GfuiBorderEdge comp) {return Enm_.Has_int(val, comp.val);}
|
||||
public GfuiBorderEdge Add(GfuiBorderEdge comp) {
|
||||
return new GfuiBorderEdge(comp.val + val);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class IptEventType_ {
|
||||
if (ary.length == 0) return IptEventType_.None;
|
||||
int newVal = ary[0].Val();
|
||||
for (int i = 1; i < ary.length; i++)
|
||||
newVal = Enm_.FlipInt(true, newVal, ary[i].Val());
|
||||
newVal = Enm_.Flip_int(true, newVal, ary[i].Val());
|
||||
return getOrNew_(newVal);
|
||||
}
|
||||
static IptEventType getOrNew_(int v) {
|
||||
@ -46,7 +46,7 @@ public class IptEventType_ {
|
||||
}
|
||||
@gplx.Internal protected static boolean Has(IptEventType val, IptEventType find) {
|
||||
if (find == IptEventType_.None && val != IptEventType_.None) return false; // check .None manually b/c 0 is identity when BitShifting
|
||||
return Enm_.HasInt(val.Val(), find.Val());
|
||||
return Enm_.Has_int(val.Val(), find.Val());
|
||||
}
|
||||
public static IptEventType default_(IptArg[] args) {
|
||||
IptEventType rv = IptEventType_.None;
|
||||
|
@ -23,7 +23,7 @@ public class IptKey implements IptArg {
|
||||
public boolean Eq(IptArg comp) {return String_.Eq(key, comp.Key());}
|
||||
public String XtoUiStr() {return IptKeyStrMgr._.To_str(this);}
|
||||
public IptKey Add(IptKey comp) {return IptKey_.add_(this, comp);}
|
||||
public boolean Mod_shift() {return Enm_.HasInt(val, IptKey_.Shift.Val());}
|
||||
public boolean Mod_ctrl() {return Enm_.HasInt(val, IptKey_.Ctrl.Val());}
|
||||
public boolean Mod_alt() {return Enm_.HasInt(val, IptKey_.Alt.Val());}
|
||||
public boolean Mod_shift() {return Enm_.Has_int(val, IptKey_.Shift.Val());}
|
||||
public boolean Mod_ctrl() {return Enm_.Has_int(val, IptKey_.Ctrl.Val());}
|
||||
public boolean Mod_alt() {return Enm_.Has_int(val, IptKey_.Alt.Val());}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class IptKey_ {
|
||||
if (ary.length == 0) return IptKey_.None;
|
||||
int newVal = ary[0].Val();
|
||||
for (int i = 1; i < ary.length; i++)
|
||||
newVal = Enm_.FlipInt(true, newVal, ary[i].Val());
|
||||
newVal = Enm_.Flip_int(true, newVal, ary[i].Val());
|
||||
return get_or_new_(newVal);
|
||||
}
|
||||
public static IptKey api_(int val) {
|
||||
@ -138,9 +138,9 @@ public class IptKey_ {
|
||||
}
|
||||
public static String To_str(int val) {
|
||||
String mod_str = "", rv = "";
|
||||
boolean mod_c = Enm_.HasInt(val, IptKey_.Ctrl.Val()); if (mod_c) {mod_str += "c"; val = Enm_.FlipInt(Bool_.N, val, IptKey_.Ctrl.Val());}
|
||||
boolean mod_a = Enm_.HasInt(val, IptKey_.Alt.Val()); if (mod_a) {mod_str += "a"; val = Enm_.FlipInt(Bool_.N, val, IptKey_.Alt.Val());}
|
||||
boolean mod_s = Enm_.HasInt(val, IptKey_.Shift.Val()); if (mod_s) {mod_str += "s"; val = Enm_.FlipInt(Bool_.N, val, IptKey_.Shift.Val());}
|
||||
boolean mod_c = Enm_.Has_int(val, IptKey_.Ctrl.Val()); if (mod_c) {mod_str += "c"; val = Enm_.Flip_int(Bool_.N, val, IptKey_.Ctrl.Val());}
|
||||
boolean mod_a = Enm_.Has_int(val, IptKey_.Alt.Val()); if (mod_a) {mod_str += "a"; val = Enm_.Flip_int(Bool_.N, val, IptKey_.Alt.Val());}
|
||||
boolean mod_s = Enm_.Has_int(val, IptKey_.Shift.Val()); if (mod_s) {mod_str += "s"; val = Enm_.Flip_int(Bool_.N, val, IptKey_.Shift.Val());}
|
||||
if (String_.Len_gt_0(mod_str)) {
|
||||
rv = "mod." + mod_str;
|
||||
if (val == 0) return rv; // handle modifiers only, like "mod.cs"; else will be "mod.cs+key.#0"
|
||||
|
@ -30,7 +30,7 @@ class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, GfoInvkAble, GfoEvObj {
|
||||
int keyVal = iptData.Key().Val();
|
||||
GfuiElem sender = GfuiElem_.as_(iptData.Sender());
|
||||
if (GfuiTextBox_.as_(sender) != null // is sender textBox?
|
||||
&& !Enm_.HasInt(keyVal, IptKey_.Alt.Val()) // does key not have alt
|
||||
&& !Enm_.Has_int(keyVal, IptKey_.Alt.Val()) // does key not have alt
|
||||
) return false; // ignore keys from textbox if they do not have alt
|
||||
List_adp elemList = (List_adp)listHash.Get_by(keyVal); if (elemList == null) return false;
|
||||
for (int i = 0; i < elemList.Count(); i++) {
|
||||
|
@ -108,12 +108,12 @@ class Swt_lnr_key implements KeyListener {
|
||||
case 327680: val = IptKey_.Insert.Val(); break;
|
||||
}
|
||||
if (Has_ctrl(ev.stateMask)) val |= IptKey_.KeyCode_Ctrl;
|
||||
if (Enm_.HasInt(ev.stateMask, IptKey_.KeyCode_Shift)) val |= IptKey_.KeyCode_Alt;
|
||||
if (Enm_.HasInt(ev.stateMask, IptKey_.KeyCode_Ctrl)) val |= IptKey_.KeyCode_Shift;
|
||||
if (Enm_.Has_int(ev.stateMask, IptKey_.KeyCode_Shift)) val |= IptKey_.KeyCode_Alt;
|
||||
if (Enm_.Has_int(ev.stateMask, IptKey_.KeyCode_Ctrl)) val |= IptKey_.KeyCode_Shift;
|
||||
// Tfds.Write(String_.Format("val={4} keyCode={0} stateMask={1} keyLocation={2} character={3}", ev.keyCode, ev.stateMask, ev.keyLocation, ev.character, val));
|
||||
return IptEvtDataKey.int_(val);
|
||||
}
|
||||
public static boolean Has_ctrl(int val) {return Enm_.HasInt(val, IptKey_.KeyCode_Alt);} // NOTE:SWT's ctrl constant is different from SWING's
|
||||
public static boolean Has_ctrl(int val) {return Enm_.Has_int(val, IptKey_.KeyCode_Alt);} // NOTE:SWT's ctrl constant is different from SWING's
|
||||
}
|
||||
class Swt_lnr_mouse implements MouseListener {
|
||||
public Swt_lnr_mouse(GxwElem elem) {this.elem = elem;} GxwElem elem;
|
||||
|
@ -85,9 +85,9 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
|
||||
Object arg = args[i];
|
||||
if (i != 0) bfr.Add_byte(Byte_ascii.Comma);
|
||||
boolean quote_val = true;
|
||||
if ( ClassAdp_.Eq_typeSafe(arg, Bool_.Cls_ref_type)
|
||||
|| ClassAdp_.Eq_typeSafe(arg, Int_.Cls_ref_type)
|
||||
|| ClassAdp_.Eq_typeSafe(arg, Long_.Cls_ref_type)
|
||||
if ( Type_adp_.Eq_typeSafe(arg, Bool_.Cls_ref_type)
|
||||
|| Type_adp_.Eq_typeSafe(arg, Int_.Cls_ref_type)
|
||||
|| Type_adp_.Eq_typeSafe(arg, Long_.Cls_ref_type)
|
||||
) {
|
||||
quote_val = false;
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ public class Json_doc_srl {
|
||||
return this;
|
||||
}
|
||||
public void Write_obj(boolean comma, byte[] key, Object val) {
|
||||
Class<?> t = ClassAdp_.ClassOf_obj(val);
|
||||
if (ClassAdp_.Is_array(t))
|
||||
Class<?> t = Type_adp_.ClassOf_obj(val);
|
||||
if (Type_adp_.Is_array(t))
|
||||
Write_kv_ary(comma, key, (Object[])val);
|
||||
else
|
||||
Write_kv_str(comma, key, Object_.Xto_str_strict_or_empty(val));
|
||||
|
@ -21,11 +21,12 @@ public class Json_wtr {
|
||||
private int indent;
|
||||
private boolean nde_itm_is_first;
|
||||
private boolean ary_itm_is_first;
|
||||
public Bry_bfr Bfr() {return bfr;}
|
||||
public void Indent_(int v) {this.indent = v;}
|
||||
public byte Opt_quote_byte() {return opt_quote_byte;} public Json_wtr Opt_quote_byte_(byte v) {opt_quote_byte = v; return this;} private byte opt_quote_byte = Byte_ascii.Quote;
|
||||
public boolean Opt_ws() {return opt_ws;} public Json_wtr Opt_ws_(boolean v) {opt_ws = v; return this;} private boolean opt_ws = true;
|
||||
public byte[] To_bry_and_clear() {return bfr.Xto_bry_and_clear();}
|
||||
public String To_str_and_clear() {return bfr.Xto_str_and_clear();}
|
||||
public Bry_bfr Bfr() {return bfr;}
|
||||
public Json_wtr Clear() {
|
||||
indent = 0;
|
||||
nde_itm_is_first = ary_itm_is_first = true;
|
||||
@ -33,11 +34,10 @@ public class Json_wtr {
|
||||
}
|
||||
public Json_wtr Doc_bgn() {return Add_grp_bgn(Sym_nde_bgn);}
|
||||
public Json_wtr Doc_end() {Add_grp_end(Bool_.Y, Sym_nde_end); return Add_nl();}
|
||||
public void Indent_(int v) {this.indent = v;}
|
||||
public Json_wtr Nde_bgn(String nde) {return Nde_bgn(Bry_.new_u8(nde));}
|
||||
public Json_wtr Nde_bgn(byte[] nde) {
|
||||
public Json_wtr Nde_bgn(String key) {return Nde_bgn(Bry_.new_u8(key));}
|
||||
public Json_wtr Nde_bgn(byte[] key) {
|
||||
Add_indent_itm(nde_itm_is_first);
|
||||
Add_key(nde);
|
||||
Add_key(key);
|
||||
Add_nl();
|
||||
return Add_grp_bgn(Sym_nde_bgn);
|
||||
}
|
||||
@ -49,17 +49,23 @@ public class Json_wtr {
|
||||
ary_itm_is_first = true;
|
||||
return Add_grp_bgn(Sym_ary_bgn);
|
||||
}
|
||||
public Json_wtr Ary_itm_str(String itm) {
|
||||
public Json_wtr Ary_itm_str(String itm) {return Ary_itm_by_type_tid(Type_adp_.Tid__str, itm);}
|
||||
public Json_wtr Ary_itm_bry(byte[] itm) {return Ary_itm_by_type_tid(Type_adp_.Tid__bry, itm);}
|
||||
public Json_wtr Ary_itm_obj(Object itm) {return Ary_itm_by_type_tid(Type_adp_.To_tid(itm), itm);}
|
||||
private Json_wtr Ary_itm_by_type_tid(int itm_type_tid, Object itm) {
|
||||
Add_indent_itm(ary_itm_is_first);
|
||||
Add_itm_bry(Bry_.new_u8(itm));
|
||||
Add_itm_by_tid(itm_type_tid, itm);
|
||||
Add_nl();
|
||||
ary_itm_is_first = false;
|
||||
return this;
|
||||
}
|
||||
public Json_wtr Ary_end() {Add_grp_end(Bool_.N, Sym_ary_end); return Add_nl();}
|
||||
public Json_wtr Kv_bool(String key, boolean val) {return Kv_bool(Bry_.new_u8(key), val);}
|
||||
public Json_wtr Kv_bool(byte[] key, boolean val) {return Kv_raw(key, val ? Bool_.True_bry : Bool_.False_bry);}
|
||||
public Json_wtr Kv_int(String key, int val) {return Kv_raw(Bry_.new_u8(key), Int_.Xto_bry(val));}
|
||||
public Json_wtr Kv_bool(String key, boolean val) {return Kv_bool(Bry_.new_u8(key), val);}
|
||||
public Json_wtr Kv_bool(byte[] key, boolean val) {return Kv_raw(key, val ? Bool_.True_bry : Bool_.False_bry);}
|
||||
public Json_wtr Kv_int(String key, int val) {return Kv_raw(Bry_.new_u8(key), Int_.Xto_bry(val));}
|
||||
public Json_wtr Kv_long(String key, long val) {return Kv_raw(Bry_.new_u8(key), Bry_.new_a7(Long_.Xto_str(val)));}
|
||||
public Json_wtr Kv_float(String key, float val) {return Kv_raw(Bry_.new_u8(key), Bry_.new_a7(Float_.Xto_str(val)));}
|
||||
public Json_wtr Kv_double(String key, double val) {return Kv_raw(Bry_.new_u8(key), Bry_.new_a7(Double_.Xto_str(val)));}
|
||||
private Json_wtr Kv_raw(byte[] key, byte[] val) {
|
||||
Add_indent_itm(nde_itm_is_first);
|
||||
Add_key(key);
|
||||
@ -109,6 +115,23 @@ public class Json_wtr {
|
||||
bfr.Add_byte_colon();
|
||||
return this;
|
||||
}
|
||||
public void Add_itm_by_tid(int type_tid, Object obj) {
|
||||
switch (type_tid) {
|
||||
case Type_adp_.Tid__bool: bfr.Add_bool(Bool_.cast_(obj)); break;
|
||||
case Type_adp_.Tid__byte: bfr.Add_byte(Byte_.cast_(obj)); break;
|
||||
case Type_adp_.Tid__int: bfr.Add_int_variable(Int_.cast_(obj)); break;
|
||||
case Type_adp_.Tid__long: bfr.Add_long_variable(Long_.cast_(obj)); break;
|
||||
case Type_adp_.Tid__float: bfr.Add_float(Float_.cast_(obj)); break;
|
||||
case Type_adp_.Tid__double: bfr.Add_double(Double_.cast_(obj)); break;
|
||||
case Type_adp_.Tid__str: Add_itm_bry(Bry_.new_u8((String)obj)); break;
|
||||
case Type_adp_.Tid__bry: Add_itm_bry((byte[])obj); break;
|
||||
case Type_adp_.Tid__char:
|
||||
case Type_adp_.Tid__date:
|
||||
case Type_adp_.Tid__decimal: Add_itm_bry(Bry_.new_u8(Object_.Xto_str_strict_or_empty(obj))); break;
|
||||
case Type_adp_.Tid__null:
|
||||
default: throw Err_.new_unhandled(type_tid);
|
||||
}
|
||||
}
|
||||
private void Add_itm_bry(byte[] bry) {Add_itm_bry(bry, 0, bry.length);}
|
||||
private void Add_itm_bry(byte[] bry, int bgn, int end) {
|
||||
bfr.Add_byte(opt_quote_byte);
|
||||
|
@ -24,20 +24,22 @@ public class Gfo_protocol_itm {
|
||||
int text_len = text_bry.length;
|
||||
for (int i = 0; i < text_len; i++) {
|
||||
if (text_bry[i] == Byte_ascii.Colon) {
|
||||
key_wo_colon_bry = Bry_.Mid(text_bry, 0, i);
|
||||
key_w_colon_bry_len = i;
|
||||
key_wo_colon_str = String_.new_u8(key_wo_colon_bry);
|
||||
key_w_colon_bry = Bry_.Mid(text_bry, 0, i + 1);
|
||||
text_ends_w_colon = i == text_len - 1;
|
||||
this.key_wo_colon_bry = Bry_.Mid(text_bry, 0, i);
|
||||
this.key_w_colon_bry_len = i;
|
||||
this.key_wo_colon_str = String_.new_u8(key_wo_colon_bry);
|
||||
this.key_w_colon_bry = Bry_.Mid(text_bry, 0, i + 1);
|
||||
this.key_w_colon_str = String_.new_u8(key_w_colon_bry);
|
||||
this.text_ends_w_colon = i == text_len - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public byte Tid() {return tid;} private byte tid;
|
||||
public byte[] Key_wo_colon_bry() {return key_wo_colon_bry;} private byte[] key_wo_colon_bry; // http
|
||||
public String Key_wo_colon_str() {return key_wo_colon_str;} private String key_wo_colon_str;
|
||||
public byte[] Key_w_colon_bry() {return key_w_colon_bry;} private byte[] key_w_colon_bry; // http:
|
||||
public int Key_w_colon_bry_len() {return key_w_colon_bry_len;} private int key_w_colon_bry_len;
|
||||
public byte[] Key_wo_colon_bry() {return key_wo_colon_bry;} private byte[] key_wo_colon_bry; // http
|
||||
public String Key_wo_colon_str() {return key_wo_colon_str;} private String key_wo_colon_str;
|
||||
public byte[] Key_w_colon_bry() {return key_w_colon_bry;} private byte[] key_w_colon_bry; // http:
|
||||
public String Key_w_colon_str() {return key_w_colon_str;} private String key_w_colon_str;
|
||||
public int Key_w_colon_bry_len() {return key_w_colon_bry_len;} private int key_w_colon_bry_len;
|
||||
public byte[] Text_bry() {return text_bry;} private byte[] text_bry; // http://
|
||||
public String Text_str() {return text_str;} private String text_str;
|
||||
public boolean Text_ends_w_colon() {return text_ends_w_colon;} private boolean text_ends_w_colon;
|
||||
|
@ -127,7 +127,7 @@ public class Gfui_bnd_parser {
|
||||
switch (sym_tkn.Tid()) {
|
||||
case Gfui_bnd_tkn.Tid_sym_plus: // EX: Ctrl + A
|
||||
if (mod_adj != Mod_val_null) { // if mod, just update mod_val and exit
|
||||
mod_val = Enm_.FlipInt(true, mod_val, mod_adj);
|
||||
mod_val = Enm_.Flip_int(true, mod_val, mod_adj);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -21,7 +21,7 @@ public class Dsv_fld_parser_ {
|
||||
public static final Dsv_fld_parser Int_parser = Dsv_fld_parser_int._;
|
||||
public static final Dsv_fld_parser Line_parser__comment_is_pipe = new Dsv_fld_parser_line(Byte_ascii.Pipe);
|
||||
public static Err err_fld_unhandled(Dsv_fld_parser parser, Dsv_wkr_base wkr, int fld_idx, byte[] src, int bgn, int end) {
|
||||
throw Err_.new_wo_type("fld unhandled", "parser", ClassAdp_.NameOf_obj(parser), "wkr", ClassAdp_.NameOf_obj(wkr), "fld_idx", fld_idx, "val", String_.new_u8(src, bgn, end)).Trace_ignore_add_1_();
|
||||
throw Err_.new_wo_type("fld unhandled", "parser", Type_adp_.NameOf_obj(parser), "wkr", Type_adp_.NameOf_obj(wkr), "fld_idx", fld_idx, "val", String_.new_u8(src, bgn, end)).Trace_ignore_add_1_();
|
||||
}
|
||||
}
|
||||
class Dsv_fld_parser_line implements Dsv_fld_parser {
|
||||
|
@ -58,7 +58,7 @@ public class Xoa_app_ {
|
||||
}
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final String Version = "2.8.3.1";
|
||||
public static final String Version = "2.8.4.1";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Op_sys_str;
|
||||
public static String User_agent = "";
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa; import gplx.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.files.exts.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_app_fxt {
|
||||
public static Xoae_app app_() {
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
@ -44,7 +44,7 @@ public class Xoa_app_fxt {
|
||||
public static Xowe_wiki wiki_(Xoae_app app, String key) {return wiki_(app, key, app.Lang_mgr().Lang_en());}
|
||||
public static Xowe_wiki wiki_(Xoae_app app, String key, Xol_lang lang) {
|
||||
Io_url wiki_dir = app.Fsys_mgr().Wiki_dir().GenSubDir(key);
|
||||
Xowe_wiki rv = new Xowe_wiki(app, lang, Xow_ns_mgr_.default_(lang.Case_mgr()), Xow_domain_.parse(Bry_.new_u8(key)), wiki_dir);
|
||||
Xowe_wiki rv = new Xowe_wiki(app, lang, Xow_ns_mgr_.default_(lang.Case_mgr()), Xow_domain_itm_.parse(Bry_.new_u8(key)), wiki_dir);
|
||||
rv.File_mgr().Meta_mgr().Depth_(2); // TEST: written for 2 depth
|
||||
rv.Props().Main_page_(Xoa_page_.Main_page_bry); // TEST: default to Main Page (nothing tests loading Main Page from wiki.gfs)
|
||||
rv.Ns_mgr().Ids_get_or_null(Xow_ns_.Id_main).Subpages_enabled_(true);
|
||||
|
@ -24,6 +24,7 @@ public class Xoa_url_ {
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
public static String Main_page__home_str = gplx.xowa.wikis.domains.Xow_domain_itm_.Str__home + gplx.xowa.html.hrefs.Xoh_href_.Str__wiki + gplx.xowa.Xoa_page_.Main_page_str; // EX:home/wiki/Main_Page
|
||||
public static final byte[]
|
||||
Qarg__redirect = Bry_.new_a7("redirect")
|
||||
, Qarg__redirect__yes = Bry_.new_a7("yes")
|
||||
|
@ -71,6 +71,7 @@ class Xog_find_box {
|
||||
}
|
||||
private void Exec_find(String find, boolean highlight_matches) {
|
||||
Xog_tab_itm tab = win.Tab_mgr().Active_tab(); if (tab == Xog_tab_itm_.Null) return;
|
||||
find = String_.Replace(find, "\\", "\\\\"); // NOTE: backslashes are always literal, never escape codes; EX: "C:\new" "\n" means "\n", not (byte)10; DATE:2015-08-17
|
||||
boolean find_in_hdoc = tab.View_mode() == Xopg_view_mode.Tid_read;
|
||||
if (find_in_hdoc)
|
||||
tab.Html_box().Html_js_eval_proc_as_str(Xog_js_procs.Win__find_in_hdoc , find, dir_fwd, case_match, wrap_search, highlight_matches);
|
||||
|
@ -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.apis.xowa.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.crts.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.domains.crts.*;
|
||||
public class Xoapi_search implements GfoInvkAble, GfoEvMgrOwner {
|
||||
private final Xow_domain_crt_kv_itm_mgr multi_wikis_mgr = new Xow_domain_crt_kv_itm_mgr(); private byte[] multi_wikis_bry = Dflt_multi_wikis_bry;
|
||||
private final Xow_domain_crt_kv_itm_mgr multi_sorts_mgr = new Xow_domain_crt_kv_itm_mgr(); private byte[] multi_sorts_bry = Dflt_multi_sorts_bry;
|
||||
@ -33,7 +33,7 @@ public class Xoapi_search implements GfoInvkAble, GfoEvMgrOwner {
|
||||
this.multi_wikis_bry = v;
|
||||
GfoEvMgr_.PubVal(this, Evt_multi_wikis_changed, v);
|
||||
}
|
||||
public Xow_domain_crt_itm Multi_wikis_crt(Xow_domain cur_domain) {
|
||||
public Xow_domain_crt_itm Multi_wikis_crt(Xow_domain_itm cur_domain) {
|
||||
return multi_wikis_mgr.Find_itm(cur_domain, cur_domain);
|
||||
}
|
||||
public void Multi_sorts_bry_(byte[] v) {
|
||||
@ -41,7 +41,7 @@ public class Xoapi_search implements GfoInvkAble, GfoEvMgrOwner {
|
||||
this.multi_sorts_bry = v;
|
||||
GfoEvMgr_.PubVal(this, Evt_multi_sorts_changed, v);
|
||||
}
|
||||
public Xow_domain_crt_itm[] Multi_sorts_crt(Xow_domain cur_domain) {
|
||||
public Xow_domain_crt_itm[] Multi_sorts_crt(Xow_domain_itm cur_domain) {
|
||||
return multi_sorts_mgr.Find_ary(cur_domain, cur_domain);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
|
@ -20,9 +20,16 @@ import gplx.core.primitives.*;
|
||||
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;}
|
||||
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;}
|
||||
public boolean Uid_supports_js() {
|
||||
switch (uid) {
|
||||
case Uid_gui:
|
||||
case Uid_tcp: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
public byte[] Name() {
|
||||
switch (uid) {
|
||||
case Uid_cmd: return Key_cmd;
|
||||
|
@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.apps; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.consoles.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
public class Xoa_shell implements GfoInvkAble {
|
||||
public Xoa_shell(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
public boolean Fetch_page_exec_async() {return fetch_page_exec_async;} private boolean fetch_page_exec_async = true;
|
||||
@ -29,7 +31,8 @@ public class Xoa_shell implements GfoInvkAble {
|
||||
}
|
||||
private String Fetch_page(GfoMsg m) {
|
||||
String url = m.ReadStr("url");
|
||||
if (String_.Has_at_bgn(url, "//")) url = String_.Replace(url, "//", ""); // NOTE: handle Firefox_addon which sometimes sends urls of the form "//wiki/" when coming from the sidebar; DATE:2015-07-04
|
||||
if (String_.Eq(url, "home")) url = Xoa_url_.Main_page__home_str; // WORKAROUND.ADDON: toolbar button sends "home"; note that Fetch_page is only called from command-line / addon, so "home" should never mean "home" page in current wiki; EX: en.wikipedia.org/wiki/home; DATE:2015-08-18
|
||||
if (String_.Has_at_bgn(url, "//")) url = gplx.core.net.Gfo_protocol_itm.Itm_https.Key_w_colon_str() + url; // WORKAROUND.ADDON: sidebar sends urls of form "//en.wikipedia.org/"; prefix with "https:" so url parser can handle it; DATE:2015-07-05; DATE:2015-08-18
|
||||
return String_.new_u8(app.Gui_mgr().Browser_win().App__retrieve_by_url(url, m.ReadStrOr("output_type", "html")));
|
||||
}
|
||||
private static final String Invk_fetch_page = "fetch_page"
|
||||
|
@ -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.fsys; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_fsys_mgr implements GfoInvkAble {
|
||||
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;
|
||||
@ -31,7 +31,7 @@ public class Xoa_fsys_mgr implements GfoInvkAble {
|
||||
this.cfg_lang_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "lang", "core");
|
||||
this.cfg_wiki_core_dir = bin_xowa_dir.GenSubDir_nest("cfg", "wiki", "core");
|
||||
this.cfg_site_meta_fil = bin_xowa_dir.GenSubDir_nest("cfg", "wiki", "site_meta.sqlite3");
|
||||
this.home_wiki_dir = bin_xowa_dir.GenSubDir_nest("wiki", Xow_domain_.Domain_str_home);
|
||||
this.home_wiki_dir = bin_xowa_dir.GenSubDir_nest("wiki", Xow_domain_itm_.Str__home);
|
||||
}
|
||||
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;
|
||||
|
@ -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.aria2; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.xowa.apps.fsys.*;
|
||||
import gplx.xowa.apps.fsys.*; import gplx.xowa.wmfs.dumps.*;
|
||||
public class Aria2_lib_mgr implements GfoInvkAble {
|
||||
public ProcessAdp Lib() {return lib;} private ProcessAdp lib = new ProcessAdp();
|
||||
public void Init_by_app(Xoae_app app) {
|
||||
@ -27,7 +27,7 @@ public class Aria2_lib_mgr implements GfoInvkAble {
|
||||
, "wiki_abrv", "wiki_date", "wiki_type");
|
||||
}
|
||||
// private Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public void Exec(Xob_dump_file dump_file) {
|
||||
public void Exec(Xowm_dump_file dump_file) {
|
||||
// byte[] args_bry = lib.Args_fmtr().Bld_bry_many(tmp_bfr, dump_file.Wiki_alias(), dump_file.Dump_date(), dump_file.Dump_file_type());
|
||||
// ProcessAdp process = new ProcessAdp().Exe_url_(lib.Exe_url()).Args_str_(String_.new_u8(args_bry));
|
||||
// process.Run_wait();
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.cmds.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.dbs.*; import gplx.dbs.cfgs.*; import gplx.dbs.engines.sqlite.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*; import gplx.xowa.dbs.*; import gplx.fsdb.*; import gplx.ios.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.data.*; import gplx.xowa.dbs.*; import gplx.fsdb.*; import gplx.ios.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.files.bins.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.fsdb.data.*; import gplx.fsdb.meta.*;
|
||||
public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
@ -181,7 +181,7 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
tier_id_val = fsdb.Lnki_tier_id();
|
||||
page_id_val = fsdb.Lnki_page_id();
|
||||
lnki_id_val = fsdb.Lnki_id();
|
||||
fsdb.Orig_repo_name_(fsdb.Orig_repo_id() == Xof_repo_itm_.Repo_local ? wiki.Domain_bry() : Xow_domain_.Domain_bry_commons);
|
||||
fsdb.Orig_repo_name_(fsdb.Orig_repo_id() == Xof_repo_itm_.Repo_local ? wiki.Domain_bry() : Xow_domain_itm_.Bry__commons);
|
||||
Download_exec(fsdb);
|
||||
++exec_count;
|
||||
if (exec_count % progress_interval == 0) Print_progress(fsdb);
|
||||
@ -226,13 +226,10 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
finally {src_rdr.Rls();}
|
||||
}
|
||||
private void Make_trg_bin_file(boolean try_nth, Xodb_tbl_oimg_xfer_itm fsdb, long src_rdr_len) {
|
||||
boolean make = true, txn_bgn = true;
|
||||
if (trg_bin_fil != null) { // pre-existing bin_file;
|
||||
if (trg_mnt_itm.Db_mgr().File__solo_file())
|
||||
txn_bgn = false; // solo file; do nothing
|
||||
else
|
||||
trg_bin_fil.Conn().Txn_end(); // close txn before making new db
|
||||
}
|
||||
boolean is_solo = trg_mnt_itm.Db_mgr().File__solo_file();
|
||||
boolean make = true, use_txn = !is_solo; // solo file; should never open txn
|
||||
if (trg_bin_fil != null && use_txn) // pre-existing bin_file;
|
||||
trg_bin_fil.Conn().Txn_end(); // close txn before making new db
|
||||
int tier_id = fsdb.Lnki_tier_id();
|
||||
Xob_bin_db_itm nth_bin_db = bin_db_mgr.Get_nth_by_tier(tier_id);
|
||||
if (try_nth) { // try_nth is true; occurs for new runs or changed tier
|
||||
@ -256,7 +253,7 @@ public class Xob_fsdb_make_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
this.trg_bin_fil = trg_mnt_itm.Bin_mgr().Dbs__get_at(nth_bin_db.Id());
|
||||
trg_bin_fil.Bin_len_(nth_bin_db.Db_len());
|
||||
}
|
||||
if (txn_bgn)
|
||||
if (use_txn)
|
||||
trg_bin_fil.Conn().Txn_bgn("bldr__fsdb_make__trg_bin_fil");
|
||||
}
|
||||
private void Txn_sav() {
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.cmds.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.dbs.*; import gplx.dbs.cfgs.*; import gplx.xowa.wikis.data.tbls.*; import gplx.xowa.pages.*;
|
||||
import gplx.xowa.files.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.parsers.lnkis.redlinks.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.html.hdumps.bldrs.*; import gplx.xowa.xtns.scribunto.*; import gplx.xowa.xtns.wdatas.*;
|
||||
import gplx.fsdb.meta.*; import gplx.xowa.files.fsdb.*; import gplx.fsdb.*;
|
||||
public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink_logger {
|
||||
@ -49,7 +49,7 @@ public class Xob_lnki_temp_wkr extends Xob_dump_mgr_base implements Xopg_redlink
|
||||
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__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);
|
||||
commons_wiki = app.Wiki_mgr().Get_by_key_or_make(Xow_domain_itm_.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
|
||||
invoke_wkr = this.Invoke_wkr(); // set member reference
|
||||
|
@ -16,7 +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.bldrs.cmds.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.dbs.*; import gplx.xowa.wikis.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xob_orig_regy_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
private boolean repo_0_is_remote = false;
|
||||
public Xob_orig_regy_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki);}
|
||||
@ -25,7 +26,7 @@ public class Xob_orig_regy_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public void Cmd_bgn(Xob_bldr bldr) {
|
||||
Db_conn conn = Xob_db_file.new__file_make(wiki.Fsys_mgr().Root_dir()).Conn();
|
||||
Xob_orig_regy_tbl.Create_table(conn);
|
||||
Xowe_wiki commons_wiki = bldr.App().Wiki_mgr().Get_by_key_or_make(Xow_domain_.Domain_bry_commons).Init_assert();
|
||||
Xowe_wiki commons_wiki = bldr.App().Wiki_mgr().Get_by_key_or_make(Xow_domain_itm_.Bry__commons).Init_assert();
|
||||
Xowe_wiki repo_0 = wiki, repo_1 = commons_wiki;
|
||||
if (repo_0_is_remote) { // NOTE: default is false; local_wiki will be preferred over commons_wiki
|
||||
repo_0 = commons_wiki;
|
||||
|
@ -16,7 +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.bldrs.cmds.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.dbs.*; import gplx.xowa.wikis.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.dbs.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.dbs.engines.sqlite.*;
|
||||
class Xob_orig_regy_tbl {
|
||||
public static void Create_table(Db_conn p) {Sqlite_engine_.Tbl_create_and_delete(p, Tbl_name, Tbl_sql);}
|
||||
@ -30,7 +31,7 @@ class Xob_orig_regy_tbl {
|
||||
boolean local_is_remote = Bry_.Eq(repo_0_wiki.Domain_bry(), repo_1_wiki.Domain_bry());
|
||||
Xowe_wiki local_wiki = repo_0_wiki;
|
||||
if ( repo_0_is_remote // .gfs manually marked specifes repo_0 as remote
|
||||
|| ( Bry_.Eq(repo_0_wiki.Domain_bry(), Xow_domain_.Domain_bry_commons) // repo_0 = commons; force repo_0 to be remote; else all orig_repo will be 1; DATE:2014-02-01
|
||||
|| ( Bry_.Eq(repo_0_wiki.Domain_bry(), Xow_domain_itm_.Bry__commons) // repo_0 = commons; force repo_0 to be remote; else all orig_repo will be 1; DATE:2014-02-01
|
||||
&& local_is_remote // repo_0 = repo_1
|
||||
)
|
||||
) {
|
||||
|
@ -16,14 +16,15 @@ 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.files; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.dbs.*; import gplx.xowa.wikis.*; import gplx.dbs.engines.sqlite.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.dbs.*; import gplx.dbs.engines.sqlite.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xob_page_regy_cmd extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public Xob_page_regy_cmd(Xob_bldr bldr, Xowe_wiki wiki) {this.Cmd_ctor(bldr, wiki);}
|
||||
private boolean build_commons = false;
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_file_page_regy;}
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {
|
||||
Xowe_wiki commons_wiki = bldr.App().Wiki_mgr().Get_by_key_or_make(Xow_domain_.Domain_bry_commons).Init_assert();
|
||||
Xowe_wiki commons_wiki = bldr.App().Wiki_mgr().Get_by_key_or_make(Xow_domain_itm_.Bry__commons).Init_assert();
|
||||
Db_conn page_regy_provider = Xob_db_file.new__page_regy(commons_wiki.Fsys_mgr().Root_dir()).Conn();
|
||||
commons_wiki.Init_assert();
|
||||
if (build_commons) {
|
||||
|
@ -26,6 +26,7 @@ public class Xob_xfer_regy_update_cmd extends Xob_itm_basic_base implements Xob_
|
||||
public void Cmd_end() {}
|
||||
public void Cmd_term() {}
|
||||
private void Exec_main() {
|
||||
wiki.Init_assert(); // NOTE: must init wiki to set up db_core; DATE:2015-08-17
|
||||
Db_conn make_db_provider = Xob_db_file.new__file_make(wiki.Fsys_mgr().Root_dir()).Conn();
|
||||
this.Copy_atrs_to_make_db(make_db_provider);
|
||||
this.Update_status(make_db_provider);
|
||||
|
@ -16,8 +16,9 @@ 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.xowa.wikis.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.xmls.*;
|
||||
import gplx.xowa.xtns.wdatas.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.xmls.*;
|
||||
import gplx.xowa.bldrs.css.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public abstract class Xob_init_base implements Xob_cmd, GfoInvkAble {
|
||||
private Xob_bldr bldr; private Xowe_wiki wiki; private Gfo_usr_dlg usr_dlg;
|
||||
private byte wbase_enabled = Bool_.__byte;
|
||||
@ -27,7 +28,7 @@ public abstract class Xob_init_base implements Xob_cmd, GfoInvkAble {
|
||||
public abstract void Cmd_run_end(Xowe_wiki wiki);
|
||||
public void Cmd_init(Xob_bldr bldr) { // add other cmds; EX: wikidata
|
||||
bldr.Import_marker().Bgn(wiki);
|
||||
if (wbase_enabled == Bool_.__byte) wbase_enabled = wiki.Domain_tid() == Xow_domain_type_.Tid_wikidata ? Bool_.Y_byte : Bool_.N_byte; // if wbase_enabled not explicitly set, set it to y if wiki is "www.wikidata.org"
|
||||
if (wbase_enabled == Bool_.__byte) wbase_enabled = wiki.Domain_tid() == Xow_domain_type_.Int__wikidata ? Bool_.Y_byte : Bool_.N_byte; // if wbase_enabled not explicitly set, set it to y if wiki is "www.wikidata.org"
|
||||
if (wbase_enabled == Bool_.Y_byte) // if wbase_enabled, auto-add wdata_wkrs bldr
|
||||
this.Cmd_ini_wdata(bldr, wiki);
|
||||
}
|
||||
|
@ -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.bldrs.cmds.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.cmds.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.wmfs.dumps.*;
|
||||
public class Xob_core_batch_utl implements GfoInvkAble {
|
||||
public Xob_core_batch_utl(Xob_bldr bldr, byte[] raw) {this.bldr = bldr; fmtr.Fmt_(raw);} private Xob_bldr bldr;
|
||||
Bry_fmtr fmtr = Bry_fmtr.keys_("bz2_fil", "wiki_key");
|
||||
private final Xob_bldr bldr;
|
||||
private final Bry_fmtr fmtr = Bry_fmtr.keys_("bz2_fil", "wiki_key");
|
||||
public Xob_core_batch_utl(Xob_bldr bldr, byte[] raw) {this.bldr = bldr; fmtr.Fmt_(raw);}
|
||||
private void Run() {
|
||||
Io_url[] bz2_fils = Io_mgr.I.QueryDir_fils(bldr.App().Fsys_mgr().Wiki_dir().GenSubDir_nest(Dir_dump, "todo"));
|
||||
Bry_bfr bfr = Bry_bfr.reset_(Io_mgr.Len_kb);
|
||||
int bz2_fils_len = bz2_fils.length;
|
||||
Xow_wiki_alias bz2_fil = new Xow_wiki_alias();
|
||||
for (int i = 0; i < bz2_fils_len; i++) {
|
||||
Io_url bz2_fil_url = bz2_fils[i];
|
||||
bz2_fil.Fil_(bz2_fil_url).Parse(bz2_fil_url.NameOnly());
|
||||
fmtr.Bld_bfr_many(bfr, bz2_fil_url.Raw(), bz2_fil.Domain());
|
||||
bldr.Usr_dlg().Note_many("", "", "starting script for ~{0}", String_.new_u8(bz2_fil.Domain()));
|
||||
Xowm_dump_file dump_file = Xowm_dump_file_.parse(Bry_.new_u8(bz2_fil_url.NameOnly()));
|
||||
String domain_str = dump_file.Domain_itm().Domain_str();
|
||||
fmtr.Bld_bfr_many(bfr, bz2_fil_url.Raw(), domain_str);
|
||||
bldr.Usr_dlg().Note_many("", "", "starting script for ~{0}", domain_str);
|
||||
bldr.App().Gfs_mgr().Run_str(bfr.Xto_str_and_clear());
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ 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.dbs.*; import gplx.ios.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.xowa.wmfs.dumps.*;
|
||||
public class Xob_download_wkr extends Xob_itm_basic_base implements Xob_cmd {
|
||||
private String dump_date = "latest";
|
||||
private String dump_type = null;
|
||||
@ -28,7 +29,7 @@ public class Xob_download_wkr extends Xob_itm_basic_base implements Xob_cmd {
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {
|
||||
if (dump_type == null) throw Err_.new_wo_type("dump_type must be specified");
|
||||
Xob_dump_file dump_file = Xob_dump_file.new_(wiki.Domain_str(), dump_date, dump_type);
|
||||
Xowm_dump_file dump_file = new Xowm_dump_file(wiki.Domain_str(), dump_date, dump_type);
|
||||
if (dump_src == null) {
|
||||
dump_file.Server_url_(app.Setup_mgr().Dump_mgr().Server_urls()[0]);
|
||||
dump_src = dump_file.File_url();
|
||||
|
@ -21,14 +21,25 @@ import gplx.xowa.wmfs.*; import gplx.xowa.wmfs.data.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xob_site_meta_cmd implements Xob_cmd {
|
||||
private final Xob_bldr bldr;
|
||||
private String[] wikis; private Io_url db_url; private DateAdp cutoff_time;
|
||||
public Xob_site_meta_cmd(Xob_bldr bldr, Xow_wiki wiki) {this.bldr = bldr;}
|
||||
public String Cmd_key() {return Xob_cmd_keys.Key_site_meta;}
|
||||
public void Cmd_run() {
|
||||
Site_meta_itm.Build_site_meta(bldr.App().Wmf_mgr(), bldr.App().Fsys_mgr().Cfg_site_meta_fil(), Xow_wmf_api_mgr.Wikis, DateAdp_.Now());
|
||||
if (wikis == null) wikis = Xow_wmf_api_mgr.Wikis;
|
||||
if (db_url == null) db_url = bldr.App().Fsys_mgr().Cfg_site_meta_fil();
|
||||
if (cutoff_time == null) cutoff_time = DateAdp_.Now().Add_day(-1);
|
||||
Site_meta_itm.Build_site_meta(bldr.App().Wmf_mgr(), db_url, wikis, cutoff_time);
|
||||
}
|
||||
public void Cmd_init(Xob_bldr bldr) {}
|
||||
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_db_url_)) this.db_url = m.ReadIoUrl("v");
|
||||
else if (ctx.Match(k, Invk_wikis_)) this.wikis = m.ReadStrAry("v", "\n");
|
||||
else if (ctx.Match(k, Invk_cutoff_time_)) this.cutoff_time = m.ReadDate("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static String Invk_db_url_ = "db_url_", Invk_wikis_ = "wikis_", Invk_cutoff_time_ = "cutoff_time_";
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.css; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.ios.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.xowa.files.downloads.*;
|
||||
import gplx.core.net.*;
|
||||
public class Xoa_css_extractor {
|
||||
@ -49,7 +49,7 @@ public class Xoa_css_extractor {
|
||||
Io_url css_comm_fil = wiki_html_dir.GenSubFil(Css_common_name);
|
||||
Io_url css_wiki_fil = wiki_html_dir.GenSubFil(Css_wiki_name);
|
||||
wiki.Html__page_wtr_mgr().Init_css_urls(css_comm_fil, css_wiki_fil);
|
||||
if (wiki.Domain_tid() == Xow_domain_type_.Tid_home || Env_.Mode_testing()) return; // NOTE: do not download if home_wiki; also needed for TEST
|
||||
if (wiki.Domain_tid() == Xow_domain_type_.Int__home || Env_.Mode_testing()) return; // NOTE: do not download if home_wiki; also needed for TEST
|
||||
if (Io_mgr.I.ExistsFil(css_wiki_fil)) return; // css file exists; nothing to generate
|
||||
if (wiki.Html__css_installing()) return;
|
||||
wiki.Html__css_installing_(true);
|
||||
@ -200,7 +200,7 @@ public class Xoa_css_extractor {
|
||||
}
|
||||
private byte[] Mainpage_download_html() {
|
||||
String main_page_url_temp = mainpage_url;
|
||||
if (Bry_.Eq(wiki_domain, Xow_domain_.Domain_bry_wikidata)) // if wikidata, download css for a Q* page; Main_Page has less css; DATE:2014-09-30
|
||||
if (Bry_.Eq(wiki_domain, Xow_domain_itm_.Bry__wikidata)) // if wikidata, download css for a Q* page; Main_Page has less css; DATE:2014-09-30
|
||||
main_page_url_temp = main_page_url_temp + "/wiki/Q2";
|
||||
String log_msg = usr_dlg.Prog_many("", "main_page.download", "downloading main page for '~{0}'", main_page_url_temp);
|
||||
byte[] main_page_html = download_xrg.Prog_fmt_hdr_(log_msg).Exec_as_bry(main_page_url_temp);
|
||||
|
@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.bldrs.xmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.core.xmls.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xob_xml_dumper {
|
||||
private final Gfo_xml_wtr wtr = new Gfo_xml_wtr();
|
||||
public String Bld_str() {return wtr.Bld_str();}
|
||||
public void Write_root_bgn(Xow_ns_mgr ns_mgr, Xow_domain domain, String wiki_abrv, String main_page, String ns_case, String app_version) {
|
||||
public void Write_root_bgn(Xow_ns_mgr ns_mgr, Xow_domain_itm domain, String wiki_abrv, String main_page, String ns_case, String app_version) {
|
||||
wtr.Nde_lhs_bgn_grp("mediawiki");
|
||||
wtr.Atr_kv_str_a7("xmlns" , "http://www.mediawiki.org/xml/export-0.10/");
|
||||
wtr.Atr_kv_str_a7("xmlns:xsi" , "http://www.w3.org/2001/XMLSchema-instance");
|
||||
@ -35,9 +35,9 @@ public class Xob_xml_dumper {
|
||||
public void Write_root_end() {
|
||||
wtr.Nde_rhs();
|
||||
}
|
||||
private void Write_siteinfo(Xow_domain domain, String wiki_abrv, String main_page, String ns_case, String app_version) {
|
||||
private void Write_siteinfo(Xow_domain_itm domain, String wiki_abrv, String main_page, String ns_case, String app_version) {
|
||||
wtr.Nde_lhs("siteinfo");
|
||||
wtr.Nde_txt_bry("sitename" , Xow_domain_type_.Get_type_as_bry(domain.Domain_tid()));
|
||||
wtr.Nde_txt_bry("sitename" , Xow_domain_type_.Get_type_as_bry(domain.Domain_type_id()));
|
||||
wtr.Nde_txt_str("dbname" , wiki_abrv);
|
||||
wtr.Nde_txt_str("base" , main_page);
|
||||
wtr.Nde_txt_str("generator" , app_version);
|
||||
|
@ -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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_cfg_grp {
|
||||
public Xoa_cfg_grp(Xoa_cfg_mgr mgr, Xoa_cfg_grp_tid tid, byte[] key_bry) {
|
||||
this.mgr = mgr; this.tid = tid; this.key_bry = key_bry; this.key_str = String_.new_u8(key_bry);
|
||||
|
@ -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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_cfg_grp_tid {
|
||||
public byte Tid() {return tid;} private byte tid;
|
||||
public byte[] Key() {return key;} private byte[] key;
|
||||
@ -31,12 +31,12 @@ public class Xoa_cfg_grp_tid {
|
||||
if (Bry_.Eq(key, Key_all_bry)) rv.tid = Tid_all;
|
||||
else if (Bry_.Eq(key, Key_app_bry)) rv.tid = Tid_app;
|
||||
else {
|
||||
Xow_domain wiki_type = Xow_domain_.parse(key);
|
||||
if (wiki_type.Domain_tid() == Xow_domain_type_.Tid_other)
|
||||
Xow_domain_itm wiki_type = Xow_domain_itm_.parse(key);
|
||||
if (wiki_type.Domain_type_id() == Xow_domain_type_.Int__other)
|
||||
rv.tid = Tid_wiki;
|
||||
else {
|
||||
rv.tid = Tid_type;
|
||||
rv.wiki_tid = wiki_type.Domain_tid();
|
||||
rv.wiki_tid = wiki_type.Domain_type_id();
|
||||
}
|
||||
}
|
||||
rv.key = key;
|
||||
|
@ -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.cfgs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoa_cfg_mgr implements GfoInvkAble {
|
||||
public Xoa_cfg_mgr(Xoae_app app) {this.app = app;} private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
public Xoae_app App() {return app;} private Xoae_app app;
|
||||
|
@ -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.dbs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.tdbs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.tdbs.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xodb_save_mgr_txt implements Xodb_save_mgr {
|
||||
public Xodb_save_mgr_txt(Xowe_wiki wiki, Xodb_load_mgr_txt load_mgr) {
|
||||
this.wiki = wiki;
|
||||
@ -59,7 +59,7 @@ public class Xodb_save_mgr_txt implements Xodb_save_mgr {
|
||||
}
|
||||
public void Data_update(Xoae_page page, byte[] text) {Data_update_under(page, text, null);}
|
||||
public void Data_rename(Xoae_page page, int trg_ns, byte[] trg_ttl) {
|
||||
if (wiki.Domain_tid() != Xow_domain_type_.Tid_home) {
|
||||
if (wiki.Domain_tid() != Xow_domain_type_.Int__home) {
|
||||
wiki.Appe().Usr_dlg().Warn_many("", "", "Only pages in the home wiki can be renamed");
|
||||
return;
|
||||
}
|
||||
|
@ -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.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.files.repos.*;
|
||||
public class Xof_fsdb_itm_fxt {
|
||||
private byte[] wiki_abrv;
|
||||
@ -53,7 +53,7 @@ public class Xof_fsdb_itm_fxt {
|
||||
return this;
|
||||
}
|
||||
public Xof_fsdb_itm_fxt Orig__commons__lnki() {
|
||||
this.orig_repo_name = Xow_domain_.Domain_bry_commons;
|
||||
this.orig_repo_name = Xow_domain_itm_.Bry__commons;
|
||||
this.orig_repo_id = Xof_repo_itm_.Repo_remote;
|
||||
this.orig_ttl = lnki_ttl;
|
||||
this.orig_ext = Xof_ext_.new_by_ttl_(orig_ttl);
|
||||
@ -62,7 +62,7 @@ public class Xof_fsdb_itm_fxt {
|
||||
return this;
|
||||
}
|
||||
public Xof_fsdb_itm_fxt Orig__enwiki__lnki() {
|
||||
this.orig_repo_name = Xow_domain_.Domain_bry_enwiki;
|
||||
this.orig_repo_name = Xow_domain_itm_.Bry__enwiki;
|
||||
this.orig_repo_id = Xof_repo_itm_.Repo_local;
|
||||
this.orig_ttl = lnki_ttl;
|
||||
this.orig_ext = Xof_ext_.new_by_ttl_(orig_ttl);
|
||||
|
@ -29,9 +29,12 @@ public class Xof_img_size {
|
||||
public void Html_size_calc(int exec_tid, int lnki_w, int lnki_h, byte lnki_type, int upright_patch, double lnki_upright, int orig_ext, int orig_w, int orig_h, int thm_dflt_w) {
|
||||
synchronized (this) {
|
||||
this.Clear(); // always clear before calc; caller should be responsible, but just to be safe.
|
||||
if (Xof_ext_.Id_supports_time(orig_ext) && lnki_w == Xof_img_size.Null) // use orig_w if no size specified for video; EX:[[File:A.ogv]] -> [[File:A.ogv|550px]] where 550px is orig_w; DATE:2015-08-07
|
||||
lnki_w = orig_w;
|
||||
if (Enm_.HasInt(lnki_type, Xop_lnki_type.Id_frame) // frame: always return orig size; Linker.php!makeThumbLink2; // Use image dimensions, don't scale
|
||||
if ( Xof_ext_.Id_supports_time(orig_ext) // ext is video
|
||||
&& lnki_w == Xof_img_size.Null // no size specified
|
||||
&& !Xop_lnki_type.Id_is_thumbable(lnki_type) // not thumb which is implicitly 220; PAGE:en.w:Edward_Snowden; DATE:2015-08-17
|
||||
)
|
||||
lnki_w = orig_w; // use original size; EX:[[File:A.ogv]] -> [[File:A.ogv|550px]] where 550px is orig_w; DATE:2015-08-07
|
||||
if (Enm_.Has_int(lnki_type, Xop_lnki_type.Id_frame) // frame: always return orig size; Linker.php!makeThumbLink2; // Use image dimensions, don't scale
|
||||
&& lnki_h == Null) { // unless lnki_h specified; DATE:2013-12-22
|
||||
html_w = file_w = orig_w;
|
||||
html_h = file_h = orig_h;
|
||||
|
@ -81,6 +81,9 @@ public class Xof_img_size_tst {
|
||||
@Test public void Video__use_orig_w(){ // PURPOSE: video should use orig_w; DATE:2015-08-07
|
||||
fxt.Lnki_type_(Xop_lnki_type.Id_none).Lnki_ext_(Xof_ext_.Id_ogv).Lnki_(-1, -1).Orig_(500, 250).Test_html(500, 250, Bool_.N);
|
||||
}
|
||||
@Test public void Video__use_thumb(){ // PURPOSE: video should use thumb_w, not orig_w; PAGE:en.w:Edward_Snowden DATE:2015-08-17
|
||||
fxt.Lnki_type_(Xop_lnki_type.Id_thumb).Lnki_ext_(Xof_ext_.Id_ogv).Lnki_(-1, -1).Orig_(440, 220).Test_html(220, 110, Bool_.N);
|
||||
}
|
||||
}
|
||||
class Xof_img_size_fxt {
|
||||
private Xof_img_size img_size = new Xof_img_size();
|
||||
|
@ -20,11 +20,11 @@ public class Xof_patch_upright_tid_ {
|
||||
public static final int Tid_unpatched = 0, Tid_use_thumb_w = 1, Tid_fix_default = 2;
|
||||
public static final int Tid_all = Tid_use_thumb_w | Tid_fix_default;
|
||||
public static int Merge(boolean use_thumb_w, boolean fix_default) {
|
||||
if (use_thumb_w && fix_default) return Enm_.AddInt(Tid_use_thumb_w, Tid_fix_default);
|
||||
if (use_thumb_w && fix_default) return Enm_.Add_int(Tid_use_thumb_w, Tid_fix_default);
|
||||
else if (use_thumb_w) return Tid_use_thumb_w;
|
||||
else if (fix_default) return Tid_fix_default;
|
||||
else return Tid_unpatched;
|
||||
}
|
||||
public static boolean Split_use_thumb_w(int tid) {return Enm_.HasInt(tid, Tid_use_thumb_w);}
|
||||
public static boolean Split_fix_default(int tid) {return Enm_.HasInt(tid, Tid_fix_default);}
|
||||
public static boolean Split_use_thumb_w(int tid) {return Enm_.Has_int(tid, Tid_use_thumb_w);}
|
||||
public static boolean Split_fix_default(int tid) {return Enm_.Has_int(tid, Tid_fix_default);}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package gplx.xowa.files.bins; import gplx.*; import gplx.xowa.*; import gplx.xow
|
||||
import gplx.ios.*; import gplx.core.threads.*;
|
||||
import gplx.xowa.apps.*;
|
||||
import gplx.xowa.files.fsdb.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
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 Io_download_mgr download_mgr;
|
||||
@ -38,11 +38,11 @@ public class Xof_bin_wkr__http_wmf implements Xof_bin_wkr {
|
||||
if (!rv) {
|
||||
Handle_error();
|
||||
if (!rv && fsdb.Orig_repo_id() == Xof_repo_itm_.Repo_local) { // image is not found in local; check commons; occurs with bldr which relies on inaccurate data in image dumps; PAGE:en.w:Apollo_13; DATE:2015-08-05
|
||||
src = Make_src(Xow_domain_.Domain_bry_commons, fsdb.Orig_ttl(), fsdb.Orig_ttl_md5(), fsdb.Orig_ext(), is_thumb, w, fsdb.Lnki_time(), fsdb.Lnki_page(), Io_url_.Empty);
|
||||
src = Make_src(Xow_domain_itm_.Bry__commons, fsdb.Orig_ttl(), fsdb.Orig_ttl_md5(), fsdb.Orig_ext(), is_thumb, w, fsdb.Lnki_time(), fsdb.Lnki_page(), Io_url_.Empty);
|
||||
rdr = download_mgr.Download_as_rdr(src);
|
||||
rv = rdr.Exists();
|
||||
if (rv)
|
||||
fsdb.Change_repo(Xof_repo_itm_.Repo_remote, Xow_domain_.Domain_bry_commons); // set commons.wikimedia.org; DATE:2015-08-05
|
||||
fsdb.Change_repo(Xof_repo_itm_.Repo_remote, Xow_domain_itm_.Bry__commons); // set commons.wikimedia.org; DATE:2015-08-05
|
||||
else
|
||||
Handle_error();
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class Xou_cache_mgr {
|
||||
Xoa_app_.Usr_dlg().Note_many("", "", "cache compress done");
|
||||
}
|
||||
private Io_url Calc_url(Xou_cache_itm cache) {
|
||||
byte[] wiki_domain = Xow_domain_abrv_xo_.To_itm(cache.Lnki_wiki_abrv()).Domain_bry();
|
||||
byte[] wiki_domain = Xow_abrv_xo_.To_itm(cache.Lnki_wiki_abrv()).Domain_bry();
|
||||
Xow_wiki wiki = wiki_mgr.Get_by_key_or_make_init_y(wiki_domain); if (wiki == null) return Io_url_.Empty; // wiki is not available; should only happen in read-only mode; DATE:2015-05-23
|
||||
Xof_repo_itm trg_repo = wiki.File__repo_mgr().Get_trg_by_id_or_null(cache.Orig_repo_id(), cache.Lnki_ttl(), Bry_.Empty);
|
||||
if (trg_repo == null) return Io_url_.Empty;
|
||||
|
@ -25,11 +25,15 @@ public class Fs_root_fsdb_mgr implements Xof_fsdb_mgr, GfoInvkAble { // read ima
|
||||
public void Init_by_wiki(Xow_wiki wiki) {this.wiki = (Xowe_wiki)wiki;}
|
||||
public void Fsdb_search_by_list(List_adp itms, Xow_wiki wiki, Xoa_page page, Xog_js_wkr js_wkr) {
|
||||
int itms_len = itms.Count();
|
||||
// Xou_cache_mgr cache_mgr = wiki.App().User().User_db_mgr().Cache_mgr(); // repo_id is 127; DATE:2015-08-23
|
||||
for (int i = 0; i < itms_len; i++) {
|
||||
Xof_fsdb_itm itm = (Xof_fsdb_itm)itms.Get_at(i);
|
||||
if (fsdb_wkr.Find_file(itm))
|
||||
if (fsdb_wkr.Find_file(itm)) {
|
||||
Js_img_mgr.Update_img(page, js_wkr, itm);
|
||||
// cache_mgr.Update(itm);
|
||||
}
|
||||
}
|
||||
// cache_mgr.Db_save();
|
||||
}
|
||||
private Io_url Xto_url(byte[] v) {
|
||||
if (Op_sys.Cur().Tid_is_wnt())
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.fsdb.tsts; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*; import gplx.xowa.files.fsdb.*;
|
||||
import gplx.fsdb.*; import gplx.fsdb.meta.*; import gplx.dbs.*; import gplx.xowa.files.origs.*; import gplx.xowa.files.bins.*; import gplx.xowa.files.cnvs.*; import gplx.xowa.files.exts.*; import gplx.xowa.files.gui.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.files.repos.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.files.repos.*; import gplx.xowa.wikis.data.*;
|
||||
import gplx.fsdb.data.*;
|
||||
class Xof_file_fxt {
|
||||
private Xoae_app app; private Xof_fsdb_mgr__sql fsdb_mgr; private Xowe_wiki wiki; private Xof_orig_mgr orig_mgr;
|
||||
@ -84,10 +84,10 @@ class Xof_repo_fxt {
|
||||
byte[] src_en_wiki = Bry_.new_a7("src_en_wiki");
|
||||
byte[] trg_commons = Bry_.new_a7("trg_commons");
|
||||
byte[] trg_en_wiki = Bry_.new_a7("trg_en_wiki");
|
||||
Ini_repo_add(file_mgr, src_commons, "mem/src/commons.wikimedia.org/", Xow_domain_.Domain_str_commons, false);
|
||||
Ini_repo_add(file_mgr, src_en_wiki, "mem/src/en.wikipedia.org/" , Xow_domain_.Domain_str_enwiki, false);
|
||||
Ini_repo_add(file_mgr, trg_commons, "mem/root/common/", Xow_domain_.Domain_str_commons, true).Primary_(true);
|
||||
Ini_repo_add(file_mgr, trg_en_wiki, "mem/root/enwiki/", Xow_domain_.Domain_str_enwiki, true).Primary_(true);
|
||||
Ini_repo_add(file_mgr, src_commons, "mem/src/commons.wikimedia.org/", Xow_domain_itm_.Str__commons, false);
|
||||
Ini_repo_add(file_mgr, src_en_wiki, "mem/src/en.wikipedia.org/" , Xow_domain_itm_.Str__enwiki, false);
|
||||
Ini_repo_add(file_mgr, trg_commons, "mem/root/common/", Xow_domain_itm_.Str__commons, true).Primary_(true);
|
||||
Ini_repo_add(file_mgr, trg_en_wiki, "mem/root/enwiki/", Xow_domain_itm_.Str__enwiki, true).Primary_(true);
|
||||
Xowe_repo_mgr wiki_repo_mgr = wiki.File_mgr().Repo_mgr();
|
||||
Xof_repo_pair pair = null;
|
||||
pair = wiki_repo_mgr.Add_repo(src_commons, trg_commons);
|
||||
@ -136,14 +136,14 @@ class Xof_fsdb_arg {
|
||||
public byte[] Bin() {return bin;} private final byte[] bin;
|
||||
public DateAdp Modified() {return modified;} private final DateAdp modified = Fsd_thm_tbl.Modified_null;
|
||||
public String Hash() {return hash;} private final String hash = Fsd_thm_tbl.Hash_null;
|
||||
public static Xof_fsdb_arg new_comm_file(String ttl) {return new_(Xow_domain_.Domain_bry_commons, Bool_.N, ttl, Xof_img_size.Null, Xof_img_size.Null, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm_thumb(String ttl) {return new_(Xow_domain_.Domain_bry_commons, Bool_.Y, ttl, W_default, H_default, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm_thumb(String ttl, int w, int h) {return new_(Xow_domain_.Domain_bry_commons, Bool_.Y, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm_thumb(String ttl, int w, int h, int s) {return new_(Xow_domain_.Domain_bry_commons, Bool_.Y, ttl, w, h, s);}
|
||||
public static Xof_fsdb_arg new_comm_orig(String ttl, int w, int h) {return new_(Xow_domain_.Domain_bry_commons, Bool_.N, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm(boolean thumb, String ttl, int w, int h) {return new_(Xow_domain_.Domain_bry_commons, thumb, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_wiki_thumb(String ttl, int w, int h) {return new_(Xow_domain_.Domain_bry_enwiki, Bool_.Y, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_wiki_orig(String ttl, int w, int h) {return new_(Xow_domain_.Domain_bry_enwiki, Bool_.N, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm_file(String ttl) {return new_(Xow_domain_itm_.Bry__commons, Bool_.N, ttl, Xof_img_size.Null, Xof_img_size.Null, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm_thumb(String ttl) {return new_(Xow_domain_itm_.Bry__commons, Bool_.Y, ttl, W_default, H_default, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm_thumb(String ttl, int w, int h) {return new_(Xow_domain_itm_.Bry__commons, Bool_.Y, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm_thumb(String ttl, int w, int h, int s) {return new_(Xow_domain_itm_.Bry__commons, Bool_.Y, ttl, w, h, s);}
|
||||
public static Xof_fsdb_arg new_comm_orig(String ttl, int w, int h) {return new_(Xow_domain_itm_.Bry__commons, Bool_.N, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_comm(boolean thumb, String ttl, int w, int h) {return new_(Xow_domain_itm_.Bry__commons, thumb, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_wiki_thumb(String ttl, int w, int h) {return new_(Xow_domain_itm_.Bry__enwiki, Bool_.Y, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_wiki_orig(String ttl, int w, int h) {return new_(Xow_domain_itm_.Bry__enwiki, Bool_.N, ttl, w, h, Xof_lnki_time.Null_as_int);}
|
||||
public static Xof_fsdb_arg new_(byte[] wiki, boolean is_thumb, String ttl_str, int w, int h, int time) {
|
||||
byte[] ttl = Bry_.new_u8(ttl_str);
|
||||
int ext = Xof_ext_.new_by_ttl_(ttl).Id();
|
||||
|
@ -26,7 +26,7 @@ public class Js_img_mgr {
|
||||
html_itm.Html_redlink(html_id);
|
||||
}
|
||||
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, Io_url html_view_url, int orig_w, int orig_h, Io_url html_orig_url, byte[] lnki_ttl, int gallery_mgr_h) {
|
||||
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
|
||||
if (!page.Wiki().App().App_type().Uid_supports_js()) 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_view_url, orig_w, orig_h, html_orig_url, lnki_ttl);
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.repos; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.files.exts.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xof_repo_itm implements GfoInvkAble {
|
||||
private final Xoa_fsys_mgr app_fsys; private final Xof_rule_mgr ext_rule_mgr; private final Bry_bfr tmp_bfr = Bry_bfr.reset_(300);
|
||||
public Xof_repo_itm(byte[] key, Xoa_fsys_mgr app_fsys, Xof_rule_mgr ext_rule_mgr, byte[] wiki_domain) {
|
||||
@ -41,13 +41,13 @@ public class Xof_repo_itm implements GfoInvkAble {
|
||||
public boolean Primary() {return primary;} public Xof_repo_itm Primary_(boolean v) {primary = v; return this;} private boolean primary;
|
||||
public void Wiki_domain_(byte[] v) {
|
||||
this.wiki_domain = v;
|
||||
Xow_domain domain_itm = Xow_domain_.parse(v);
|
||||
Xow_domain_itm domain_itm = Xow_domain_itm_.parse(v);
|
||||
if (domain_itm == null) {
|
||||
Xoa_app_.Usr_dlg().Warn_many("", "", "repo:invalid domain; raw=~{0}", v);
|
||||
this.wiki_abrv_xo = Bry_.Empty;
|
||||
}
|
||||
else
|
||||
this.wiki_abrv_xo = Xow_domain_abrv_xo_.To_bry(v, domain_itm.Lang_itm(), domain_itm.Domain_type());
|
||||
this.wiki_abrv_xo = Xow_abrv_xo_.To_bry(v, domain_itm.Lang_actl_key(), domain_itm.Domain_type());
|
||||
}
|
||||
public Xof_repo_itm Root_str_(String root_str) {
|
||||
this.wmf_fsys = String_.Has_at_bgn(root_str, "http") || String_.Has_at_bgn(root_str, "ftp");
|
||||
|
@ -16,7 +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.files.repos; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.xowa.apps.fsys.*; import gplx.xowa.files.exts.*; import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.apps.fsys.*; import gplx.xowa.files.exts.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xow_repo_mgr_ {
|
||||
public static void Assert_repos(Xoae_app app, Xowe_wiki wiki) {
|
||||
Xoa_repo_mgr repo_mgr = app.File_mgr().Repo_mgr();
|
||||
@ -32,7 +33,7 @@ public class Xow_repo_mgr_ {
|
||||
if (pair_mgr.Repos_len() == 0) { // no pairs defined; add at least 1
|
||||
Xof_repo_itm repo_src = repo_mgr.Get_by(File_repo_xowa_null);
|
||||
if (repo_src == null) {
|
||||
repo_itm = new Xof_repo_itm(File_repo_xowa_null, app_fsys_mgr, ext_rule_mgr, Xow_domain_type_.Key_bry_home);
|
||||
repo_itm = new Xof_repo_itm(File_repo_xowa_null, app_fsys_mgr, ext_rule_mgr, Xow_domain_type_.Bry__home);
|
||||
repo_mgr.Add(repo_itm);
|
||||
}
|
||||
pair_mgr.Add_repo(File_repo_xowa_null, domain_bry);
|
||||
|
@ -16,7 +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.files.repos; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.files.xfers.*;
|
||||
import gplx.xowa.files.xfers.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xowe_repo_mgr implements Xow_repo_mgr, GfoInvkAble {
|
||||
private Xowe_wiki wiki; private final List_adp repos = List_adp_.new_();
|
||||
public Xowe_repo_mgr(Xowe_wiki wiki) {
|
||||
@ -192,7 +193,7 @@ public class Xowe_repo_mgr implements Xow_repo_mgr, GfoInvkAble {
|
||||
Xoa_repo_mgr repo_mgr = wiki.Appe().File_mgr().Repo_mgr();
|
||||
Xof_repo_itm src_repo = repo_mgr.Get_by(src_repo_key), trg_repo = repo_mgr.Get_by(trg_repo_key);
|
||||
byte[] src_wiki_key = src_repo.Wiki_domain(), trg_wiki_key = trg_repo.Wiki_domain();
|
||||
if (!Bry_.Eq(src_wiki_key, trg_wiki_key) && !Bry_.Eq(src_wiki_key, Xow_domain_type_.Key_bry_home)) throw Err_.new_wo_type("wiki keys do not match", "src", String_.new_u8(src_wiki_key), "trg", String_.new_u8(trg_wiki_key));
|
||||
if (!Bry_.Eq(src_wiki_key, trg_wiki_key) && !Bry_.Eq(src_wiki_key, Xow_domain_type_.Bry__home)) throw Err_.new_wo_type("wiki keys do not match", "src", String_.new_u8(src_wiki_key), "trg", String_.new_u8(trg_wiki_key));
|
||||
Xof_repo_pair pair = new Xof_repo_pair((byte)repos.Count(), src_wiki_key, src_repo, trg_repo);
|
||||
repos.Add(pair);
|
||||
return pair;
|
||||
|
@ -65,7 +65,7 @@ public class Xof_xfer_queue {
|
||||
}
|
||||
private void Exec_v2(Xowe_wiki wiki, Xoae_page page) {
|
||||
wiki.File_mgr().Init_file_mgr_by_load(wiki);
|
||||
Xog_js_wkr js_wkr = wiki.App().App_type().Uid_is_gui() ? page.Tab_data().Tab().Html_itm() : Xog_js_wkr_.Noop;
|
||||
Xog_js_wkr js_wkr = wiki.App().App_type().Uid_supports_js() ? page.Tab_data().Tab().Html_itm() : Xog_js_wkr_.Noop;
|
||||
wiki.File_mgr().Fsdb_mgr().Fsdb_search_by_list(Xfer_itms_to_fsdb_itms(wiki, page, xfer_list, wiki.File_mgr().Patch_upright()), wiki, page, js_wkr);
|
||||
}
|
||||
private List_adp Xfer_itms_to_fsdb_itms(Xowe_wiki cur_wiki, Xoae_page page, List_adp xfer_list, int upright_patch) {
|
||||
|
@ -16,7 +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.files.xfers; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.ios.*; import gplx.xowa.wikis.*; import gplx.xowa.files.cnvs.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.files.cnvs.*; import gplx.xowa.files.repos.*;
|
||||
import gplx.xowa.wmfs.apis.*; import gplx.xowa.files.exts.*; import gplx.xowa.files.imgs.*;
|
||||
public class Xof_xfer_queue_base_fxt {
|
||||
public Xoapi_orig_mok Api_size() {return api_size;} private Xoapi_orig_mok api_size = Xoapi_orig_mok._;
|
||||
@ -26,8 +27,8 @@ public class Xof_xfer_queue_base_fxt {
|
||||
Io_mgr.I.InitEngine_mem();
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
en_wiki = Xoa_app_fxt.wiki_(app, Xow_domain_.Domain_str_enwiki);
|
||||
commons = Xoa_app_fxt.wiki_(app, Xow_domain_.Domain_str_commons);
|
||||
en_wiki = Xoa_app_fxt.wiki_(app, Xow_domain_itm_.Str__enwiki);
|
||||
commons = Xoa_app_fxt.wiki_(app, Xow_domain_itm_.Str__commons);
|
||||
app.Wiki_mgr().Add(commons);
|
||||
app.Wiki_mgr().Add(en_wiki);
|
||||
|
||||
@ -40,10 +41,10 @@ public class Xof_xfer_queue_base_fxt {
|
||||
byte[] src_en_wiki = Bry_.new_a7("src_en_wiki");
|
||||
byte[] trg_commons = Bry_.new_a7("trg_commons");
|
||||
byte[] trg_en_wiki = Bry_.new_a7("trg_en_wiki");
|
||||
src_commons_repo = Ini_repo_add(file_mgr, src_commons, "mem/src/commons.wikimedia.org/", Xow_domain_.Domain_str_commons, false);
|
||||
src_en_wiki_repo = Ini_repo_add(file_mgr, src_en_wiki, "mem/src/en.wikipedia.org/" , Xow_domain_.Domain_str_enwiki, false);
|
||||
Ini_repo_add(file_mgr, trg_commons, "mem/trg/commons.wikimedia.org/", Xow_domain_.Domain_str_commons, true).Primary_(true);
|
||||
Ini_repo_add(file_mgr, trg_en_wiki, "mem/trg/en.wikipedia.org/" , Xow_domain_.Domain_str_enwiki, true).Primary_(true);
|
||||
src_commons_repo = Ini_repo_add(file_mgr, src_commons, "mem/src/commons.wikimedia.org/", Xow_domain_itm_.Str__commons, false);
|
||||
src_en_wiki_repo = Ini_repo_add(file_mgr, src_en_wiki, "mem/src/en.wikipedia.org/" , Xow_domain_itm_.Str__enwiki, false);
|
||||
Ini_repo_add(file_mgr, trg_commons, "mem/trg/commons.wikimedia.org/", Xow_domain_itm_.Str__commons, true).Primary_(true);
|
||||
Ini_repo_add(file_mgr, trg_en_wiki, "mem/trg/en.wikipedia.org/" , Xow_domain_itm_.Str__enwiki, true).Primary_(true);
|
||||
Xowe_repo_mgr wiki_repo_mgr = en_wiki.File_mgr().Repo_mgr();
|
||||
Xof_repo_pair pair = null;
|
||||
pair = wiki_repo_mgr.Add_repo(src_commons, trg_commons);
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.files.xfers; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
|
||||
import gplx.core.primitives.*; import gplx.dbs.*;
|
||||
import gplx.ios.*; import gplx.xowa.wikis.*; import gplx.xowa.files.*;
|
||||
import gplx.ios.*; import gplx.xowa.wikis.domains.*; import gplx.xowa.files.*;
|
||||
public class Xof_xfer_queue_html_fxt extends Xof_xfer_queue_base_fxt {
|
||||
private final Xof_xfer_queue queue = new Xof_xfer_queue();
|
||||
@Override public void Clear(boolean src_repo_is_wmf) {
|
||||
@ -41,7 +41,7 @@ public class Xof_xfer_queue_html_fxt extends Xof_xfer_queue_base_fxt {
|
||||
public Xof_xfer_queue_html_fxt Html_orig_src_(String v) {html_orig_src = v; return this;} private String html_orig_src;
|
||||
public Xof_xfer_queue_html_fxt ini_page_api(String wiki_str, String ttl_str, String redirect_str, int orig_w, int orig_h) {return ini_page_api(wiki_str, ttl_str, redirect_str, orig_w, orig_h, true);}
|
||||
public Xof_xfer_queue_html_fxt ini_page_api(String wiki_str, String ttl_str, String redirect_str, int orig_w, int orig_h, boolean pass) {
|
||||
String wiki_key = String_.Eq(wiki_str, "commons") ? Xow_domain_.Domain_str_commons : Xow_domain_.Domain_str_enwiki;
|
||||
String wiki_key = String_.Eq(wiki_str, "commons") ? Xow_domain_itm_.Str__commons : Xow_domain_itm_.Str__enwiki;
|
||||
this.Api_size().Ini(wiki_key, ttl_str, redirect_str, orig_w, orig_h, pass);
|
||||
return this;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class Xog_resizer {
|
||||
private static RectAdp Prv_elem_rect_initial = RectAdp_.Zero, Prv_elem_rect_win_7 = RectAdp_.new_(0, -1, 0, 0);
|
||||
private static void Exec_win_resize_elem(Xog_layout_box box, GfuiElem cur_elem, Rect_ref cur_elem_rect, GfuiElem prv_elem, byte layout) {Exec_win_resize_elem(box, cur_elem, cur_elem_rect, prv_elem.Rect(), layout);}
|
||||
private static void Exec_win_resize_elem(Xog_layout_box box, GfuiElem cur_elem, Rect_ref cur_elem_rect, RectAdp prv_elem_rect, byte layout) {
|
||||
if (ClassAdp_.Eq_typeSafe(cur_elem, GfuiTextBox.class)) {
|
||||
if (Type_adp_.Eq_typeSafe(cur_elem, GfuiTextBox.class)) {
|
||||
try {
|
||||
GfuiTextBox cur_box = (GfuiTextBox)cur_elem;
|
||||
cur_box.Margins_set(0, txt_margin_v, 0, txt_margin_v);
|
||||
@ -88,7 +88,7 @@ public class Xog_resizer {
|
||||
box.Adj_pos(cur_elem_rect);
|
||||
}
|
||||
cur_elem.Rect_set(cur_elem_rect.XtoRectAdp());
|
||||
if (ClassAdp_.Eq_typeSafe(cur_elem, GfuiBtn.class)) {
|
||||
if (Type_adp_.Eq_typeSafe(cur_elem, GfuiBtn.class)) {
|
||||
GfuiBtn cur_btn = (GfuiBtn)cur_elem;
|
||||
cur_btn.Btn_img_(cur_btn.Btn_img());
|
||||
}
|
||||
|
@ -38,7 +38,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.App_type().Uid_is_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);
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, html_box, win, Xog_win_itm.Invk_exit, IptKey_.add_(IptKey_.Alt, IptKey_.F4)); // WORKAROUND:SWT: xulrunner_v24 no longer sends Alt+F4 to SwtShell; must manually subscribe it to quit; DATE:2015-07-31
|
||||
|
@ -249,36 +249,24 @@ public class Xog_win_itm implements GfoInvkAble, GfoEvObj {
|
||||
public byte[] App__retrieve_by_url(String url_str, String output_str) {
|
||||
synchronized (App__retrieve__lock) {
|
||||
boolean output_html = String_.Eq(output_str, "html");
|
||||
byte[] url_bry = Bry_.new_u8(url_str);
|
||||
Xowe_wiki home_wiki = app.Usere().Wiki();
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(home_wiki, Xoa_page_.Main_page_bry); // NOTE: must be Main_Page, not "" else Firefox Addon will fail; DATE:2014-03-13
|
||||
Xoae_page new_page = Xoae_page.new_(home_wiki, ttl);
|
||||
Xoa_url url = home_wiki.Utl__url_parser().Parse_by_urlbar(url_str);
|
||||
Xowe_wiki wiki = (Xowe_wiki)app.Wiki_mgr().Get_by_key_or_make_init_y(url.Wiki_bry());
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, url.Page_bry());
|
||||
Xoae_page new_page = wiki.Load_page_by_ttl(url, ttl);
|
||||
if (new_page.Missing()) {return Bry_.Empty;}
|
||||
gplx.xowa.servers.Gxw_html_server.Assert_tab(app, new_page); // HACK: assert at least 1 tab for Firefox addon; DATE:2015-01-23
|
||||
this.Active_page_(new_page);
|
||||
Xoa_url url = Xoa_url.blank();
|
||||
url = home_wiki.Utl__url_parser().Parse(url_bry);
|
||||
new_page.Url_(url);
|
||||
return App__retrieve_by_href(url, output_html);
|
||||
Xog_tab_itm tab = tab_mgr.Active_tab();
|
||||
tab.Page_(new_page);
|
||||
tab.History_mgr().Add(new_page);
|
||||
byte[] rv = output_html
|
||||
? wiki.Html_mgr().Page_wtr_mgr().Gen(new_page, tab.View_mode())
|
||||
: new_page.Data_raw();
|
||||
if (app.Shell().Fetch_page_exec_async())
|
||||
app.Gui_mgr().Browser_win().Page__async__bgn(tab);
|
||||
return rv;
|
||||
}
|
||||
} private Object App__retrieve__lock = new Object();
|
||||
public byte[] App__retrieve_by_href(String href, boolean output_html) {return App__retrieve_by_href(Xog_url_wkr.Exec_url(this, href), output_html);} // NOTE: used by drd
|
||||
private byte[] App__retrieve_by_href(Xoa_url url, boolean output_html) {
|
||||
if (url == null) return Bry_.new_a7("missing");
|
||||
Xowe_wiki wiki = (Xowe_wiki)app.Wiki_mgr().Get_by_key_or_make_init_y(url.Wiki_bry());
|
||||
Xoa_ttl ttl = Xoa_ttl.parse_(wiki, url.Page_bry());
|
||||
Xoae_page new_page = wiki.Load_page_by_ttl(url, ttl);
|
||||
if (new_page.Missing()) {return Bry_.Empty;}
|
||||
Xog_tab_itm tab = tab_mgr.Active_tab();
|
||||
tab.Page_(new_page);
|
||||
tab.History_mgr().Add(new_page);
|
||||
byte[] rv = output_html
|
||||
? wiki.Html_mgr().Page_wtr_mgr().Gen(new_page, tab.View_mode())
|
||||
: new_page.Data_raw()
|
||||
;
|
||||
if (app.Shell().Fetch_page_exec_async())
|
||||
app.Gui_mgr().Browser_win().Page__async__bgn(tab);
|
||||
return rv;
|
||||
}
|
||||
public void Init_by_kit(Gfui_kit kit) {
|
||||
this.kit = kit;
|
||||
win_box = kit.New_win_app("win");
|
||||
|
@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.html; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.core.btries.*; import gplx.html.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.btries.*; import gplx.html.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.parsers.apos.*; import gplx.xowa.parsers.amps.*; import gplx.xowa.parsers.lnkes.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.lists.*; import gplx.xowa.html.lnkis.*; import gplx.xowa.parsers.tblws.*; import gplx.xowa.parsers.paras.*;
|
||||
import gplx.xowa.xtns.*; import gplx.xowa.xtns.dynamicPageList.*; import gplx.xowa.xtns.math.*; import gplx.xowa.langs.vnts.*; import gplx.xowa.xtns.cite.*; import gplx.xowa.html.hzips.*;
|
||||
public class Xoh_html_wtr {
|
||||
@ -428,7 +429,7 @@ public class Xoh_html_wtr {
|
||||
default: // unknown tag
|
||||
if (tag.Restricted()) { // a; img; script; etc..
|
||||
if ( !page.Html_data().Html_restricted() // page is not marked restricted (only [[Special:]])
|
||||
|| page.Wiki().Domain_tid() == Xow_domain_type_.Tid_home) { // page is in home wiki
|
||||
|| page.Wiki().Domain_tid() == Xow_domain_type_.Int__home) { // page is in home wiki
|
||||
bfr.Add_mid(src, xnde.Src_bgn(), xnde.Src_end());
|
||||
return;
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.html; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.primitives.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xoh_imgs_mgr implements GfoInvkAble {
|
||||
public Xoh_imgs_mgr(Xow_html_mgr html_mgr) {wiki_is_default = html_mgr.Wiki().Domain_tid() == Xow_domain_type_.Tid_home;} private boolean wiki_is_default;
|
||||
public Xoh_imgs_mgr(Xow_html_mgr html_mgr) {wiki_is_default = html_mgr.Wiki().Domain_tid() == Xow_domain_type_.Int__home;} private boolean wiki_is_default;
|
||||
public Bool_obj_ref Alt_in_caption() {return alt_in_caption;} Bool_obj_ref alt_in_caption = Bool_obj_ref.y_();
|
||||
public Bool_obj_ref Alt_defaults_to_caption() {return alt_defaults_to_caption;} Bool_obj_ref alt_defaults_to_caption = Bool_obj_ref.y_();
|
||||
public void Copy_cfg(Xoh_imgs_mgr copy) {this.alt_in_caption = copy.alt_in_caption;}
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.html; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.html.*; import gplx.xowa.html.portal.*; import gplx.xowa.pages.skins.*; import gplx.xowa.pages.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.gui.*; import gplx.xowa.xtns.wdatas.*; import gplx.xowa.langs.vnts.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*; 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;
|
||||
@ -108,7 +108,7 @@ public class Xoh_page_wtr_wkr implements Bry_fmtr_arg {
|
||||
case Xow_page_tid.Tid_json: app.Wiki_mgr().Wdata_mgr().Write_json_as_html(bfr, page_ttl.Page_db(), data_raw); break;
|
||||
}
|
||||
}
|
||||
if ( wiki.Domain_tid() != Xow_domain_type_.Tid_home // allow home wiki to use javascript
|
||||
if ( wiki.Domain_tid() != Xow_domain_type_.Int__home // allow home wiki to use javascript
|
||||
&& !page_tid_uses_pre) { // if .js, .css or .lua, skip test; may have js fragments, but entire text is escaped and put in pre; don't show spurious warning; DATE:2013-11-21
|
||||
app.Html_mgr().Js_cleaner().Clean_bfr(wiki, page_ttl, bfr, bfr_page_bgn);
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ public class Bridge_msg_bldr {
|
||||
public Bridge_msg_bldr Notify_hint_(String v) {synchronized(wtr){this.notify_hint = v;} return this;} private String notify_hint;
|
||||
public Bridge_msg_bldr Notify_pass_(String v){synchronized(wtr){this.notify_text = v; this.notify_status = "success";} return this;}
|
||||
public Bridge_msg_bldr Notify_fail_(String v){synchronized(wtr){this.notify_text = v; this.notify_status = "error"; this.rslt_pass = false;} return this;}
|
||||
public Bridge_msg_bldr Data(String key, boolean val) {return Data_obj(key, val, ClassAdp_.Tid_bool);}
|
||||
public Bridge_msg_bldr Data(String key, int val) {return Data_obj(key, val, ClassAdp_.Tid_int);}
|
||||
public Bridge_msg_bldr Data(String key, String val) {return Data_obj(key, val, ClassAdp_.Tid_str);}
|
||||
public Bridge_msg_bldr Data(String key, byte[] val) {return Data_obj(key, val, ClassAdp_.Tid_bry);}
|
||||
public Bridge_msg_bldr Data(String key, boolean val) {return Data_obj(key, val, Type_adp_.Tid__bool);}
|
||||
public Bridge_msg_bldr Data(String key, int val) {return Data_obj(key, val, Type_adp_.Tid__int);}
|
||||
public Bridge_msg_bldr Data(String key, String val) {return Data_obj(key, val, Type_adp_.Tid__str);}
|
||||
public Bridge_msg_bldr Data(String key, byte[] val) {return Data_obj(key, val, Type_adp_.Tid__bry);}
|
||||
private Bridge_msg_bldr Data_obj(String key, Object val, int val_tid) {
|
||||
synchronized (wtr) {data_root.Add_data(key, val, val_tid);}
|
||||
return this;
|
||||
@ -83,9 +83,9 @@ public class Bridge_msg_bldr {
|
||||
Gfo_tree_data sub_kv = (Gfo_tree_data)itm;
|
||||
String key = sub_kv.Key(); Object val = sub_kv.Val();
|
||||
switch (sub_kv.Val_tid()) {
|
||||
case ClassAdp_.Tid_bool: wtr.Kv_bool(key, Bool_.cast_(val)); break;
|
||||
case ClassAdp_.Tid_int: wtr.Kv_int(key, Int_.cast_(val)); break;
|
||||
case ClassAdp_.Tid_bry: wtr.Kv_bry(key, (byte[])val); break;
|
||||
case Type_adp_.Tid__bool: wtr.Kv_bool(key, Bool_.cast_(val)); break;
|
||||
case Type_adp_.Tid__int: wtr.Kv_int(key, Int_.cast_(val)); break;
|
||||
case Type_adp_.Tid__bry: wtr.Kv_bry(key, (byte[])val); break;
|
||||
default: wtr.Kv_str(key, Object_.Xto_str_strict_or_null_mark(val)); break;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package gplx.xowa.html.hdumps.abrvs; import gplx.*; import gplx.xowa.*; import g
|
||||
import gplx.core.primitives.*; import gplx.core.brys.*; import gplx.core.btries.*;
|
||||
import gplx.html.*; import gplx.xowa.html.*; import gplx.xowa.html.hdumps.core.*; import gplx.xowa.html.lnkis.*;
|
||||
import gplx.xowa.files.*; import gplx.xowa.files.repos.*; import gplx.xowa.xtns.gallery.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.apps.fsys.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.apps.fsys.*;
|
||||
import gplx.xowa2.gui.*;
|
||||
public class Xohd_abrv_mgr {
|
||||
private Bry_bfr tmp_bfr = Bry_bfr.reset_(255); private Bry_rdr bry_rdr = new Bry_rdr(); private Gfo_usr_dlg usr_dlg = Gfo_usr_dlg_.I;
|
||||
@ -37,7 +37,7 @@ public class Xohd_abrv_mgr {
|
||||
this.wiki_domain = wiki_domain;
|
||||
}
|
||||
private void Init() {
|
||||
file_dir_comm = tmp_bfr.Add(file_dir).Add(Xow_domain_.Domain_bry_commons).Add_byte_slash().Xto_bry_and_clear();
|
||||
file_dir_comm = tmp_bfr.Add(file_dir).Add(Xow_domain_itm_.Bry__commons).Add_byte_slash().Xto_bry_and_clear();
|
||||
file_dir_wiki = tmp_bfr.Add(file_dir).Add(wiki_domain).Add_byte_slash().Xto_bry_and_clear();
|
||||
}
|
||||
public byte[] Parse(Bry_bfr rv, Xog_page hpg) {
|
||||
|
@ -155,13 +155,13 @@ public class Xoh_head_mgr implements Bry_fmtr_arg {
|
||||
boolean enabled = itm.Enabled();
|
||||
if (enabled) {
|
||||
int flag = itms[i].Flags();
|
||||
if (Enm_.HasInt(flag, Xoh_head_itm__base.Flag__css_include)) list__css_include.Add(itm);
|
||||
if (Enm_.HasInt(flag, Xoh_head_itm__base.Flag__css_text)) list__css_text.Add(itm);
|
||||
if (Enm_.HasInt(flag, Xoh_head_itm__base.Flag__js_include)) list__js_include.Add(itm);
|
||||
if (Enm_.HasInt(flag, Xoh_head_itm__base.Flag__js_head_global)) list__js_head_global.Add(itm);
|
||||
if (Enm_.HasInt(flag, Xoh_head_itm__base.Flag__js_head_script)) list__js_head_script.Add(itm);
|
||||
if (Enm_.HasInt(flag, Xoh_head_itm__base.Flag__js_tail_script)) list__js_tail_script.Add(itm);
|
||||
if (Enm_.HasInt(flag, Xoh_head_itm__base.Flag__js_window_onload)) list__js_window_onload.Add(itm);
|
||||
if (Enm_.Has_int(flag, Xoh_head_itm__base.Flag__css_include)) list__css_include.Add(itm);
|
||||
if (Enm_.Has_int(flag, Xoh_head_itm__base.Flag__css_text)) list__css_text.Add(itm);
|
||||
if (Enm_.Has_int(flag, Xoh_head_itm__base.Flag__js_include)) list__js_include.Add(itm);
|
||||
if (Enm_.Has_int(flag, Xoh_head_itm__base.Flag__js_head_global)) list__js_head_global.Add(itm);
|
||||
if (Enm_.Has_int(flag, Xoh_head_itm__base.Flag__js_head_script)) list__js_head_script.Add(itm);
|
||||
if (Enm_.Has_int(flag, Xoh_head_itm__base.Flag__js_tail_script)) list__js_tail_script.Add(itm);
|
||||
if (Enm_.Has_int(flag, Xoh_head_itm__base.Flag__js_window_onload)) list__js_window_onload.Add(itm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,11 +211,11 @@ public class Xoh_file_wtr__basic {
|
||||
return scratch_bfr.Xto_bry_and_clear();
|
||||
}
|
||||
private static byte[] Arg_anchor_title(Bry_bfr tmp_bfr, byte[] src, Xop_lnki_tkn lnki, byte[] lnki_ttl, Xoh_lnki_title_fmtr anchor_title_wkr) {
|
||||
if ( Enm_.HasInt(lnki.Lnki_type(), Xop_lnki_type.Id_thumb)
|
||||
|| Enm_.HasInt(lnki.Lnki_type(), Xop_lnki_type.Id_frame) // If the image is a thumb, do not add a title / alt, even if a caption is available
|
||||
if ( Enm_.Has_int(lnki.Lnki_type(), Xop_lnki_type.Id_thumb)
|
||||
|| Enm_.Has_int(lnki.Lnki_type(), Xop_lnki_type.Id_frame) // If the image is a thumb, do not add a title / alt, even if a caption is available
|
||||
)
|
||||
return Bry_.Empty;
|
||||
else if ( Enm_.HasInt(lnki.Lnki_type(), Xop_lnki_type.Id_frameless)) { // If the image is frameless, add the caption as a title / alt. If no caption is available, do not add a title / alt
|
||||
else if ( Enm_.Has_int(lnki.Lnki_type(), Xop_lnki_type.Id_frameless)) { // If the image is frameless, add the caption as a title / alt. If no caption is available, do not add a title / alt
|
||||
}
|
||||
Xop_tkn_itm anchor_title_tkn = lnki.Caption_tkn();
|
||||
if (anchor_title_tkn == Xop_tkn_null.Null_tkn) return Bry_.Empty; // no caption; return empty; (do not use lnki); DATE:2013-12-31
|
||||
|
@ -49,7 +49,7 @@ public class Xoh_lnki_wtr {
|
||||
Xow_xwiki_itm xwiki_lang = lnki_ttl.Wik_itm();
|
||||
if ( xwiki_lang != null // lnki is xwiki; EX: [[commons:]] [[en:]] [[wikt:]]
|
||||
&& xwiki_lang.Domain_tid() == wiki.Xwiki_domain_tid() // xwiki is same type as cur wiki; EX: cur=w xwiki=w -> add to xwiki_langs; cur=w xwikid=d -> don't add to xwiki_langs; DATE:2014-09-14
|
||||
&& xwiki_lang.Type_is_xwiki_lang(wiki.Domain_itm().Lang_orig_uid())// NOTE: use Lang_orig_id to handle xwikis between s.w and en.w; PAGE:s.q:Anonymous DATE:2014-09-10
|
||||
&& xwiki_lang.Type_is_xwiki_lang(wiki.Domain_itm().Lang_orig_key())// NOTE: use Lang_orig_id to handle xwikis between s.w and en.w; PAGE:s.q:Anonymous DATE:2014-09-10
|
||||
&& !lnki_ttl.ForceLiteralLink() // not literal; [[:en:A]]
|
||||
) {
|
||||
Wdata_sitelink_itm slink = new Wdata_sitelink_itm(null, null, null).Page_ttl_(lnki_ttl);
|
||||
|
@ -16,7 +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.modules.popups; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*; import gplx.xowa.html.modules.*;
|
||||
import gplx.core.btries.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.btries.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.apis.xowa.html.modules.*; import gplx.xowa.html.modules.popups.keeplists.*;
|
||||
import gplx.xowa.gui.views.*; import gplx.xowa.parsers.hdrs.*; import gplx.xowa.parsers.tblws.*;
|
||||
public class Xow_popup_parser {
|
||||
@ -68,7 +69,7 @@ public class Xow_popup_parser {
|
||||
wtxt_ctx.Cur_page().Ttl_(ttl); // NOTE: must set cur_page, or rel lnkis won't work; EX: [[../A]]
|
||||
}
|
||||
public byte[] Parse(Xowe_wiki cur_wiki, Xoae_page page, Xog_tab_itm cur_tab, Xow_popup_itm popup_itm) { // NOTE: must pass cur_wiki for xwiki label; DATE:2014-07-02
|
||||
if (Bry_.Eq(popup_itm.Wiki_domain(), Xow_domain_.Domain_bry_wikidata)) {
|
||||
if (Bry_.Eq(popup_itm.Wiki_domain(), Xow_domain_itm_.Bry__wikidata)) {
|
||||
data.Wrdx_bfr().Add(app.Wiki_mgr().Wdata_mgr().Popup_text(page));
|
||||
}
|
||||
else {
|
||||
|
@ -16,7 +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.portal; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.xowa.files.xfers.*;
|
||||
public class Xoa_available_wikis_mgr implements GfoInvkAble {
|
||||
private Bry_fmtr itms_as_html_fmtr = Bry_fmtr.new_("\n <li><a href=\"/site/~{domain}/\"~{itm_cls}>~{domain}</a></li>", "domain", "itm_cls");
|
||||
public Xoa_available_wikis_mgr(Xoae_app app) {this.app = app;} private Xoae_app app;
|
||||
@ -29,7 +30,7 @@ public class Xoa_available_wikis_mgr implements GfoInvkAble {
|
||||
int len = xwiki_mgr.Len();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xow_xwiki_itm itm = xwiki_mgr.Get_at(i);
|
||||
if (itm.Domain_tid() == Xow_domain_type_.Tid_home) continue;// don't show home wiki
|
||||
if (itm.Domain_tid() == Xow_domain_type_.Int__home) continue;// don't show home wiki
|
||||
if (!itm.Offline()) continue; // only show items marked Offline (added by Available_from_fsys); DATE:2014-09-21
|
||||
itms_as_html_fmtr.Bld_bfr_many(tmp_bfr, itm.Domain_bry(), itm_cls);
|
||||
}
|
||||
|
@ -16,7 +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.portal; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.gui.*; import gplx.xowa.html.sidebar.*; import gplx.xowa.pages.*; import gplx.xowa.langs.vnts.*;
|
||||
import gplx.xowa.gui.*; import gplx.xowa.html.sidebar.*; import gplx.xowa.pages.*; import gplx.xowa.langs.vnts.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.html.hrefs.*;
|
||||
import gplx.xowa.apis.xowa.html.*; import gplx.xowa.apis.xowa.html.skins.*;
|
||||
public class Xow_portal_mgr implements GfoInvkAble {
|
||||
@ -24,7 +25,7 @@ public class Xow_portal_mgr implements GfoInvkAble {
|
||||
public Xow_portal_mgr(Xowe_wiki wiki) {
|
||||
this.wiki = wiki;
|
||||
this.sidebar_mgr = new Xowh_sidebar_mgr(wiki);
|
||||
this.missing_ns_cls = Bry_.Eq(wiki.Domain_bry(), Xow_domain_type_.Key_bry_home) ? Missing_ns_cls_hide : null; // if home wiki, set missing_ns to application default; if any other wiki, set to null; will be overriden during init
|
||||
this.missing_ns_cls = Bry_.Eq(wiki.Domain_bry(), Xow_domain_type_.Bry__home) ? Missing_ns_cls_hide : null; // if home wiki, set missing_ns to application default; if any other wiki, set to null; will be overriden during init
|
||||
}
|
||||
public void Init_by_lang(Xol_lang lang) {
|
||||
lang_is_rtl = !lang.Dir_ltr();
|
||||
|
@ -28,7 +28,7 @@ public class Xowh_sidebar_mgr implements GfoInvkAble {
|
||||
Xol_msg_itm sidebar_msg = Xol_msg_mgr_.Get_msg_itm(bfr, wiki, wiki.Lang(), CONST_sidebar_ttl);
|
||||
if ( sidebar_msg.Src() == Xol_msg_itm.Src_missing
|
||||
|| ( sidebar_msg.Src() == Xol_msg_itm.Src_lang
|
||||
&& wiki.Domain_tid() == gplx.xowa.wikis.Xow_domain_type_.Tid_home
|
||||
&& wiki.Domain_tid() == gplx.xowa.wikis.domains.Xow_domain_type_.Int__home
|
||||
)) {
|
||||
html_bry = Bry_.Empty;
|
||||
bfr.Mkr_rls();
|
||||
|
@ -48,7 +48,8 @@ public class Gxw_html_server implements Gxw_html {
|
||||
}
|
||||
private String Exec_as_str(String s) {
|
||||
if (wtr == null) return ""; // HACK: handles http_server
|
||||
s = "(function () {" + s + "})();"; // NOTE: dependent on firefox addon which does 'var result = Function("with(arguments[0]){return "+cmd_text+"}")(session.window);'; DATE:2014-01-28
|
||||
s = "(function () {" + s + "})();"; // NOTE: dependent on firefox_addon which does 'var result = Function("with(arguments[0]){return "+cmd_text+"}")(session.window);'; DATE:2014-01-28
|
||||
gplx.core.threads.Thread_adp_.Sleep(50); // NOTE: need to sleep, else images won't actually show up on screen; PAGE:nethackwiki.com:Weapons; DATE:2015-08-23
|
||||
Xosrv_msg msg = Xosrv_msg.new_(Xosrv_cmd_types.Browser_exec, Bry_.Empty, Bry_.Empty, Bry_.Empty, Bry_.Empty, Bry_.new_u8(s));
|
||||
usr_dlg.Note_many("", "", "sending browser.js: msg=~{0}", s);
|
||||
wtr.Write(msg);
|
||||
|
@ -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.servers.http; import gplx.*; import gplx.xowa.*; import gplx.xowa.servers.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.langs.*;
|
||||
class Http_server_wkr_ {
|
||||
public static String Assert_main_page(Xoae_app app, String req) {
|
||||
int mode = -1;
|
||||
@ -27,8 +27,8 @@ class Http_server_wkr_ {
|
||||
if (mode == -1) return req; // not a link to a Main Page; EX:localhost:8080/en.wikipedia.org/wiki/Earth
|
||||
if (req_array.length < 3) return req; // shouldn't happen; EX: "localhost:8080wiki"
|
||||
byte[] wiki_domain = Bry_.new_u8(req_array[1]);
|
||||
Xow_domain domain_itm = Xow_domain_.parse(wiki_domain);
|
||||
if (domain_itm.Domain_tid() == Xow_domain_type_.Tid_other && domain_itm.Lang_itm().Id() == Xol_lang_itm_.Id__intl) return req;
|
||||
Xow_domain_itm domain_itm = Xow_domain_itm_.parse(wiki_domain);
|
||||
if (domain_itm.Domain_type_id() == Xow_domain_type_.Int__other && domain_itm.Lang_actl_itm().Id() == Xol_lang_itm_.Id__intl) return req;
|
||||
Xowe_wiki wiki = app.Wiki_mgr().Get_by_key_or_make(wiki_domain);
|
||||
wiki.Init_assert();
|
||||
String main_page = String_.new_u8(wiki.Props().Main_page());
|
||||
|
@ -65,7 +65,7 @@ public class Xosrv_server implements GfoInvkAble {
|
||||
}
|
||||
private String Exec_cmd(String msg_text) {
|
||||
Object rv_obj = app.Gfs_mgr().Run_str(msg_text);
|
||||
String rv = ClassAdp_.Eq_typeSafe(rv_obj, String_.Cls_ref_type) ? (String)rv_obj : Object_.Xto_str_strict_or_null(rv_obj);
|
||||
String rv = Type_adp_.Eq_typeSafe(rv_obj, String_.Cls_ref_type) ? (String)rv_obj : Object_.Xto_str_strict_or_null(rv_obj);
|
||||
return rv;
|
||||
}
|
||||
public String Exec_js(byte[] sender, byte[] msg_text) {
|
||||
|
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.setup.maints; import gplx.*; import gplx.xowa.*; import gplx.xowa.setup.*;
|
||||
import org.junit.*;
|
||||
import gplx.xowa.wikis.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
|
||||
public class Wmf_dump_list_parser_tst {
|
||||
@Before public void init() {fxt.Clear();} private Wmf_dump_list_parser_fxt fxt = new Wmf_dump_list_parser_fxt();
|
||||
@Test public void Parse() {
|
||||
@ -41,7 +41,7 @@ public class Wmf_dump_list_parser_tst {
|
||||
, fxt.itm("zh-classicalwiki", "20131128", Wmf_dump_itm.Status_tid_complete, "Dump complete", "2013-11-28 06:08:56")
|
||||
);
|
||||
}
|
||||
// @Test public void Update() { // MAINT:QUARTERLY:2015-03-01; must run C:\xowa\ and update dump status
|
||||
// @Test public void Update() { // MAINT:QUARTERLY:2015-08-23; must run C:\xowa\ and update dump status
|
||||
// Hash_adp_bry excluded_domains = Hash_adp_bry.cs().Add_many_str
|
||||
// ( "advisory.wikipedia.org", "beta.wikiversity.org", "donate.wikipedia.org", "login.wikipedia.org"
|
||||
// , "nostalgia.wikipedia.org", "outreach.wikipedia.org", "quality.wikipedia.org", "sources.wikipedia.org"
|
||||
@ -49,7 +49,7 @@ public class Wmf_dump_list_parser_tst {
|
||||
// , "usability.wikipedia.org", "vote.wikipedia.org"
|
||||
// , "bd.wikimedia.org", "dk.wikimedia.org", "mx.wikimedia.org", "nyc.wikimedia.org", "nz.wikimedia.org", "pa-us.wikimedia.org", "rs.wikimedia.org", "ua.wikimedia.org"
|
||||
// );
|
||||
// Wmf_dump_itm[] itms = new Wmf_dump_list_parser().Parse(Io_mgr.I.LoadFilBry("C:\\xowa\\bin\\any\\html\\xowa\\maint\\backup-index.html"));
|
||||
// Wmf_dump_itm[] itms = new Wmf_dump_list_parser().Parse(Io_mgr.I.LoadFilBry("C:\\xowa\\bin\\any\\xowa\\xtns\\xowa\\maintenance\\backup-index.html"));
|
||||
// Array_.Sort(itms);
|
||||
// Bry_bfr sql_bfr = Bry_bfr.new_();
|
||||
// Bry_bfr bld_bfr = Bry_bfr.new_();
|
||||
@ -59,12 +59,12 @@ public class Wmf_dump_list_parser_tst {
|
||||
// Wmf_dump_itm itm = itms[i];
|
||||
// byte[] abrv = itm.Wiki_abrv();
|
||||
// if (Bry_.Eq(abrv, Bry_.new_a7("testwikidatawiki"))) continue;
|
||||
// byte[] domain_bry = Xow_wiki_alias.Parse__domain_name(abrv, 0, abrv.length);
|
||||
// byte[] domain_bry = Xow_abrv_wm_.Parse_to_domain_bry(abrv);
|
||||
// if (domain_bry == null) continue; // not a standard WMF wiki; ignore
|
||||
// if (Bry_finder.Find_fwd(domain_bry, Bry_.new_a7("wikimania")) != Bry_.NotFound) continue;
|
||||
// if (excluded_domains.Has(domain_bry)) continue;
|
||||
// Xow_domain domain_itm = Xow_domain_.parse(domain_bry);
|
||||
// byte[] tid_name = Xto_display_name(Xow_domain_type_.Get_type_as_bry(domain_itm.Domain_tid()));
|
||||
// Xow_domain_itm domain_itm = Xow_domain_itm_.parse(domain_bry);
|
||||
// byte[] tid_name = Xto_display_name(Xow_domain_type_.Get_type_as_bry(domain_itm.Domain_type_id()));
|
||||
// sql_bfr
|
||||
// .Add_byte(Byte_ascii.Paren_bgn)
|
||||
// .Add_int_variable(counter++)
|
||||
@ -97,9 +97,9 @@ public class Wmf_dump_list_parser_tst {
|
||||
//// Io_mgr.I.AppendFilBfr(temp, bld_bfr);
|
||||
// }
|
||||
// private static byte[] Xto_display_name(byte[] v) {
|
||||
// if (Bry_.Eq(v, Xow_domain_type_.Key_bry_wmforg)) return Bry_.new_a7("Wikimedia Foundation");
|
||||
// else if (Bry_.Eq(v, Xow_domain_type_.Key_bry_species)) return Bry_.new_a7("Wikispecies");
|
||||
// else if (Bry_.Eq(v, Xow_domain_type_.Key_bry_mediawiki)) return Bry_.new_a7("MediaWiki");
|
||||
// if (Bry_.Eq(v, Xow_domain_type_.Bry__wmforg)) return Bry_.new_a7("Wikimedia Foundation");
|
||||
// else if (Bry_.Eq(v, Xow_domain_type_.Bry__species)) return Bry_.new_a7("Wikispecies");
|
||||
// else if (Bry_.Eq(v, Xow_domain_type_.Bry__mediawiki)) return Bry_.new_a7("MediaWiki");
|
||||
// else return Bry_.Add(Byte_ascii.Case_upper(v[0]), Bry_.Mid(v, 1, v.length));
|
||||
// }
|
||||
}
|
||||
|
@ -16,7 +16,9 @@ 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.setup.maints; import gplx.*; import gplx.xowa.*; import gplx.xowa.setup.*;
|
||||
import gplx.ios.*; import gplx.xowa.wikis.*; import gplx.xowa.files.downloads.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.files.downloads.*;
|
||||
public class Xoa_maint_mgr implements GfoInvkAble {
|
||||
public Xoa_maint_mgr(Xoae_app app) {
|
||||
this.app = app;
|
||||
@ -57,8 +59,8 @@ public class Xoa_maint_mgr implements GfoInvkAble {
|
||||
Wmf_dump_itm itm = itms[i];
|
||||
byte[] wiki_abrv = itm.Wiki_abrv();
|
||||
Xoa_app_.Usr_dlg().Log_many("", "", "maint.html itm; itm=~{0}", wiki_abrv);
|
||||
byte[] wiki_domain = Xow_wiki_alias.Parse__domain_name(wiki_abrv, 0, wiki_abrv.length);
|
||||
if (wiki_domain == Xow_wiki_alias.Parse__domain_name_null) continue; // invalid wiki-name; ex: nycwikimedia
|
||||
byte[] wiki_domain = Xow_abrv_wm_.Parse_to_domain_bry(wiki_abrv);
|
||||
if (wiki_domain == null) continue; // invalid wiki-name; ex: nycwikimedia
|
||||
itms_hash.Add(wiki_domain, itm);
|
||||
}
|
||||
len = app.Wiki_mgr().Count();
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.specials.allPages; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.primitives.*; import gplx.core.net.*;
|
||||
import gplx.xowa.html.*; import gplx.xowa.html.hrefs.*; import gplx.xowa.html.lnkis.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.urls.*;
|
||||
public class Xows_page_allpages implements GfoInvkAble, Bry_fmtr_arg, Xows_page {
|
||||
public Xows_page_allpages(Xowe_wiki wiki) {
|
||||
@ -73,7 +73,7 @@ public class Xows_page_allpages implements GfoInvkAble, Bry_fmtr_arg, Xows_page
|
||||
public void Special_gen(Xowe_wiki wiki, Xoae_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
wiki.Ctx().Cur_page().Html_data().Display_ttl_(wiki.Msg_mgr().Val_by_id(Xol_msg_itm_.Id_sp_allpages_hdr));
|
||||
url.Page_bry_(Bry_.Add(Bry_.new_a7("Special:"), ttl.Page_txt_wo_qargs())); // HACK: need to re-set Page b/c href_wtr does not eliminate qargs; DATE:2013-02-08
|
||||
if (wiki.Domain_tid() == Xow_domain_type_.Tid_home) {wiki.Appe().Usr_dlg().Prog_many(GRP_KEY, "home.invalid", "AllPages not implemented for home wiki"); return;}
|
||||
if (wiki.Domain_tid() == Xow_domain_type_.Int__home) {wiki.Appe().Usr_dlg().Prog_many(GRP_KEY, "home.invalid", "AllPages not implemented for home wiki"); return;}
|
||||
if (rslt_list_ttls == null) this.Itms_per_page_(itms_per_page);
|
||||
boolean found = Build_data(url, ttl); if (!found) return;
|
||||
Build_html(page);
|
||||
|
@ -16,17 +16,17 @@ 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.specials.search; import gplx.*; import gplx.xowa.*; import gplx.xowa.specials.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.wikis.*; import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.domains.crts.*;
|
||||
import gplx.core.primitives.*; import gplx.xowa.langs.*;
|
||||
import gplx.xowa.wikis.domains.*; import gplx.xowa.wikis.domains.crts.*;
|
||||
class Xow_domain_sorter__manual implements gplx.lists.ComparerAble {
|
||||
private final Xow_domain cur_domain;
|
||||
private final Xow_domain_itm cur_domain;
|
||||
private final Xow_domain_crt_itm[] ary; private final int ary_len;
|
||||
public Xow_domain_sorter__manual(Xow_domain cur_domain, Xow_domain_crt_itm[] ary) {
|
||||
public Xow_domain_sorter__manual(Xow_domain_itm cur_domain, Xow_domain_crt_itm[] ary) {
|
||||
this.cur_domain = cur_domain; this.ary = ary; this.ary_len = ary.length;
|
||||
}
|
||||
public int compare(Object lhsObj, Object rhsObj) {
|
||||
Xow_domain lhs = (Xow_domain)lhsObj;
|
||||
Xow_domain rhs = (Xow_domain)rhsObj;
|
||||
Xow_domain_itm lhs = (Xow_domain_itm)lhsObj;
|
||||
Xow_domain_itm rhs = (Xow_domain_itm)rhsObj;
|
||||
int lhs_sort = Get_sort_idx_or_neg1(lhs);
|
||||
int rhs_sort = Get_sort_idx_or_neg1(rhs);
|
||||
if (lhs_sort == -1 && rhs_sort != -1) return rhs_sort;
|
||||
@ -34,7 +34,7 @@ class Xow_domain_sorter__manual implements gplx.lists.ComparerAble {
|
||||
else if (lhs_sort != -1 && rhs_sort != -1) return Int_.Compare(lhs_sort, rhs_sort);
|
||||
else return Bry_.Compare(lhs.Domain_bry(), rhs.Domain_bry());
|
||||
}
|
||||
private int Get_sort_idx_or_neg1(Xow_domain domain) {
|
||||
private int Get_sort_idx_or_neg1(Xow_domain_itm domain) {
|
||||
int sort_idx = domain.Sort_idx(); if (sort_idx != -1) return sort_idx;
|
||||
sort_idx = Int_.MaxValue;
|
||||
for (int i = 0; i < ary_len; ++i) {
|
||||
@ -44,7 +44,7 @@ class Xow_domain_sorter__manual implements gplx.lists.ComparerAble {
|
||||
domain.Sort_idx_(sort_idx);
|
||||
return sort_idx;
|
||||
}
|
||||
public static void Sort(Xow_domain_sorter__manual sorter, Xow_domain[] ary) {
|
||||
public static void Sort(Xow_domain_sorter__manual sorter, Xow_domain_itm[] ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; ++i)
|
||||
ary[i].Sort_idx_(-1);
|
||||
@ -61,14 +61,14 @@ class Xow_domain_sorter__manual_tid implements gplx.lists.ComparerAble {
|
||||
}
|
||||
}
|
||||
public int compare(Object lhsObj, Object rhsObj) {
|
||||
Xow_domain lhs = (Xow_domain)lhsObj;
|
||||
Xow_domain rhs = (Xow_domain)rhsObj;
|
||||
int lhs_sort = Get_sort_idx_or_neg1(lhs.Domain_tid());
|
||||
int rhs_sort = Get_sort_idx_or_neg1(rhs.Domain_tid());
|
||||
Xow_domain_itm lhs = (Xow_domain_itm)lhsObj;
|
||||
Xow_domain_itm rhs = (Xow_domain_itm)rhsObj;
|
||||
int lhs_sort = Get_sort_idx_or_neg1(lhs.Domain_type_id());
|
||||
int rhs_sort = Get_sort_idx_or_neg1(rhs.Domain_type_id());
|
||||
if (lhs_sort == -1 && rhs_sort != -1) return rhs_sort;
|
||||
else if (lhs_sort != -1 && rhs_sort == -1) return lhs_sort;
|
||||
else if (lhs_sort != -1 && rhs_sort != -1) return Int_.Compare(lhs_sort, rhs_sort);
|
||||
else return Bry_.Compare(Xow_domain_type_.Get_type_as_bry(lhs.Domain_tid()), Xow_domain_type_.Get_type_as_bry(rhs.Domain_tid()));
|
||||
else return Bry_.Compare(Xow_domain_type_.Get_type_as_bry(lhs.Domain_type_id()), Xow_domain_type_.Get_type_as_bry(rhs.Domain_type_id()));
|
||||
}
|
||||
private int Get_sort_idx_or_neg1(int tid) {
|
||||
Object o = sort_hash.Get_by(sort_key.Val_(tid));
|
||||
@ -95,14 +95,14 @@ class Xow_domain_sorter__manual_lang implements gplx.lists.ComparerAble {
|
||||
}
|
||||
}
|
||||
public int compare(Object lhsObj, Object rhsObj) {
|
||||
Xow_domain lhs = (Xow_domain)lhsObj;
|
||||
Xow_domain rhs = (Xow_domain)rhsObj;
|
||||
int lhs_sort = Get_sort_idx_or_neg1(lhs.Lang_uid());
|
||||
int rhs_sort = Get_sort_idx_or_neg1(rhs.Lang_uid());
|
||||
Xow_domain_itm lhs = (Xow_domain_itm)lhsObj;
|
||||
Xow_domain_itm rhs = (Xow_domain_itm)rhsObj;
|
||||
int lhs_sort = Get_sort_idx_or_neg1(lhs.Lang_actl_uid());
|
||||
int rhs_sort = Get_sort_idx_or_neg1(rhs.Lang_actl_uid());
|
||||
if (lhs_sort == -1 && rhs_sort != -1) return rhs_sort;
|
||||
else if (lhs_sort != -1 && rhs_sort == -1) return lhs_sort;
|
||||
else if (lhs_sort != -1 && rhs_sort != -1) return Int_.Compare(lhs_sort, rhs_sort);
|
||||
else return Bry_.Compare(lhs.Lang_key(), rhs.Lang_key());
|
||||
else return Bry_.Compare(lhs.Lang_actl_key(), rhs.Lang_actl_key());
|
||||
}
|
||||
private int Get_sort_idx_or_neg1(int tid) {
|
||||
Object o = sort_hash.Get_by(sort_key.Val_(tid));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user