Example #1
0
  private void _loadConfig() {
    try {

      _configScope.set("__instance__", this);

      _loadConfigFromCloudObject(getSiteObject());
      _loadConfigFromCloudObject(getEnvironmentObject());

      File f;
      if (!_admin) {
        f = getFileSafe("_config.js");
        if (f == null || !f.exists()) f = getFileSafe("_config");
      } else
        f =
            new File(
                Module.getModule("core-modules/admin").getRootFile(getVersionForLibrary("admin")),
                "_config.js");

      _libraryLogger.info("config file [" + f + "] exists:" + f.exists());

      if (f == null || !f.exists()) return;

      Convert c = new Convert(f);
      JSFunction func = c.get();
      func.setUsePassedInScope(true);
      func.call(_configScope);

      _logger.debug("config things " + _configScope.keySet());
    } catch (Exception e) {
      throw new RuntimeException("couldn't load config", e);
    }
  }
Example #2
0
  public void setHttpRequest(int pagesize, HttpServletRequest req) throws Exception {
    request = req;
    // 从request中提取页面信息
    // pageSize = Convert.parseToInt32(req.getParameter(PN_PAGE_SIZE), 20) ;
    pageSize = pagesize;
    if (pageSize <= 0) pageSize = 20;
    pageCur = Convert.parseToInt32(req.getParameter(PN_PAGE_CUR), 0);

    DataOut dout = new DataOut();
    XmlData xd = Convert.getXmlDataFromRequest(req);
    listObjs = getPageObjList(xd, pageCur, pageSize, dout);
    total = dout.totalCount;
  }