cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin Paul Adams <co...@colina.demon.co.uk>
Subject Re: Styling fi:field widgets for times
Date Fri, 02 Jul 2004 05:41:15 GMT
Switching to the developers list, as this proposes some source-code
changes.

>>>>> "Joerg" == Joerg Heinicke <joerg.heinicke@gmx.de> writes:

    >> The calendar sample stylesheet is then putting in a date-picker
    >> popup, which in this case is far from appropriate.

    Joerg> That's correct, the variant would in this case also
    Joerg> interesting.

Right.
In forms-calendar-styling.xsl:

 <!--+
      | fi:field with either
      | - explicit styling @type = 'date' or
      | - implicit if no styling @type is specified,
      |   but datatype @type = 'date', selection lists must be excluded here
      +-->
  <xsl:template match="fi:field[fi:styling/@type='date'] |
                       fi:field[not(fi:styling/@type)][fi:datatype[@type='date']][not(fi:selection-list)]">

adding a test for @variant being absent or else eq 'date' should do
the trick.

    >> I guess I can add fi:styling elements to my template, to
    >> override this behaviour. Simply adding a class and tailoring
    >> the CSS file should be sufficient for presentation.

    Joerg> Yes, it should work. I hope fi:styling information in
    Joerg> template overrides the one from the form model.

Well, my fi:styling element gets through. It's not over-riding as
such, just supplementing, as I have to add a type
attribute to prevent the calendar-matching logic above kicking in. I
added type="time" - even though it is not documented as doing anything
(or even existing), it is sufficient.
I also added a class="time" attribute, for custom styling.

Which brings me to another RFE. The sample styling transforms need two
global parameter adding to them to specify the CSS stylesheets to use,
defaulting to the existing ones.

Within forms-calendar-styling.xsl, add a:

<xsl:param name="calendar-css" select="{$resources-uri}/forms-calendar.css" />

immediately after the declaration of the resources-uri parameter,
then change:

<link rel="stylesheet" type="text/css" href="forms-calendar.css"/>

to:

<link rel="stylesheet" type="text/css" href="{$calendar-css}"/>

(I need this feature in order to style my time fields)

Within forms-field-styling.xsl, add a

<xsl:param name="forms-css" select="$resources-uri}/forms.css"/>

immediately after the declaration of the resources-uri parameter,
then change:

   <link rel="stylesheet" type="text/css" href="{$resources-uri}/forms.css"/>

to:

   <link rel="stylesheet" type="text/css" href="{$forms-css}"/>

Then the user has far fewer needs to customise the transforms
themselves - simply code your own css files (presumably importing the
sample ones).

maybe the forms-lib.js and other .js scripts ought to receive the same treatment.
-- 
Colin Paul Adams
Preston Lancashire

Mime
View raw message