L'ordre des modules est maintenant toujours le même quand un espace projet est créé :
Le script suivant est à exécuter dans la console d'administration afin de réorganiser les modules des projets existants
var pageDao = serviceManager.lookup(org.ametys.web.repository.page.PageDAO.ROLE);
var query = session.getWorkspace().getQueryManager().createQuery("//element(*, ametys:site)[@ametys:type = 'org.ametys.plugins.workspaces.project.sitetype']/ametys-internal:sitemaps/*", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
var positions = ["index", "calendars", "documents", "forum", "tasks", "wiki"];
while (nodes.hasNext())
{
var node = nodes.next();
var parentId = node.getId();
for (var i=0; i < positions.length; i++)
{
var page = node.getNode(positions[i]);
var pageId = page.getId();
pageDao.movePage("page://" + pageId, "sitemap://" + parentId, i+1);
}
count++;
}
print(count + " sitemaps have been updated");
var pageDao = serviceManager.lookup(org.ametys.web.repository.page.PageDAO.ROLE);
var query = session.getWorkspace().getQueryManager().createQuery("//element(*, ametys:site)[@ametys:type = 'org.ametys.plugins.workspaces.project.sitetype']/ametys-internal:sitemaps/*", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
var positions = ["index", "calendars", "documents", "forum", "tasks", "wiki"];
while (nodes.hasNext())
{
var node = nodes.next();
var parentId = node.getId();
for (var i=0; i < positions.length; i++)
{
var page = node.getNode(positions[i]);
var pageId = page.getId();
pageDao.movePage("page://" + pageId, "sitemap://" + parentId, i+1);
}
count++;
}
print(count + " sitemaps have been updated");
var pageDao = serviceManager.lookup(org.ametys.web.repository.page.PageDAO.ROLE);
var query = session.getWorkspace().getQueryManager().createQuery("//element(*, ametys:site)[@ametys:type = 'org.ametys.plugins.workspaces.project.sitetype']/ametys-internal:sitemaps/*", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
var count = 0;
var positions = ["index", "calendars", "documents", "forum", "tasks", "wiki"];
while (nodes.hasNext())
{
var node = nodes.next();
var parentId = node.getId();
for (var i=0; i < positions.length; i++)
{
var page = node.getNode(positions[i]);
var pageId = page.getId();
pageDao.movePage("page://" + pageId, "sitemap://" + parentId, i+1);
}
count++;
}
print(count + " sitemaps have been updated");