#296 background field color for a specific text

open
nobody
None
2
2012-10-19
2012-10-18
Anonymous
No

How is it possible to define a specific background color for the entry.name field ?
For example when the word teacher is in the filed (only teacher or director nothing more) the booking colour of the field should be light red. Rest of the bookings for other colleagues or students should stay in its original colour like green.

Thanks a lot.

Discussion

  • Campbell Morrison

    You'd have to (a) remove the type field from the edit_entry.php form and (b) modify edit_entry_handler.php code to set $type based on the contents of the booking name. Not too difficult (only a few lines) if you know some PHP.

    Campbell

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-10-19

    Hi Campbell,
    thanks for your answer.
    Unfortunately I am not a specialist to make such a change, i do not even understand what to remove in the edit_entry.php, certainly not what to add or change in the edit_entry_handler.php.

    Possible you have an idea how to proceed.
    Thanks

     
  • Campbell Morrison

    Yes, I can help you. But first I need to know two things:

    (1) Which version of MRBS are you using? (It would be best if you could upgrade to 1.4.9 first)

    (2) I need to understand exactly how you want types to operate. Do you want
    (a) the user to be able to select from a list of types, as at present, and MRBS to override the type with another type if "teacher" or "director" is in the name field? Or
    (b) MRBS just to use two types and assign them automatically depending on whether or not "teacher" or "director" is in the name field?

    Campbell

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-10-19

    I´m using version 1.4.8, upgrade of version 1.4.9 not possible the next weeks.

    What i want to realize is:
    If i make a new entry and put in the "name"-field the word "teacher", and nothing else than teacher, the field in the booking overview for day or month, however should not change the colour.
    If i make an entry with "Miller", the field should change the color like there is a normal booking entry.

     
  • Campbell Morrison

    OK. Is there a reason why you cannot just create a type called "Teacher" and assign it a colour ("transparent" might work, I haven't tried, but if not then some light grey colour), and then when you book a teacher slot remember to select the type "Teacher"?

    This would have the advantage that it is all standard MRBS.

    Campbell

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-10-19

    can you give me a hint how to change this, please.
    Tried to find it in the documentation, but was not able to.

    Thanks a lot

     
  • Campbell Morrison

    (1) In your config file add

    unset($booking_types);
    $booking_types[] = "A";  // This could be your teacher type
    $booking_types[] = "B";  // This could be another type
    $booking_types[] = "Z";  // This could be another type.  Note - the characters don't have to be consecutive
    

    (2) Then in lang.en add a line for each of your booking types giving the description of the type, eg.

    $vocab["type.A"] = "Teacher";
    // etc.
    

    (3) Finally in Themes/default/styling.inc make dure there's a colour defined for each of your types in the array $color_types

    Campbell

     


Anonymous

Cancel  Add attachments