Graphics migration


    • Content proposal form

      This page should only be used if script asks you to manually migrate skin.20220127.UGC.form

      If script asks you to skip this migration, it's because you've overloaded one or more core templates to render the content proposal form (e.g. to publish a classified ad).

      Input XML has been modified and the XSL helper containing templates for rendering fields, buttons and forms has been rewritten.

      Before performing the graphic migration, run the following script to check whether the "Content proposal" service is really in use:

      let count = 0;
      Repository.query("//element(*, ametys:zoneItem)[@ametys-internal:service='org.ametys.plugin.ugc.service.UGC']").forEach(function(zoneItem) {
          count++;
      Ametys.console.log(`Found in site '${zoneItem.getZone().getPage().getSiteName()}' : ${zoneItem.getZone().getPage().getSitemapName()}/${zoneItem.getZone().getPage().getPathInSitemap()}`);
      });
      Ametys.console.log(`${count} UGC services found`);

      If script returns 0 results, it's probably best to simply remove the service rendering overload. To do this, delete the services/ugc folder from your charts.

      Otherwise, the service will have to be reintegrated, avoiding as much as possible template overloads XSL from the helper "service:web://pages/services/contenttype/helper/form_4.5.xsl"

      We strongly advise against overloading (or even forbidding) these templates, especially the "contenttype-form" and "contenttype-form-***" templates, at the risk of not benefiting from any enhancements or corrections.

      For the rendering of form fields, if an overload had been made to change a class css, this overload should be banned and the css modified instead to ensure correct rendering.

      If the charter includes an overload of templates of the type "contenttype-form-field-string", "contenttype-form-field-content", ... compare them with their equivalent in the form.xsl of the form:

      • <xsl:template match="metadata[@type='string']" mode="contenttype-form-field">
      • <xsl:template match="metadata[@type='content']" mode="contenttype-form-field">

      If they are identical within one class CSS , remove the overload and modify the css rendering.

      If it is necessary to override the rendering of a particular type of field (this is often the case for file fields), the template to be overridden will be of the form <xsl:template match="metadata[@type='file']" mode="contenttype-form-field"> instead of <xsl:template name="contenttype-form-field-file"> previously.

      You can draw inspiration from the Intranet charter:

      • in the services\web\pages\services\contenttype\helper\form.xsl rendering of file fields is overloaded to replace file inputs with :
      • in the services\ugc\pages\services\ugc\form.xsl the rendering of the "illustrations" composite is overloaded to add an enclosing div
      <xsl:template match="metadata[@type='composite' and @name='illustrations']" mode="contenttype-form-field">
              <xsl:param name="fieldId" select="translate(@path, '/', '-')"/>
              <xsl:param name="fieldName" select="translate(@path, '/', '.')"/>
              <xsl:param name="values"/>
              <xsl:param name="contentValues"/>
              <xsl:param name="value" select="$values/*[local-name() = $fieldName]"/>
              <xsl:param name="errors" />
              <xsl:param name="uniqueId" />
              
              <div class="add-photos">
                  <xsl:apply-templates select="metadata" mode="contenttype-form-field">
                      <xsl:with-param name="values" select="$values" />
                      <xsl:with-param name="contentValues" select="$contentValues" />
                      <xsl:with-param name="errors" select="$errors" />
                      <xsl:with-param name="uniqueId" select="$uniqueId"/>
                  </xsl:apply-templates>
              </div>
          </xsl:template>

       

       

Back to top