Changing the order of modules


Changing the order of modules

The order of modules is now always the same when a project space is created:

  1. index
  2. calendars
  3. documents
  4. forum
  5. tasks
  6. wiki

To reorganize the modules of existing projects, run the following script from the administration console

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"); 
Back to top

v1