User_wiki: Add list of user wikis page

v3.3.4
gnosygnu 8 years ago
parent 0fb6fea11a
commit 6d92c3cfbf

@ -16,7 +16,8 @@ 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.addons.users.wikis.regys.dbs.*;
import gplx.xowa.addons.users.wikis.regys.specials.itms.*; import gplx.xowa.addons.users.wikis.regys.specials.lists.*;
import gplx.xowa.htmls.bridges.*;
import gplx.dbs.*;
import gplx.xowa.specials.*;
@ -24,6 +25,7 @@ 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_itm_special.Prototype
, Xouw_list_special.Prototype
};
}
public Bridge_cmd_itm[] Json_cmds() {

@ -17,8 +17,8 @@ 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 {
import gplx.langs.mustaches.*; import gplx.xowa.addons.users.wikis.regys.dbs.*;
public class Xouw_itm_doc implements Mustache_doc_itm {
private final boolean mode_is_new;
private final int id;
private final String domain, name, dir;
@ -41,5 +41,15 @@ class Xouw_itm_doc implements Mustache_doc_itm {
if (String_.Eq(key, "mode_is_new")) return Mustache_doc_itm_.Ary__bool(mode_is_new);
return Mustache_doc_itm_.Ary__empty;
}
public static final Xouw_itm_doc[] Ary_empty = new Xouw_itm_doc[0];
public static Xouw_itm_doc New(Xou_wiki_itm itm) {return new Xouw_itm_doc(itm.Id(), itm.Domain(), itm.Name(), itm.Url().OwnerDir().Xto_api());}
public static Xouw_itm_doc[] New_ary(Xou_wiki_itm[] itms_ary) {
int len = itms_ary.length;
Xouw_itm_doc[] rv = new Xouw_itm_doc[itms_ary.length];
for (int i = 0; i < len; i++) {
rv[i] = New(itms_ary[i]);
}
return rv;
}
}

@ -31,7 +31,7 @@ class Xouw_itm_html extends Xow_special_wtr__base {
Xou_wiki_itm itm = db_mgr.Tbl__wiki().Select_by_key_or_null(domain);
if (itm == null)
itm = new Xou_wiki_itm(-1, "", "", Io_url_.Empty, "");
return new Xouw_itm_doc(itm.Id(), itm.Domain(), itm.Name(), itm.Url().OwnerDir().Xto_api());
return Xouw_itm_doc.New(itm);
}
@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();

@ -0,0 +1,34 @@
/*
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.lists; 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.*;
import gplx.xowa.addons.users.wikis.regys.dbs.*; import gplx.xowa.addons.users.wikis.regys.specials.itms.*;
class Xouw_list_doc implements Mustache_doc_itm {
private final Xouw_itm_doc[] itms_ary;
public Xouw_list_doc(Xouw_itm_doc[] itms_ary) {
this.itms_ary = itms_ary;
}
public boolean Mustache__write(String key, Mustache_bfr bfr) {
return true;
}
public Mustache_doc_itm[] Mustache__subs(String key) {
if (String_.Eq(key, "itms")) return itms_ary;
return Mustache_doc_itm_.Ary__empty;
}
}

@ -0,0 +1,40 @@
/*
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.lists; 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.*;
import gplx.dbs.*; import gplx.xowa.addons.users.wikis.regys.dbs.*; import gplx.xowa.addons.users.wikis.regys.specials.itms.*;
class Xouw_list_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", "user", "wiki", "list");}
@Override protected Io_url Get_mustache_fil(Io_url addon_dir) {return addon_dir.GenSubFil_nest("bin", "xouw_list.mustache.html");}
@Override protected Mustache_doc_itm Bld_mustache_root(Xoa_app app) {
Db_conn conn = app.User().User_db_mgr().Conn();
Xouw_db_mgr db_mgr = new Xouw_db_mgr(conn);
Xou_wiki_itm[] itms_ary = db_mgr.Tbl__wiki().Select_all();
return new Xouw_list_doc(Xouw_itm_doc.New_ary(itms_ary));
}
@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", "xouw_list.css")));
head_tags.Add(Xopg_tag_itm.New_js_file(addon_dir.GenSubFil_nest("bin", "xouw_list.js")));
}
}

@ -0,0 +1,28 @@
/*
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.lists; 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_list_special implements Xow_special_page {
public void Special__gen(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
new Xouw_list_html().Bld_page_by_mustache(wiki.App(), page, this);
}
Xouw_list_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_list_special(Xow_special_meta.New_xo("XowaUserWikis", "Personal Wikis"));
}
Loading…
Cancel
Save