mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Rough cut: blogSpace custom view webscript
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7529 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<webscript>
|
||||
<shortname>Blog Custom View</shortname>
|
||||
<description>Collaboration Blog Space view</description>
|
||||
<url>/collaboration/blogSpace?nodeRef={noderef}</url>
|
||||
<format default="html"/>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1,74 @@
|
||||
<div class="blogTitle">Blog Status</div>
|
||||
|
||||
<div id="blogContainer">
|
||||
<div class="blogStatusTitle">Pending Articles</div>
|
||||
<div class="blogPending">
|
||||
<#list blogSpace.pending as p>
|
||||
<div class="blogPost">
|
||||
<div class="blogPostName">
|
||||
${p.name}, ${p.properties["cm:title"]}
|
||||
</div>
|
||||
<div class="blogPostActions">
|
||||
<span class="blogPostAction"><img src="${url.context}/images/icons/blog_post.png"><input type="button" href="${scripturl("?nodeRef=" + p.parent.nodeRef + "&n=" + p.nodeRef + "&a=p")}" value="Post" /></span>
|
||||
</div>
|
||||
</div>
|
||||
</#list>
|
||||
</div>
|
||||
|
||||
<div class="blogStatusTitle">Published Articles</div>
|
||||
<div class="blogPublished">
|
||||
<#list blogSpace.published as p>
|
||||
<div class="blogPost">
|
||||
<div class="blogPostName">
|
||||
<a href="${p.properties["blg:link"]}" target="_blank">${p.properties["cm:title"]} (${p.name}) Published=${p.properties["blg:published"]?string}</a>
|
||||
</div>
|
||||
<div class="blogPostActions">
|
||||
<span class="blogPostAction"><img src="${url.context}/images/icons/blog_update.png"><input type="button" href="${scripturl("?nodeRef=" + p.parent.nodeRef + "&n=" + p.nodeRef + "&a=u")}" value="Update" /></span>
|
||||
<span class="blogPostAction"><img src="${url.context}/images/icons/blog_remove.png"><input type="button" href="${scripturl("?nodeRef=" + p.parent.nodeRef + "&n=" + p.nodeRef + "&a=r")}" value="Remove" /></span>
|
||||
</div>
|
||||
</div>
|
||||
</#list>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.blogTitle
|
||||
{
|
||||
font-family: "Trebuchet MS", Verdana, Helvetica, sans-serif;
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
margin: -8px 0px 4px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.blogStatusTitle
|
||||
{
|
||||
padding: 4px 0px 0px 0px;
|
||||
font-weight: bold;
|
||||
clear: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.blogPending
|
||||
{
|
||||
clear: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.blogPublished
|
||||
{
|
||||
clear: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.blogPost
|
||||
{
|
||||
clear: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#blogContainer
|
||||
{
|
||||
clear: left;
|
||||
}
|
||||
</style>
|
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* blogSpace
|
||||
*
|
||||
* Inputs:
|
||||
* mandatory: nodeRef = parent space nodeRef
|
||||
* optional: n = nodeId for document to action against
|
||||
* a = action
|
||||
* "p" = publish
|
||||
* "u" = update
|
||||
* "r" = remove
|
||||
*
|
||||
* Outputs: blogSpace - object containing published and pending node arrays
|
||||
*/
|
||||
parseArgs(args["n"], args["a"]);
|
||||
model.blogSpace = main(args["nodeRef"]);
|
||||
|
||||
function parseArgs(nodeId, action)
|
||||
{
|
||||
if ((nodeId != null) && (action != null))
|
||||
{
|
||||
var blog = actions.create("blog-post");
|
||||
|
||||
var node = search.findNode(nodeId);
|
||||
if (node != null)
|
||||
{
|
||||
var blogAction = "";
|
||||
var isPublished = false;
|
||||
if ((node.hasAspect("blg:blogPost")) && (node.properties["blg:published"] == true))
|
||||
{
|
||||
isPublished = true;
|
||||
}
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case "p":
|
||||
blogAction = (isPublished ? "" : "post");
|
||||
break;
|
||||
case "u":
|
||||
blogAction = (isPublished ? "update" : "");
|
||||
break;
|
||||
case "r":
|
||||
blogAction = (isPublished ? "remove" : "");
|
||||
break;
|
||||
}
|
||||
|
||||
if (blogAction != "")
|
||||
{
|
||||
blog.parameters.action = blogAction;
|
||||
blog.execute(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function main(nodeRef)
|
||||
{
|
||||
var published = new Array(),
|
||||
pending = new Array();
|
||||
|
||||
var space = search.findNode(nodeRef);
|
||||
|
||||
if (space != null)
|
||||
{
|
||||
for each(node in space.children)
|
||||
{
|
||||
if ((node.hasAspect("blg:blogPost")) && (node.properties["blg:published"] == true))
|
||||
{
|
||||
published.push(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
pending.push(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var blogSpace =
|
||||
{
|
||||
"published": published,
|
||||
"pending": pending
|
||||
};
|
||||
return blogSpace;
|
||||
}
|
Reference in New Issue
Block a user