Commit 8b48d5ea authored by Andrey Lugovskiy's avatar Andrey Lugovskiy Committed by Matija Obreza

Article#template are not indexed in ES

- added template to Article
parent decc3ef4
......@@ -53,9 +53,20 @@ public class FullTextDocument {
@Field(index = FieldIndex.not_analyzed, type = FieldType.Date)
private Date lastModifiedDate;
@Field(type = FieldType.Boolean)
private Boolean template;
/** The score here will boost result relevance */
private Float score = 0.5f;
public Boolean getTemplate() {
return template;
}
public void setTemplate(Boolean template) {
this.template = template;
}
public Long getId() {
return this.id;
}
......
......@@ -69,6 +69,17 @@ public class Article extends AuditedModel {
@Temporal(TemporalType.TIMESTAMP)
private Calendar postDate;
@Column(nullable = false, columnDefinition = "boolean default false")
private boolean template;
public boolean isTemplate() {
return template;
}
public void setTemplate(boolean template) {
this.template = template;
}
public String getSlug() {
return slug;
}
......
......@@ -24,6 +24,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface ArticleRepository extends JpaRepository<Article, Long> {
Article findByClassPkAndTargetIdAndSlugAndLang(ClassPK classPk, Long id, String slug, String lang);
......@@ -37,4 +39,6 @@ public interface ArticleRepository extends JpaRepository<Article, Long> {
Article findBySlugAndLangAndTargetIdAndClassPk(String slug, String lang, Long targetId, ClassPK classPK);
@Query("select a from Article a where a.template = :isTemplate")
List<Article> findAllByTemplate(@Param("isTemplate") Boolean isTemplate);
}
......@@ -46,7 +46,6 @@ public interface ContentService {
* Load article with {@link ClassPK} of clazz with specified id and the
* "slug" for the locale
*
* @param target
* @param slug
* @param locale
* @return
......@@ -95,11 +94,11 @@ public interface ContentService {
*/
ActivityPost createActivityPost(String title, String body);
Article updateArticle(EntityId entity, String slug, String title, String body, String summary, Locale locale);
Article updateArticle(EntityId entity, String slug, String title, String body, String summary, Locale locale, Boolean isTemplate);
Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, String summary, Locale locale);
Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, String summary, Locale locale, Boolean isTemplate );
Article updateArticle(long id, String slug, String title, String body, String summary);
Article updateArticle(long id, String slug, String title, String body, String summary, Boolean isTemplate);
Article updateGlobalArticle(String slug, Locale locale, String title, String body, String summary);
......
......@@ -165,16 +165,15 @@ public class ContentServiceImpl implements ContentService {
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article updateArticle(long id, String slug, String title, String body, String summary) {
public Article updateArticle(long id, String slug, String title, String body, String summary, Boolean isTemplate) {
final Article article = articleRepository.findOne(id);
article.setSlug(slug);
article.setTitle(htmlSanitizer.sanitize(title));
article.setSummary(htmlSanitizer.sanitize(summary));
article.setTemplate(isTemplate);
// FIXME TODO Find a better way to distinguish between Velocity
// templates and general articles
if (StringUtils.contains(body, "VELOCITY")) {
if (isTemplate) {
article.setBody(body);
} else {
article.setBody(htmlSanitizer.sanitize(body));
......@@ -218,18 +217,18 @@ public class ContentServiceImpl implements ContentService {
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER') or hasPermission(#entity, 'ADMINISTRATION')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article updateArticle(EntityId entity, String slug, String title, String body, String summary, Locale locale) {
public Article updateArticle(EntityId entity, String slug, String title, String body, String summary, Locale locale, Boolean isTemplate) {
// return
// articleRepository.findByClassPkAndTargetIdAndSlugAndLang(getClassPk(clazz),
// id, slug, locale.getLanguage());
return updateArticle(entity.getClass(), entity.getId(), slug, title, body, summary, locale);
return updateArticle(entity.getClass(), entity.getId(), slug, title, body, summary, locale, isTemplate);
}
@Override
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, String summary, Locale locale) {
public Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, String summary, Locale locale, Boolean isTemplate) {
Article article = getArticle(clazz, id, slug, locale, false);
if (article == null || !article.getLang().equals(locale.getLanguage())) {
article = new Article();
......@@ -239,7 +238,11 @@ public class ContentServiceImpl implements ContentService {
article.setPostDate(Calendar.getInstance());
article.setSlug(slug);
}
article.setBody(htmlSanitizer.sanitize(body));
if (isTemplate) {
article.setBody(body);
} else {
article.setBody(htmlSanitizer.sanitize(body));
}
article.setSummary(htmlSanitizer.sanitize(summary));
article.setTitle(htmlSanitizer.sanitize(title));
......
......@@ -113,7 +113,8 @@ public class CropServiceImpl implements CropService {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER') or hasPermission(#crop, 'ADMINISTRATION')")
@Transactional(readOnly = false)
public void updateBlurp(Crop crop, String textBody, String summary, Locale locale) {
contentService.updateArticle(crop, "blurp", null, textBody, summary, locale);
//isTemplate = false because it's crop
contentService.updateArticle(crop, "blurp", null, textBody, summary, locale, false);
}
@Override
......
......@@ -24,7 +24,7 @@ import org.genesys2.server.service.EasySMTA;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@Profile({ "dev" })
//@Profile({ "dev" })
@Component
public class EasySMTAMockConnector implements EasySMTA {
private static final Log LOG = LogFactory.getLog(EasySMTAMockConnector.class);
......
......@@ -66,6 +66,7 @@ public class FullTextSearchServiceImpl implements FullTextSearchService, Initial
private static final String ACCESSION_SECTION = "accession";
private static final String CLASSPK_SHORTNAME = "classPK.shortName";
private static final Boolean DEFAULT_ARTICLE_TEMPLATE = false;
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
......@@ -141,12 +142,11 @@ public class FullTextSearchServiceImpl implements FullTextSearchService, Initial
SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withIndices(IndexAliasConstants.INDEXALIAS_FULLTEXT_READ)
.withQuery(
functionScoreQuery(
boolQuery().must(matchQuery(CLASSPK_SHORTNAME, classPK.getShortName())).must(
queryStringQuery(query).defaultOperator(QueryStringQueryBuilder.Operator.AND))).add(
fieldValueFactorFunction("score").factor(1.0f))).withPageable(pageable).build();
.withQuery(functionScoreQuery(boolQuery()
.must(matchQuery(CLASSPK_SHORTNAME, classPK.getShortName()))
.must(queryStringQuery(query).defaultOperator(QueryStringQueryBuilder.Operator.AND)))
.add(fieldValueFactorFunction("score").factor(1.0f)))
.withPageable(pageable).build();
try {
FacetedPage<FullTextDocument> fulltextResults = this.elasticsearchTemplate.queryForPage(searchQuery, FullTextDocument.class);
return toEntities(fulltextResults, pageable);
......@@ -211,9 +211,7 @@ public class FullTextSearchServiceImpl implements FullTextSearchService, Initial
public List<FullTextDocument> getFullTextDocuments(final String className, final Collection<Long> ids) {
final List<BasicModel> models = new ArrayList<>(ids.size());
// TODO Only include global articles, exclude "blurbs"
models.addAll(this.articleRepository.findAll(ids));
models.addAll(this.articleRepository.findAllByTemplate(DEFAULT_ARTICLE_TEMPLATE));
// Posts are only in "en"
models.addAll(this.postRepository.findAll(ids));
models.addAll(this.countryRepository.findAll(ids));
......@@ -289,7 +287,7 @@ public class FullTextSearchServiceImpl implements FullTextSearchService, Initial
/**
* TODO FIXME
*
*
* @param model
* @return
*/
......@@ -304,6 +302,7 @@ public class FullTextSearchServiceImpl implements FullTextSearchService, Initial
// countries
final Article article = (Article) model;
document.setBody(article.getBody());
document.setTemplate(article.isTemplate());
document.setSummary(article.getSummary());
document.setLanguage(article.getLang());
document.setCreatedDate(article.getCreatedDate());
......
......@@ -154,9 +154,7 @@ public class GeoServiceImpl implements GeoService {
/**
* Check if we have a country that has
*
* @param name
* in i18n
* @param countryString
* @param name in i18n
* @return
*/
private Country findCountryByName(String name) {
......@@ -363,7 +361,8 @@ public class GeoServiceImpl implements GeoService {
@Transactional(readOnly = false)
public void updateBlurp(Country country, String blurp, Locale locale) {
// TODO Should we provide summary?
contentService.updateArticle(country, "blurp", null, blurp, null, locale);
//isTemplate = false because it's country.
contentService.updateArticle(country, "blurp", null, blurp, null, locale, false);
}
@Override
......
......@@ -139,7 +139,8 @@ public class InstituteServiceImpl implements InstituteService {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#faoInstitute, 'ADMINISTRATION')")
@Transactional(readOnly = false)
public void updateAbout(FaoInstitute faoInstitute, String body, String summary, Locale locale) {
contentService.updateArticle(faoInstitute, "blurp", null, body, summary, locale);
//isTemplate = false because it's institute.
contentService.updateArticle(faoInstitute, "blurp", null, body, summary, locale, false);
}
@Override
......
......@@ -86,7 +86,8 @@ public class OrganizationServiceImpl implements OrganizationService {
@PreAuthorize("hasRole('ADMINISTRATOR')")
@Transactional(readOnly = false)
public Article updateAbout(Organization organization, String body, String summary, Locale locale) {
return contentService.updateArticle(organization, "blurp", null, body, summary, locale);
//isTemplate = false because it's organization.
return contentService.updateArticle(organization, "blurp", null, body, summary, locale,false);
}
@Override
......
......@@ -85,6 +85,7 @@ public class ProjectServiceImpl implements ProjectService {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER') or hasPermission(#project, 'ADMINISTRATION')")
@Transactional
public void updateBlurp(Project project, String textBody, String summary, Locale locale) {
contentService.updateArticle(project, "blurp", null, textBody, summary, locale);
//isTemplate = false because it's project.
contentService.updateArticle(project, "blurp", null, textBody, summary, locale, false);
}
}
......@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.TreeMap;
import javax.annotation.Resource;
import javax.naming.NoPermissionException;
import org.apache.commons.lang.StringUtils;
import org.genesys.blocks.model.ClassPK;
......@@ -40,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
......@@ -143,8 +145,6 @@ public class ArticleController extends BaseController {
* Fetch all from Transifex and store
*
* @param slug
* @param language
* @param model
* @return
* @throws Exception
*/
......@@ -152,7 +152,7 @@ public class ArticleController extends BaseController {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
public String fetchAllFromTransifex(RedirectAttributes redirectAttrs, @RequestParam("slug") String slug,
@RequestParam(value = "targetId", required = false) Long targetId,
@RequestParam(value = "classPkShortName", required = false) String classPkShortName) throws Exception {
@RequestParam(value = "classPkShortName", required = false) String classPkShortName, @RequestParam(name = "template", defaultValue = "false" ) Boolean template) throws Exception {
if (transifexService == null) {
throw new ResourceNotFoundException("translationService not enabled");
......@@ -211,7 +211,7 @@ public class ArticleController extends BaseController {
if (targetId != null && StringUtils.isNotBlank(classPkShortName)) {
ClassPK classPk = contentService.getClassPk(classPkShortName);
contentService.updateArticle(Class.forName(classPk.getClassname()), targetId, slug, title, body, summary, new Locale(lang));
contentService.updateArticle(Class.forName(classPk.getClassname()), targetId, slug, title, body, summary, new Locale(lang), template);
responses.add("article.translations-updated");
} else if (targetId == null && StringUtils.isBlank(classPkShortName)) {
contentService.updateGlobalArticle(slug, locale, title, body, summary);
......@@ -277,7 +277,7 @@ public class ArticleController extends BaseController {
}
@RequestMapping("{slug:.+}")
public String view(ModelMap model, @PathVariable(value = "slug") String slug) {
public String view(ModelMap model, @PathVariable(value = "slug") String slug) throws NoPermissionException {
_logger.debug("Viewing article " + slug);
final Article article = contentService.getGlobalArticle(slug, getLocale());
......@@ -286,6 +286,10 @@ public class ArticleController extends BaseController {
return "redirect:/content/edit/" + slug + "/" + LocaleContextHolder.getLocale().getLanguage();
}
throw new ResourceNotFoundException();
}else{
if (article.isTemplate() && !hasRole("ADMINISTRATOR") && !hasRole("CONTENTMANAGER")){
throw new AccessDeniedException("You do not have permission to access the resource");
}
}
model.addAttribute("title", article.getTitle());
model.addAttribute("article", article);
......@@ -294,7 +298,7 @@ public class ArticleController extends BaseController {
}
@RequestMapping("{menu}/{url:.+}")
public String viewWithMenu(ModelMap model, @PathVariable(value = "menu") String menuKey, @PathVariable(value = "url") String slug) {
public String viewWithMenu(ModelMap model, @PathVariable(value = "menu") String menuKey, @PathVariable(value = "url") String slug) throws NoPermissionException {
String result = view(model, slug);
if (StringUtils.isNotBlank(menuKey)) {
_logger.debug("Loading menu " + menuKey);
......@@ -346,7 +350,6 @@ public class ArticleController extends BaseController {
*
* @param model
* @param slug
* @param shortName
* @param targetId
* @param language
* @return
......@@ -364,6 +367,7 @@ public class ArticleController extends BaseController {
article.setSlug(slug);
article.setLang(language);
article.setTargetId(targetId);
article.setTemplate(article.isTemplate());
article.setClassPk(contentService.getClassPk(classPkShortName));
}
model.addAttribute("article", article);
......@@ -374,7 +378,8 @@ public class ArticleController extends BaseController {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@RequestMapping(value = "/save-article/{language}", method = { RequestMethod.POST })
public String createNewGlobalArticle(ModelMap model, @RequestParam("slug") String slug, @PathVariable("language") String language,
@RequestParam("title") String title, @RequestParam("body") String body, @RequestParam(value = "summary", required = false) String summary) {
@RequestParam("title") String title, @RequestParam("body") String body, @RequestParam(value = "summary", required = false) String summary,
@RequestParam(name = "template", defaultValue = "false" ) Boolean template) {
Article article = contentService.updateGlobalArticle(slug, new Locale(language), title, body, summary);
return redirectAfterSave(article, language);
......@@ -384,9 +389,9 @@ public class ArticleController extends BaseController {
@RequestMapping(value = "/save-article/{language}", params = { "id" }, method = { RequestMethod.POST })
public String saveExistingGlobalArticle(ModelMap model, @PathVariable("language") String language, @RequestParam("id") long id,
@RequestParam("slug") String slug, @RequestParam("title") String title, @RequestParam("body") String body,
@RequestParam(value = "summary", required = false) String summary) {
@RequestParam(value = "summary", required = false) String summary, @RequestParam(name = "template", defaultValue = "false" ) Boolean template) {
Article article = contentService.updateArticle(id, slug, title, body, summary);
Article article = contentService.updateArticle(id, slug, title, body, summary, template);
return redirectAfterSave(article, language);
}
......@@ -394,10 +399,10 @@ public class ArticleController extends BaseController {
@RequestMapping(value = "/save-article/{language}", params = { "classPkShortName", "targetId" }, method = { RequestMethod.POST })
public String saveNewClassPkArticle(ModelMap model, @PathVariable("language") String language, @RequestParam("classPkShortName") String classPkShortName,
@RequestParam("targetId") long entityId, @RequestParam("slug") String slug, @RequestParam("title") String title, @RequestParam("body") String body,
@RequestParam(value = "summary", required = false) String summary) throws ClassNotFoundException {
@RequestParam(value = "summary", required = false) String summary, @RequestParam(name = "template", defaultValue = "false" ) Boolean template) throws ClassNotFoundException {
ClassPK classPk = contentService.getClassPk(classPkShortName);
Article article = contentService.updateArticle(Class.forName(classPk.getClassname()), entityId, slug, title, body, summary, new Locale(language));
Article article = contentService.updateArticle(Class.forName(classPk.getClassname()), entityId, slug, title, body, summary, new Locale(language), template);
return redirectAfterSave(article, language);
}
......
......@@ -80,8 +80,8 @@ public class GeoRegionController extends BaseController {
if (region == null) {
throw new ResourceNotFoundException();
}
contentService.updateArticle(region, "blurp", null, body, summary, getLocale());
//isTemplate = false because it's region.
contentService.updateArticle(region, "blurp", null, body, summary, getLocale(), false);
return "redirect:/geo/regions/" + code;
}
......
......@@ -882,3 +882,4 @@ welcome.search-genesys=Search Genesys
welcome.networks=Networks
geo.country=Country:
article.is.template=Is template:
......@@ -858,3 +858,4 @@ welcome.search-genesys=البحث في جينيسيس
welcome.networks=الشبكات
geo.country=الدولة:
article.is.template=هو القالب:
......@@ -858,3 +858,4 @@ welcome.search-genesys=Genesys durchsuchen
welcome.networks=Netzwerke
geo.country=Land:
article.is.template=Ist Vorlage:
......@@ -858,3 +858,4 @@ welcome.search-genesys=Buscar en Genesys
welcome.networks=Redes
geo.country=País:
article.is.template=Es plantilla:
......@@ -858,3 +858,4 @@ welcome.search-genesys=جستجو در Genesys
welcome.networks=شبکه‌ها
geo.country=کشور:
article.is.template=الگو است:
......@@ -858,3 +858,4 @@ welcome.search-genesys=Recherche sur Genesys
welcome.networks=Réseaux
geo.country=Pays :
article.is.template=Est-ce que le modèle:
......@@ -858,3 +858,4 @@ welcome.search-genesys=Pesquisar no Genesys
welcome.networks=Redes
geo.country=País:
article.is.template=É modelo:
......@@ -858,3 +858,4 @@ welcome.search-genesys=Поиск по Genesys
welcome.networks=Сети
geo.country=Страна:
article.is.template=Шаблон:
......@@ -858,3 +858,4 @@ welcome.search-genesys=搜索Genesys
welcome.networks=网站
geo.country=国家/地区:
article.is.template=是模板
......@@ -680,3 +680,15 @@ databaseChangeLog:
- column:
name: username
type: varchar(100)
- changeSet:
id: 1506155384557-6
author: a.lugovskiy (generated)
changes:
- addColumn:
tableName: article
columns:
- column:
name: template
type: boolean
defaultValue: false
......@@ -1582,6 +1582,7 @@ form.form-horizontal .form-group {
& > div {
html[dir="ltr"] & {
border-left: 2px solid #E7E5DF;
min-height: 66px;
}
html[dir="rtl"] & {
border-right: 2px solid #E7E5DF;
......
......@@ -5,99 +5,112 @@
<html>
<head>
<title><c:out value="${title}" /></title>
<title><c:out value="${title}"/></title>
</head>
<body class="article-page selected-list">
<h1 class="green-bg">
<spring:message code="article.edit-article" />
</h1>
<%@ include file="transifex-responses.jspf" %>
<c:set var="url" value="/content/save-article/${article.lang}"/>
<c:set var="cancel" value="${article.id ne null ? (article.targetId ne null? '/content/'.concat(article.slug).concat('/').concat(article.classPk.shortName).concat('/').concat(article.targetId).concat('/').concat(article.lang) : '/content/'.concat(article.slug)) : '/content' }"/>
<c:if test="${article.lang eq 'en'}">
<div class="row main-col-header clearfix">
<form method="post" action="<c:url value="/content/transifex"/>">
<input type="hidden" name="slug" class="btn btn-default" value="${article.slug}" />
<input type="hidden" name="targetId" class="btn btn-default" value="${article.targetId}" />
<input type="hidden" name="classPkShortName" class="btn btn-default" value="${article.classPk.shortName}" />
<input type="submit" name="post" class="btn btn-default" value="<spring:message code="article.post-to-transifex" />" />
<input type="submit" name="remove" class="btn btn-default" value="<spring:message code="article.remove-from-transifex" />" />
<input type="submit" name="fetch-all" class="btn btn-default" value="<spring:message code="article.fetch-from-transifex" />" />
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
</div>
<div><c:out value="${resource}" /></div>
</c:if>
<form dir="${article.lang=='fa' || article.lang=='ar' ? 'rtl' : 'ltr'}" role="form" id="editForm" class="form-horizontal" action="<c:url value="${url}" />" method="post">
<c:choose>
<c:when test="${article.id gt 0}">
<input type="hidden" name="id" value="${article.id}" />
</c:when>
<c:when test="${article.targetId ne null}">
<input type="hidden" name="targetId" value="${article.targetId}" />
<input type="hidden" name="classPkShortName" value="${article.classPk.shortName}" />
</c:when>
</c:choose>
<div class="form-group">
<label for="article-slug" class="col-lg-2 col-md-3 col-sm-3 col-xs-12 control-label">
<spring:message code="article.slug" />
</label>
<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12 controls">
<input type="text" id="article-slug" name="slug" value="<c:out value="${article.slug}" />" class="span9 form-control required" />
</div>
</div>
<div class="form-group">
<label for="article-title" class="col-lg-2 col-md-3 col-sm-3 col-xs-12 control-label">
<spring:message code="article.title" />
</label>
<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12 controls">
<input type="text" id="article-title" name="title" value="<c:out value="${article.title}" />" class="span9 form-control required" />
</div>
</div>
<div dir="${article.lang=='fa' || article.lang=='ar' ? 'rtl' : 'ltr'}" class="form-group">
<label for="article-body" class="control-label">
<spring:message code="article.body" />
</label>
<div class="controls">
<textarea id="article-body" name="body" class="span9 required form-control html-editor"><c:out value="${article.body}" escapeXml="false" /></textarea>
</div>
</div>
<div class="form-group">
<label for="article-summary" class="control-label">
<spring:message code="article.summary" />
</label>
<div class="controls">
<textarea id="article-summary" name="summary" class="span9 required form-control html-editor"><c:out value="${article.summary}" escapeXml="false" /></textarea>
</div>
</div>
<div class="form-group transparent">
<input type="submit" value="<spring:message code="save"/>" class="btn btn-primary" />
<a href="<c:url value="${cancel}" />" class="btn btn-default">Cancel</a>
</div>
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
<content tag="javascript">
<h1 class="green-bg">
<spring:message code="article.edit-article"/>
</h1>
<%@ include file="transifex-responses.jspf" %>
<c:set var="url" value="/content/save-article/${article.lang}"/>
<c:set var="cancel"
value="${article.id ne null ? (article.targetId ne null? '/content/'.concat(article.slug).concat('/').concat(article.classPk.shortName).concat('/').concat(article.targetId).concat('/').concat(article.lang).concat('/').concat(article.template) : '/content/'.concat(article.slug)) : '/content' }"/>
<c:if test="${article.lang eq 'en'}">
<div class="row main-col-header clearfix">
<form method="post" action="<c:url value="/content/transifex"/>">
<input type="hidden" name="slug" class="btn btn-default" value="${article.slug}"/>
<input type="hidden" name="targetId" class="btn btn-default" value="${article.targetId}"/>
<input type="hidden" name="classPkShortName" class="btn btn-default" value="${article.classPk.shortName}"/>
<input type="hidden" name="template" class="btn btn-default"
<c:if test="${article.template}">checked</c:if> />
<input type="submit" name="post" class="btn btn-default" value="<spring:message code="article.post-to-transifex" />"/>
<input type="submit" name="remove" class="btn btn-default" value="<spring:message code="article.remove-from-transifex" />"/>
<input type="submit" name="fetch-all" class="btn btn-default" value="<spring:message code="article.fetch-from-transifex" />"/>
<!-- CSRF protection -->
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>
</div>
<div><c:out value="${resource}"/></div>
</c:if>