Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookup content root nodes when using MNTP in media and members section #10049

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,34 @@ function contentPickerController($scope, $q, $routeParams, $location, entityReso
dialogOptions.startNodeId = -1;
}
else if ($scope.model.config.startNode.query) {
//if we have a query for the startnode, we will use that.
var rootId = $routeParams.id;
entityResource.getByQuery($scope.model.config.startNode.query, rootId, "Document").then(function (ent) {
dialogOptions.startNodeId = ($scope.model.config.idType === "udi" ? ent.udi : ent.id).toString();
});

if ($routeParams.section === "content") {
var nodeId = $routeParams.id;
//if we have a query for the startnode, we will use that.
entityResource.getByQuery($scope.model.config.startNode.query, nodeId, "Document").then(function (ent) {
// ensure an entity is returned
if (ent) {
dialogOptions.startNodeId = ($scope.model.config.idType === "udi" ? ent.udi : ent.id).toString();
}
});
}
else {
// find content root nodes
entityResource.getChildren(-1, "Document").then(function (data) {

// if only a single content node at root we can use that in XPath query
if (data && data.length === 1) {
var nodeId = data[0].id;
entityResource.getByQuery($scope.model.config.startNode.query, nodeId, "Document").then(function (ent) {
// ensure an entity is returned
if (ent) {
dialogOptions.startNodeId = ($scope.model.config.idType === "udi" ? ent.udi : ent.id).toString();
}
});
}

});
}
}
else {
dialogOptions.startNodeId = $scope.model.config.startNode.id;
Expand Down