Photo Calendar Program

The Photo Calendar Program is designed as an easy to use browser interface for creating personalized calendars. Just add your photos to the automatically generated calendar template. Date notations are selectable and customizable. The program requires a browser that supports frames and implements JavaScript 1.3 or higher.

The Photo Calendar Program is released under the GNU General Public License.

Software Design

The calendar.html page is a master frameset for a three frame display. The left frame is an input form controlling the calendar configuration. The upper right frame displays a calendar block. The lower right frame displays a table of date notation selections. The calendar page loads the Notation database, including any user supplied plugin files. It restores the calendar PageState from a browser cookie then calls the initialization function for the input form.

The cal_edit.html page implements the input form with event handlers that respond to user input. It manages the form state values and updates the calendar block and notation table when necessary. The calendar format settings are maintained in a browser cookie for the duration of the current session.

The loading.html page provides a document for dynamically updating the calendar block. Its purpose is to rewrite itself in response to update commands from the input form. This is accomplished with help from the PageState and CalendarPage classes.

The page_state.js module implements the PageState class, which manages the calendar page state variables. The current year and month are used to generate the basic calendar block. These two parameters are maintained in a CalendarState browser cookie for the duration of the of the current session. The other state parameters (photo, caption and copyright) are maintained in a persistent browser cookie with an expiration set at 400 days. The month and year are prefixed to the cookie name so that each calendar page has a separate state cookie. In response to calls from the input page event handlers, the PageState module notes changes to the state variables and updates the current cookie whenever the photo, caption or copyright are modified. It loads a new state cookie when the month or year changes.

The cal_page.js module implements the CalendarPage class, which provides functions that generate HTML text for the calendar. It has two top level entry points. One generates the full calendar page with photo, caption and copyright. The other generates only the date block. User defined calendar page parameters are copied from the current PageState. Calendar format settings are applied directly by event handlers that service the option checkboxes on the input page. Browser specific page layout parameters are initialized in the CalendarPage constructor.

The dates.html page provides a document for dynamically displaying a table of calendar notation selections. The page rewrites itself in response to update commands triggered from the input form. The current Notation selection list is used to generate the table, including checkboxes to toggle the enable/disable state. An event handler posts changes in the notation state then updates the calendar block.

The notation.js module implements the Notation class, which manages the calendar notation database. The database is built from four component files: holidays.js, astronomical.js, religious.js, personal.js along with any user supplied plugins. The notation selection list is updated whenever the year or month is changed on the input form. The selection table on the dates page is then updated to display the new list of notations. The enable/disable state of all notations is maintained in a browser cookie for the duration of the current session.

The simple_cookie.js module implements the SimpleCookie class. This is a general purpose class for saving and restoring browser cookies. By default, cookies expire at the end of the current browser session. The "days" parameter of the save function allows a cookie to persist for a specified period of days. The CalendarState class is used to calculate the expiration date.

The cal_state.js module implements the CalendarState class. This is a general purpose class for performing date calculations with the Gregorian calendar. It is primarily used for determining the day of the week for a specified date or calculating the year/month/day of a date which is offset a specified number of days foreward or backward. The algorithms are very efficient and require only simple integer arithmetic. The SimpleCookie class is used to save or restore dates as browser cookies.

The os_fix.js module defines the master kluge enable flags for fixing compatability problems with various browsers.

The selection.html page is a simple demonstration of the plugin capability for customizing the Notation database. The page is dynamically constructed from a database supplied in the selection.js file. Three demonstration modules: family.js, friends.js, business.js provide trivial examples of custom notations. You can easily modify these files to meet your personal needs.