03-22-2011 11:12 AM
function isAvalaibleDashlet(dashletName){
/*this array contains the script name of dashlet we want to see*/
var enabledDashlet=["alfresco-network","cmisfeed","my-documents","my-profile","webview"];
/*————————————————————————————————————————————*/
for(var j = 0; j < enabledDashlet.length; j++){
if(enabledDashlet[j] == dashletName){
return true;
}
}
return false;
}
// Transform the webscripts to easy-to-access dashlet items for the template
var availableDashlets = [];
for (var i = 0; i < webscripts.length; i++)
{
var webscript = webscripts[i];
var uris = webscript.getURIs();
var scriptId, scriptName, shortNameId, descriptionId;
if (uris !== null && uris.length > 0 && webscript.shortName !== null)
{
// Use the webscript ID to generate a message bundle ID
//
// This should really be retrieved from an explicit value but the web scripts framework does not provide
// a means for storing message bundle IDs, and the web framework is not being used here.
scriptId = webscript.id;
scriptName = scriptId.substring(scriptId.lastIndexOf("/") + 1, scriptId.lastIndexOf("."));
logger.log("****************************** "+scriptName);
shortNameId = "dashlet." + scriptName + ".shortName";
descriptionId = "dashlet." + scriptName + ".description";
if(isAvalaibleDashlet(scriptName)){
availableDashlets[i] =
{
url: uris[0],
// msg.get(key) returns key if no matching value
shortName: (msg.get(shortNameId) != shortNameId ? msg.get(shortNameId) : webscript.shortName),
description: (msg.get(descriptionId) != descriptionId ? msg.get(descriptionId) : webscript.description)
};
}
}
// else skip this webscript since it lacks uri or shortName
}
logger.log("****************************** END FOR");
[…]
// Transform the webscripts to easy-to-access dashlet items for the template
var columns = [[], [], [], []];
for (i = 0; i < components.length; i++)
{
var comp = components[i];
var regionId = comp.properties["region-id"],
theUrl = comp.properties.url;
if (regionId !== null && theUrl !== null)
{
// Create dashlet
var shortName, description, d;
for (var j = 0; j < availableDashlets.length; j++)
{
d = availableDashlets[j];
if(d !== undefined){
if (d.url == theUrl)
{
shortName = d.shortName;
description = d.description;
break;
}
}
}
var dashlet =
{
url: theUrl,
shortName: shortName,
description: description,
originalRegionId: regionId
};
// Place it in correct column and in a temporary row literal
if (regionId.match("^component-\\d+-\\d+$"))
{
var column = parseInt(regionId.substring(regionId.indexOf("-") + 1, regionId.lastIndexOf("-"))),
row = parseInt(regionId.substring(regionId.lastIndexOf("-") + 1));
columns[column-1][row-1] = dashlet;
}
}
// else skip this component since it lacks regionId or shortName
}
[…]
05-03-2011 10:53 AM
08-07-2012 07:02 PM
function isAvalaibleDashlet(dashletName){
/*this array contains the script name of dashlet we want to see*/
var enabledDashlet=["alfresco-network","cmisfeed","my-documents","my-profile","webview"];
/*————————————————————————————————————————————*/
// My change - Allow admins to add any dashlet
if (user.isAdmin) return true;
for(var j = 0; j < enabledDashlet.length; j++){
if(enabledDashlet[j] == dashletName){
return true;
}
}
return false;
}
08-08-2012 02:34 AM
08-08-2012 08:07 AM
!!~enabledDashlet.indexOf(dashletName)
cheers, jan
08-08-2012 08:24 AM
08-08-2012 08:29 AM
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.