mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Add/Manage/Delete record references. Also updates to document picker to show correct icons and filter out specific types. TODO: documentpicker should probably filter out current record and already referenced records to avoid cyclic and duplicate errors when adding new references
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16059 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
var argsFilterType = args['filterType'],
|
var argsFilterType = args['filterType'],
|
||||||
argsSelectableType = args['selectableType']
|
argsSelectableType = args['selectableType']
|
||||||
parent = null,
|
parent = null,
|
||||||
rootNode = companyhome,
|
rootNode = companyhome,
|
||||||
results = [],
|
results = [],
|
||||||
categoryResults = null,
|
categoryResults = null,
|
||||||
resultObj = null;
|
resultObj = null;
|
||||||
|
|
||||||
if (logger.isLoggingEnabled())
|
if (logger.isLoggingEnabled())
|
||||||
{
|
{
|
||||||
logger.log("children type = " + url.templateArgs.type);
|
logger.log("children type = " + url.templateArgs.type);
|
||||||
logger.log("argsSelectableType = " + argsSelectableType);
|
logger.log("argsSelectableType = " + argsSelectableType);
|
||||||
logger.log("argsFilterType = " + argsFilterType);
|
logger.log("argsFilterType = " + argsFilterType);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -43,41 +43,58 @@ function main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var query = "+PARENT:\"" + parent.nodeRef + "\"";
|
var query = "+PARENT:\"" + parent.nodeRef + "\"";
|
||||||
if (argsFilterType != null)
|
if (argsFilterType != null)
|
||||||
{
|
{
|
||||||
query += " +TYPE:\"" + argsFilterType + "\"";
|
//map short name to long name
|
||||||
}
|
var types = {
|
||||||
|
'rma:dispositionSchedule': '{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionSchedule',
|
||||||
if (logger.isLoggingEnabled())
|
'rma:dispositionActionDefinition': '{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionActionDefinition',
|
||||||
logger.log("query = " + query);
|
'rma:dispositionAction': '{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionAction',
|
||||||
|
'rma:hold':'{http://www.alfresco.org/model/recordsmanagement/1.0}hold',
|
||||||
|
'rma:transfer':'{http://www.alfresco.org/model/recordsmanagement/1.0}transfer'
|
||||||
|
};
|
||||||
|
|
||||||
|
var filterTypes = argsFilterType.split(',');
|
||||||
|
for (var i=0,len=filterTypes.length; i<len; i++)
|
||||||
|
{
|
||||||
|
var identifier = filterTypes[i];
|
||||||
|
if (types[identifier])
|
||||||
|
{
|
||||||
|
query += " -TYPE:\"" + types[identifier] + "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logger.isLoggingEnabled())
|
||||||
|
logger.log("query = " + query);
|
||||||
|
|
||||||
var searchResults = search.luceneSearch(query, "@{http://www.alfresco.org/model/content/1.0}name", true);
|
var searchResults = search.luceneSearch(query, "@{http://www.alfresco.org/model/content/1.0}name", true);
|
||||||
|
|
||||||
// Ensure folders and folderlinks appear at the top of the list
|
// Ensure folders and folderlinks appear at the top of the list
|
||||||
var containerResults = new Array();
|
var containerResults = new Array();
|
||||||
var contentResults = new Array();
|
var contentResults = new Array();
|
||||||
for each(var result in searchResults)
|
for each(var result in searchResults)
|
||||||
{
|
{
|
||||||
if (result.isContainer || result.type == "{http://www.alfresco.org/model/application/1.0}folderlink")
|
if (result.isContainer || result.type == "{http://www.alfresco.org/model/application/1.0}folderlink")
|
||||||
{
|
{
|
||||||
// wrap result and determine if it is selectable in the UI
|
// wrap result and determine if it is selectable in the UI
|
||||||
resultObj =
|
resultObj =
|
||||||
{
|
{
|
||||||
item: result
|
item: result
|
||||||
};
|
};
|
||||||
resultObj.selectable = isItemSelectable(result, argsSelectableType);
|
resultObj.selectable = isItemSelectable(result, argsSelectableType);
|
||||||
|
|
||||||
containerResults.push(resultObj);
|
containerResults.push(resultObj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// wrap result and determine if it is selectable in the UI
|
// wrap result and determine if it is selectable in the UI
|
||||||
resultObj =
|
resultObj =
|
||||||
{
|
{
|
||||||
item: result
|
item: result
|
||||||
};
|
};
|
||||||
resultObj.selectable = isItemSelectable(result, argsSelectableType);
|
resultObj.selectable = isItemSelectable(result, argsSelectableType);
|
||||||
|
|
||||||
contentResults.push(resultObj);
|
contentResults.push(resultObj);
|
||||||
}
|
}
|
||||||
@@ -99,19 +116,19 @@ function main()
|
|||||||
{
|
{
|
||||||
parent = search.findNode(nodeRef);
|
parent = search.findNode(nodeRef);
|
||||||
categoryResults = parent.children;
|
categoryResults = parent.children;
|
||||||
}
|
|
||||||
|
|
||||||
// make each result an object and indicate it is selectable in the UI
|
|
||||||
for each(var result in categoryResults)
|
|
||||||
{
|
|
||||||
results.push(
|
|
||||||
{
|
|
||||||
item: result,
|
|
||||||
selectable: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// make each result an object and indicate it is selectable in the UI
|
||||||
|
for each(var result in categoryResults)
|
||||||
|
{
|
||||||
|
results.push(
|
||||||
|
{
|
||||||
|
item: result,
|
||||||
|
selectable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (logger.isLoggingEnabled())
|
if (logger.isLoggingEnabled())
|
||||||
logger.log("Found " + results.length + " results");
|
logger.log("Found " + results.length + " results");
|
||||||
}
|
}
|
||||||
@@ -130,18 +147,18 @@ function main()
|
|||||||
model.parent = parent;
|
model.parent = parent;
|
||||||
model.rootNode = rootNode;
|
model.rootNode = rootNode;
|
||||||
model.results = results;
|
model.results = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isItemSelectable(node, selectableType)
|
function isItemSelectable(node, selectableType)
|
||||||
{
|
{
|
||||||
var selectable = true;
|
var selectable = true;
|
||||||
|
|
||||||
if (selectableType !== null && selectableType !== "")
|
if (selectableType !== null && selectableType !== "")
|
||||||
{
|
{
|
||||||
selectable = node.isSubType(selectableType);
|
selectable = node.isSubType(selectableType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectable;
|
return selectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
Reference in New Issue
Block a user