|
|
|
|
|
|
|
|
|
|
|
|
|
|
Build a Domino pop-up calendar widget using formula language (continued)
The value of the DateVal field is used to give a string name to the month to which the year is appended.
Building the calendar After the table row containing the five computed text fields, you should create a row with seven columns, each bearing a two letter heading for a day of the week. Start with Sunday, as this is Domino's preferred start day and after you reach the end, close the table row and open a new one.
Next, insert a computed rich-text field named "calendar". This is the heart of the calendar generation system. The formula should be as follows:
REM {Domino Popup Calendar Widget -- Daniel Koffler 2004}
1 tDate := @Date(DateVal);
REM {-*-*- Get Starting Parameters -*-*-}
2 FirstOMonth := @Adjust(tDate; 0; 0; -(@Day(tDate) - 1); 0; 0; 0);
3 tDayNum := @Weekday(FirstOMonth);
4 tMonth := @Month(FirstOMonth);
REM {-*-*- Cycle through all slots in table -*-*-}
5 tmpDates:="";
6 @For(n :=1; n<=42; n:= n + 1;
7 nDate:= @Adjust(FirstOMonth; 0; 0; (n - tDayNum); 0; 0; 0);
8 tDayTxt := @Right("0" + @Text(@Day(nDate)); 2);
9 tLink:={<a href="#" onClick="opener.document.forms[0].}+upField+{.value = '} +@Text(nDate;"D0")+ {';window.close()">}+tDayTxt+"</a></td>";
10 dspDate := @If(@Month(nDate) != tMonth; {<td class="otherMonth" ></td> }
@If(nDate = @Today;{<td class="today">} +tLink;{<td class="thisMonth">}+tLink));
11 dspDate:=@If(@Modulo(n;7) =0; dspDate+"</tr><tr>";dspDate);
12 tmpDates:=tmpDates : dspDate
);
REM {-*-*- Print Results. -*-*-}
13 @Implode(tmpDates)
|
Line 1 gets the value from the DateVal field and makes sure it is a Domino time object. Line 2 gets the first day of the month as a time object by adjusting the DateVal date back to one day less than the day of the month in DateVal. This will always give you the first day of the month specified in DateVal.
Line 3 uses the @Weekday function to get a number between 1 and 7 corresponding to the day of the week of the first day of the month (1=Sunday, 7=Saturday). Line 6 initiates a loop through the maximum 42 that might make up our calendar. That's seven columns multiplied by six rows.
Line 7 sets nDate to the next date we want to work on when going through the @For loop. For our table to line up properly, all the day numbers must be 2 digits. Line 8 gates the day of the month, converts it to a text value and ensures it is a 2-character sequence such as 02 instead of 2.
Line 9 creates an HTML link with a JavaScript onClick event. When clicked, this link uses JavaScript to update the a field on the calling form using the "opener" object and we know what field to update based on the value of upField. After the field on the opener form is updated we use a JavaScript call to close the popup window.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.
Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.
Learn how to easily clean up your address book. |
-- Advertisement --
Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino
- Don't spend unproductive time maintaining different versions of the same spreadsheet
- Preserve data integrity and security in multi-user environments
- Create reports in minutes INSIDE Notes
- Get freedom from iterative report requests, deliver self-serve capabilities
Experience Reporting, Dashboards, and Analysis INSIDE Notes.
Try IntelliPRINT NOW! |
|
|
|
|
|
|
|
|
|
|