mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
DownloadCentral: Move list of languages from UI to DB
This commit is contained in:
parent
2c023c2c54
commit
ae0fb89745
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.addons.bldrs.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*;
|
||||
import gplx.core.brys.evals.*; import gplx.core.gfobjs.*; import gplx.core.progs.rates.*; import gplx.core.threads.*;
|
||||
import gplx.xowa.addons.bldrs.centrals.tasks.*; import gplx.xowa.addons.bldrs.centrals.steps.*; import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
|
||||
import gplx.xowa.addons.bldrs.centrals.tasks.*; import gplx.xowa.addons.bldrs.centrals.steps.*; import gplx.xowa.addons.bldrs.centrals.cmds.*; import gplx.xowa.addons.bldrs.centrals.dbs.*; import gplx.xowa.addons.bldrs.centrals.mgrs.*;
|
||||
import gplx.xowa.guis.cbks.*;
|
||||
public class Xobc_task_mgr implements Xog_json_wkr {
|
||||
private final Xog_cbk_trg cbk_trg = Xog_cbk_trg.New(Xobc_task_special.Prototype.Special__meta().Ttl_bry());
|
||||
@ -44,6 +44,7 @@ public class Xobc_task_mgr implements Xog_json_wkr {
|
||||
public Gfo_rate_mgr Rate_mgr() {return rate_mgr;} private final Gfo_rate_mgr rate_mgr;
|
||||
public Xobc_step_factory Step_mgr() {return step_mgr;} private final Xobc_step_factory step_mgr;
|
||||
public Xobc_filter_mgr Filter_mgr() {return filter_mgr;} private final Xobc_filter_mgr filter_mgr = new Xobc_filter_mgr();
|
||||
public Xobc_lang_mgr Lang_mgr() {return lang_mgr;} private final Xobc_lang_mgr lang_mgr = new Xobc_lang_mgr();
|
||||
public void Send_json(String func, Gfobj_nde data) {cbk_mgr.Send_json(cbk_trg, func, data);}
|
||||
public Xobc_task_mgr Load_or_init() {
|
||||
Gfo_log_.Instance.Info("task_mgr.load_or_init.bgn");
|
||||
@ -60,6 +61,7 @@ public class Xobc_task_mgr implements Xog_json_wkr {
|
||||
todo_mgr.Save_to(lists_nde.New_ary("todo"), filter_mgr.Filter(todo_mgr));
|
||||
done_mgr.Save_to(lists_nde.New_ary("done"));
|
||||
root.Add_nde("filters", filter_mgr.Make_init_msg());
|
||||
root.Add_ary("langs", lang_mgr.Make_init_msg(data_db.Tbl__lang_regy().Select_all()));
|
||||
cbk_mgr.Send_json(cbk_trg, "xo.bldr.core.reload__recv", root);
|
||||
}
|
||||
public void Filter_todo(String lang_key, String type_key) {
|
||||
|
@ -28,6 +28,7 @@ public class Xobc_data_db {
|
||||
this.tbl__import_step = new Xobc_import_step_tbl(conn);
|
||||
this.tbl__host_regy = new Xobc_host_regy_tbl(conn);
|
||||
this.tbl__version_regy = new Xobc_version_regy_tbl(conn);
|
||||
this.tbl__lang_regy = new Xobc_lang_regy_tbl(conn);
|
||||
conn.Meta_tbl_assert(tbl__task_regy, tbl__step_regy, tbl__step_map, tbl__import_step, tbl__host_regy, tbl__version_regy);
|
||||
}
|
||||
public Db_conn Conn() {return conn;} private final Db_conn conn;
|
||||
@ -38,6 +39,7 @@ public class Xobc_data_db {
|
||||
public Xobc_import_step_tbl Tbl__import_step() {return tbl__import_step;} private final Xobc_import_step_tbl tbl__import_step;
|
||||
public Xobc_host_regy_tbl Tbl__host_regy() {return tbl__host_regy;} private final Xobc_host_regy_tbl tbl__host_regy;
|
||||
public Xobc_version_regy_tbl Tbl__version_regy() {return tbl__version_regy;} private final Xobc_version_regy_tbl tbl__version_regy;
|
||||
public Xobc_lang_regy_tbl Tbl__lang_regy() {return tbl__lang_regy;} private final Xobc_lang_regy_tbl tbl__lang_regy;
|
||||
|
||||
public void Delete_by_import(byte[] wiki_abrv, String wiki_date) {
|
||||
// get all step ids from import_regy
|
||||
|
@ -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.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
|
||||
public class Xobc_lang_regy_itm {
|
||||
public Xobc_lang_regy_itm(int id, String key, String name) {
|
||||
this.id = id;
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
public int Id() {return id;} private final int id;
|
||||
public String Key() {return key;} private final String key;
|
||||
public String Name() {return name;} private final String name;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
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.bldrs.centrals.dbs.datas; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*; import gplx.xowa.addons.bldrs.centrals.dbs.*;
|
||||
import gplx.dbs.*;
|
||||
public class Xobc_lang_regy_tbl implements Db_tbl {
|
||||
private final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private final String fld__lang_id, fld__lang_key, fld__lang_name;
|
||||
private final Db_conn conn;
|
||||
public Xobc_lang_regy_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
this.tbl_name = "lang_regy";
|
||||
this.fld__lang_id = flds.Add_int_pkey("lang_id");
|
||||
this.fld__lang_key = flds.Add_str("lang_key", 255);
|
||||
this.fld__lang_name = flds.Add_str("lang_name", 255);
|
||||
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 Xobc_lang_regy_itm[] Select_all() {
|
||||
List_adp list = List_adp_.New();
|
||||
Db_rdr rdr = conn.Stmt_select(tbl_name, flds).Exec_select__rls_auto();
|
||||
try {
|
||||
while (rdr.Move_next())
|
||||
list.Add(new Xobc_lang_regy_itm(rdr.Read_int(fld__lang_id), rdr.Read_str(fld__lang_key), rdr.Read_str(fld__lang_name)));
|
||||
}
|
||||
finally {rdr.Rls();}
|
||||
return (Xobc_lang_regy_itm[])list.To_ary_and_clear(Xobc_lang_regy_itm.class);
|
||||
}
|
||||
public void Rls() {}
|
||||
}
|
@ -15,7 +15,7 @@ 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.bldrs.centrals; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*;
|
||||
package gplx.xowa.addons.bldrs.centrals.mgrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*;
|
||||
import gplx.core.gfobjs.*;
|
||||
import gplx.xowa.addons.bldrs.centrals.tasks.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
@ -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.bldrs.centrals.mgrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.centrals.*;
|
||||
import gplx.core.gfobjs.*;
|
||||
import gplx.xowa.addons.bldrs.centrals.dbs.datas.*;
|
||||
public class Xobc_lang_mgr {
|
||||
public Gfobj_ary Make_init_msg(Xobc_lang_regy_itm[] itms) {
|
||||
List_adp list = List_adp_.New();
|
||||
int len = itms.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
Xobc_lang_regy_itm itm = itms[i];
|
||||
Gfobj_nde itm_nde = Gfobj_nde.New();
|
||||
list.Add(itm_nde);
|
||||
itm_nde.Add_str("key", itm.Key());
|
||||
itm_nde.Add_str("name", itm.Name());
|
||||
}
|
||||
return new Gfobj_ary((Gfobj_nde[])list.To_ary_and_clear(Gfobj_nde.class));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user