示例#1
0
    @Override
    protected FormConfigElement getFormConfig(String itemId, String formId) {
      FormConfigElement formConfig = null;

      Config configResult = this.configService.getConfig(itemId);
      FormsConfigElement formsConfig =
          (FormsConfigElement) configResult.getConfigElement(CONFIG_FORMS);

      assertNotNull("The ConfigElement object doesn't exist", formsConfig);

      if (formsConfig != null) {
        // Extract the form we are looking for
        if (formsConfig != null) {
          // try and retrieve the specified form
          if (formId != null && formId.length() > 0) {
            formConfig = formsConfig.getForm(formId);
          }

          // fall back to the default form
          if (formConfig == null) {
            formConfig = formsConfig.getDefaultForm();
          }
        }
      }
      assertNotNull("The ConfigElement object doesn't exist", formConfig);

      return formConfig;
    }
 protected boolean isDebugMode() {
   if (this.isDebugMode == null) {
     Boolean debugValue = false;
     if (configService != null) {
       Config global = configService.getGlobalConfig();
       if (global != null) {
         ConfigElement flags = global.getConfigElement("flags");
         if (flags != null) {
           ConfigElement clientDebug = flags.getChild("client-debug");
           if (clientDebug != null) {
             debugValue = Boolean.valueOf(clientDebug.getValue());
           }
         }
       }
     }
     this.isDebugMode = debugValue;
   }
   return this.isDebugMode;
 }
  protected List<String> getInlineEditableMimeTypes() {
    if ((this.inlineEditableMimeTypes == null)
        || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) {
      this.inlineEditableMimeTypes = new ArrayList<String>(8);

      // get the create mime types list from the config
      ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
      Config wizardCfg = svc.getConfig("Content Wizards");
      if (wizardCfg != null) {
        ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types");
        if (typesCfg != null) {
          for (ConfigElement child : typesCfg.getChildren()) {
            String currentMimeType = child.getAttribute("name");
            this.inlineEditableMimeTypes.add(currentMimeType);
          }
        }
      }
    }

    return this.inlineEditableMimeTypes;
  }