Coloring the Rack dates for holidays |
Top Previous Next |
DISCLAIMER: This article involves Advanced Customizations, which can be technically challenging to get working and is not part of standard support. This is programming and must be done precisely or the results can be unpredictable. This information is provided as a service for those who have the technical skills to work through it -- we cannot help you solve any issues with getting it working. For more information about Advanced Customizations, see the full documentation:
https://campgroundmaster.com/help/overview32.html
With version 4.0 or later, you can create a custom color scheme to change the colors of the date headers on the Rack. This can be used to highlight holidays or other special events. You can also create a scheme to color those dates for empty sites, similar to the way weekends are normally shaded in a darker color.
Using the Samples:
There is a sample color scheme file which you can import from the Color Schemes Setup. This can save a lot of work, but you still need to modify the rules to fit your needs so it's good to be familiar with the "from scratch" steps below.
Under Maintenance / Advanced Customizations / Color Schemes., click the Import schemes button, and you'll get a typical Windows file dialog labeled "Import Color Schemes". You need to locate the samples folder, which is typically in C:\Program Files (x86)\Campground Master\Samples (most likely you just need to double-click the "Samples" folder to get there). Now select the appropriate file (look for "Sample Color Scheme - Rack sites & dates, holidays"), and click Open. Once the sample is imported, you'll see one or more Color Schemes appear in the list.
Now you need to edit the expressions to change the dates used in the conditions, modify or remove any Site Type condition, and set the colors the way you want (see steps 5 and 6 below). You may also need to add additional rules for more dates -- see step 8 below.
Important: You would also need to use Select Global Color Schemes as shown in step 9 below (for each type -- date headings and empty sites) to enable the imported scheme(s) to be used on the Rack.
Starting from scratch:
Coloring the date headings:
If you prefer to create a new scheme from scratch instead of importing the sample, follow these steps:
1. Go to Maintenance / Advanced Customizations / Color Schemes.
2. Click "Add scheme definition", and give it a name like "Rack dates, holidays". Note that only one Color Scheme can be used to override the rack date headings, so if you have multiple holidays or other reasons to change the date colors, etc. then the rules for all of them need to be defined in this one scheme.
3. Make sure the Default scheme is "None".
4. Click "Add Color Rule", and give it a name. This is what will show in the Color Key for this color. Lets make this one "July 4th weekend".
5. Define the text and background colors you want using the "Change Text Color" and "Change Background Color" buttons.
6. Define the rule condition using an Expression, which must have a boolean result. If it's True, then this color will be used. If it's False, then it will continue on and check the next rule, and so forth. If no rules are satisfied, then the default color is used (so we don't have to create a rule for that).
The context function ThisDate() is used for the date of interest (each column's date). We just need to compare it to the special dates we want this color, using the syntax or boolean expressions. In particular, when comparing multiple dates we need to use "OR" operators so it's true if any one of the dates matches. So if the dates to color are July 4th thru the 6th of 2008, the expression for this condition would be:
ThisDate() = {7/4/08} OR ThisDate() = {7/5/08} OR ThisDate() = {7/5/08}
Note that it's curly braces around the dates, not parenthesis -- that's the format used to enter date values. Also, make sure the spaces are only added where shown -- e.g. there should not be a space between "ThisDate" and "()", but there must be spaces around the "=" and the "OR" operators.
If you need to specify a broader date range like July 1st thru the 31st , you would use the '>=' and '<=' operators to specify a range, like:
ThisDate() >= {7/1/08} AND ThisDate() <= {7/31/08}
7. Save that rule.
8. Now we need to continue adding other rules to cover any other dates we want to change colors for. The easiest way is to select one of the existing rules, click "Copy selected Rule(s)", and then Edit the new copy -- just changing the name of the rule, the colors, and the dates. Any number of dates can be checked in a single rule, just keep repeating the sequence as needed.
9. Once the scheme has all the rules and you Save it, there's one more thing you need to do -- make this scheme the default for date headings. Go to Maintenance / Advanced Customizations / Select Global Color Schemes, and select the scheme you just created in the drop-down list after "Override Dates headings with color scheme:".
Now your new colors should be used on date headings of the Rack.
Coloring the Empty Sites
If you want to also color all of the empty sites on those dates, you need to create another scheme, and select it for the default for open sites. Again you can import the Sample scheme to have a template for this, and all you need to do is edit the dates and select it (see step 9).
If you prefer to create a new scheme from scratch instead of importing the sample, follow these steps:
1. Go to Maintenance / Advanced Customizations / Color Schemes.
2. Click "Add scheme definition", and give it a name like "Rack open sites, holidays". (As before, you need to use a single scheme for all open-site rules.)
3. Make sure the Default scheme is "Open Sites (Rack)".
4. Click "Add Color Rule", and give it a name. Lets make this one "July 4th weekend" to match the previous one.
5. Define the text and background colors you want using the "Change Text Color" and "Change Background Color" buttons.
6. The Color Rule Condition Expression will be slightly different for this scheme, because we only want to use this color if the site is available (not marked as unavailable). We can use the ColorStatusSite() function to get the status, and make sure it's not unavailable in addition to checking the dates:
ColorStatusSite(ThisSite(), ThisDate(), ThisPeriod()) != 9
AND (ThisDate() = {7/4/08} OR ThisDate() = {7/5/08} OR ThisDate() = {7/5/08})
The expression is broken into 2 or more lines for readability here, but it must be continuous (no line breaks) when you enter it.
Note that you have to use AND between that function and the dates checking, which also means there must be parenthesis around the rest of the condition to make sure the OR operators are treated properly.
7. Save that rule.
8. Now we need to continue adding other rules to cover any other dates we want to change colors for, so repeat steps 4 through 7 as needed.
9. Once the scheme has all the rules and you Save it, there's one more thing you need to do -- make this scheme the default for open sites. Go to Maintenance / Advanced Customizations / Select Global Color Schemes, and select the scheme you just created in the drop-down list after "Override empty sites with color scheme:".
Now your new colors should be used on empty sites of the Rack.