Search in sources :

Example 16 with StructImpl

use of lucee.runtime.type.StructImpl in project Lucee by lucee.

the class Admin method doGetError.

private void doGetError() throws PageException {
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    // sct.set("errorTemplate",config.getErrorTemplate());
    Struct templates = new StructImpl();
    Struct str = new StructImpl();
    sct.set(TEMPLATES, templates);
    sct.set(STR, str);
    sct.set(DO_STATUS_CODE, Caster.toBoolean(config.getErrorStatusCode()));
    // 500
    String template = config.getErrorTemplate(500);
    try {
        PageSource ps = ((PageContextImpl) pageContext).getPageSourceExisting(template);
        if (ps != null)
            templates.set("500", ps.getDisplayPath());
        else
            templates.set("500", "");
    } catch (PageException e) {
        templates.set("500", "");
    }
    str.set("500", template);
    // 404
    template = config.getErrorTemplate(404);
    try {
        PageSource ps = ((PageContextImpl) pageContext).getPageSourceExisting(template);
        if (ps != null)
            templates.set("404", ps.getDisplayPath());
        else
            templates.set("404", "");
    } catch (PageException e) {
        templates.set("404", "");
    }
    str.set("404", template);
}
Also used : PageException(lucee.runtime.exp.PageException) StructImpl(lucee.runtime.type.StructImpl) PageContextImpl(lucee.runtime.PageContextImpl) Struct(lucee.runtime.type.Struct) PageSource(lucee.runtime.PageSource)

Example 17 with StructImpl

use of lucee.runtime.type.StructImpl in project Lucee by lucee.

the class Admin method doGetUpdate.

/**
 * @throws PageException
 */
private void doGetUpdate() throws PageException {
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    URL location = config.getUpdateLocation();
    if (location == null)
        location = Constants.DEFAULT_UPDATE_URL;
    String type = config.getUpdateType();
    if (StringUtil.isEmpty(type))
        type = "manual";
    sct.set("location", location.toExternalForm());
    sct.set("type", type);
}
Also used : StructImpl(lucee.runtime.type.StructImpl) URL(java.net.URL) Struct(lucee.runtime.type.Struct)

Example 18 with StructImpl

use of lucee.runtime.type.StructImpl in project Lucee by lucee.

the class Admin method doGetMailSetting.

/**
 * @throws PageException
 */
private void doGetMailSetting() throws PageException {
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    int maxThreads = 20;
    SpoolerEngine engine = config.getSpoolerEngine();
    if (engine instanceof SpoolerEngineImpl) {
        maxThreads = ((SpoolerEngineImpl) engine).getMaxThreads();
    }
    sct.set("spoolEnable", Caster.toBoolean(config.isMailSpoolEnable()));
    sct.set("spoolInterval", Caster.toInteger(config.getMailSpoolInterval()));
    sct.set("maxThreads", Caster.toDouble(maxThreads));
    sct.set("timeout", Caster.toInteger(config.getMailTimeout()));
    sct.set("defaultencoding", config.getMailDefaultCharset().name());
}
Also used : StructImpl(lucee.runtime.type.StructImpl) SpoolerEngine(lucee.runtime.spooler.SpoolerEngine) SpoolerEngineImpl(lucee.runtime.spooler.SpoolerEngineImpl) Struct(lucee.runtime.type.Struct)

Example 19 with StructImpl

use of lucee.runtime.type.StructImpl in project Lucee by lucee.

the class Admin method _fillSecData.

private void _fillSecData(SecurityManager sm) throws PageException {
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    sct.set("cfx_setting", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_CFX_SETTING) == SecurityManager.VALUE_YES));
    sct.set("cfx_usage", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_CFX_USAGE) == SecurityManager.VALUE_YES));
    sct.set("custom_tag", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_CUSTOM_TAG) == SecurityManager.VALUE_YES));
    sct.set(KeyConstants._datasource, _fillSecDataDS(sm.getAccess(SecurityManager.TYPE_DATASOURCE)));
    sct.set("debugging", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_DEBUGGING) == SecurityManager.VALUE_YES));
    sct.set("direct_java_access", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_DIRECT_JAVA_ACCESS) == SecurityManager.VALUE_YES));
    sct.set("mail", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_MAIL) == SecurityManager.VALUE_YES));
    sct.set(KeyConstants._mapping, Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_MAPPING) == SecurityManager.VALUE_YES));
    sct.set("remote", Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_REMOTE) == SecurityManager.VALUE_YES));
    sct.set("setting", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_SETTING) == SecurityManager.VALUE_YES));
    sct.set("search", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_SEARCH) == SecurityManager.VALUE_YES));
    sct.set("scheduled_task", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_SCHEDULED_TASK) == SecurityManager.VALUE_YES));
    sct.set(KeyConstants._cache, Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_CACHE) == SecurityManager.VALUE_YES));
    sct.set("gateway", Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_GATEWAY) == SecurityManager.VALUE_YES));
    sct.set(KeyConstants._orm, Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_ORM) == SecurityManager.VALUE_YES));
    sct.set("tag_execute", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_EXECUTE) == SecurityManager.VALUE_YES));
    sct.set("tag_import", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_IMPORT) == SecurityManager.VALUE_YES));
    sct.set("tag_object", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_OBJECT) == SecurityManager.VALUE_YES));
    sct.set("tag_registry", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_REGISTRY) == SecurityManager.VALUE_YES));
    sct.set("access_read", SecurityManagerImpl.toStringAccessRWValue(sm.getAccess(SecurityManager.TYPE_ACCESS_READ)));
    sct.set("access_write", SecurityManagerImpl.toStringAccessRWValue(sm.getAccess(SecurityManager.TYPE_ACCESS_WRITE)));
    short accessFile = sm.getAccess(SecurityManager.TYPE_FILE);
    String str = SecurityManagerImpl.toStringAccessValue(accessFile);
    if (str.equals("yes"))
        str = "all";
    sct.set(KeyConstants._file, str);
    Array arr = new ArrayImpl();
    if (accessFile != SecurityManager.VALUE_ALL) {
        Resource[] reses = ((SecurityManagerImpl) sm).getCustomFileAccess();
        for (int i = 0; i < reses.length; i++) {
            arr.appendEL(reses[i].getAbsolutePath());
        }
    }
    sct.set("file_access", arr);
}
Also used : Array(lucee.runtime.type.Array) StructImpl(lucee.runtime.type.StructImpl) ArrayImpl(lucee.runtime.type.ArrayImpl) Resource(lucee.commons.io.res.Resource) SecurityManagerImpl(lucee.runtime.security.SecurityManagerImpl) Struct(lucee.runtime.type.Struct)

Example 20 with StructImpl

use of lucee.runtime.type.StructImpl in project Lucee by lucee.

the class Admin method doGetTaskSetting.

private void doGetTaskSetting() throws PageException {
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    int maxThreads = 20;
    SpoolerEngine engine = config.getSpoolerEngine();
    if (engine instanceof SpoolerEngineImpl) {
        SpoolerEngineImpl ei = ((SpoolerEngineImpl) engine);
        maxThreads = ei.getMaxThreads();
    }
    sct.set("maxThreads", Caster.toDouble(maxThreads));
}
Also used : StructImpl(lucee.runtime.type.StructImpl) SpoolerEngine(lucee.runtime.spooler.SpoolerEngine) SpoolerEngineImpl(lucee.runtime.spooler.SpoolerEngineImpl) Struct(lucee.runtime.type.Struct)

Aggregations

StructImpl (lucee.runtime.type.StructImpl)251 Struct (lucee.runtime.type.Struct)216 PageException (lucee.runtime.exp.PageException)40 Entry (java.util.Map.Entry)34 Key (lucee.runtime.type.Collection.Key)28 Array (lucee.runtime.type.Array)25 ArrayImpl (lucee.runtime.type.ArrayImpl)24 ApplicationException (lucee.runtime.exp.ApplicationException)21 IOException (java.io.IOException)19 Map (java.util.Map)19 Resource (lucee.commons.io.res.Resource)18 Iterator (java.util.Iterator)17 PageContextImpl (lucee.runtime.PageContextImpl)14 QueryImpl (lucee.runtime.type.QueryImpl)13 Collection (lucee.runtime.type.Collection)11 Query (lucee.runtime.type.Query)11 DateTimeImpl (lucee.runtime.type.dt.DateTimeImpl)11 HashMap (java.util.HashMap)9 PageSource (lucee.runtime.PageSource)8 Element (org.w3c.dom.Element)8