Examples of StringOutput


Examples of org.olat.core.gui.render.StringOutput

          target.append(" b_table_marked");
        }
        target.append("\">");
        if (j == 0) target.append("<a name=\"b_table\"></a>"); //add once for accessabillitykey
        String action = cd.getAction(i);
        StringOutput so = new StringOutput();
        cd.renderValue(so, i, renderer);
        String renderval = so.toString();
        log.debug("render: i=" + i + " renderval=" + renderval );

        if (action != null) {
          // If we have actions on the table rows, we just submit traditional style (not via form.submit())
          // Note that changes in the state of multiselects will not be reflected in the model.
          HrefGenerator hrefG = cd.getHrefGenerator();

          if (hrefG != null) {
            if(table.markSelectedRowId == currentPosInModel && action.equals(table.markActionId)){
              target.append("<span style=\"border:2px solid red;\">");
            }
           
            target.append("<a href=\"");
            StringOutput link = new StringOutput();
            ubu.buildURI(link, new String[] { Table.COMMANDLINK_ROWACTION_CLICKED, Table.COMMANDLINK_ROWACTION_ID }, new String[] {
                String.valueOf(currentPosInModel), action }); // url
            target.append(hrefG.generate(currentPosInModel, link.toString()));
            target.append("\">");
           
          } else if (cd.isPopUpWindowAction()) {
            if(table.markSelectedRowId == currentPosInModel && action.equals(table.markActionId)){
              target.append("<span style=\"border:2px solid red;\">");
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

        // we must let the original renderer do its work so that the
        // collecting translator is callbacked.
        // we save the result in a new var since it is too early to
        // append it
        // to the 'stream' right now.
        StringOutput sbOrig = new StringOutput();
        try {
          originalRenderer.render(renderer, sbOrig, source, ubu, translator, renderResult, args);
        } catch (Exception e) {
          String emsg = "exception while rendering component '" + source.getComponentName() + "' (" + source.getClass().getName() + ") "
              + source.getListenerInfo() + "<br />Message of exception: " + e.getMessage();
          sbOrig.append("<span style=\"color:red\">Exception</span><br /><pre>" + emsg + "</pre>");
        }

        String rendered = sbOrig.toString();
        String renderedWithHTMLMarkup = InlineTranslationInterceptHandlerController.replaceLocalizationMarkupWithHTML(rendered,
            inlineTranslationURLBuilder, getTranslator());
        sb.append(renderedWithHTMLMarkup);
      }
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

      int startEPos = startPostfixPos + I18nManager.IDENT_START_POSTFIX.length();
      String endIdent = I18nManager.IDENT_PREFIX + combinedKey + I18nManager.IDENT_END_POSTFIX;
      int endSPos = stringWithMarkup.indexOf(endIdent);
      int endEPos = endSPos + endIdent.length();
      // build link for this identifyer
      StringOutput link = new StringOutput();
      buildInlineTranslationLink(combinedKey, link, inlineTrans, inlineTranslationURLBuilder);

      // Case 1: translated within a 'a' tag. The tag can contain an optional
      // span tag
      // before and after translated link some other content could be
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

  public HrefGenerator getHrefGenerator() {
    return hrefGenerator;
  }

  public String toString(int rowid) {
    StringOutput sb = new StringOutput();
    renderValue(sb,rowid,null);
    return sb.toString();
  }
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

      }
    }
  }

  public String toString(int rowid) {
    StringOutput sb = new StringOutput();
    renderValue(sb,rowid,null);
    return sb.toString();
  }
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

      throw new RuntimeException("no translator");
    }
    boolean doNotWrapSubmit = (args != null && args[0].equals("donotwrapsubmit"));

    // precompile form elements into sting buffer
    StringOutput formElementsSO = new StringOutput(4096);
    Form f = (Form) source;
    boolean error = false;
    renderFormHeader(f, formElementsSO, ubu, renderer.getGlobalSettings().getAjaxFlags());   
   
    Iterator it_names = f.getNameIterator();
    while (it_names.hasNext()) {
      String name = (String) it_names.next();
      FormElement fe = f.getFormElement(name);
      if (fe.isError()) {
        error = true;
      }
      renderFormElement(f, fe, formElementsSO, translator, ubu, args);
    }

    if (!f.isDisplayOnly()) {
      if (doNotWrapSubmit) {
        renderFormSubmit(f, formElementsSO, translator);
      } else {
        formElementsSO.append("<div class=\"b_form_element_wrapper b_clearfix\"><div class=\"b_form_element\"><div class=\"b_button_group\">");
        renderFormSubmit(f, formElementsSO, translator);
        formElementsSO.append("</div></div></div>");
      }
     
      //check form
      formElementsSO.append("<script type=\"text/javascript\">\n/* <![CDATA[ */\n");
      formElementsSO.append("function checkform").append(f.getComponentName()).append("(){\n");
      renderElementVisibilityDependencyRules(f, formElementsSO);
      formElementsSO.append("}\n/* ]]> */\n</script>\n");
     
    }
    renderFormFooter(f, formElementsSO, translator);
    // end precompiling form elements
   
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

      if (link.getTarget() != null){
        cssSb.append(" target=\""+ link.getTarget() +"\"");
      else if (iframePostEnabled && link.isEnabled() && !flexiformlink) {
        //flexi form link is excluded because the form post goes to the
        //iframe
        StringOutput so = new StringOutput();
        ubu.appendTarget(so);
        cssSb.append(so.toString());
      }
    }

    String elementId = link.getElementId();
   
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

          }
          sb.append("<br />");
         
          // we must let the original renderer do its work so that the collecting translator is callbacked.
          // we save the result in a new var since it is too early to append it to the 'stream' right now.
          StringOutput sbOrig = new StringOutput();
          try {
            originalRenderer.render(renderer, sbOrig, source, ubu, translator, renderResult, args);
          } catch (Exception e) {
            String emsg = "exception while rendering component '" + source.getComponentName() + "' ("
            + source.getClass().getName() + ") " + source.getListenerInfo() + "<br />Message of exception: " + e.getMessage();
            sbOrig.append("<span style=\"color:red\">Exception</span><br /><pre>"+emsg+"</pre>");
          }
         
          sb.append("</div>");
             
          // add original component
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

   * @param theme
   */
  public void init(String themeIdentifyer) {
    this.identifyer = themeIdentifyer;
    // Themes are deliverd as static resources by StaticMediaDispatcher
    StringOutput themePath = new StringOutput();
    StaticMediaDispatcher.renderStaticURI(themePath, "themes/" + themeIdentifyer + "/");
    this.baseURI = themePath.toString();
  }
View Full Code Here

Examples of org.olat.core.gui.render.StringOutput

  /**
   * TODO:gs make more stable by only adding some js stuff to the end of the page. First check if document.height is ready
   * when puttings js to the end or menachism like ext.onReady is needed
   */
  private String injectJavaScript(String page, boolean addCheckForInlineEvents) {
    StringOutput sb = new StringOutput();
    //do not use parser and just check for css and script stuff myself and append just before body and head
    SimpleHtmlParser parser = new SimpleHtmlParser(page);
    if (!parser.isValidHtml()) {
      return page;
    }

    String docType = parser.getHtmlDocType();   
    if (docType != null) sb.append(docType).append("\n");
    if (parser.getXhtmlNamespaces() == null) sb.append("<html><head>");
    else {
      sb.append(parser.getXhtmlNamespaces());
      sb.append("<head><meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\">");//neded to allow body onload attribute
    }
    //<meta http-equiv="content-type" content="text/html; charset=utf-8" />
    sb.append("<meta http-equiv=\"content-type\" content=\"text/html; charset=");
    if (parser.getCharsetName() != null) sb.append(parser.getCharsetName());
    else sb.append(DEFAULT_ENCODING);
    sb.append("\"");
    if (docType != null && docType.indexOf("XHTML") > 0) sb.append("/"); // close tag only when xhtml to validate
    sb.append(">");
   
    if (!parser.hasOwnCss()) {
      // add olat content css as used in html editor
      sb.append("<link href=\"").append(themeBaseUri).append("all/content.css\" rel=\"stylesheet\" type=\"text/css\" ");
      if (docType != null && docType.indexOf("XHTML") > 0) sb.append("/"); // close tag only when xhtml to validate
      sb.append(">\n");
      if (customCssURL != null) {
        // add the custom  CSS, e.g. the course css that overrides the standard content css
        sb.append("<link href=\"").append(customCssURL).append("\" rel=\"stylesheet\" type=\"text/css\" ");
        if (docType != null && docType.indexOf("XHTML") > 0) sb.append("/"); // close tag only when xhtml to validate
        sb.append(">\n");       
      }
    }
   
    //TODO:gs:a do not include if it is a scorm packge!! may results in problems
    if (this.enableTextmarking) {
      if (log.isDebug()) log.debug("Textmarking is enabled, including tooltips js files into iframe source...");
      sb.append("\n<script type=\"text/javascript\" src=\"");
      StaticMediaDispatcher.renderStaticURI(sb, "js/prototype/prototype.js");
      sb.append("\"></script>");
      sb.append("\n<script type=\"text/javascript\" src=\"");
      StaticMediaDispatcher.renderStaticURI(sb, "js/ext/adapter/prototype/ext-prototype-adapter.js");
      sb.append("\"></script>");
      sb.append("\n<link rel=\"stylesheet\" type=\"text/css\" href=\"");
      StaticMediaDispatcher.renderStaticURI(sb, "js/ext/resources/css/ext-all.css");
      sb.append("\"");
      if (docType != null && docType.indexOf("XHTML") > 0) sb.append("/"); // close tag only when xhtml to validate
      // Loading ExtJS minimalisic, only what's needed for the quick tips
      sb.append(">\n<script type=\"text/javascript\" src=\"");
      StaticMediaDispatcher.renderStaticURI(sb, "js/ext/pkgs/ext-foundation.js");
      sb.append("\"></script>");
      sb.append("\n<script type=\"text/javascript\" src=\"");
      StaticMediaDispatcher.renderStaticURI(sb, "js/ext/pkgs/cmp-foundation.js");
      sb.append("\"></script>");
      sb.append("\n<script type=\"text/javascript\" src=\"");
      StaticMediaDispatcher.renderStaticURI(sb, "js/ext/pkgs/ext-dd.js");
      sb.append("\"></script>");
      sb.append("\n<script type=\"text/javascript\" src=\"");
      StaticMediaDispatcher.renderStaticURI(sb, "js/ext/pkgs/pkg-tips.js");
      sb.append("\"></script>");
      // Load glossary code now     
      sb.append("\n<script type=\"text/javascript\" id=\"textmarkerLib\" src=\"");
      sb.append( getWindowControl().getWindowBackOffice().getWindowManager().getMapPathFor(GlossaryMarkupItemController.class) ) ;
      sb.append("/js/glossaryhighlighter.js");
      sb.append("\"></script>");
     
      sb.append("\n<link rel=\"stylesheet\" type=\"text/css\" id=\"textmarkercss\" href=\"");
      sb.append( getWindowControl().getWindowBackOffice().getWindowManager().getMapPathFor(GlossaryMarkupItemController.class) ) ;
      sb.append("/css/textmarker.css");
      sb.append("\">\n");
    }
   
    // Load some iframe.js helper code
    sb.append("\n<script type=\"text/javascript\">\n/* <![CDATA[ */\n");
    // Set the iframe id, used by the resize function. Important to set before iframe.js is loaded
    sb.append("b_iframeid=\"").append(this.frameId).append("\";");
    sb.append("b_isInlineUri=").append(Boolean.valueOf(addCheckForInlineEvents).toString()).append(";");
    sb.append("\n/* ]]> */\n</script>");
    sb.append("<script type=\"text/javascript\" src=\"").append(staticFilesPath).append("/js/iframe.js\"></script>\n");

    // Resize frame to fit height of html page.
    // Do this only when there is some content available. This can be false when
    // the content is written all dynamically via javascript. In this cases, the
    // resizeing is meaningless anyway.
    if (parser.getHtmlContent().length() > 0) {
      sb.append("\n<script type=\"text/javascript\">\n/* <![CDATA[ */\n");
      // register the resize code to be executed on document load and click events
      if (adjusteightAutomatically) {
        sb.append("b_addOnloadEvent(b_sizeIframe);");   
        sb.append("b_addOnclickEvent(b_sizeIframe);");   
      }
      // register the tooltips enabling on document load event
      sb.append("b_addOnloadEvent(b_enableTooltips);");
      sb.append("b_addOnloadEvent(b_hideExtMessageBox);");
      if (addCheckForInlineEvents) {
        // Refresh dirty menu tree by triggering client side request to component which fires events
        // which is not possible by mappers. The method will first check if the page is loaded in our
        // iframe and ignore all other requests (files in framesets, sub-iframes, AJAX calls etc)
        if ((System.currentTimeMillis() - this.suppressEndlessReload) > 2000) sb.append("b_addOnloadEvent(b_sendNewUriEventToParent);");
        this.suppressEndlessReload = System.currentTimeMillis();
      }
      sb.append("b_addOnloadEvent(b_changeLinkTargets);");
     
      if (this.enableTextmarking){
        sb.append("b_addOnloadEvent(b_glossaryHighlight);");
      }
     
      sb.append("\n/* ]]> */\n</script>");
    }   
   
   
    String origHTMLHead = parser.getHtmlHead();
    // jsMath brute force approach to render latex formulas: add library if
    // a jsmath class is found in the code and the library is not already in
    // the header of the page
    if (BaseChiefController.isJsMathEnabled()) {
      if ((page.indexOf("class=\"math\"") != -1 || page.indexOf("class='math'") != -1) && (origHTMLHead == null || origHTMLHead.indexOf("jsMath/easy/load.js") == -1)) {
        sb.append("\n<script type=\"text/javascript\" src=\"");
        StaticMediaDispatcher.renderStaticURI(sb, "js/jsMath/easy/load.js");
        sb.append("\"></script>");     
        // don't show jsmath info box, aready visible in parent window
        sb.append("<style type='text/css'>#jsMath_button {display:none}</style>");     
      }     
    }

    // add some custom header things like js code or css
    if (customHeaderContent  != null) {
      sb.append(customHeaderContent);
    }

    // Add HTML header stuff from original page: css, javascript, title etc.
    if (origHTMLHead != null) sb.append(origHTMLHead);   
    sb.append("</head>");
    // use the original body tag, may include all kind of attributes (class, style, onload, on...)
    sb.append(parser.getBodyTag());
    // finally add content and finish page
    sb.append(parser.getHtmlContent());
    sb.append("</body></html>");
   
    return sb.toString();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.