Пример #1
0
 /**
  * Create a link that can be used within a context help page to link to another context help page
  * from another package. The link text can be specified as a thirt attribute.
  *
  * @param bundleName e.g. "org.olat.core"
  * @param pageName e.g. "my-page.html"
  * @return
  */
 public StringOutput contextHelpRelativeLink(String bundleName, String pageName, String linkText) {
   StringOutput sb = new StringOutput(100);
   if (ContextHelpModule.isContextHelpEnabled()) {
     sb.append("<a href=\"");
     if (bundleName == null) {
       renderer
           .getUrlBuilder()
           .buildURI(
               sb,
               new String[] {VelocityContainer.COMMAND_ID},
               new String[] {pageName},
               isIframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
     } else {
       renderer
           .getUrlBuilder()
           .buildURI(
               sb,
               new String[] {VelocityContainer.COMMAND_ID, PARAM_CHELP_BUNDLE},
               new String[] {pageName, bundleName},
               isIframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
     }
     sb.append("\" ");
     if (isIframePostEnabled) {
       renderer.getUrlBuilder().appendTarget(sb);
     }
     sb.append(">");
     sb.append(linkText);
     sb.append("</a>");
   }
   return sb;
 }
Пример #2
0
 /**
  * Use it to create the forced non-ajax action for a handmade form in a velocity template, e.g.
  * '<form method="post" action="$r.formURIgb("viewswitch")">'
  *
  * @param command
  * @return
  */
 public StringOutput formURI(String command) {
   StringOutput sb = new StringOutput(100);
   renderer
       .getUrlBuilder()
       .buildURI(sb, new String[] {VelocityContainer.COMMAND_ID}, new String[] {command});
   return sb;
 }
Пример #3
0
 /**
  * renderer a target="oaa" if ajax-mode is on, otherwise returns an empty string
  *
  * @return
  */
 public StringOutput bgTarget() {
   StringOutput sb = new StringOutput(16);
   if (isIframePostEnabled) {
     renderer.getUrlBuilder().appendTarget(sb);
   }
   return sb;
 }
Пример #4
0
 /**
  * @param command
  * @return
  */
 public StringOutput commandURI(String command, String paramKey, String paramValue) {
   StringOutput sb = new StringOutput(100);
   renderer
       .getUrlBuilder()
       .buildURI(
           sb,
           new String[] {VelocityContainer.COMMAND_ID, paramKey},
           new String[] {command, paramValue});
   return sb;
 }
Пример #5
0
 /**
  * @param command
  * @return
  */
 public StringOutput commandURIbg(String command, String paramKey, String paramValue) {
   StringOutput sb = new StringOutput(100);
   renderer
       .getUrlBuilder()
       .buildURI(
           sb,
           new String[] {VelocityContainer.COMMAND_ID, paramKey},
           new String[] {command, paramValue},
           isIframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
   return sb;
 }
Пример #6
0
 /**
  * Creates a java script fragment to execute a background request. In ajax mode the request uses
  * the ajax asynchronous methods, in legacy mode it uses a standard document.location.request
  *
  * @param command
  * @return
  */
 public StringOutput javaScriptBgCommand(String command) {
   StringOutput sb = new StringOutput(100);
   renderer
       .getUrlBuilder()
       .buildJavaScriptBgCommand(
           sb,
           new String[] {VelocityContainer.COMMAND_ID},
           new String[] {command},
           isIframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
   return sb;
 }