Search in sources :

Example 1 with Resolver

use of org.olat.ims.qti.process.Resolver in project OpenOLAT by OpenOLAT.

the class ResultsBuilder method addStaticsPath.

private static void addStaticsPath(Element el_in, AssessmentInstance ai) {
    Element el_staticspath = (Element) el_in.selectSingleNode(STATICS_PATH);
    if (el_staticspath == null) {
        DocumentFactory df = DocumentFactory.getInstance();
        el_staticspath = df.createElement(STATICS_PATH);
        Resolver resolver = ai.getResolver();
        el_staticspath.addAttribute("ident", resolver.getStaticsBaseURI());
        el_in.add(el_staticspath);
    }
}
Also used : DocumentFactory(org.dom4j.DocumentFactory) Resolver(org.olat.ims.qti.process.Resolver) Element(org.dom4j.Element)

Example 2 with Resolver

use of org.olat.ims.qti.process.Resolver in project OpenOLAT by OpenOLAT.

the class IQComponentRenderer method displayItem.

private void displayItem(StringOutput sb, Renderer renderer, URLBuilder ubu, ItemContext itc, AssessmentInstance ai) {
    StringBuilder buffer = new StringBuilder(1000);
    Resolver resolver = ai.getResolver();
    RenderInstructions ri = new RenderInstructions();
    ri.put(RenderInstructions.KEY_STATICS_PATH, resolver.getStaticsBaseURI() + "/");
    ri.put(RenderInstructions.KEY_LOCALE, renderer.getTranslator().getLocale());
    StringOutput soCommandURI = new StringOutput(50);
    ubu.buildURI(soCommandURI, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "sflash" });
    ri.put(RenderInstructions.KEY_APPLET_SUBMIT_URI, soCommandURI.toString());
    if (itc.getItemInput() != null)
        ri.put(RenderInstructions.KEY_ITEM_INPUT, itc.getItemInput());
    ri.put(RenderInstructions.KEY_RENDER_TITLE, Boolean.valueOf(ai.isDisplayTitles()));
    if (ai.isAutoEnum()) {
        String k = renderer.getTranslator().translate("choices.autoenum.keys");
        if (k != null) {
            ri.put(RenderInstructions.KEY_RENDER_AUTOENUM_LIST, k);
        }
    }
    itc.getQtiItem().render(buffer, ri);
    sb.append(buffer);
}
Also used : RenderInstructions(org.olat.ims.qti.container.qtielements.RenderInstructions) Resolver(org.olat.ims.qti.process.Resolver) StringOutput(org.olat.core.gui.render.StringOutput)

Example 3 with Resolver

use of org.olat.ims.qti.process.Resolver in project openolat by klemens.

the class IQComponentRenderer method displayFeedback.

private void displayFeedback(StringOutput sb, GenericQTIElement feedback, AssessmentInstance ai, Locale locale) {
    StringBuilder sbTmp = new StringBuilder();
    Resolver resolver = ai.getResolver();
    RenderInstructions ri = new RenderInstructions();
    ri.put(RenderInstructions.KEY_STATICS_PATH, resolver.getStaticsBaseURI() + "/");
    ri.put(RenderInstructions.KEY_LOCALE, locale);
    feedback.render(sbTmp, ri);
    sb.append(sbTmp);
}
Also used : RenderInstructions(org.olat.ims.qti.container.qtielements.RenderInstructions) Resolver(org.olat.ims.qti.process.Resolver)

Example 4 with Resolver

use of org.olat.ims.qti.process.Resolver in project openolat by klemens.

the class IQComponentRenderer method displayItem.

private void displayItem(StringOutput sb, Renderer renderer, URLBuilder ubu, ItemContext itc, AssessmentInstance ai) {
    StringBuilder buffer = new StringBuilder(1000);
    Resolver resolver = ai.getResolver();
    RenderInstructions ri = new RenderInstructions();
    ri.put(RenderInstructions.KEY_STATICS_PATH, resolver.getStaticsBaseURI() + "/");
    ri.put(RenderInstructions.KEY_LOCALE, renderer.getTranslator().getLocale());
    StringOutput soCommandURI = new StringOutput(50);
    ubu.buildURI(soCommandURI, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "sflash" });
    ri.put(RenderInstructions.KEY_APPLET_SUBMIT_URI, soCommandURI.toString());
    if (itc.getItemInput() != null)
        ri.put(RenderInstructions.KEY_ITEM_INPUT, itc.getItemInput());
    ri.put(RenderInstructions.KEY_RENDER_TITLE, Boolean.valueOf(ai.isDisplayTitles()));
    if (ai.isAutoEnum()) {
        String k = renderer.getTranslator().translate("choices.autoenum.keys");
        if (k != null) {
            ri.put(RenderInstructions.KEY_RENDER_AUTOENUM_LIST, k);
        }
    }
    itc.getQtiItem().render(buffer, ri);
    sb.append(buffer);
}
Also used : RenderInstructions(org.olat.ims.qti.container.qtielements.RenderInstructions) Resolver(org.olat.ims.qti.process.Resolver) StringOutput(org.olat.core.gui.render.StringOutput)

Example 5 with Resolver

use of org.olat.ims.qti.process.Resolver in project OpenOLAT by OpenOLAT.

the class OnyxModule method isOnyxTest.

public static boolean isOnyxTest(final OLATResourceable res) {
    if (res.getResourceableTypeName().equals(TestFileResource.TYPE_NAME) || res.getResourceableTypeName().equals(SurveyFileResource.TYPE_NAME)) {
        Long resourceId = res.getResourceableId();
        Boolean onyx = onyxMap.get(resourceId);
        if (onyx == null) {
            onyx = Boolean.FALSE;
            try {
                final Resolver resolver = new ImsRepositoryResolver(res);
                // search for qti.xml, it not exists for qti2
                if (resolver.getQTIDocument() == null) {
                    onyx = Boolean.TRUE;
                } else {
                    onyx = Boolean.FALSE;
                }
            } catch (OLATRuntimeException e) {
                log.error("", e);
            }
            onyxMap.put(resourceId, onyx);
        }
        return onyx.booleanValue();
    } else {
        return false;
    }
}
Also used : Resolver(org.olat.ims.qti.process.Resolver) ImsRepositoryResolver(org.olat.ims.qti.process.ImsRepositoryResolver) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) ImsRepositoryResolver(org.olat.ims.qti.process.ImsRepositoryResolver)

Aggregations

Resolver (org.olat.ims.qti.process.Resolver)14 RenderInstructions (org.olat.ims.qti.container.qtielements.RenderInstructions)8 AssessmentContext (org.olat.ims.qti.container.AssessmentContext)4 Objectives (org.olat.ims.qti.container.qtielements.Objectives)4 ImsRepositoryResolver (org.olat.ims.qti.process.ImsRepositoryResolver)4 DocumentFactory (org.dom4j.DocumentFactory)2 Element (org.dom4j.Element)2 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)2 ProgressBar (org.olat.core.gui.components.progressbar.ProgressBar)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 WindowControl (org.olat.core.gui.control.WindowControl)2 StringOutput (org.olat.core.gui.render.StringOutput)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 AssertException (org.olat.core.logging.AssertException)2 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)2 SectionContext (org.olat.ims.qti.container.SectionContext)2 Hint (org.olat.ims.qti.container.qtielements.Hint)2 Navigator (org.olat.ims.qti.navigator.Navigator)2 AssessmentInstance (org.olat.ims.qti.process.AssessmentInstance)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2