String[] identifyerSplit = helpPageIdentifyer.split(":");
String bundleName = identifyerSplit[0];
String page = identifyerSplit[1];
// Translator with default locale. Locale is set to each language in the
// language iteration below
Translator pageTranslator = new PackageTranslator(bundleName, I18nModule.getDefaultLocale());
// Open velocity page for this help page
String pagePath = bundleName.replace('.', '/') + ContextHelpModule.CHELP_DIR + page;
VelocityContainer container = new VelocityContainer("contextHelpPageVC", pagePath, pageTranslator, null);
Context ctx = container.getContext();
GlobalSettings globalSettings = new GlobalSettings() {
public int getFontSize() { return 100;}
public AJAXFlags getAjaxFlags() { return new EmptyAJAXFlags();}
public ComponentRenderer getComponentRendererFor(Component source) {
return null;
}
public boolean isIdDivsForced() { return false; }
};
Renderer renderer = Renderer.getInstance(container, pageTranslator, new EmptyURLBuilder(), null, globalSettings);
// Add render decorator with helper methods
VelocityRenderDecorator vrdec = new VelocityRenderDecorator(renderer, container);
ctx.put("r", vrdec);
// Add empty static dir url - only used to not generate error messages
ctx.put("chelpStaticDirUrl", "");
// Create document for each language using the velocity context
for (String langCode : languages) {
Locale locale = I18nManager.getInstance().getLocaleOrNull(langCode);
String relPagePath = langCode + "/" + bundleName + "/" + page;
if (log.isDebug()) log.debug("Indexing help page with path::" + relPagePath);
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
searchResourceContext.setBusinessControlFor(OresHelper.createOLATResourceableType(ContextHelpModule.class.getSimpleName()));//to match the list of indexer
// Create context help document and index now, set translator to current locale
pageTranslator.setLocale(locale);
Document document = ContextHelpDocument.createDocument(searchResourceContext, bundleName, page, pageTranslator, ctx, pagePath);
indexWriter.addDocument(document);
}
}