06-02-2014 02:16 PM
06-03-2014 07:57 PM
<!– Publish document –>
<action id="document-publish" type="javascript" label="actions.document.publish">
<param name="function">onActionPublish</param>
<evaluator negate="true">evaluator.doclib.action.isLocked</evaluator>
</action>
<param name="function">onActionPublish</param>
/**
* Social Publishing
*
* @method onActionPublish
* @param record {object} Object literal representing the file or folder to be actioned
*/
onActionPublish: function dlA_onActionPublish(record)
{
// Call the Social Publishing Module
Alfresco.module.getSocialPublishingInstance().show(
{
nodeRef: record.nodeRef,
filename: record.fileName
});
},
06-05-2014 04:24 AM
06-05-2014 07:51 PM
<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">
function getDocumentChannels(nodeRef)
{
var result = remote.call("/api/publishing/" + nodeRef.replace("://", "/") + "/channels");
if (result.status != 200)
{
AlfrescoUtil.error(result.status, 'Could not load publishing channels');
}
return eval('(' + result + ')').data;
}
function main()
{
AlfrescoUtil.param('nodeRef');
channels = getDocumentChannels(model.nodeRef);
model.urlLength = channels.urlLength;
model.publishChannels = channels.publishChannels
model.statusUpdateChannels = channels.statusUpdateChannels
}
main();
06-06-2014 04:25 PM
final JSONObject node = (JSONObject) actionObject.get("node");// get node
final String nodeRef = (String) node.get("nodeRef");// get noderef of content
final RequestContext rc = ThreadLocalRequestContext.getRequestContext();// get request context
final String userId = rc.getUserId();
final Connector conn = rc.getServiceRegistry().getConnectorService().getConnector("alfresco", userId, ServletUtil.getSession());// get connector
// custom repository webscript which checks if noderef has given association or not
//final String url = "/node/association/" + contentRef.replace("://", "/") + "/" + associations.get(0).replace(":", "_");
final String url = "/api/publishing/" + nodeRef.replace("://", "/") + "/channels";
final Response response = conn.call(url);// get response
if (Status.STATUS_OK == response.getStatus().getCode())// make sure we are getting valid response
{
final org.json.JSONObject scriptResponse = new org.json.JSONObject(response.getResponse());
org.json.JSONObject channelData = (org.json.JSONObject) scriptResponse.get("data");
org.json.JSONArray publishChannels = (org.json.JSONArray) channelData.get("publishChannels");
for (int i=0; publishChannels.length()>i; i++)
{
org.json.JSONObject channel = (org.json.JSONObject)publishChannels.getJSONObject(i);
org.json.JSONObject channelType = channel.getJSONObject("channelType");
String id = channelType.getString("id");
if (id.equalsIgnoreCase("everfresco"))
result = true;
break;
}
return result;
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.