Search in sources :

Example 1 with CoreLocale

use of app.hongs.CoreLocale in project HongsCORE by ihongs.

the class DeptAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    int rn = model.delete(rd);
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("master");
    String ms = ln.translate("core.delete.dept.success", Integer.toString(rn));
    helper.reply(ms, rn);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) RoleMap(app.hongs.serv.auth.RoleMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess)

Example 2 with CoreLocale

use of app.hongs.CoreLocale in project HongsCORE by ihongs.

the class UserAction method doSave.

@Action("save")
@Verify(conf = "master", form = "user")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    // Ignore empty password in update
    if ("".equals(rd.get("password"))) {
        rd.remove("password");
        rd.remove("passcode");
    }
    String id = model.set(rd);
    Map sd = new HashMap();
    sd.put("id", id);
    sd.put("name", rd.get("name"));
    sd.put("head", rd.get("head"));
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("master");
    String ms = ln.translate("core.save.user.success");
    helper.reply(ms, sd);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) HashMap(java.util.HashMap) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) RoleMap(app.hongs.serv.auth.RoleMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess) Verify(app.hongs.action.anno.Verify)

Example 3 with CoreLocale

use of app.hongs.CoreLocale in project HongsCORE by ihongs.

the class FormAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map data = helper.getRequestData();
    int rows = model.delete(data);
    CoreLocale lang = CoreLocale.getInstance().clone();
    lang.load("matrix");
    String ms = lang.translate("core.delete.form.success", Integer.toString(rows));
    helper.reply(ms, rows);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) Map(java.util.Map) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess)

Example 4 with CoreLocale

use of app.hongs.CoreLocale in project HongsCORE by ihongs.

the class FormSet method getFormTranslated.

public Map getFormTranslated(String namc) throws HongsException {
    Map items = getForm(namc);
    Map itemz = new LinkedHashMap();
    if (items == null)
        return itemz;
    CoreLocale lang = getCurrTranslator();
    for (Object o : items.entrySet()) {
        Map.Entry e = (Map.Entry) o;
        Map m = (Map) e.getValue();
        String k = (String) e.getKey();
        String n = (String) m.get("__text__");
        String h = (String) m.get("__hint__");
        Map u = new LinkedHashMap();
        u.putAll(m);
        if (n == null || "".equals(n)) {
            n = "fore.form." + name + "." + namc + "." + k;
        }
        u.put("__text__", lang.translate(n));
        if (h != null && !"".equals(n)) {
            u.put("__hint__", lang.translate(h));
        }
        itemz.put(k, u);
    }
    return itemz;
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Example 5 with CoreLocale

use of app.hongs.CoreLocale in project HongsCORE by ihongs.

the class NaviMap method getMenuTranslated.

public List<Map> getMenuTranslated(String name, int d, Set<String> rolez) {
    CoreLocale lang = getCurrTranslator();
    Map menu = (Map) getMenu(name).get("menus");
    return getMenuTranslated(menu, rolez, lang, d, 0);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

CoreLocale (app.hongs.CoreLocale)22 HashMap (java.util.HashMap)15 Map (java.util.Map)15 Action (app.hongs.action.anno.Action)12 CommitSuccess (app.hongs.action.anno.CommitSuccess)7 NaviMap (app.hongs.action.NaviMap)5 IAction (app.hongs.dh.IAction)4 RoleMap (app.hongs.serv.auth.RoleMap)4 File (java.io.File)4 LinkedHashMap (java.util.LinkedHashMap)4 HongsException (app.hongs.HongsException)3 ActionRunner (app.hongs.action.ActionRunner)2 Verify (app.hongs.action.anno.Verify)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 Core (app.hongs.Core)1 HongsError (app.hongs.HongsError)1 HongsExpedient (app.hongs.HongsExpedient)1 FetchCase (app.hongs.db.util.FetchCase)1 Wrong (app.hongs.util.verify.Wrong)1