cancel
Showing results for 
Search instead for 
Did you mean: 

Site evaluator for module extensions

douglascrp
World-Class Innovator
World-Class Innovator
Hey.

Is there any change I can make "site.module.evaluator" work for datalist datagrid configuration?

I know it's possible to use module extensions to change the document library configuration dinamically, but the same idea doesn't work for datalist configuration.

What I tried to do so far is something like

<code language="xml"><module>
  <id>Configuracao Filtro Historico Afastamentos SiteX</id>
  <auto-deploy>true</auto-deploy>
  <evaluator type="site.module.evaluator">
      <params>
          <sites>siteX</sites>
          <sitePresets>.*</sitePresets>
      </params>
  </evaluator>
      <configurations>
          <config evaluator="model-type" condition="xxx:historicoAfastamentoList" replace="true">
              <forms>
        <form>
          <field-visibility>
            <show id="xxx:estabelecimento" />
            <show id="xxx:localAtendimento" />
            <show id="xxx:nomeCliente" />
          </field-visibility>
          <create-form
            template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />
        </form>
        <form id="datagrid">
          <field-visibility>
            <show id="xxx:estabelecimento" />
            <show id="xxx:localAtendimento" />
            <show id="xxx:nomeCliente" />
          </field-visibility>
        </form>
      </forms>
    </config>
  </configurations>
</module></code>

The configuration for other sites different from SiteX does not include the attribute xxx:nomeCliente

So my requirement is to show the attribute xxx:nomeCliente only for siteX.

When I apply this module, it seems the evaluator completely ignores the site name.
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello douglascrp,

for module evaluators you need to keep in mind that the request URL of an operation needs to somehow include the site short name in a way the site module evaluator can process and check your filter settings against. For instances, when you call the form web script to render a form, the URL of that web script does not include the identifier for the site and thus the site module evaluator has no idea what site is the current context.
Furthermore, since the site module evaluator does not know which site is the current context, it assumes "global context" and you have not set the "applyForNonSites" parameter to "false" - by default it is evaluated as "true" which means that your configuration is used every time the site context can not be determined.

TL;DR - The evaluator behaves correctly in your case. You have a small configuration error to restrict the evaluator only to sites. When loading forms there is never any info about the site context so you can't configure forms specific for a site.

The only chance you'd have is when you add your own, site-aware form web script and change all calls to the out-of-the-box form web script to use your site-aware form web script.

Regards
Axel

douglascrp
World-Class Innovator
World-Class Innovator
Thank you.