Package org.olat.core.gui.components.velocity

Examples of org.olat.core.gui.components.velocity.VelocityContainer


   */
  protected ItemController(UserRequest ureq, WindowControl wControl, Item item, Feed feed, FeedViewHelper helper, FeedUIFactory uiFactory,
      FeedSecurityCallback callback, Link editButton, Link deleteButton) {
    super(ureq, wControl);
    setTranslator(uiFactory.getTranslator());
    VelocityContainer vcItem = uiFactory.createItemVelocityContainer(this);
    vcItem.contextPut("item", item);
    vcItem.contextPut("feed", feed);
    vcItem.contextPut("helper", helper);
    vcItem.contextPut("callback", callback);
    if (feed.isInternal()) {
      if (editButton != null) vcItem.put("editButton", editButton);
      if (deleteButton != null) vcItem.put("deleteButton", deleteButton);
    }
    backLink = LinkFactory.createLinkBack(vcItem, this);
    // Add static path for resource delivery and js player for media
    String baseStaticPath = ClassPathStaticDispatcher.getInstance().getMapperBasePath(RSSFeed.class);
    vcItem.contextPut("baseStaticPath", baseStaticPath);
    // Add date component
    if(item.getDate() != null) {
      DateComponentFactory.createDateComponentWithYear("dateComp", item.getDate(), vcItem);
    }
    // Add rating and commenting controller - only when configured
    CommentAndRatingService commentAndRatingService = (CommentAndRatingService) ServiceFactory.getServiceOrNull(CommentAndRatingService.class);
    if (commentAndRatingService != null) {       
      commentAndRatingService.init(getIdentity(), feed, item.getGuid(), callback.mayEditMetadata(), ureq.getUserSession().getRoles().isGuestOnly());
      commentsCtr = commentAndRatingService.createUserCommentsAndRatingControllerExpandable(ureq, getWindowControl());
      listenTo(commentsCtr);
      vcItem.put("commentsAndRating", commentsCtr.getInitialComponent());       
    }
    //
    this.putInitialPanel(vcItem);
    // do logging
    ThreadLocalUserActivityLogger.log(FeedLoggingAction.FEED_ITEM_READ, getClass(), LoggingResourceable.wrap(item));
View Full Code Here


 
 

  private VelocityContainer initLoginContent(UserRequest ureq, String provider) {
    // in every case we build the container for pages to fill the panel
    VelocityContainer contentBorn = createVelocityContainer("login");

//  REVIEW:12-2007:CodeCleanup
//    // is this a logout request?
//    if (ureq.getHttpReq().getPathInfo().equals(DispatcherAction.getPathDefault() + AuthHelper.LOGOUT_PAGE)) {
//      content.setPage(VELOCITY_ROOT + "/logout.html");
//      return content;
//    }

    // browser not supported messages
    // true if browserwarning should be showed
    boolean bwo = !Settings.isBrowserOlatAjaxCertified(ureq);
    contentBorn.contextPut("browserWarningOn", bwo ? Boolean.TRUE : Boolean.FALSE);
   
    // prepare login
    if (provider == nullprovider = LoginModule.getDefaultProviderName();
    AuthenticationProvider authProvider = LoginModule.getAuthenticationProvider(provider);
    if (authProvider == null)
      throw new AssertException("Invalid authentication provider: " + provider);
   
    authController = authProvider.createController(ureq, getWindowControl());
    listenTo(authController);
    contentBorn.put("loginComp", authController.getInitialComponent());
    Collection providers = LoginModule.getAuthenticationProviders();
    List providerSet = new ArrayList(providers.size());
    providerSet.addAll(providers);
    providerSet.remove(authProvider); // remove active authProvider from list of alternate authProviders
    contentBorn.contextPut("providerSet", providerSet);
    contentBorn.contextPut("locale", ureq.getLocale());

    // prepare info message
    InfoMessageManager mrg = (InfoMessageManager)CoreSpringFactory.getBean(InfoMessageManager.class);
    String infomsg = mrg.getInfoMessage();
    if (infomsg != null && infomsg.length() > 0)
      contentBorn.contextPut("infomsg", infomsg);
   
    String infomsgNode = mrg.getInfoMessageNodeOnly();
    if (infomsgNode != null && infomsgNode.length() > 0)
      contentBorn.contextPut("infomsgNode", infomsgNode);
   
    return contentBorn;
  }
View Full Code Here

    insertTree.setFormButtonKey("insertAtSelectedTreepos");
    insertTree.addListener(this);
    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    insertModel = new InsertTreeModel(course.getEditorTreeModel());
    insertTree.setTreeModel(insertModel);   
    VelocityContainer insertVC = createVelocityContainer("insertNode");
    insertVC.put("selection", insertTree);
   
    if(insertModel.totalNodeCount() > CourseModule.getCourseNodeLimit()){
      String msg = getTranslator().translate("warning.containsXXXormore.nodes",
          new String[]{String.valueOf(insertModel.totalNodeCount()),String.valueOf(CourseModule.getCourseNodeLimit()+1)});
      Controller tmp = MessageUIFactory.createWarnMessage(ureq, wControl, null, msg);
      listenTo(tmp);
      insertVC.put("nodelimitexceededwarning", tmp.getInitialComponent());
    }
   
    this.putInitialPanel(insertVC);
}
View Full Code Here

        super(wControl);
        Translator trans = new PackageTranslator(PACKAGE,  ureq.getLocale());
        List namesList;
        this.htmlElemId = htmlElemId;
        // main window containg title and the cooser list
        main = new VelocityContainer("main",VELOCITY_ROOT + "/groupandareaselect.html", trans, this);

        // initialize some type specific stuff
        switch (type) {
        case 1:
            namesList = cgm.getUniqueLearningGroupNamesFromAllContexts();           
View Full Code Here

            getWindowControl().setError(translate("login.notavailable", WebappHelper.getMailConfig("mailSupport")));
          } else {
            getWindowControl().setError(translate("login.error", WebappHelper.getMailConfig("mailSupport")));
          }
        } else if (cmd.equals(ACTION_BROWSERCHECK)) {
          VelocityContainer browserCheck = createVelocityContainer("browsercheck");
          browserCheck.contextPut("isBrowserAjaxReady", Boolean.valueOf(Settings.isBrowserOlatAjaxCertified(ureq)));
          dmzPanel.pushContent(browserCheck);
        } else if (cmd.equals(ACTION_COOKIES)) {
          dmzPanel.pushContent(createVelocityContainer("cookies"));
        } else if (cmd.equals(ACTION_ABOUT)) {
          VelocityContainer aboutVC = createVelocityContainer("about");
          // Add version info and licenses
          Version v = (Version)CoreSpringFactory.getBean("org.olat.core.Version");
          aboutVC.contextPut("version", v.getFullVersion());
          aboutVC.contextPut("license", WebappHelper.getOlatLicense());
          // Add translator and languages info
          I18nManager i18nMgr = I18nManager.getInstance();
          Set<String> enabledKeysSet = I18nModule.getEnabledLanguageKeys();
          Map<String, String> langNames = new HashMap<String, String>();
          Map<String, String> langTranslators = new HashMap<String, String>();
          String[] enabledKeys = ArrayHelper.toArray(enabledKeysSet);
          String[] names = new String[enabledKeys.length];
          for (int i = 0; i < enabledKeys.length; i++) {
            String key = enabledKeys[i];
            String langName = i18nMgr.getLanguageInEnglish(key, I18nModule.isOverlayEnabled());
            langNames.put(key, langName);
            names[i] = langName;
            String author = i18nMgr.getLanguageAuthor(key);
            langTranslators.put(key, author);
          }
          ArrayHelper.sort(enabledKeys, names, true, true, true);
          aboutVC.contextPut("enabledKeys", enabledKeys);
          aboutVC.contextPut("langNames", langNames);
          aboutVC.contextPut("langTranslators", langTranslators);
          dmzPanel.pushContent(aboutVC);
        } else if (cmd.equals(ACTION_ACCESSIBILITY)) {
          VelocityContainer accessibilityVC = createVelocityContainer("accessibility");
          dmzPanel.pushContent(accessibilityVC);
        }
      }
    } else if (event.getCommand().equals(ACTION_LOGIN)) {
      // show traditional login page
View Full Code Here

      // 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;
View Full Code Here

    super(ureq, wControl);
   
    cps = (ClipboardService) ureq.getUserSession().getServiceInstance(ClipboardService.class);
    // if cps == null --> service not available in this setup: does this make sense at all?
   
    VelocityContainer mainVc = createVelocityContainer("clipdemo");

    // copyTo demo
    copyToC = cps.createCopyToUIService(new ClipboardEntryCreator() {
      public ClipboardEntry createClipboardEntry() {
        return createCurrentClipboardEntry();
      }
   
    }).createController(ureq, getWindowControl());
    mainVc.put("copyto", copyToC.getInitialComponent());

    // pasteFrom demo
    pasteFromC = cps.createPasteFromUIService(new Class[] { DemoClipboardEntry.class}).createController(ureq, getWindowControl());
    pasteFromC.addControllerListener(this);
    mainVc.put("pastefrom", pasteFromC.getInitialComponent());

    putInitialPanel(mainVc);
  }
View Full Code Here

  /**
   * @see org.olat.modules.webFeed.FeedUIFactory#getInfoVelocityContainer()
   */
  public VelocityContainer createInfoVelocityContainer(BasicController controller) {
    return new VelocityContainer(VC_INFO_NAME, this.getClass(), VC_INFO_NAME, translator, controller);
  }
View Full Code Here

  /**
   * @see org.olat.modules.webFeed.FeedUIFactory#getInfoVelocityContainer()
   */
  public VelocityContainer createItemsVelocityContainer(BasicController controller) {
    return new VelocityContainer(VC_ITEMS_NAME, this.getClass(), "posts", translator, controller);
  }
View Full Code Here

  /**
   * @see org.olat.modules.webFeed.ui.FeedUIFactory#createItemsVelocityContainer(org.olat.core.gui.control.controller.BasicController)
   */
  public VelocityContainer createItemVelocityContainer(BasicController controller) {
    return new VelocityContainer(VC_ITEM_NAME, this.getClass(), "post", translator, controller);
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.velocity.VelocityContainer

Copyright © 2018 www.massapicom. 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.