Services (services-default.xml and services-views-default.xml)


A template's service configuration file defines what services and service views each zone can and cannot contain.

By default, it is possible to insert all available services in all zones with all views. However, it's not always advisable to be able to do everything in one place, especially if you want to limit your graphic charter.

There are two ways of filtering services in zones: by inclusion or exclusion.

the "services-default.xml" file

This file can be located in several places: from the highest priority to the lowest:

In cms/skins/[skinName]/template/[templateName]/conf/services-default.xml for a given template

<?xml version="1.0" encoding="UTF-8"?>
<services>
   <zones>
       <zone id="default" mode="include">
           <service id="org.ametys.plugins.calendar.Calendar"/>
       </zone>
       <zone id="sidebar" mode="include"></zone>
   </zones>
</services>

This example file only authorizes the insertion of the calendar service in the default zone and no service in the sidebar zone.

But the file can also be valid for all template zones, to authorize only services in all zones.

<?xml version="1.0" encoding="UTF-8"?>
<services>
 <template mode="include">
     <service id="org.ametys.plugins.calendar.Calendar"/>
 </template>
</services>

Les balises <template> et <zones> sont cumulables. Si une zone n'est pas présente dans la balise <zones> la valeur par défaut sera dans <template>.

In cms/skins/[skinName]/conf/services-default.xml for an entire graphic charter:

<?xml version="1.0" encoding="UTF-8"?>
<services mode="include">
   <service id="org.ametys.plugins.calendar.Calendar"/>
</services>

In cms/WEB-INF/param/services-default.xml for the entire application:

<?xml version="1.0" encoding="UTF-8"?>
<services mode="include">
   <service id="org.ametys.plugins.calendar.Calendar"/>
</services>

the file "services-views-default.xml"

FromAmetys 4.8

This file is used to define the views that can be used for each type of service. By default, all views are usable.

In cms/skins/[skinName]/template/[templateName]/conf/services-views-default.xml for a given template:

<?xml version="1.0" encoding="UTF-8"?>
<services>
   <zones>
     <zone id="default">
      <service id="org.ametys.web.service.ExplorerFolderService">
           <views mode="exclude">
          <view name="files_medium_3.3"/>
          <view name="files_small_3.3"/>
           </views>
        </service>
     </zone>
   </zones>
</services>

This example file no longer authorizes the "small icons" and "medium icons" views of the "Directory contents" service when used in the "default" zone.

Please note that this file does not limit authorized services, but rather views.
In this example, there is no indication that the "Directory contents" service is authorized in the "default" zone. See the top of this page to limit/authorize a service.

But the file can also be valid for all template zones to limit views in all zones.

<?xml version="1.0" encoding="UTF-8"?>
<services>
 <template>
    <service id="org.ametys.web.service.ExplorerFolderService">
           <views mode="exclude">
          <view name="files_medium_3.3"/>
          <view name="files_small_3.3"/>
           </views>
        </service>
 </template>
</services>

Les balises <template> et <zones> sont cumulables. Si une zone n'est pas présente dans la balise <zones> la valeur par défaut sera dans <template>.

In cms/skins/[skinName]/conf/services-views-default.xml for an entire graphic charter:

<?xml version="1.0" encoding="UTF-8"?>
<services>
   <service id="org.ametys.web.service.ExplorerFolderService">
           <views mode="exclude">
          <view name="files_medium_3.3"/>
          <view name="files_small_3.3"/>
           </views>
        </service>
</services>

In cms/WEB-INF/param/services-views-default.xml for the entire application:

<?xml version="1.0" encoding="UTF-8"?>
<services>
   <service id="org.ametys.web.service.ExplorerFolderService">
           <views mode="exclude">
          <view name="files_medium_3.3"/>
          <view name="files_small_3.3"/>
           </views>
        </service>
</services>

The view restriction does not apply to services already inserted, even if they are moved from one zone to another (by drag & drop, for example).

The "-default" in file names indicates the type of site created. Default is the type of all normal sites.

 

Back to top