Kevin Dangoor <[EMAIL PROTECTED]> writes:

> This kind of thing would be nice to have built into a widget. I'm
> certain it can be done, but I'm really counting on folks who are i15ng
> their apps to help out with that kind of thing, because there's
> nothing like "eating your own dogfood" to make things work better. And
> I'm not eating that particular dogfood myself right now.
>
> Do you want to use the calendar widget, or is there some other kind of
> input you want?

For single language apps I'm using this on my templates¹:

    (...)

    <script language="JavaScript" 
src="/tg_widgets/turbogears.widgets/calendar.js"> </script>
    <script language="JavaScript" 
src="/tg_widgets/turbogears.widgets/lang/calendar-pt-utf8.js"> </script>
    <script language="JavaScript" 
src="/tg_widgets/turbogears.widgets/calendar-setup.js"> </script>
    <link href="/tg_widgets/turbogears.widgets/calendar-system.css" 
type="text/css" rel="stylesheet"> </link>

    (...)

                        <td width="25%">
                          <b>Data do envio</b>
                        </td>
                        <td>
                          <input type="text" id="data_envio" name="data_envio"
                                 size="11" maxlength="10" />
                          <input type="button" id="cal_envio"
                                 value="Calendário" />
                          <script type="text/javascript">
                            Calendar.setup(
                            {
                            inputField : "data_envio",
                            ifFormat : "%d/%m/%Y",
                            button : "cal_envio"
                            }
                            );
                          </script>
                        </td>

    (...)

And then I have this on my method:

        "data_envio":validators.DateConverter(month_style='dd/mm/yyyy'),

So, data_envio on my Python code contains an mx.DateTime (or
datetime.datetime) made up from the user input.

If I could change 'ifFormat' on the template based on what locale I'm using (I
can and probably will do that using some variable to represent this format
until I find some time to contribute more with patches for this specific
thing) problem would be solved.  Of course, I'd have to use the respective
language calendar JavaScript as well...  


Since widget had troubles -- the bug about restarts said something about it --
I was avoiding using widgets.  But for this new project I am really willing to
use them since it will make a lot of my job easier.


       ¹ "Data" means "Date".  "Envio" means "send", so this is for some
         sending date...  Just to let you all know...


-- 
Jorge Godoy      <[EMAIL PROTECTED]>

Reply via email to