only show publishing actions if external blog configuration available

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10610 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Michael Ru
2008-09-01 13:21:40 +00:00
parent a75f183c55
commit 0c47dc5d11
20 changed files with 69 additions and 67 deletions

View File

@@ -1,3 +1,5 @@
<#import "../generic-paged-results.lib.ftl" as gen/>
<#-- Renders a person object. -->
<#macro renderPerson person fieldName>
<#escape x as jsonUtils.encodeJSONString(x)>
@@ -76,3 +78,28 @@
}
</#escape>
</#macro>
<#macro renderPostList>
{
"metadata" : {
"blogPermissions" : {
"create" : ${blog.hasPermission("CreateChildren")?string},
"edit" : ${blog.hasPermission("Write")?string},
"delete" : ${blog.hasPermission("Delete")?string}
},
"externalBlogConfig" : ${externalBlogConfig?string}
},
<@gen.pagedResults data=data ; item>
<@blogpostJSON item=item />
</@gen.pagedResults>
}
</#macro>
<#macro renderPost>
{
"metadata" : {
"externalBlogConfig" : ${externalBlogConfig?string}
},
"item" : <@blogpostJSON item=item />
}
</#macro>

View File

@@ -103,3 +103,27 @@ function getBlogPostData(node)
return data;
}
/**
* Checks whether a blog configuration is available
* This should at some point also check whether the configuration is enabled.
*
* @param node the node that should be checked. Will check all parents if
* the node itself doesn't contain a configuration.
* @return {boolean} whether a configuration could be found.
*/
function hasExternalBlogConfiguration(node)
{
if (node == null)
{
return false;
}
else if (node.hasAspect("blg:blogDetails"))
{
return true;
}
else
{
return hasExternalBlogConfiguration(node.parent)
}
}

View File

@@ -82,6 +82,7 @@ function main()
// get the updated data for the blog post
model.item = getBlogPostData(node);
model.externalBlogConfig = hasExternalBlogConfiguration(node);
}
main();

View File

@@ -1,4 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
{
"item" : <@blogpostLib.blogpostJSON item=item />
}
<@blogpostLib.renderPost />

View File

@@ -12,6 +12,7 @@ function main()
// assign data
model.item = getBlogPostData(node);
model.externalBlogConfig = hasExternalBlogConfiguration(node);
// fetch the contentLength param
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;

View File

@@ -1,4 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
{
"item" : <@blogpostLib.blogpostJSON item=item />
}
<@blogpostLib.renderPost />

View File

@@ -75,6 +75,7 @@ function main()
updateBlogPost(node);
model.item = getBlogPostData(node);
model.externalBlogConfig = hasExternalBlogConfiguration(node);
if (json.has("site") && json.has("container") && json.has("browsePostUrl") && ! model.item.isDraft)
{

View File

@@ -1,4 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
{
"item" : <@blogpostLib.blogpostJSON item=item />
}
<@blogpostLib.renderPost />

View File

@@ -44,6 +44,7 @@ function main()
// assign the blog node
model.blog = node;
model.externalBlogConfig = hasExternalBlogConfiguration(node);
}
main();

View File

@@ -1,12 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
<#import "../../generic-paged-results.lib.ftl" as gen/>
{
"blogPermissions" : {
"create" : ${blog.hasPermission("CreateChildren")?string},
"edit" : ${blog.hasPermission("Write")?string},
"delete" : ${blog.hasPermission("Delete")?string}
},
<@gen.pagedResults data=data ; item>
<@blogpostLib.blogpostJSON item=item />
</@gen.pagedResults>
}
<@blogpostLib.renderPostList />

View File

@@ -45,6 +45,7 @@ function main()
// assign the blog node
model.blog = node;
model.externalBlogConfig = hasExternalBlogConfiguration(node);
}
main();

View File

@@ -1,12 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
<#import "../../generic-paged-results.lib.ftl" as gen/>
{
"blogPermissions" : {
"create" : ${blog.hasPermission("CreateChildren")?string},
"edit" : ${blog.hasPermission("Write")?string},
"delete" : ${blog.hasPermission("Delete")?string}
},
<@gen.pagedResults data=data ; item>
<@blogpostLib.blogpostJSON item=item />
</@gen.pagedResults>
}
<@blogpostLib.renderPostList />

View File

@@ -47,6 +47,7 @@ function main()
// assign the blog node
model.blog = node;
model.externalBlogConfig = hasExternalBlogConfiguration(node);
}
main();

View File

@@ -1,12 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
<#import "../../generic-paged-results.lib.ftl" as gen/>
{
"blogPermissions" : {
"create" : ${blog.hasPermission("CreateChildren")?string},
"edit" : ${blog.hasPermission("Write")?string},
"delete" : ${blog.hasPermission("Delete")?string}
},
<@gen.pagedResults data=data ; item>
<@blogpostLib.blogpostJSON item=item />
</@gen.pagedResults>
}
<@blogpostLib.renderPostList />

View File

@@ -43,6 +43,7 @@ function main()
// assign the blog node
model.blog = node;
model.externalBlogConfig = hasExternalBlogConfiguration(node);
}
main();

View File

@@ -1,12 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
<#import "../../generic-paged-results.lib.ftl" as gen/>
{
"blogPermissions" : {
"create" : ${blog.hasPermission("CreateChildren")?string},
"edit" : ${blog.hasPermission("Write")?string},
"delete" : ${blog.hasPermission("Delete")?string}
},
<@gen.pagedResults data=data ; item>
<@blogpostLib.blogpostJSON item=item />
</@gen.pagedResults>
}
<@blogpostLib.renderPostList />

View File

@@ -83,6 +83,7 @@ function main()
// assign the blog node
model.blog = node;
model.externalBlogConfig = hasExternalBlogConfiguration(node);
}
main();

View File

@@ -1,12 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
<#import "../../generic-paged-results.lib.ftl" as gen/>
{
"blogPermissions" : {
"create" : ${blog.hasPermission("CreateChildren")?string},
"edit" : ${blog.hasPermission("Write")?string},
"delete" : ${blog.hasPermission("Delete")?string}
},
<@gen.pagedResults data=data ; item>
<@blogpostLib.blogpostJSON item=item />
</@gen.pagedResults>
}
<@blogpostLib.renderPostList />

View File

@@ -85,6 +85,7 @@ function main()
var post = createBlogPost(node);
model.item = getBlogPostData(post);
model.externalBlogConfig = hasExternalBlogConfiguration(node);
if (json.has("site") && json.has("container") && json.has("browsePostUrl") && ! model.item.isDraft)
{

View File

@@ -1,4 +1,2 @@
<#import "../blogpost.lib.ftl" as blogpostLib/>
{
"item" : <@blogpostLib.blogpostJSON item=item />
}
<@blogpostLib.renderPost />