private String doGetPreviewHtml(final String rendererType, final String unrenderedMarkup, final IssueRenderContext renderContext) { // The issueRenderContext allows us to resolve links to attached files and is also used by the wiki renderer, if // the issue is null then it is probably the case that we are on the CreateIssue screen and therefore we will // not have any attachments. The worst that will happen rendering wiki markup without an issue context is that some links // will not render. JRA-11464(JIRA), JST-763(JIRA Studio). final String result = rendererManager.getRenderedContent(rendererType, unrenderedMarkup, renderContext); return (StringUtils.isBlank(result)) ? RenderersResource.NBSP : result; }
@Nonnull private JiraRendererPlugin getRenderer() { final JiraRendererPlugin renderer = rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE); if (renderer == null) { throw new InfrastructureException("wikimarkup renderer not found, but it is required to render the project description"); } return renderer; } }
public List<String> getAllActiveRenderers() { final OrderableField field = getSelectedLayoutItem().getOrderableField(); final List<String> ret = new ArrayList<String>(); if(hackyFieldRendererRegistry.shouldOverrideDefaultRenderers(field)) { final Set<HackyRendererType> rendererTypeSet = hackyFieldRendererRegistry.getRendererTypes(field); for (HackyRendererType rendererType : rendererTypeSet) { ret.add(rendererType.getKey()); } } else { final List<JiraRendererPlugin> rendererPlugins = getRendererManager().getAllActiveRenderers(); for (JiraRendererPlugin rendererPlugin : rendererPlugins) { ret.add(rendererPlugin.getRendererType()); } } return ret; }
public String getDescription(String fieldDescription) { String description = fieldDescription; if (featureManager.isOnDemand()) { description = rendererManager.getRenderedContent(AtlassianWikiRenderer.RENDERER_TYPE, fieldDescription, null); } return description; } }
private void populateRendererParams(final Map<String, Object> velocityParams, final FieldLayoutItem fieldLayoutItem) { final String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; velocityParams.put("rendererDescriptor", getRendererManager().getRendererForType(rendererType).getDescriptor()); velocityParams.put("rendererParams", new HashMap()); }
private String getActionHtml(Comment comment) { return rendererManager.getRenderedContent(new CommentFieldRenderContext(comment)); }
private Object processValueThroughRenderer(FieldLayoutItem fieldLayoutItem, Object value) { if (isRenderable()) { String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; value = rendererManager.getRendererForType(rendererType).transformFromEdit(value); } return value; }
private Object getRendererCustomFieldValue(FieldLayoutItem fieldLayoutItem, Issue issue, Map displayParams) { Object customFieldValue = issue.getCustomFieldValue(this); if (isRenderable() && displayParams.get("excel_view") == null) { String renderedContent = rendererManager.getRenderedContent(fieldLayoutItem, issue); if (StringUtils.isNotBlank(renderedContent)) { // JRA-12479 - probably the custom field is in value creation process customFieldValue = renderedContent; } } return customFieldValue; }
public String getContactAdministratorsMessage() { String message = getApplicationProperties().getDefaultBackedString(APKeys.JIRA_CONTACT_ADMINISTRATORS_MESSSAGE); return rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).render(message, null); }
public String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters) { Map velocityParams = getVelocityParams(fieldLayoutItem, action, issue, displayParameters); if (isRenderable()) { velocityParams.put("value", rendererManager.getRenderedContent(fieldLayoutItem, issue)); } else { velocityParams.put("value", getValueFromIssue(issue)); } return getViewHtml(velocityParams); }
@ActionViewData(key="renderedMessageContent") public String getRenderedMessage() { String message = getApplicationProperties().getDefaultBackedText(APKeys.JIRA_CONTACT_ADMINISTRATORS_MESSSAGE); if (isEmpty(message) || !getShouldDisplayForm()) { message = getText("admin.generalconfiguration.contact.administrators.message.default"); } return rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).render(message, null); }
@Override public void send() throws MailException { String format = recipient.getFormat(); String bodyTemplatePath = "templates/email/" + format + "/issuementioned.vm"; String comment = (String) context.get("comment"); String content = rendererManager.getRenderedContent( AtlassianWikiRenderer.RENDERER_TYPE, comment, issueRenderContext); context.put("htmlComment", content); MailQueueItem item = new MailServiceQueueItemBuilder(from, recipient, subjectTemplatePath, bodyTemplatePath, context).buildQueueItemUsingProjectEmailAsReplyTo(); mailQueue.addItem(item); }
@Override public void updateValue(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder) { // all comment creations are seen as an update Map<String, Object> commentParams = (Map<String, Object>) modifiedValue.getNewValue(); String body = (String) commentParams.get(getId()); // allow the renderer for this field a change to transform the value String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; body = (String) rendererManager.getRendererForType(rendererType).transformFromEdit(body); if (commentParams.containsKey(EDIT_COMMENT)) { editComment(issueChangeHolder, commentParams, body); } else if(commentParams.containsKey(REMOVE_COMMENT)) { removeComment(issueChangeHolder, commentParams); } else { if (StringUtils.isNotBlank(body)) { createComment(issue, issueChangeHolder, commentParams, body); } } }
public String render(String text, boolean linkCruKeys) { if (linkCruKeys) { text = CrucibleRenderer.linkCrucibleKeys(text, fishEyeConfig.getCrucibleProjectToUrlMappings()); } IssueRenderContext renderContext = resolveContext(text); return rendererManager.getRenderedContent(MESSAGE_RENDERER, text, renderContext); }
velocityParams.put("rendererDescriptor", rendererManager.getRendererForType(rendererType).getDescriptor()); velocityParams.put("groupLevels", getGroupLevels()); velocityParams.put("mentionable", mentionService.isUserAbleToMention(authenticationContext.getUser()));
private Object getRendererCustomFieldValue(FieldLayoutItem fieldLayoutItem, Issue issue, Object value) { Object customFieldValue; if (isRenderable() && value instanceof String) { String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; customFieldValue = rendererManager.getRenderedContent(rendererType, (String) value, issue.getIssueRenderContext()); } else { customFieldValue = value; } return customFieldValue; }
/** * Returns the edit HTML for this renderable application property. * * @param fieldName the field name to use in the generated HTML * @return a String containing the edit HTML */ @Override public final String getEditHtml(String fieldName) { if (isOnDemand()) { JiraRendererModuleDescriptor rendererDescriptor = rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).getDescriptor(); Map<String, String> renderParams = Maps.newHashMap(ImmutableMap.of( "rows", "10", "cols", "60", "wrap", "virtual", "class", "long-field" )); return rendererDescriptor.getEditVM(getValue(), null, AtlassianWikiRenderer.RENDERER_TYPE, fieldName, fieldName, renderParams, false); } return renderTemplate(EDIT_VM, new Context(fieldName)); }
/** * Returns the view HTML for this renderable application property. * * @return a String containing the view HTML */ @Override public final String getViewHtml() { if (isOnDemand()) { return rendererManager.getRenderedContent(AtlassianWikiRenderer.RENDERER_TYPE, getValue(), null); } // no OnDemand == no encoding return getValue(); }
public String getRendererDisplayName(String rendererType) { final HackyRendererType hackyRendererType = HackyRendererType.fromKey(rendererType); if (hackyRendererType != null) { return getText(hackyRendererType.getDisplayNameI18nKey()); } else { return rendererManager.getRendererForType(rendererType).getDescriptor().getName(); } }
protected void populateVelocityParams(Map params) { params.put("action", this); params.put("worklog", this.getWorklog()); params.put("content", worklog.getComment()); params.put("userformats", userFormats); try { final FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue).getFieldLayoutItem(IssueFieldConstants.WORKLOG); if (fieldLayoutItem != null) { params.put("content", rendererManager.getRenderedContent(fieldLayoutItem.getRendererType(), worklog.getComment(), issue.getIssueRenderContext())); } } catch (DataAccessException e) { log.error(e.getMessage(), e); } }