Integration manual


Installation

  • Stop the server
  • Download jars from plugin and add them (ametys-plugin-glossary-1.2.0.jar and ametys- plugin-glossary-resources-1.2.0.jar) to your application's WEB-INF/lib directory. Ametys

  • Add a button to open the glossary tool in the WEB-INF/params/cms-ribbon-default.xml. The button identifier is org.ametys.plugins.glossary.Glossary.
    We recommend adding it to the Home tab, in the "Tools" group.

  • In this same file, to be able to add a definition in the content editor, also add the button org.ametys.glossary.editor.AddDefinition in the org.ametys.cms.content.EditionTab

  • In the same file, import the ribbon file specific to the glossary plugin:glossary://cms-ribbon.xml
<tabs>
	<tab label="RIBBON_TABS_TAB_HOME_LABEL">
    	<groups>
			[...]
			<group label="RIBBON_TABS_TAB_HOME_GROUPS_GROUP_TOOL_LABEL" icon="">
				<large>
					[...]
					<control id="org.ametys.plugins.glossary.Glossary"/>
				</large>
				<medium>
					[...]
					<control id="org.ametys.plugins.glossary.Glossary"/>
				</medium>
				<small/>
    		</group>
			[...]
		</groups>
	<tab>
	[...]
	<tab label="plugin.cms:RIBBON_TABS_TAB_CONTENT_EDIT_LABEL" id="org.ametys.cms.content.EditionTab" contextualColor="1" contextualGroup="Z" contextualLabel="plugin.cms:RIBBON_TABS_TAB_CONTENT_EDIT_LABEL">
		<groups>
			[...]
			<group label="plugin.cms:RIBBON_TABS_TAB_CONTENT_EDIT_GROUPS_GROUP_CHARACTER_LABEL" icon="">
				<large>...</large>				
				<medium>
					<layout align="middle" size="small">
						<toolbar>
							[...]
							<control id="org.ametys.glossary.editor.AddDefinition"/>
						</toolbar>
					</layout>
				</medium>
				<small>...</small>
			</group>
		</groups
	</tab>
	 <import>plugin:glossary://cms-ribbon.xml</import>
</tabs>

Please note! If the group contains a description , and , the button must be added to the 3.

 

  • Restart the server

Data migration 1.4 => 1.5

function getUniqueName (rootNode, defaultName)
{
   var uniqueName = defaultName;
   var index = 2;
   while (rootNode.hasNode(uniqueName))
   {
      uniqueName = defaultName + "-" + index;
      index++;
   }   
   return uniqueName;
}

var qm = session.getWorkspace().getQueryManager();
var query = qm.createQuery("//element(*, ametys:site)/ametys-internal:plugins/glossary/*/ametys:wordDefinitions/element(ametys:definition, ametys:wordDefinition)", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
  
var count = 0;
while (nodes.hasNext())
{
  var node = nodes.next();
   
  var word = node.getProperty('ametys-internal:word').getString();
  var defaultName = org.ametys.cms.FilterNameHelper.filterName(word)
  var newName = getUniqueName (node.getParent(), defaultName);
    
  session.move(node.getPath(), node.getParent().getPath() + '/' + newName);
  count++;
}
  
if (count > 0)
{
  session.save();
}
println(count + " word have been renamed");
Back to top

Glossary