Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Host


      
    fileName = hostId + "_toplinks.vtl";
    file  = new java.io.File(MENU_VTL_PATH + java.io.File.separator + fileName);
    if (!file.exists()) {
      try {
        Host host = APILocator.getHostAPI().find(hostId, APILocator.getUserAPI().getSystemUser(), false);
        itemsList = APILocator.getFolderAPI().findSubFolders(host, true);
      } catch (Exception e) {
        Logger.error(this, e.getMessage(), e);
        throw new DotRuntimeException(e.getMessage(),e);
      }
View Full Code Here


    */
  private void getTrail(StringBuffer stringbuffer, String openPath, String fullPath, String imgPath, String crumbTitle, HttpServletRequest request) throws DotSecurityException, PortalException, SystemException, DotDataException {

    boolean multilingual = request.getAttribute("dot_multilingual_navigation") != null;

    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);

    //Checking if it's the end of the url and we are requesting a page
    if (openPath.equals(fullPath) && openPath.endsWith("." + Config.getStringProperty("VELOCITY_PAGE_EXTENSION"))) {
      getPageTrail(stringbuffer, fullPath, crumbTitle, request);
    } else {
      Folder folder = APILocator.getFolderAPI().findFolderByPath(openPath, host, user, true);

      String tempPath = openPath + "index." + Config.getStringProperty("VELOCITY_PAGE_EXTENSION");

      if ((tempPath.equals(fullPath)) ||
        (!UtilMethods.isSet(LiveCache.getPathFromCache(tempPath, host.getIdentifier()))))
        return;

      stringbuffer.append("<li><a href=\"" + UtilMethods.encodeURIComponent(APILocator.getIdentifierAPI().find(folder).getPath()) + "\">");
        if(multilingual && (folder.getTitle().contains("glossary.get")||folder.getTitle().contains("text.get")))
          stringbuffer.append(UtilHTML.escapeHTMLSpecialChars(folder.getTitle())+ "</a>");
View Full Code Here

   * @throws DotDataException
   * @throws SystemException
   * @throws PortalException
    */
  private StringBuffer getPageTrail(StringBuffer stringbuffer, String fullPath, String crumbTitle, HttpServletRequest request) throws PortalException, SystemException, DotDataException, DotSecurityException {
    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);

    boolean multilingual = request.getAttribute("dot_multilingual_navigation") != null;

    if (UtilMethods.isSet(crumbTitle)) {
      String title = multilingual?"$languagewebapi.get('" + crumbTitle + "')":crumbTitle;
View Full Code Here

    */
  @SuppressWarnings("unchecked")
  public String createMenu(String startFromPath, int numberOfLevels, HttpServletRequest request) throws PortalException, SystemException, DotDataException, DotSecurityException
  {
    String currentPath = request.getRequestURI();
    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
    String hostId = host.getIdentifier();
    StringBuffer stringbuf = new StringBuffer();

    //Variable used to discriminate the menu names based on the paramaters given to the macro
    String paramsValues = "";

    boolean addSpans = false;
    if(request.getAttribute("menu_spans") != null && (Boolean)request.getAttribute("menu_spans")){
      addSpans = true;
    }

    String firstItemClass = "";
    if(request.getAttribute("firstItemClass") != null){
      firstItemClass = " class=\""+(String)request.getAttribute("firstItemClass")+"_";
    }

    String lastItemClass = "";
    if(request.getAttribute("lastItemClass") != null ) {
      lastItemClass=" class=\""+(String)request.getAttribute("lastItemClass")+"_";
    }

    String menuIdPrefix = "";
    if(request.getAttribute("menuIdPrefix") != null ){
      menuIdPrefix=(String)request.getAttribute("menuIdPrefix")+"_";
    }


    paramsValues = ((Boolean)addSpans).toString() + firstItemClass.toString() + lastItemClass.toString() +
    menuIdPrefix.toString();

    try {

      Logger.debug(NavigationWebAPI.class, "\n\nNavigationWebAPI :: StaticMenuBuilder begins");
      Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder start path=" + startFromPath);
      Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder number of levels=" + numberOfLevels);

      if ((startFromPath == null) || (startFromPath.length() == 0)) {

        Logger.debug(NavigationWebAPI.class, "pagePath=" + currentPath);

        int idx1 = currentPath.indexOf("/");
        int idx2 = currentPath.indexOf("/", idx1 + 1);

        startFromPath = currentPath.substring(idx1, idx2 + 1);

        Logger.debug(NavigationWebAPI.class, "path=" + startFromPath);
      }

      Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder hostId=" + host.getIdentifier());

      java.util.List itemsList = new ArrayList();
      String folderPath = "";
      String fileName = "";
      boolean fileExists = true;
View Full Code Here

    String siteMapIdPrefix = "";
    if(request.getAttribute("siteMapIdPrefix") != null ){
      siteMapIdPrefix=(String)request.getAttribute("siteMapIdPrefix")+"_";
    }

    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
    String hostId = host.getIdentifier();
    StringBuffer stringbuf = new StringBuffer();
    FileOutputStream fo = null;

    int orderDirection = 1;
    if(reverseOrder){
      orderDirection = -1;
    }

    try {


      Logger.debug(StaticMenuBuilder.class, "\n\nStaticMenuBuilder begins");
      Logger.debug(StaticMenuBuilder.class, "StaticMenuBuilder start path=" + startFromPath);
      Logger.debug(StaticMenuBuilder.class, "StaticMenuBuilder number of levels=" + numberOfLevels);

      if ((startFromPath == null) || (startFromPath.length() == 0)) {

        Logger.debug(StaticMenuBuilder.class, "pagePath=" + currentPath);

        int idx1 = currentPath.indexOf("/");
        int idx2 = currentPath.indexOf("/", idx1 + 1);

        startFromPath = currentPath.substring(idx1, idx2 + 1);

        Logger.debug(StaticMenuBuilder.class, "path=" + startFromPath);
      }

      Logger.debug(StaticMenuBuilder.class, "StaticMenuBuilder hostId=" + host.getIdentifier());

      java.util.List itemsList = new ArrayList();
      String folderPath = "";
      String fileName = "";
      boolean fileExists = true;
View Full Code Here

    boolean nextLevelItems = (itemsChildrenList2.size() > 0 && currentLevel < numberOfLevels);

    String folderChildPath = thisFolderPath.substring(0, thisFolderPath.length() - 1);
    folderChildPath = folderChildPath.substring(0, folderChildPath.lastIndexOf("/"));

    Host host = WebAPILocator.getHostWebAPI().findParentHost(thisFolder, user, true);//DOTCMS-4099
    Identifier id = APILocator.getIdentifierAPI().find(host,thisFolderPath + "index." + Config.getStringProperty("VELOCITY_PAGE_EXTENSION"));
    if(id != null && InodeUtils.isSet(id.getInode()))
      stringbuf.append("<a href=\"" + UtilMethods.encodeURIComponent(thisFolderPath) + "\">");
    stringbuf.append(UtilHTML.escapeHTMLSpecialChars(thisFolder.getTitle()));
    if(id != null && InodeUtils.isSet(id.getInode()))
View Full Code Here

    {
      //Create the Menu for this path and depthLevel
      createMenu(startFromPath,numberOfLevels,request);
      //Validate if the file has been created, if so the menu have items
      String currentPath = request.getRequestURI();
      Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
      String hostId = host.getIdentifier();

      if ((startFromPath == null) || (startFromPath.length() == 0)) {

        Logger.debug(NavigationWebAPI.class, "pagePath=" + currentPath);
View Full Code Here

    */
  @SuppressWarnings("unchecked")
  public List<HTMLPage> getPagesList(String folderPath, HttpServletRequest request) throws PortalException, SystemException, DotDataException, DotSecurityException {

    List<HTMLPage> pagesList = new ArrayList<HTMLPage>();
    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
    Folder thisFolder = APILocator.getFolderAPI().findFolderByPath(folderPath, host,user,true);
    List<Inode> itemsChildrenList = (List<Inode>)APILocator.getFolderAPI().findMenuItems(thisFolder, user, true);
    for (Inode childChild : itemsChildrenList) {
      if(childChild instanceof HTMLPage){
        pagesList.add((HTMLPage) childChild);
View Full Code Here

    */
  @SuppressWarnings("unchecked")
  public String buildMenuItems(String startFromPath, int numberOfLevels, HttpServletRequest request) throws PortalException, SystemException, DotDataException, DotSecurityException
  {
    String currentPath = request.getRequestURI();
    Host host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
    String hostId = host.getIdentifier();
    StringBuffer stringbuf = new StringBuffer();

    try {

      Logger.debug(NavigationWebAPI.class, "\n\nNavigationWebAPI :: StaticMenuBuilder begins");
      Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder start path=" + startFromPath);
      Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder number of levels=" + numberOfLevels);

      if ((startFromPath == null) || (startFromPath.length() == 0)) {
        Logger.debug(NavigationWebAPI.class, "pagePath=" + currentPath);

        int idx1 = currentPath.indexOf("/");
        int idx2 = currentPath.indexOf("/", idx1 + 1);

        startFromPath = currentPath.substring(idx1, idx2 + 1);

        Logger.debug(NavigationWebAPI.class, "path=" + startFromPath);
      }

      Logger.debug(NavigationWebAPI.class, "NavigationWebAPI :: StaticMenuBuilder hostId=" + host.getIdentifier());

      java.util.List itemsList = new ArrayList<Inode>();
      String folderPath = "";
      String fileName = "";
      boolean fileExists = true;
View Full Code Here

  //pagePath == $VTLSERVLET_URI where the user is at that moment
    //links Folders as default
  public String createMenu(String path, String pagePath, String divName, int numberOfLevels)
  {
    try {
      Host host = hostWebAPI.getCurrentHost(request);
      return createMenu(path, pagePath, host.getIdentifier(),divName,"",true,"","",numberOfLevels);
    } catch (DotDataException e) {
      Logger.error(HorizontalMenuBuilder.class, e.getMessage(), e);
      throw new DotRuntimeException(e.getMessage(), e);
    } catch (PortalException e) {
      Logger.error(HorizontalMenuBuilder.class, e.getMessage(), e);
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.Host

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.