Package com.dotmarketing.portlets.htmlpages.business

Examples of com.dotmarketing.portlets.htmlpages.business.HTMLPageAPI$TemplateContainersReMap$ContainerRemapTuple


    }
   
   
   
    // set the host variables
    HTMLPageAPI htmlPageAPI = APILocator.getHTMLPageAPI();

    Host host = htmlPageAPI.getParentHost(htmlPage);
    sb.append("#if(!$doNotParseTemplate)");
      sb.append("$velutil.mergeTemplate('" ).append( folderPath ).append( host.getIdentifier() ).append( "." ).append( Config.getStringProperty("VELOCITY_HOST_EXTENSION") ).append( "')");
    sb.append(" #end ");
   
   
View Full Code Here


    Identifier id = APILocator.getIdentifierAPI().find(host, uri);
    request.setAttribute("idInode", id.getInode());

    HTMLPage htmlPage = (HTMLPage) APILocator.getVersionableAPI()
        .findWorkingVersion(id, APILocator.getUserAPI().getSystemUser(), false);
    HTMLPageAPI htmlPageAPI = APILocator.getHTMLPageAPI();
    VelocityUtil.makeBackendContext(context, htmlPage, "", id.getURI(), request, true, false, false, host);

    boolean canUserWriteOnTemplate = permissionAPI.doesUserHavePermission(htmlPageAPI.getTemplateForWorkingHTMLPage(htmlPage),
        PERMISSION_WRITE, backendUser);
    context.put("EDIT_TEMPLATE_PERMISSION", canUserWriteOnTemplate);

    Template template = null;
View Full Code Here

    // creates the context where to place the variables
    response.setContentType(CHARSET);
    Context context = VelocityUtil.getWebContext(request, response);

    HTMLPage htmlPage = (HTMLPage) APILocator.getVersionableAPI().findWorkingVersion(id, user, true);
    HTMLPageAPI htmlPageAPI = APILocator.getHTMLPageAPI();
    PublishingEndPointAPI pepAPI = APILocator.getPublisherEndPointAPI();
    List<PublishingEndPoint> receivingEndpoints = pepAPI.getReceivingEndPoints();
    // to check user has permission to write on this page
        boolean hasWritePermOverHTMLPage = permissionAPI.doesUserHavePermission( htmlPage, PERMISSION_WRITE, user );
        boolean hasPublishPermOverHTMLPage = permissionAPI.doesUserHavePermission( htmlPage, PERMISSION_PUBLISH, user );
        boolean hasRemotePublishPermOverHTMLPage = hasPublishPermOverHTMLPage && LicenseUtil.getLevel() > 199;
        boolean hasEndPoints = UtilMethods.isSet( receivingEndpoints ) && !receivingEndpoints.isEmpty();

        context.put( "EDIT_HTMLPAGE_PERMISSION", new Boolean( hasWritePermOverHTMLPage ) );
        context.put( "PUBLISH_HTMLPAGE_PERMISSION", new Boolean( hasPublishPermOverHTMLPage ) );
        context.put( "REMOTE_PUBLISH_HTMLPAGE_PERMISSION", new Boolean( hasRemotePublishPermOverHTMLPage ) );
        context.put( "REMOTE_PUBLISH_END_POINTS", new Boolean( hasEndPoints ) );
        context.put( "canViewDiff", new Boolean( LicenseUtil.getLevel() > 199 ? true : false ) );
    boolean canUserWriteOnTemplate = permissionAPI.doesUserHavePermission(htmlPageAPI.getTemplateForWorkingHTMLPage(htmlPage),
        PERMISSION_WRITE, user, true);
    context.put("EDIT_TEMPLATE_PERMISSION", canUserWriteOnTemplate);

    com.dotmarketing.portlets.templates.model.Template cmsTemplate = com.dotmarketing.portlets.htmlpages.factories.HTMLPageFactory
        .getHTMLPageTemplate(htmlPage, true);
View Full Code Here

        // creates the context where to place the variables
        response.setContentType( CHARSET );
        Context context = VelocityUtil.getWebContext( request, response );

        HTMLPage htmlPage = (HTMLPage) APILocator.getVersionableAPI().findWorkingVersion( id, APILocator.getUserAPI().getSystemUser(), false );
        HTMLPageAPI htmlPageAPI = APILocator.getHTMLPageAPI();
        PublishingEndPointAPI pepAPI = APILocator.getPublisherEndPointAPI();
    List<PublishingEndPoint> receivingEndpoints = pepAPI.getReceivingEndPoints();
        // to check user has permission to write on this page
        boolean hasAddChildrenPermOverHTMLPage = permissionAPI.doesUserHavePermission( htmlPage, PERMISSION_CAN_ADD_CHILDREN, backendUser );
        boolean hasWritePermOverHTMLPage = permissionAPI.doesUserHavePermission( htmlPage, PERMISSION_WRITE, backendUser );
        boolean hasPublishPermOverHTMLPage = permissionAPI.doesUserHavePermission( htmlPage, PERMISSION_PUBLISH, backendUser );
        boolean hasRemotePublishPermOverHTMLPage = hasPublishPermOverHTMLPage && LicenseUtil.getLevel() > 199;
        boolean hasEndPoints = UtilMethods.isSet( receivingEndpoints ) && !receivingEndpoints.isEmpty();

        context.put( "ADD_CHILDREN_HTMLPAGE_PERMISSION", new Boolean( hasAddChildrenPermOverHTMLPage ) );
        context.put( "EDIT_HTMLPAGE_PERMISSION", new Boolean( hasWritePermOverHTMLPage ) );
        context.put( "PUBLISH_HTMLPAGE_PERMISSION", new Boolean( hasPublishPermOverHTMLPage ) );
        context.put( "REMOTE_PUBLISH_HTMLPAGE_PERMISSION", new Boolean( hasRemotePublishPermOverHTMLPage ) );
        context.put( "REMOTE_PUBLISH_END_POINTS", new Boolean(hasEndPoints) );
        context.put( "canAddForm", new Boolean( LicenseUtil.getLevel() > 199 ? true : false ) );
        context.put( "canViewDiff", new Boolean( LicenseUtil.getLevel() > 199 ? true : false ) );

        boolean canUserWriteOnTemplate = permissionAPI.doesUserHavePermission( htmlPageAPI.getTemplateForWorkingHTMLPage( htmlPage ), PERMISSION_WRITE, backendUser ) && portletAPI.hasTemplateManagerRights( backendUser );
        context.put( "EDIT_TEMPLATE_PERMISSION", canUserWriteOnTemplate );

        com.dotmarketing.portlets.templates.model.Template cmsTemplate = com.dotmarketing.portlets.htmlpages.factories.HTMLPageFactory.getHTMLPageTemplate( htmlPage, true );
        //issue- 1775 If User doesn't have edit permission on HTML Pages
       /* if(!hasWritePermOverHTMLPage){
 
View Full Code Here

        //Unsubscriber mailing list
        MailingList unSubscribers = MailingListFactory.getUnsubscribersMailingList();

        //do we have an html page?
        String alternateTextMessage = null;
        HTMLPageAPI pageAPI = APILocator.getHTMLPageAPI();
        HTMLPage htmlPage = (HTMLPage) pageAPI.loadWorkingPageById(comm.getHtmlPage(), APILocator.getUserAPI().getSystemUser(), false);
        String serverName;
        if (htmlPage != null && UtilMethods.isSet(htmlPage.getTitle())) {
          html = true;
          Logger.debug(DeliverCampaignThread.class, "Got htmlPage:"+ htmlPage.getTitle());
View Full Code Here

    // permission changes
    dc.setSQL(selectChildrenHTMLPageWithIndividualPermissionsSQL);
    dc.addParam(host.getPermissionId());
    dc.addParam(isHost ? "%" : folderPath + "%");
    idsToUpdate = dc.loadResults();
    HTMLPageAPI pageAPI = APILocator.getHTMLPageAPI();
    permission = 0;
    if (inheritablePermission != null) {
      permission = inheritablePermission.getPermission();
    }
    for (Map<String, String> idMap : idsToUpdate) {
      String id = idMap.get("id");
      Permissionable childPermissionable;
      try {
        childPermissionable = pageAPI.loadWorkingPageById(id, systemUser, false);
      } catch (DotSecurityException e) {
        Logger.error(PermissionBitFactoryImpl.class, e.getMessage(), e);
        throw new DotRuntimeException(e.getMessage(), e);
      }
      savePermission(new Permission(id, role.getId(), permission, true), childPermissionable);
View Full Code Here

  @Override
  public Permissionable getParentPermissionable() throws DotDataException {

    try {
      HTMLPageAPI pageAPI = APILocator.getHTMLPageAPI();
      HTMLPage base = this;
      if(!this.isWorking())
        base = pageAPI.loadWorkingPageById(this.getIdentifier(), APILocator.getUserAPI().getSystemUser(), false);
         
      User systemUser = APILocator.getUserAPI().getSystemUser();
     
      Folder parentFolder=null;
     
      if(base!=null)
      parentFolder = pageAPI.getParentFolder(base);

      if (parentFolder != null && InodeUtils.isSet(parentFolder.getInode()))
        return parentFolder;
     
      Host host=null;
View Full Code Here

        }

        DotConnect dc = new DotConnect();

        // Remove HTML Pages
        HTMLPageAPI htmlPageAPI = APILocator.getHTMLPageAPI();
        List<HTMLPage> pages = htmlPageAPI.findHtmlPages(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);
        for (HTMLPage page : pages) {
          htmlPageAPI.delete(page, user, respectFrontendRoles);
        }

        // Remove Links
        MenuLinkAPI linkAPI = APILocator.getMenuLinkAPI();
        List<Link> links = linkAPI.findLinks(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);
        for (Link link : links) {
          linkAPI.delete(link, user, respectFrontendRoles);
        }

        // Remove Contentlet
        ContentletAPI contentAPI = APILocator.getContentletAPI();               
        List<Contentlet> contentlets = contentAPI.findContentletsByHost(host, user, respectFrontendRoles);
        for (Contentlet contentlet : contentlets) { 
          contentAPI.delete(contentlet, user, respectFrontendRoles);
        }

        // Remove Folders
        FolderAPI folderAPI = APILocator.getFolderAPI();
        List<Folder> folders = folderAPI.findFoldersByHost(host, user, respectFrontendRoles);
        for (Folder folder : folders) {
          folderAPI.delete(folder, user, respectFrontendRoles);
        }

        // Remove Templates
        TemplateAPI templateAPI = APILocator.getTemplateAPI();
        List<Template> templates = templateAPI.findTemplates(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);
        for (Template template : templates) {
          dc.setSQL("delete from template_containers where template_id = ?");
          dc.addParam(template.getIdentifier());
          dc.loadResult();

          dc.setSQL("select inode, identifier from htmlpage where template_id = ?");
          dc.addParam(template.getIdentifier());
          List<HashMap<String, Object>> htmlpages =  dc.loadResults();
          for (HashMap<String, Object> folderMap : htmlpages) {
            String identifier = (String) folderMap.get("identifier");
            HTMLPage page = htmlPageAPI.loadWorkingPageById(identifier, user, respectFrontendRoles);
            htmlPageAPI.delete(page, user, respectFrontendRoles);
          }

          templateAPI.delete(template, user, respectFrontendRoles);
        }
View Full Code Here

        }

        DotConnect dc = new DotConnect();

        // Remove HTML Pages
        HTMLPageAPI htmlPageAPI = APILocator.getHTMLPageAPI();
        List<HTMLPage> pages = htmlPageAPI.findHtmlPages(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);
        for (HTMLPage page : pages) {
          htmlPageAPI.delete(page, user, respectFrontendRoles);
        }

        // Remove Links
        MenuLinkAPI linkAPI = APILocator.getMenuLinkAPI();
        List<Link> links = linkAPI.findLinks(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);
        for (Link link : links) {
          linkAPI.delete(link, user, respectFrontendRoles);
        }

        // Remove Contentlet
        ContentletAPI contentAPI = APILocator.getContentletAPI();               
        List<Contentlet> contentlets = contentAPI.findContentletsByHost(host, user, respectFrontendRoles);
        for (Contentlet contentlet : contentlets) { 
          contentAPI.delete(contentlet, user, respectFrontendRoles);
        }

        // Remove Folders
        FolderAPI folderAPI = APILocator.getFolderAPI();
        List<Folder> folders = folderAPI.findFoldersByHost(host, user, respectFrontendRoles);
        for (Folder folder : folders) {
          folderAPI.delete(folder, user, respectFrontendRoles);
        }

        // Remove Templates
        TemplateAPI templateAPI = APILocator.getTemplateAPI();
        List<Template> templates = templateAPI.findTemplates(user, true, null, host.getIdentifier(), null, null, null, 0, -1, null);
        for (Template template : templates) {
          dc.setSQL("delete from template_containers where template_id = ?");
          dc.addParam(template.getIdentifier());
          dc.loadResult();

          dc.setSQL("select inode, identifier from htmlpage where template_id = ?");
          dc.addParam(template.getIdentifier());
          List<HashMap<String, Object>> htmlpages =  dc.loadResults();
          for (HashMap<String, Object> folderMap : htmlpages) {
            String identifier = (String) folderMap.get("identifier");
            HTMLPage page = htmlPageAPI.loadWorkingPageById(identifier, user, respectFrontendRoles);
            htmlPageAPI.delete(page, user, respectFrontendRoles);
          }

          templateAPI.delete(template, user, respectFrontendRoles);
        }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.htmlpages.business.HTMLPageAPI$TemplateContainersReMap$ContainerRemapTuple

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.