Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 11524 custom field showing pencil on content edit #11526

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

import java.io.Writer;

import javax.servlet.http.HttpServletRequest;

import org.apache.velocity.context.Context;

import com.dotmarketing.beans.Host;
import com.dotmarketing.beans.Identifier;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.business.DotStateException;
import com.dotmarketing.business.PermissionAPI;
import com.dotmarketing.filters.CMSFilter;
import com.dotmarketing.portlets.contentlet.model.Contentlet;
import com.dotmarketing.portlets.contentlet.model.ContentletVersionInfo;
import com.dotmarketing.portlets.fileassets.business.FileAsset;
Expand Down Expand Up @@ -42,6 +45,8 @@ String resolveTemplatePath(final Context context, final Writer writer, final Ren
boolean live = params.live;
Host host = params.currentHost;;
User user = params.user;
HttpServletRequest request = (HttpServletRequest) context.get("request");

try {

// if we have a host
Expand Down Expand Up @@ -72,8 +77,8 @@ String resolveTemplatePath(final Context context, final Writer writer, final Ren
FileAsset asset = APILocator.getFileAssetAPI().fromContentlet(c);


// add the edit control
if (!context.containsKey("dontShowIcon") && params.editMode) {
// add the edit control if we have run through a page render
if (!context.containsKey("dontShowIcon") && params.editMode && (request.getAttribute(CMSFilter.CMS_FILTER_URI_OVERRIDE)!=null)) {
if (APILocator.getPermissionAPI().doesUserHavePermission(c, PermissionAPI.PERMISSION_READ, user)) {
String editIcon = new String(EDIT_ICON).replace("${_dotParseInode}", c.getInode()).replace("${_dotParsePath}",
id.getParentPath());
Expand Down