mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.6.3.1'
This commit is contained in:
@@ -16,12 +16,12 @@ 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.wikis.metas; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
public class Xow_html_util implements GfoInvkAble {
|
||||
public class Xow_html_util implements Gfo_invk {
|
||||
public Xow_html_util(Xowe_wiki wiki) {this.wiki = wiki;} private Xowe_wiki wiki;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_if_bool)) return If_bool(m.ReadStr("expr"), m.ReadStr("true_val"), m.ReadStr("false_val"));
|
||||
else if (ctx.Match(k, Invk_if_yn)) return If_yn(m.ReadStr("expr"), m.ReadStr("true_val"), m.ReadStr("false_val"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
} private static final String Invk_if_bool = "if_bool", Invk_if_yn = "if_yn";
|
||||
String If_bool(String expr, String true_val, String false_val) {
|
||||
Object o = wiki.Appe().Gfs_mgr().Run_str(expr);
|
||||
|
||||
@@ -18,10 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.wikis.metas; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.brys.fmtrs.*; import gplx.core.envs.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
public class Xow_script_mgr implements GfoInvkAble {
|
||||
public class Xow_script_mgr implements Gfo_invk {
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_set)) Set(m.ReadBry("key"), m.ReadBry("wiki_type"), m.ReadBry("script"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_set = "set";
|
||||
public void Exec(Xowe_wiki wiki) {
|
||||
|
||||
@@ -16,14 +16,14 @@ 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.wikis.metas; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
public class Xow_sys_cfg implements GfoInvkAble {
|
||||
public class Xow_sys_cfg implements Gfo_invk {
|
||||
public Xow_sys_cfg(Xowe_wiki wiki) {}
|
||||
public boolean Xowa_cmd_enabled() {return xowa_cmd_enabled;} public Xow_sys_cfg Xowa_cmd_enabled_(boolean v) {xowa_cmd_enabled = v; return this;} private boolean xowa_cmd_enabled;
|
||||
public boolean Xowa_proto_enabled() {return xowa_proto_enabled;} public Xow_sys_cfg Xowa_proto_enabled_(boolean v) {xowa_proto_enabled = v; return this;} private boolean xowa_proto_enabled;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_xowa_cmd_enabled_)) xowa_cmd_enabled = m.ReadYn("v");
|
||||
else if (ctx.Match(k, Invk_xowa_cmd_enabled_)) xowa_proto_enabled = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_xowa_cmd_enabled_ = "xowa_cmd_enabled_";
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ 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.wikis.metas; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
public class Xow_user implements GfoInvkAble {
|
||||
public class Xow_user implements Gfo_invk {
|
||||
public byte[] Name() {return name;} private byte[] name = Bry_.new_a7("anonymous");
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_name_)) name = m.ReadBry("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_name_ = "name_";
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.xowa.wikis.metas; import gplx.*; import gplx.xowa.*; import gplx.xo
|
||||
import gplx.xowa.langs.msgs.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.htmls.hrefs.*;
|
||||
public class Xow_wiki_props implements GfoInvkAble {
|
||||
public class Xow_wiki_props implements Gfo_invk {
|
||||
public byte[] Main_page() {return main_page;} private byte[] main_page = Xoa_page_.Main_page_bry; // HACK: default to Main_Page b/c some code tries to do Xoa_ttl.parse() which will not work with ""; DATE:2014-02-16
|
||||
public Xow_wiki_props Main_page_(byte[] v) {main_page = v; return this;}
|
||||
public void Main_page_update(Xowe_wiki wiki) {
|
||||
@@ -42,6 +42,7 @@ public class Xow_wiki_props implements GfoInvkAble {
|
||||
public byte[] Siteinfo_misc() {return siteinfo_misc;}
|
||||
public byte[] Siteinfo_mainpage() {return siteinfo_mainpage;} private byte[] siteinfo_mainpage = Bry_.Empty;
|
||||
public DateAdp Modified_latest() {return modified_latest;} private DateAdp modified_latest;
|
||||
public String Modified_latest__yyyy_MM_dd() {return modified_latest == null ? "" : modified_latest.XtoStr_fmt_yyyy_MM_dd();}
|
||||
public Xow_wiki_props Init_props(int domain_tid, byte[] domain_bry) {
|
||||
this.site_name = Bry_.new_a7(String_.UpperFirst(String_.new_a7(Xow_domain_tid_.Get_type_as_bry(domain_tid)))); // EX: "Wikipedia"
|
||||
this.server_name = domain_bry; // EX: "en.wikipedia.org"
|
||||
@@ -58,6 +59,7 @@ public class Xow_wiki_props implements GfoInvkAble {
|
||||
public void Init_by_load(Xoa_app app, gplx.dbs.cfgs.Db_cfg_tbl cfg_tbl) {
|
||||
if (app.Bldr__running()) return; // never load main_page during bldr; note that Init_by_load is called by bldr cmds like css; DATE:2015-07-24
|
||||
this.main_page = cfg_tbl.Select_bry_or(Xow_cfg_consts.Grp__wiki_init, Xow_cfg_consts.Key__init__main_page, null);
|
||||
this.modified_latest = cfg_tbl.Select_date_or(Xow_cfg_consts.Grp__wiki_init, Xow_cfg_consts.Key__init__modified_latest, null);
|
||||
if (main_page == null) { // main_page not found
|
||||
Xoa_app_.Usr_dlg().Warn_many("", "", "mw_props.load; main_page not found; conn=~{0}", cfg_tbl.Conn().Conn_info().Db_api());
|
||||
this.main_page = Xoa_page_.Main_page_bry;
|
||||
@@ -70,7 +72,7 @@ public class Xow_wiki_props implements GfoInvkAble {
|
||||
else if (ctx.Match(k, Invk_siteinfo_mainpage_)) siteinfo_mainpage = m.ReadBry("v");
|
||||
else if (ctx.Match(k, Invk_css_version_)) css_version = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_modified_latest_)) modified_latest = m.ReadDate("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_main_page_ = "main_page_"
|
||||
|
||||
Reference in New Issue
Block a user