From 6459d990a5235f9dad5d40796a9aaeb870be1e8f Mon Sep 17 00:00:00 2001 From: gnosygnu Date: Fri, 18 Nov 2016 09:10:16 -0500 Subject: [PATCH] App_update: Add addon and special page --- .../src/gplx/xowa/addons/Xoax_addon_mgr.java | 1 + .../xowa/addons/apps/cfgs/gui/Xogui_grp.java | 2 +- .../addons/apps/updates/Xoa_update_addon.java | 31 ++++++++++++ .../updates/specials/Xoa_update_html.java | 36 ++++++++++++++ .../apps/updates/specials/Xoa_update_itm.java | 48 +++++++++++++++++++ .../updates/specials/Xoa_update_special.java | 27 +++++++++++ .../pages/syncs/core/Xosync_read_mgr.java | 2 +- 7 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 400_xowa/src/gplx/xowa/addons/apps/updates/Xoa_update_addon.java create mode 100644 400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_html.java create mode 100644 400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_itm.java create mode 100644 400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_special.java diff --git a/400_xowa/src/gplx/xowa/addons/Xoax_addon_mgr.java b/400_xowa/src/gplx/xowa/addons/Xoax_addon_mgr.java index 964cfdaee..cc3f0632e 100644 --- a/400_xowa/src/gplx/xowa/addons/Xoax_addon_mgr.java +++ b/400_xowa/src/gplx/xowa/addons/Xoax_addon_mgr.java @@ -57,6 +57,7 @@ public class Xoax_addon_mgr { , new gplx.xowa.addons.wikis.pages.syncs .Xosync_addon() , new gplx.xowa.addons.users.wikis.regys .Xou_regy_addon() , new gplx.xowa.addons.apps.cfgs .Xoa_cfg_addon() + , new gplx.xowa.addons.apps.updates .Xoa_update_addon() // jsons ); diff --git a/400_xowa/src/gplx/xowa/addons/apps/cfgs/gui/Xogui_grp.java b/400_xowa/src/gplx/xowa/addons/apps/cfgs/gui/Xogui_grp.java index 4ca364113..f4a8e356c 100644 --- a/400_xowa/src/gplx/xowa/addons/apps/cfgs/gui/Xogui_grp.java +++ b/400_xowa/src/gplx/xowa/addons/apps/cfgs/gui/Xogui_grp.java @@ -49,7 +49,7 @@ public class Xogui_grp implements Xogui_nde, Mustache_doc_itm { else if (String_.Eq(k, "lang")) bfr.Add_str_u8(name); else if (String_.Eq(k, "name")) bfr.Add_str_u8(name); else if (String_.Eq(k, "help")) bfr.Add_str_u8(help); - return false; + return true; } public Mustache_doc_itm[] Mustache__subs(String key) { if (String_.Eq(key, "itms")) return itms; diff --git a/400_xowa/src/gplx/xowa/addons/apps/updates/Xoa_update_addon.java b/400_xowa/src/gplx/xowa/addons/apps/updates/Xoa_update_addon.java new file mode 100644 index 000000000..4cd38824c --- /dev/null +++ b/400_xowa/src/gplx/xowa/addons/apps/updates/Xoa_update_addon.java @@ -0,0 +1,31 @@ +/* +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 . +*/ +package gplx.xowa.addons.apps.updates; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; +import gplx.xowa.specials.*; import gplx.xowa.htmls.bridges.*; +import gplx.xowa.addons.apps.updates.specials.*; +public class Xoa_update_addon implements Xoax_addon_itm, Xoax_addon_itm__special { + public Xow_special_page[] Special_pages() { + return new Xow_special_page[] + { Xoa_update_special.Prototype + }; + } + + public String Addon__key() {return ADDON__KEY;} private static final String ADDON__KEY = "xowa.app.update"; + public static void Init(Xoae_app app) { + } +} diff --git a/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_html.java b/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_html.java new file mode 100644 index 000000000..e507bed32 --- /dev/null +++ b/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_html.java @@ -0,0 +1,36 @@ +/* +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 . +*/ +package gplx.xowa.addons.apps.updates.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.updates.*; +import gplx.xowa.specials.*; import gplx.langs.mustaches.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.pages.tags.*; +class Xoa_update_html extends Xow_special_wtr__base { + @Override protected Io_url Get_addon_dir(Xoa_app app) {return app.Fsys_mgr().Http_root().GenSubDir_nest("bin", "any", "xowa", "addon", "app", "update");} + @Override protected Io_url Get_mustache_fil(Io_url addon_dir) {return addon_dir.GenSubFil_nest("bin", "xoa_update.mustache.html");} + @Override protected Mustache_doc_itm Bld_mustache_root(Xoa_app app) { + return Xoa_update_itm.Load(app.Fsys_mgr().Bin_addon_dir()); + } + @Override protected void Bld_tags(Xoa_app app, Io_url addon_dir, Xopage_html_data page_data) { + Xopg_tag_mgr head_tags = page_data.Head_tags(); + Xopg_tag_wtr_.Add__xocss (head_tags, app.Fsys_mgr().Http_root()); + Xopg_tag_wtr_.Add__xohelp (head_tags, app.Fsys_mgr().Http_root()); + Xopg_tag_wtr_.Add__xolog (head_tags, app.Fsys_mgr().Http_root()); + Xopg_tag_wtr_.Add__xoajax (head_tags, app.Fsys_mgr().Http_root(), app); + + head_tags.Add(Xopg_tag_itm.New_css_file(addon_dir.GenSubFil_nest("bin", "xoa_update.css"))); + head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xoa_update.js"))); + } +} diff --git a/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_itm.java b/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_itm.java new file mode 100644 index 000000000..6341897db --- /dev/null +++ b/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_itm.java @@ -0,0 +1,48 @@ +/* +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 . +*/ +package gplx.xowa.addons.apps.updates.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.updates.*; +import gplx.langs.mustaches.*; +class Xoa_update_itm implements Mustache_doc_itm { + private final String version, date, priority, summary, details; + public Xoa_update_itm(String version, String date, String priority, String summary, String details) { + this.version = version; + this.date = date; + this.priority = priority; + this.summary = summary; + this.details = details; + } + public boolean Mustache__write(String k, Mustache_bfr bfr) { + if (String_.Eq(k, "version")) bfr.Add_str_u8(version); + else if (String_.Eq(k, "date")) bfr.Add_str_u8(date); + else if (String_.Eq(k, "priority")) bfr.Add_str_u8(priority); + else if (String_.Eq(k, "summary")) bfr.Add_str_u8(summary); + else if (String_.Eq(k, "details")) bfr.Add_str_u8(details); + return true; + } + public Mustache_doc_itm[] Mustache__subs(String key) { + return Mustache_doc_itm_.Ary__empty; + } + public static Mustache_doc_itm Load(Io_url app_root) { + // get from internet +// Io_url trg_url = app_root.GenSubFil_nest("app", "update", "xowa_update_info.sqlite3"); +// String src_url = "http://xowa.org/admin/app_update/xowa_update_info.sqlite3"; +// Io_mgr.Instance.DownloadFil(src_url, trg_url); + + return new Xoa_update_itm("", "", "", "", ""); + } +} diff --git a/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_special.java b/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_special.java new file mode 100644 index 000000000..8533edb0e --- /dev/null +++ b/400_xowa/src/gplx/xowa/addons/apps/updates/specials/Xoa_update_special.java @@ -0,0 +1,27 @@ +/* +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 . +*/ +package gplx.xowa.addons.apps.updates.specials; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.apps.*; import gplx.xowa.addons.apps.updates.*; +import gplx.xowa.specials.*; import gplx.core.net.qargs.*; +public class Xoa_update_special implements Xow_special_page { + public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) { + } + Xoa_update_special(Xow_special_meta special__meta) {this.special__meta = special__meta;} + public Xow_special_meta Special__meta() {return special__meta;} private final Xow_special_meta special__meta; + public Xow_special_page Special__clone() {return this;} + public static final Xow_special_page Prototype = new Xoa_update_special(Xow_special_meta.New_xo("XowaAppUpdate", "App Update")); +} diff --git a/400_xowa/src/gplx/xowa/addons/wikis/pages/syncs/core/Xosync_read_mgr.java b/400_xowa/src/gplx/xowa/addons/wikis/pages/syncs/core/Xosync_read_mgr.java index 64953e928..fb49684c7 100644 --- a/400_xowa/src/gplx/xowa/addons/wikis/pages/syncs/core/Xosync_read_mgr.java +++ b/400_xowa/src/gplx/xowa/addons/wikis/pages/syncs/core/Xosync_read_mgr.java @@ -42,7 +42,7 @@ public class Xosync_read_mgr { sync_conn.Meta_tbl_assert(sync_tbl); } DateAdp sync_date = sync_tbl.Select_sync_date_or_min(tmp_dbpg.Id()); - if (Datetime_now.Get().Diff(sync_date).Total_mins().To_int() < sync_api.Auto_interval()) return; + if (Datetime_now.Get().Diff(sync_date).Total_mins().To_int() <= sync_api.Auto_interval()) return; Xoa_app app = wiki.App(); Xoh_page hpg = new Xoh_page();