mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-06-06 09:24:20 +00:00
User_wikis: Add special page for editing user wiki
This commit is contained in:
parent
1711d52985
commit
69f9f3b048
@ -159,7 +159,6 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
api_root.Init_by_app(this);
|
||||
wmf_mgr.Init_by_app(this);
|
||||
gplx.core.net.emails.Gfo_email_mgr_.Instance = gplx.core.net.emails.Gfo_email_mgr_.New_jre();
|
||||
gplx.xowa.addons.users.wikis.regys.Xou_regy_addon.Init(this);
|
||||
}
|
||||
public boolean Launch_done() {return stage == Xoa_stage_.Tid_launch;}
|
||||
public void Launch() {
|
||||
@ -169,6 +168,7 @@ public class Xoae_app implements Xoa_app, Gfo_invk {
|
||||
user.Cfg_mgr().Setup_mgr().Setup_run_check(this); log_bfr.Add("app.upgrade.done");
|
||||
gplx.xowa.users.prefs.Prefs_converter.Instance.Check(this);
|
||||
user.Wiki().Init_assert(); // NOTE: must assert wiki and load langs first, else will be asserted during Portal_mgr().Init(), which will cause IndexOutOfBounds; DATE:2014-10-04
|
||||
gplx.xowa.addons.users.wikis.regys.Xou_regy_addon.Init(this);
|
||||
}
|
||||
public byte Stage() {return stage;} public Xoae_app Stage_(byte v) {stage = v; return this;} private byte stage = Xoa_stage_.Tid_ctor;
|
||||
public boolean Term_cbk() {
|
||||
|
@ -170,6 +170,11 @@ public class Xowe_wiki implements Xow_wiki, Gfo_invk, Gfo_evt_itm {
|
||||
}
|
||||
public Xodb_mgr_sql Db_mgr_create_as_sql() {Xodb_mgr_sql rv = new Xodb_mgr_sql(this); db_mgr = rv; return rv;}
|
||||
public void Init_by_wiki__force() {init_needed = true; Init_by_wiki();}
|
||||
public void Init_by_wiki__force_and_mark_inited() {
|
||||
init_needed = true;
|
||||
Init_by_wiki();
|
||||
init_needed = false;
|
||||
}
|
||||
public void Init_by_wiki() {Init_assert();}
|
||||
public Xowe_wiki Init_assert() {if (init_needed) Init_wiki(app.Usere()); return this;}
|
||||
public void Init_db_mgr() {
|
||||
|
@ -55,6 +55,7 @@ public class Xoax_addon_mgr {
|
||||
, new gplx.xowa.addons.bldrs.centrals .Xobc_task_addon()
|
||||
, new gplx.xowa.addons.apps.helps.logs .Xolog_addon()
|
||||
, new gplx.xowa.addons.wikis.pages.syncs .Xosync_addon()
|
||||
, new gplx.xowa.addons.users.wikis.regys .Xou_regy_addon()
|
||||
|
||||
// jsons
|
||||
);
|
||||
|
@ -16,17 +16,19 @@ 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.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.addons.users.wikis.regys.dbs.*; import gplx.xowa.addons.users.wikis.regys.specials.itms.*;
|
||||
import gplx.xowa.htmls.bridges.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.specials.*;
|
||||
import gplx.xowa.addons.users.wikis.regys.dbs.*; import gplx.xowa.addons.users.wikis.regys.specials.registers.*;
|
||||
public class Xou_regy_addon implements Xoax_addon_itm, Xoax_addon_itm__special {
|
||||
public Xou_regy_addon(Db_conn conn) {
|
||||
db_mgr = new Xouw_db_mgr(conn);
|
||||
}
|
||||
public Xouw_db_mgr Db_mgr() {return db_mgr;} private final Xouw_db_mgr db_mgr;
|
||||
public class Xou_regy_addon implements Xoax_addon_itm, Xoax_addon_itm__special, Xoax_addon_itm__json {
|
||||
public Xow_special_page[] Special_pages() {
|
||||
return new Xow_special_page[]
|
||||
{ Xouw_register_special.Prototype
|
||||
{ Xouw_itm_special.Prototype
|
||||
};
|
||||
}
|
||||
public Bridge_cmd_itm[] Json_cmds() {
|
||||
return new Bridge_cmd_itm[]
|
||||
{ Xouw_itm_bridge.Prototype
|
||||
};
|
||||
}
|
||||
|
||||
@ -45,8 +47,9 @@ public class Xou_regy_addon implements Xoax_addon_itm, Xoax_addon_itm__special {
|
||||
if (!conn.Meta_tbl_exists(Xou_wiki_tbl.Tbl_name_dflt)) return;
|
||||
|
||||
// register
|
||||
Xou_regy_addon addon = new Xou_regy_addon(conn);
|
||||
Xou_wiki_itm[] itms = addon.Db_mgr().Tbl__wiki().Select_all();
|
||||
// Xou_regy_addon addon = new Xou_regy_addon();
|
||||
Xouw_db_mgr db_mgr = new Xouw_db_mgr(conn);
|
||||
Xou_wiki_itm[] itms = db_mgr.Tbl__wiki().Select_all();
|
||||
int len = itms.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xou_wiki_itm itm = itms[i];
|
||||
@ -56,8 +59,9 @@ public class Xou_regy_addon implements Xoax_addon_itm, Xoax_addon_itm__special {
|
||||
, gplx.xowa.wikis.nss.Xow_ns_mgr_.default_(gplx.xowa.langs.cases.Xol_case_mgr_.A7())
|
||||
, gplx.xowa.wikis.domains.Xow_domain_itm_.parse(Bry_.new_u8(itm.Domain()))
|
||||
, itm.Url().OwnerDir());
|
||||
wiki.Init_assert();
|
||||
wiki.Appe().Wiki_mgr().Add(wiki);
|
||||
wiki.Init_by_wiki__force_and_mark_inited();
|
||||
wiki.Db_mgr_as_sql().Save_mgr().Create_enabled_(true);
|
||||
app.User().Wikii().Xwiki_mgr().Add_by_atrs(itm.Domain(), itm.Domain());
|
||||
}
|
||||
}
|
||||
|
@ -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.xowa.addons.users.wikis.regys.specials.itms; 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.langs.jsons.*;
|
||||
public class Xouw_itm_bridge implements gplx.xowa.htmls.bridges.Bridge_cmd_itm {
|
||||
public void Init_by_app(Xoa_app app) {}
|
||||
public String Exec(Json_nde data) {
|
||||
byte proc_id = proc_hash.Get_as_byte_or(data.Get_as_bry_or(Msg__proc, null), Byte_ascii.Max_7_bit);
|
||||
//Json_nde args = data.Get_kv(Msg__args).Val_as_nde();
|
||||
switch (proc_id) {
|
||||
case Proc__save: break;
|
||||
default: throw Err_.new_unhandled_default(proc_id);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
private static final byte[] Msg__proc = Bry_.new_a7("proc"); //, Msg__args = Bry_.new_a7("args");
|
||||
private static final byte Proc__save = 0;
|
||||
private static final Hash_adp_bry proc_hash = Hash_adp_bry.cs()
|
||||
.Add_str_byte("save" , Proc__save)
|
||||
;
|
||||
|
||||
public byte[] Key() {return BRIDGE_KEY;} public static final byte[] BRIDGE_KEY = Bry_.new_a7("user.wiki.itm.exec");
|
||||
public static final Xouw_itm_bridge Prototype = new Xouw_itm_bridge(); Xouw_itm_bridge() {}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
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.users.wikis.regys.specials.itms; 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.core.ios.*;
|
||||
import gplx.langs.mustaches.*;
|
||||
class Xouw_itm_doc implements Mustache_doc_itm {
|
||||
private final int id;
|
||||
private final byte[] domain, name, file;
|
||||
public Xouw_itm_doc(int id, byte[] domain, byte[] name, byte[] file) {
|
||||
this.id = id;
|
||||
this.domain = domain;
|
||||
this.name = name;
|
||||
this.file = file;
|
||||
}
|
||||
public boolean Mustache__write(String key, Mustache_bfr bfr) {
|
||||
if (String_.Eq(key, "id")) bfr.Add_int(id);
|
||||
else if (String_.Eq(key, "domain")) bfr.Add_bry(domain);
|
||||
else if (String_.Eq(key, "name")) bfr.Add_bry(name);
|
||||
else if (String_.Eq(key, "file")) bfr.Add_bry(file);
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
public Mustache_doc_itm[] Mustache__subs(String key) {
|
||||
return Mustache_doc_itm_.Ary__empty;
|
||||
}
|
||||
public static final Xouw_itm_doc[] Ary_empty = new Xouw_itm_doc[0];
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
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.users.wikis.regys.specials.itms; 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.*; import gplx.langs.mustaches.*; import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.pages.tags.*;
|
||||
class Xouw_itm_html extends Xow_special_wtr__base {
|
||||
public Xouw_itm_html() {
|
||||
}
|
||||
@Override protected Io_url Get_addon_dir(Xoa_app app) {return app.Fsys_mgr().Http_root().GenSubDir_nest("bin", "any", "xowa", "addon", "user", "wiki", "itm");}
|
||||
@Override protected Io_url Get_mustache_fil(Io_url addon_dir) {return addon_dir.GenSubFil_nest("bin", "xouw_itm.mustache.html");}
|
||||
@Override protected Mustache_doc_itm Bld_mustache_root(Xoa_app app) {
|
||||
return new Xouw_itm_doc(1, Bry_.new_a7("domain"), Bry_.new_a7("name"), Bry_.new_a7("file"));
|
||||
}
|
||||
@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());
|
||||
head_tags.Add(Xopg_tag_itm.New_css_file(addon_dir.GenSubFil_nest("bin", "xouw_itm.css")));
|
||||
head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xouw_itm.js")));
|
||||
head_tags.Add(Xopg_tag_itm.New_css_file(addon_dir.GenSubFil_nest("bin", "xo.log.css")));
|
||||
head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xo.log.js")));
|
||||
head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xo.app.js")));
|
||||
head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xo.app.http_server.js")));
|
||||
head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xo.app.swt.js")));
|
||||
head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xo.server.js")));
|
||||
}
|
||||
}
|
@ -15,17 +15,16 @@ 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.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 {
|
||||
package gplx.xowa.addons.users.wikis.regys.specials.itms; 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.*; import gplx.core.net.qargs.*;
|
||||
public class Xouw_itm_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);
|
||||
|
||||
new Xouw_itm_html().Bld_page_by_mustache(wiki.App(), page, this);
|
||||
}
|
||||
Xouw_register_special(Xow_special_meta special__meta) {this.special__meta = special__meta;}
|
||||
Xouw_itm_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"));
|
||||
public static final Xow_special_page Prototype = new Xouw_itm_special(Xow_special_meta.New_xo("XowaWikiRegister", "Register Wiki"));
|
||||
}
|
Loading…
Reference in New Issue
Block a user