mirror of https://github.com/gnosygnu/xowa
parent
b2a06b8125
commit
14471ca656
@ -0,0 +1,39 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.mustaches; import gplx.*; import gplx.langs.*;
|
||||
public class Mustache_bfr {
|
||||
private final Bry_bfr bfr;
|
||||
public Mustache_bfr(Bry_bfr bfr) {this.bfr = bfr;}
|
||||
public Bry_bfr Bfr() {return bfr;}
|
||||
public Mustache_bfr Escape_(boolean v) {escape = v; return this;} private boolean escape;
|
||||
public void Add_int (int v) {bfr.Add_int_variable(v);}
|
||||
public void Add_double (double v) {bfr.Add_double(v);}
|
||||
public void Add_str_u8 (String v) {bfr.Add_str_u8(v);}
|
||||
public void Add_mid (byte[] src, int bgn, int end) {bfr.Add_mid(src, bgn, end);}
|
||||
public void Add_bry (byte[] v) {
|
||||
if (v == null) return; // allow items to have null props
|
||||
if (escape)
|
||||
gplx.langs.htmls.Gfh_utl.Escape_html_to_bfr(bfr, v, 0, v.length, Bool_.Y, Bool_.Y, Bool_.Y, Bool_.Y, Bool_.Y);
|
||||
else
|
||||
bfr.Add(v);
|
||||
}
|
||||
public byte[] To_bry_and_clear() {return bfr.To_bry_and_clear();}
|
||||
public String To_str_and_clear() {return bfr.To_str_and_clear();}
|
||||
public static Mustache_bfr New() {return new Mustache_bfr(Bry_bfr.new_());}
|
||||
public static Mustache_bfr New_bfr(Bry_bfr v) {return new Mustache_bfr(v);}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.langs.mustaches; import gplx.*; import gplx.langs.*;
|
||||
public class Mustache_wtr_ {
|
||||
public static byte[] Write_to_bry(byte[] src, Mustache_doc_itm itm) {return Write_to_bry(Bry_bfr.new_(), src, itm);}
|
||||
public static byte[] Write_to_bry(Bry_bfr bfr, byte[] src, Mustache_doc_itm itm) {
|
||||
Mustache_tkn_parser parser = new Mustache_tkn_parser();
|
||||
Mustache_tkn_itm root = parser.Parse(src, 0, src.length);
|
||||
Mustache_render_ctx ctx = new Mustache_render_ctx().Init(itm);
|
||||
Mustache_bfr mbfr = new Mustache_bfr(bfr);
|
||||
root.Render(mbfr, ctx);
|
||||
return mbfr.To_bry_and_clear();
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.xowa.specials.*;
|
||||
public class Fbrow_addon implements Xoax_addon_itm, Xoax_addon_itm__sp {
|
||||
public Xows_page[] Pages_ary() {
|
||||
return new Xows_page[]
|
||||
{ Fbrow_special_page.Prototype
|
||||
, Wikis_list_page.Prototype
|
||||
};
|
||||
}
|
||||
|
||||
public static final byte[] ADDON_KEY = Bry_.new_a7("xowa.apps.file_browsers");
|
||||
public byte[] Addon__key() {return ADDON_KEY;}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.langs.mustaches.*;
|
||||
class Fbrow_file_itm implements Mustache_doc_itm {
|
||||
private final boolean is_dir, is_core_xowa;
|
||||
private final byte[] owner_dir_enc, path, name, date, size, color;
|
||||
private final Fbrow_file_itm[] subs;
|
||||
public Fbrow_file_itm(boolean is_dir, boolean is_core_xowa, int color, byte[] owner_dir, byte[] path, byte[] name, byte[] date, byte[] size, Fbrow_file_itm[] subs) {
|
||||
this.is_dir = is_dir; this.is_core_xowa = is_core_xowa;
|
||||
this.color = color % 2 == 0 ? Byte_ascii.Num_0_bry : Byte_ascii.Num_1_bry;
|
||||
this.owner_dir_enc = gplx.langs.htmls.encoders.Gfo_url_encoder_.Href.Encode(owner_dir);
|
||||
this.path = path; this.name = name; this.date = date; this.size = size;
|
||||
this.subs = subs;
|
||||
}
|
||||
public boolean Mustache__write(String key, Mustache_bfr bfr) {
|
||||
if (String_.Eq(key, "path")) bfr.Add_bry(path);
|
||||
else if (String_.Eq(key, "path_enc")) bfr.Add_bry(gplx.langs.htmls.encoders.Gfo_url_encoder_.Href.Encode(path));
|
||||
else if (String_.Eq(key, "owner_dir_enc")) bfr.Add_bry(owner_dir_enc);
|
||||
else if (String_.Eq(key, "name")) bfr.Add_bry(name);
|
||||
else if (String_.Eq(key, "date")) bfr.Add_bry(date);
|
||||
else if (String_.Eq(key, "size")) bfr.Add_bry(size);
|
||||
else if (String_.Eq(key, "color")) bfr.Add_bry(color);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
public Mustache_doc_itm[] Mustache__subs(String key) {
|
||||
if (String_.Eq(key, "is_dir")) return Mustache_doc_itm_.Ary__bool(is_dir);
|
||||
else if (String_.Eq(key, "is_core_xowa")) return Mustache_doc_itm_.Ary__bool(is_core_xowa);
|
||||
else if (String_.Eq(key, "subs")) return subs;
|
||||
return Mustache_doc_itm_.Ary__empty;
|
||||
}
|
||||
public static final Fbrow_file_itm[] Ary_empty = new Fbrow_file_itm[0];
|
||||
public static Fbrow_file_itm New(IoItmDir owner_dir) {
|
||||
List_adp sub_list = List_adp_.new_();
|
||||
New_subs(owner_dir.Url(), sub_list, owner_dir.SubDirs());
|
||||
New_subs(owner_dir.Url(), sub_list, owner_dir.SubFils());
|
||||
Fbrow_file_itm[] subs = (Fbrow_file_itm[])sub_list.To_ary_and_clear(Fbrow_file_itm.class);
|
||||
return new Fbrow_file_itm(Bool_.Y, Bool_.N, 0, owner_dir.Url().OwnerDir().RawBry(), owner_dir.Url().RawBry(), Bry_.new_u8(owner_dir.Name()), Bry_.Empty, Bry_.Empty, subs);
|
||||
}
|
||||
private static void New_subs(Io_url owner_dir, List_adp list, IoItmList subs) {
|
||||
subs.Sort();
|
||||
int len = subs.Len();
|
||||
int list_total = list.Len();
|
||||
byte[] owner_dir_bry = owner_dir.RawBry();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
IoItm_base src = (IoItm_base)subs.Get_at(i);
|
||||
Fbrow_file_itm trg = null;
|
||||
if (src.Type_dir()) {
|
||||
byte[] trg_url = src.Url().RawBry();
|
||||
trg = new Fbrow_file_itm(Bool_.Y, Bool_.N, list_total + i, owner_dir_bry, trg_url, Bry_.new_u8(src.Url().NameAndExt_noDirSpr()), Bry_.Empty, Bry_.Empty, Ary_empty);
|
||||
}
|
||||
else {
|
||||
IoItmFil src_as_fil = (IoItmFil)src;
|
||||
String size_str = Io_size_.To_str(src_as_fil.Size(), "#,###");
|
||||
boolean is_xowa_core = gplx.xowa.wikis.data.Xowd_db_mgr.Maybe_core(owner_dir.NameOnly(), src.Url().NameAndExt());
|
||||
trg = new Fbrow_file_itm(Bool_.N, is_xowa_core, list_total + i, owner_dir_bry, src.Url().RawBry(), Bry_.new_u8(src.Name()), Bry_.new_u8(src_as_fil.ModifiedTime().XtoStr_fmt("yyyy-MM-dd")), Bry_.new_u8(size_str), Ary_empty);
|
||||
}
|
||||
list.Add(trg);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.core.ios.*; import gplx.core.net.*;
|
||||
import gplx.xowa.specials.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
public class Fbrow_special_page implements Xows_page {
|
||||
public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
Xopage_html_data html_data = Write_html(wiki.App(), url.Qargs_ary());
|
||||
html_data.Apply(page);
|
||||
}
|
||||
private static Xopage_html_data Write_html(Xoa_app app, Gfo_qarg_itm[] args_ary) {
|
||||
// scan owner_dir
|
||||
Xoa_url_arg_mgr arg_mgr = new Xoa_url_arg_mgr(null).Init(args_ary);
|
||||
String owner_str = arg_mgr.Read_str_or_null("path"); if (owner_str == null) return Xopage_html_data.err_("url has unknown path");
|
||||
IoItmDir owner_dir = Io_mgr.Instance.QueryDir_args(Io_url_.new_any_(owner_str)).DirInclude_(true).ExecAsDir();
|
||||
Fbrow_file_itm owner_itm = Fbrow_file_itm.New(owner_dir);
|
||||
|
||||
// write body
|
||||
Io_url addon_dir = app.Fsys_mgr().Bin_addon_dir().GenSubDir_nest("import", "file_browser");
|
||||
byte[] template_src = Io_mgr.Instance.LoadFilBry(addon_dir.GenSubFil_nest("bin", "file_browser.mustache.html"));
|
||||
Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
byte[] body = gplx.langs.mustaches.Mustache_wtr_.Write_to_bry(tmp_bfr, template_src, owner_itm);
|
||||
|
||||
// write head
|
||||
Xopage_html_data rv = new Xopage_html_data(Display_ttl, body);
|
||||
rv.Head_tags().Add(Xopg_tag_itm.New_css(addon_dir.GenSubFil_nest("bin", "file_browser.css")));
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static final String SPECIAL_KEY = "XowaFileBrowser";
|
||||
public static final byte[] Display_ttl = Bry_.new_a7("Import XOWA Wikis");
|
||||
public Xows_special_meta Special__meta() {return new Xows_special_meta(Xows_special_meta_.Src__xowa, SPECIAL_KEY);}
|
||||
public static final Xows_page Prototype = new Fbrow_special_page();
|
||||
public Xows_page Special__clone() {return this;}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.core.ios.*;
|
||||
import gplx.langs.mustaches.*;
|
||||
class Wikis_list_mgr implements Mustache_doc_itm {
|
||||
private final byte[] import_root;
|
||||
private final Wikis_list_itm[] subs;
|
||||
public Wikis_list_mgr(byte[] import_root, Wikis_list_itm[] subs) {this.import_root = import_root; this.subs = subs;}
|
||||
public boolean Mustache__write(String key, Mustache_bfr bfr) {
|
||||
if (String_.Eq(key, "import_root")) bfr.Add_bry(import_root);
|
||||
return false;
|
||||
}
|
||||
public Mustache_doc_itm[] Mustache__subs(String key) {
|
||||
if (String_.Eq(key, "subs")) return subs;
|
||||
return Mustache_doc_itm_.Ary__empty;
|
||||
}
|
||||
}
|
||||
class Wikis_list_itm implements Mustache_doc_itm {
|
||||
private final byte[] domain, date;
|
||||
public Wikis_list_itm(byte[] domain, byte[] date) {
|
||||
this.domain = domain; this.date = date;
|
||||
}
|
||||
public boolean Mustache__write(String key, Mustache_bfr bfr) {
|
||||
if (String_.Eq(key, "domain")) bfr.Add_bry(domain);
|
||||
else if (String_.Eq(key, "date")) bfr.Add_bry(date);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
public Mustache_doc_itm[] Mustache__subs(String key) {return Mustache_doc_itm_.Ary__empty;}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.xowa.specials.*; import gplx.core.ios.*; import gplx.core.net.*;
|
||||
public class Wikis_list_page implements Xows_page {
|
||||
public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
|
||||
Xoa_url_arg_mgr arg_mgr = new Xoa_url_arg_mgr(null).Init(url.Qargs_ary());
|
||||
Wikis_list_wtr wtr = new Wikis_list_wtr();
|
||||
byte[] cmd = arg_mgr.Read_bry_or_null("cmd");
|
||||
if (cmd == null) {
|
||||
Xopage_html_data html_data = wtr.Write(wiki.App(), url.Qargs_ary(), GfoInvkAble_.Null);
|
||||
html_data.Apply(page);
|
||||
}
|
||||
else {
|
||||
if (Bry_.Eq(cmd, Bry_.new_a7("add"))) {
|
||||
byte[] file = arg_mgr.Read_bry_or_null("file");
|
||||
if (file != null) {
|
||||
if (wiki.App().Tid_is_edit()) {
|
||||
wiki.App().User().User_db_mgr().Init_site_mgr();
|
||||
}
|
||||
wiki.App().Wiki_mgri().Import_by_url(Io_url_.new_fil_(String_.new_u8(file)));
|
||||
Xopage_html_data html_data = wtr.Write(wiki.App(), url.Qargs_ary(), GfoInvkAble_.Null);
|
||||
html_data.Apply(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final String SPECIAL_KEY = "XowaWikis";
|
||||
public static final byte[] Display_ttl = Bry_.new_a7("XOWA Wikis");
|
||||
public Xows_special_meta Special__meta() {return new Xows_special_meta(Xows_special_meta_.Src__xowa, SPECIAL_KEY);}
|
||||
public static final Xows_page Prototype = new Wikis_list_page();
|
||||
public Xows_page Special__clone() {return this;}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.core.net.*;
|
||||
import gplx.xowa.wikis.xwikis.*;
|
||||
import gplx.langs.mustaches.*;
|
||||
import gplx.xowa.users.data.*; import gplx.xowa.wikis.pages.*;
|
||||
class Wikis_list_wtr {
|
||||
public Xopage_html_data Write(Xoa_app app, Gfo_qarg_itm[] args, GfoInvkAble select_invkable) {
|
||||
// scan wikis
|
||||
List_adp list = List_adp_.new_();
|
||||
app.User().User_db_mgr().Init_site_mgr();
|
||||
Xoud_site_row[] site_ary = app.User().User_db_mgr().Site_mgr().Get_all();
|
||||
int len = site_ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xoud_site_row site_itm = site_ary[i];
|
||||
if (String_.Eq(site_itm.Domain(), gplx.xowa.wikis.domains.Xow_domain_itm_.Str__home)) continue;
|
||||
list.Add(new Wikis_list_itm(Bry_.new_u8(site_itm.Domain()), Bry_.new_a7("2016-03-05")));
|
||||
}
|
||||
Wikis_list_mgr mgr = new Wikis_list_mgr(Get_root_url(), (Wikis_list_itm[])list.To_ary_and_clear(Wikis_list_itm.class));
|
||||
|
||||
// write body
|
||||
Io_url addon_dir = app.Fsys_mgr().Bin_addon_dir().GenSubDir_nest("app", "wiki_list");
|
||||
byte[] template_src = Io_mgr.Instance.LoadFilBry(addon_dir.GenSubFil_nest("bin", "wiki_list.mustache.html"));
|
||||
Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
byte[] body = gplx.langs.mustaches.Mustache_wtr_.Write_to_bry(tmp_bfr, template_src, mgr);
|
||||
|
||||
// write to html
|
||||
Xopage_html_data rv = new Xopage_html_data(Wikis_list_page.Display_ttl, body);
|
||||
rv.Head_tags().Add(Xopg_tag_itm.New_css(addon_dir.GenSubFil_nest("bin", "wiki_list.css")));
|
||||
return rv;
|
||||
}
|
||||
private static byte[] Get_root_url() {
|
||||
byte tid = gplx.core.envs.Op_sys.Cur().Tid();
|
||||
byte[] rv = Bry_.new_a7("/");
|
||||
switch (tid) {
|
||||
case gplx.core.envs.Op_sys.Tid_wnt : rv = Bry_.new_a7("C:\\"); break;
|
||||
}
|
||||
rv = gplx.langs.htmls.encoders.Gfo_url_encoder_.Href.Encode(rv);
|
||||
return rv;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.file_browsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
public class Xopage_html_data {
|
||||
public Xopage_html_data(byte[] display_ttl, byte[] body) {
|
||||
this.display_ttl = display_ttl;
|
||||
this.body = body;
|
||||
}
|
||||
public byte[] Display_ttl() {return display_ttl;} private byte[] display_ttl;
|
||||
public byte[] Body() {return body;} private final byte[] body;
|
||||
public Xopg_tag_mgr Head_tags() {return head_tags;} private final Xopg_tag_mgr head_tags = new Xopg_tag_mgr();
|
||||
public Xopg_tag_mgr Tail_tags() {return tail_tags;} private final Xopg_tag_mgr tail_tags = new Xopg_tag_mgr();
|
||||
|
||||
public void Apply(Xoa_page page) {
|
||||
page.Html_data().Html_restricted_n_();
|
||||
page.Html_data().Skip_parse_(Bool_.Y);
|
||||
Bry_bfr bfr = Bry_bfr.new_();
|
||||
page.Html_data().Custom_head_end_concat(head_tags.To_html(bfr));
|
||||
page.Html_data().Custom_html_end_concat(tail_tags.To_html(bfr));
|
||||
page.Html_data().Display_ttl_(display_ttl);
|
||||
page.Html_data().Custom_body_(this.Body());
|
||||
page.Html_data().Custom_head_tags().Copy(head_tags);
|
||||
page.Html_data().Custom_tail_tags().Copy(head_tags);
|
||||
}
|
||||
|
||||
public static Xopage_html_data err_(String msg) {return new Xopage_html_data(Bry_.Empty, Bry_.new_u8(msg));}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.apps.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*;
|
||||
import gplx.xowa.specials.*;
|
||||
public class Xoa_special_regy {
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry(); // NOTE: case-sensitive; case-insensitive requires lang
|
||||
public void Add(Xows_page page) {hash.Add(page.Special__meta().Key_bry(), page);}
|
||||
public void Add_many(Xows_page... ary) {for (Xows_page itm : ary) Add(itm);}
|
||||
public Xows_page Get_by_or_null(byte[] key) {return (Xows_page)hash.Get_by(key);}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue