Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lennart Stoop 304 posts 841 karma points
    Sep 30, 2010 @ 16:56
    Lennart Stoop
    1

    Schedule data type?

    Hi,

    I would like to enable the backend users to configure a list of opening hours (a schedule if you will) for a specific document type.

    - Monday 8:00 - 16:00

    - Tuesday 9:00 - 18:00

    - Wednesday Closed

     

    What would be the best way to accomplish this? 

    Should I create a custom data type?

    If so, how can I store & retrieve the selected values?

     

    Your feedback is highly appreciated.

    Thanks!

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Sep 30, 2010 @ 17:59
    Lee Kelleher
    0

    Hi Lennart,

    It is possible to build a custom data-type to do this, but it depends how much time/effort you want to put into it?

    Would you need to use this data-type more than once per website? If not then I'd suggest have separate textfield properties for each of the days, then the user can enter the times, or a label (e.g. "Closed").

    If it will be used a lot - and the only example I can currently think of is a Business Listings website, (that displays the opening times) ... then yes, it's probably work developing a custom data-type.

    How is your .NET code?  Couple of ways to tackle it... either using the user-control wrapper, or as a "native" data-type, (using classes).

    Cheers, Lee.

  • Sascha Wolter 615 posts 1101 karma points
    Sep 30, 2010 @ 18:01
    Sascha Wolter
    0

    Hi Lennart,

    I'd say that pretty much depends on what you want to do with the info later on. E.g. if it's just used to display the opening hours of a shop on the frontend then you would probably be alright with using just a textbox of kinds. However if you want to react programmatically to the information given then you'd probably need to create your own type, although you could also achieve this with a combination of dropdowns, e.g. create 7 'sections' (one for each day) consisting of 2 dropdowns displaying hours 0:00 to 23:00. If nothing is entered then the store is closed. 

    Obviously you can also create a nice control, for instance a datatype that wraps a usercontrol, and then store the information like this:

    08:00-16:00, 09:00-18:00, closed, ...

    There are a couple of very nice tutorial videos on umbraco.org on how to create your own datatype based on a usercontrol.

    The deluxe version would be a nice and slick week grid with nice and intuitive controls to select the timings for a day, then store the data as xml like

    <schedule>

      <Monday>

        <start>08:00</start>

    ...

    yet to be honest - as nice as this would be - it might be a bit overkill.

    Hope that helps,

    Sascha

  • Lennart Stoop 304 posts 841 karma points
    Sep 30, 2010 @ 19:38
    Lennart Stoop
    0

    Hey guys,

     

    Thanks for your quick replies! 

     

    I completely agree when you say much depends on how the data or control will be used. 

    In my case many backend users will have to input their opening hours, so I really feel a custom user control would enhance user experience and restrict input for that matter.

    I have not yet implemented a datatype based on a user control, but I think this may be a good opportunity to try & learn ;-)

    The datatype storing XML data indeed sounds like a good place to start from, Sascha.

    Thanks for your insights gentlemen!

     

    Greetz

    Lennart

  • bob baty-barr 1180 posts 1294 karma points MVP
    Sep 30, 2010 @ 22:43
    bob baty-barr
    0

    i would just use the custom repeatable content dataType from the projects section... create a new dataType of storeHours and give it properties for day,openTime, closeTime and put it on yoru homepage node or store node.

    it is an awesome dataType, btw...
    http://our.umbraco.org/projects/backoffice-extensions/repeatable-custom-content

     

  • Lennart Stoop 304 posts 841 karma points
    Oct 01, 2010 @ 14:34
    Lennart Stoop
    0

    Hi Bob,

    I was able to set up the repeatable custom content datatype on Umbraco 4.5.2 and customize it accordingly.

    Excellent datatype, thanks for pointing it out!

  • Giorgos Grispos 145 posts 179 karma points
    Nov 16, 2010 @ 21:33
    Giorgos Grispos
    0

    Hi Lennart,

    I know it's out of the post but have you managed to make the cusotm contant datatype work with 4.5.2 version? I see there is no support yet. Am I wrong?

    If yes, is it under 3.5 .net or 4? If you do have .net 4 and works for the 4.5.2 could you just email it to me to test it please?

    info (at) primecut (dot) gr

    Thanks! Giorgos

  • Lennart Stoop 304 posts 841 karma points
    Nov 17, 2010 @ 19:14
    Lennart Stoop
    0

    Hello Giorgos,

    I have installed the repeatable content datatype (V2 fixed) and used it as the render control for my custom datatype.

    It is running perfect in Umbraco 4.5.2 / .NET 4, and I did not experience any issues so far :-)

     

  • Giorgos Grispos 145 posts 179 karma points
    Nov 17, 2010 @ 23:03
    Giorgos Grispos
    0

    Hey Lennart,

    I just tried it and seems more than fine, that's great news for me. I can go on now!

    Cheers! Giorgos

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies