diff --git a/400_xowa/src/gplx/xowa/addons/users/wikis/regys/Xou_regy_addon.java b/400_xowa/src/gplx/xowa/addons/users/wikis/regys/Xou_regy_addon.java new file mode 100644 index 000000000..07a49938f --- /dev/null +++ b/400_xowa/src/gplx/xowa/addons/users/wikis/regys/Xou_regy_addon.java @@ -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 . +*/ +package gplx.xowa.addons.users.wikis.regys; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.users.*; import gplx.xowa.addons.users.wikis.*; +import gplx.xowa.specials.*; +import gplx.xowa.addons.users.wikis.regys.specials.registers.*; +public class Xou_regy_addon implements Xoax_addon_itm, Xoax_addon_itm__special { + public Xow_special_page[] Special_pages() { + return new Xow_special_page[] + { Xouw_register_special.Prototype + }; + } + + public String Addon__key() {return ADDON__KEY;} private static final String ADDON__KEY = "xowa.user.wiki.regy"; +} diff --git a/400_xowa/src/gplx/xowa/addons/users/wikis/regys/dbs/Xou_wiki_tbl.java b/400_xowa/src/gplx/xowa/addons/users/wikis/regys/dbs/Xou_wiki_tbl.java new file mode 100644 index 000000000..f3b6d4246 --- /dev/null +++ b/400_xowa/src/gplx/xowa/addons/users/wikis/regys/dbs/Xou_wiki_tbl.java @@ -0,0 +1,50 @@ +/* +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.users.wikis.regys.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.users.*; import gplx.xowa.addons.users.wikis.*; import gplx.xowa.addons.users.wikis.regys.*; +import gplx.dbs.*; +public class Xou_wiki_tbl implements Db_tbl { + private final Dbmeta_fld_list flds = new Dbmeta_fld_list(); + private final String fld__wiki_id, fld__wiki_type, fld__wiki_domain, fld__wiki_name, fld__wiki_data_date, fld__wiki_core_url, fld__wiki_data; + private final Db_conn conn; + public Xou_wiki_tbl(Db_conn conn) { + this.conn = conn; + this.tbl_name = "user_wiki"; + this.fld__wiki_id = flds.Add_int_pkey("wiki_id"); + this.fld__wiki_type = flds.Add_int("wiki_type"); // enum: 0=user; 1=wmf; 2=wikia; + this.fld__wiki_domain = flds.Add_str("wiki_domain", 255); // EX: "en.wikipedia.org" + this.fld__wiki_name = flds.Add_str("wiki_name", 255); // EX: "English Wikipedia" + this.fld__wiki_data_date = flds.Add_str("wiki_data_date", 16); // EX: "20161001" + this.fld__wiki_core_url = flds.Add_str("wiki_core_url", 255); // EX: "/xowa/wiki/en.wikipedia.org/en.wikipedia.org-core.xowa" + this.fld__wiki_data = flds.Add_text("wiki_data"); // EX: '{category_level="1",search_level="2", ...}' + conn.Rls_reg(this); + } + public String Tbl_name() {return tbl_name;} private final String tbl_name; + public void Create_tbl() { + conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds)); + } + public void Insert(int id, String type, String domain, String name, String data_date, String core_url, String data) { + conn.Stmt_insert(tbl_name, flds) + .Val_int(fld__wiki_id, id) + .Val_str(fld__wiki_type, type).Val_str(fld__wiki_domain, domain).Val_str(fld__wiki_name, name) + .Val_str(fld__wiki_data_date, data_date).Val_str(fld__wiki_core_url, core_url).Val_str(fld__wiki_data, data) + .Exec_insert() + ; + } + + public void Rls() {} +} diff --git a/400_xowa/src/gplx/xowa/addons/users/wikis/regys/specials/registers/Xouw_register_special.java b/400_xowa/src/gplx/xowa/addons/users/wikis/regys/specials/registers/Xouw_register_special.java new file mode 100644 index 000000000..8e90dad0b --- /dev/null +++ b/400_xowa/src/gplx/xowa/addons/users/wikis/regys/specials/registers/Xouw_register_special.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.users.wikis.regys.specials.registers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.users.*; import gplx.xowa.addons.users.wikis.*; import gplx.xowa.addons.users.wikis.regys.*; import gplx.xowa.addons.users.wikis.regys.specials.*; +import gplx.xowa.specials.*; +public class Xouw_register_special implements Xow_special_page { + public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) { + // Special:XowaWikiRegister +// Gfo_qarg_mgr url_args = new Gfo_qarg_mgr().Init(url.Qargs_ary()); +// +// new Xow_import_html(Io_url_.new_dir_(owner_str), dir_cmd).Bld_page_by_mustache(wiki.App(), page, this); + } + Xouw_register_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 Xouw_register_special(Xow_special_meta.New_xo("XowaWikiRegister", "Register Wiki")); +} diff --git a/400_xowa/src/gplx/xowa/users/wikis/Xou_wiki_mgr.java b/400_xowa/src/gplx/xowa/users/wikis/Xou_wiki_mgr.java index 03d33cd78..413a2d88b 100644 --- a/400_xowa/src/gplx/xowa/users/wikis/Xou_wiki_mgr.java +++ b/400_xowa/src/gplx/xowa/users/wikis/Xou_wiki_mgr.java @@ -39,59 +39,6 @@ class Xou_wiki_itm_source { class Xou_wiki_itm_path_layout { public static final int Tid_multiple = 1, Tid_root = 2; } -class Xou_wiki_tbl { - public static final String Tbl_sql = String_.Concat_lines_nl - ( "CREATE TABLE wiki_regy" - , "( wiki_id integer NOT NULL PRIMARY KEY" // user_generated; - , ", wiki_key varchar(255)" // unique; akin to domain; en.wikipedia.org - , ", wiki_source integer" // 0=user; 1=wmf; 2=wikia; - , ", wiki_ctg_type integer" // - , ", wiki_search_type integer" // -// , ", wiki_data_date varchar(8)" // 20140502 -// , ", wiki_data_root varchar(255)" // -// , ", wiki_file_date varchar(8)" // 20140502 -// , ", wiki_file_root varchar(255)" // -// , ", wiki_html_date varchar(8)" // 20140502 -// , ", wiki_html_root varchar(255)" // - , ", wiki_misc varchar(255)" // 20140502 - , ");" - ); - public static final String Tbl_name = "user_wiki" - , Fld_dir_id = "dir_id", Fld_dir_name = "dir_name" - ; -// private static final Db_idx_itm -// Idx_name = Db_idx_itm.sql_("CREATE INDEX IF NOT EXISTS cache_dir__name ON cache_dir (dir_name);") -// ; -} -/* -( wf_id integer NOT NULL PRIMARY KEY -- 1,2,3, etc..; user-specified (not canonical) -, wf_key varchar(255) NOT NULL -- system key; EX: "enwiki.css.20140601" UNIQUE; SYSTEM-GENERATED; CUSTOMIZABLE -, wf_name varchar(255) NOT NULL -- ui name; EX: "English Wikipedia CSS as of 2014-06-01"; NOT UNIQUE; SYSTEM-GENERATED; CUSTOMIZABLE -, wf_data_domain varchar(255) NOT NULL -- domain; EX:en.wikipedia.org -, wf_data_date varchar(255) NOT NULL -- dump date; 20140502 -, wf_data_source varchar(255) NOT NULL -- WMF;archive.org;XOWA; -, wf_url varchar(255) NOT NULL -- url location; EX: "xowa-fs://~{xowa}/wiki/en.wikipedia.org/en.wikipedia.org.xowa" -, wf_sort integer NOT NULL -- sort order; EX: "1", "2", "3", etc.. UNIQUE; SYSTEM-GENERATED; CUSTOMIZABLE -, wf_deleted integer NOT NULL -- deleted flag - -/xowa -/bin -/data - /en.wikipedia.org - / file - fasb.mount - / fsdb.main - - / fsdb.user - / html - xowa_common.css - xowa_wiki.css - / imgs - / wiki - en.wikipedia.org.xowa - en.wikipedia.org.000.xowa -/user -*/ class Xou_wiki_part { public int Id() {return id;} public void Id_(int v) {id = v;} private int id; public boolean Deleted() {return deleted;} public void Deleted_(boolean v) {deleted = v;} private boolean deleted;