Lasso Soft Inc. > Home

[lp_smallMonthlyCalendar]

Linklp_smallMonthlyCalendar
AuthorStiti Samantaray
CategoryCalendar
Version8.5.x
LicensePublic Domain
Posted25 Dec 2009
Updated06 Jan 2010
More by this author...

Description

This tag returns a small monthly calendar menu or a date picker. User can change the color theme of the calendar by passing the calendar date cell and day name header colors as parameters to the tag. The tag will return the monthly calendar of the month and year that has been passed in the -calMonth and -calYear parameters to the [lp_smallMonthlyCalendar] tag.

The this tag needs to be called in an IFrame. Please see the sample usage section for the way how to use the date picker.

Sample Usage

[if: action_param('smallCalendar') == 1]
    [include: 'dropdown_Calendar.inc']

    [Var: 'calMonth' = 01,
        'calYear' = 2010,
        'weekDayHeader'= '#2E75AE',
        'dateCellBgClr' = '#FFFFFF',
        'excludeCellBgClr' = '#E2F0FE']
    

    [if: action_param('calMonth')!='']
        [Var: 'calMonth' = Integer(action_param('calMonth'))]
    [/if]
    [if: action_param('calYear')!='']
        [Var: 'calYear' = Integer(action_param('calYear'))]
    [/if]
    

    [Var: 'myDatePicker' = (lp_smallMonthlyCalendar:  
                            -calMonth = $calMonth,
                            -calYear = $calYear,
                            -weekDayHeader=$weekDayHeader,
                            -dateCellBgClr = $dateCellBgClr,
                            -excludeCellBgClr = $excludeCellBgClr,
                            -targetDateObjectId = action_param('targetDateObjectId'))]
        
    [Var('myDatePicker', -EncodeNone)]
        
    
[else]


    
    
    
    
    Start Date: 

End Date:

[/if]

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

[//lasso
/*----------------------------------------------------------------------------

[lp_smallMonthlyCalendar]
Returns a monthly calendar menu. Can be used as a datepicker. 

Author: Stiti Samantaray, Mindfire Solutions, Bhubaneswar, India
Last Modified: Dec 25, 2009
License: 

Description:
Returns a monthly calendar.


Sample Usage:
[lp_smallMonthlyCalendar:  
    -calMonth = 04,
    -calYear = 2009,
    -weekDayHeader='#2E75AE',
    -dateCellBgClr = '#FFFFFF',
    -excludeCellBgClr = '#E2F0FE']

Member tags Description: 
-calMonth = Two digit integer value of a month of which you want to see the calendar (e.g: -calMonth = 04, 04 stands for the month APRIL)
-calYear  = Four digit integer value of the year of which you want to see the calendar for APRIL(e.g: -calYear = 2009)
-weekDayHeader = HTML color code for WeekDay heading in the calendar
-dateCellBgClr = Current month's date cell's background color in the monthly grid (e.g: -dateCellBgClr = '#FFFFFF')
-excludeCellBgClr = Previous/Next month's date cell's background color in the monthly grid (e.g: -excludeCellBgClr = '#E2F0FE')
-targetDateObjectId = ID of the HTML form input date field (e.g -targetDateObjectId = 'myStartDate' where "myStartDate" is the ID of the input form field )

----------------------------------------------------------------------------*/

If: !(Lasso_TagExists:'lp_smallMonthlyCalendar'); 
Define_Tag: 'lp_smallMonthlyCalendar', 
    -Optional = 'calMonth', -Type='Integer',
    -Optional = 'calYear', -Type='Integer',
    -Optional = 'weekDayHeader', -Type='String',
    -Optional = 'dateCellBgClr', -Type='String',
    -Optional = 'excludeCellBgClr', -Type='String',
    -Optional = 'targetDateObjectId', -Type='String'; 
 			
    Local( 'calDisplay' = '', //Local variable that holds the monthly calendar.
            'firstDay' = '',
            'lastDate' = '',
            'lastDay' = '',
            'daysCount' = 0,
            'weekRows' = 0,
            'dateIncr' = 0,
            'tempDateIncr' = 0,		
            'rowCounter' = 0,
            'prevMonth' = '',
            'prevYear' = '',
            'prevLastDate' = '',
            'prevDaysCount' = 0,
            'prevDayIncr' = 0,
            'cellDateDay' = 0,
            'cellDate' = '', //Local variable that holds the date of the cells.
            'nextMonth'	= '',
            'nextYear' = '',
            'nextLastDate' = '',
            'nextDaysCount' = 0,
            'nextDayIncr' = 0);

    if( Local('calMonth') == '' );
        Local('calMonth') = Date_Format( Date, -Format='%m' );
    /if;
    if( Local('calYear') == '' );
        Local('calYear') = Date_Format( Date, -Format='%Y' );
    /if;
    if( Local('weekDayHeader') == '' );
        Local('weekDayHeader') = '#2E75AE';
    /if;
    if( Local('dateCellBgClr') == '' );
        Local('dateCellBgClr') = '#FFFFFF';
    /if;
    if( Local('excludeCellBgClr') == '' );
        Local('excludeCellBgClr') = '#E2F0FE';
    /if;
    if( Local('targetDateObjectId') == '' );
        Local('targetDateObjectId') = '';
    /if;
	
// Include CSS styles for the Calendar.
Local: 'calDisplay' = '';

// Include JavaScript functions for Add/Edit Activity link.
Local: 'calDisplay' = #calDisplay + '';


Local: 'calDisplay' = #calDisplay + '
'; Local: 'calDisplay' = #calDisplay + ''; /* Evaluate 1st day of the Selected Month */ Local('firstDay' = Date_Format( Date(#calMonth+'/01/'+#calYear), -Format='%w') ); /* Evaluate last date of the Selected Month */ if( #calMonth == '01' || #calMonth == '03' || #calMonth == '05' || #calMonth == '07' || #calMonth == '08' || #calMonth == '10' || #calMonth == '12' ); #lastDate = Date(#calMonth+'/31/'+#calYear); #daysCount = 31; else( #calMonth == '02' ); if( #calYear%4 == 0 ); #lastDate = Date(#calMonth+'/29/'+#calYear); #daysCount = 29; else; #lastDate = Date(#calMonth+'/28/'+#calYear); #daysCount = 28; /if; else; #lastDate = Date(#calMonth+'/30/'+#calYear); #daysCount = 30; /if; /* Evaluate last date of the Previous Month */ if( #calMonth == '01' ); #prevMonth = '12'; #prevYear = Math_Sub(#calYear, 1); else; #prevMonth = Math_Sub(#calMonth, 1); #prevYear = #calYear; /if; if( String(#prevMonth)->size == 1 ); #prevMonth = '0'+#prevMonth; /if; if( #prevMonth == '01' || #prevMonth == '03' || #prevMonth == '05' || #prevMonth == '07' || #prevMonth == '08' || #prevMonth == '10' || #prevMonth == '12' ); #prevLastDate = Date(#prevMonth+'/31/'+#prevYear); #prevDaysCount = 31; else( #prevMonth == '02' ); if( #prevYear%4 == 0 ); #prevLastDate = Date(#prevMonth+'/29/'+#prevYear); #prevDaysCount = 29; else; #prevLastDate = Date(#prevMonth+'/28/'+#prevYear); #prevDaysCount = 28; /if; else; #prevLastDate = Date(#prevMonth+'/30/'+#prevYear); #prevDaysCount = 30; /if; /* Evaluate last date of the Next Month */ if( #calMonth == '12' ); #nextMonth = '01'; #nextYear = Math_Add(#calYear, 1); else; #nextMonth = Math_Add(#calMonth, 1); #nextYear = #calYear; /if; if( String(#nextMonth)->size == 1 ); #nextMonth = '0'+#nextMonth; /if; if( #nextMonth == '01' || #nextMonth == '03' || #nextMonth == '05' || #nextMonth == '07' || #nextMonth == '08' || #nextMonth == '10' || #nextMonth == '12' ); #nextLastDate = Date(#nextMonth+'/31/'+#nextYear); #nextDaysCount = 31; else( #nextMonth == '02' ); if( #nextYear%4 == 0 ); #nextLastDate = Date(#nextMonth+'/29/'+#nextYear); #nextDaysCount = 29; else; #nextLastDate = Date(#nextMonth+'/28/'+#nextYear); #nextDaysCount = 28; /if; else; #nextLastDate = Date(#nextMonth+'/30/'+#nextYear); #nextDaysCount = 30; /if; /* Calculate no. of weeks to be displayed in the grid */ if( #daysCount%7 == 0 ); #weekRows = #daysCount/7; else; #weekRows = (#daysCount/7) + 1; /if; if( Integer(#firstDay) == 1 ); #dateCellBgClr = ''; /if; Local: 'calDisplay' = #calDisplay + ''; /******************************** * MONTH & YEAR NAVIGATION LINKS * ********************************/ Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; //------------------------------------- Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Local: 'calDisplay' = #calDisplay + ''; Loop: #weekRows; #rowCounter = (loop_count); if( #rowCounter == 1 ); Loop( Integer(#firstDay)-1 ); Local('cellBgColor1_'+(loop_count)) = #excludeCellBgClr; #prevDayIncr = #prevDaysCount - (Integer(#firstDay) - (loop_count)); /Loop; /if; Local: 'calDisplay' = #calDisplay + ''; Loop: 7; if( #rowCounter > 1 ); if( Integer(#daysCount) <= #rowCounter*(loop_count) ); Local('cellBgColor'+#rowCounter+'_'+(loop_count)) = #excludeCellBgClr; /if; /if; Local: 'calDisplay' = #calDisplay + ''; /Loop; Local: 'calDisplay' = #calDisplay + ''; /Loop; Local: 'calDisplay' = #calDisplay + '

S

M

T

W

T

F

S

'; // Get the day (dd) of the current date cell if( #rowCounter == 1 ); if( Integer(#firstDay) <= (loop_count) ); #dateIncr += 1; #tempDateIncr += 1; else; #dateIncr = 0; #tempDateIncr = 0; #prevDayIncr = #prevDaysCount - (Integer(#firstDay) - (loop_count + 1)); /if; else; #dateIncr += 1; #tempDateIncr += 1; if( Integer(#daysCount) < #tempDateIncr ); #dateIncr = 0; #nextDayIncr += 1; /if; /if; if( #dateIncr > 0 ); #cellDateDay = #dateIncr; else if( #nextDayIncr > 0 ); #cellDateDay = #nextDayIncr; else; #cellDateDay = #prevDayIncr; /if; //-------------------------------------------------- // Get the date in mm/dd/yyyy for the current cell if( #rowCounter == 1 ); if( Integer(#cellDateDay) <= 7); Local: 'cellDate' = #calMonth + '/' + #cellDateDay + '/' + #calYear; Local: 'dateDispStyle' = 'currMonDayCorner'; else; Local: 'cellDate' = #prevMonth + '/' + #cellDateDay + '/' + #prevYear; Local: 'dateDispStyle' = 'otherdayCorner'; /if; else( #rowCounter == #weekRows ); if( Integer(#cellDateDay)-1 <= 6); Local: 'cellDate' = #nextMonth + '/' + #cellDateDay + '/' + #nextYear; Local: 'dateDispStyle' = 'otherdayCorner'; else; Local: 'cellDate' = #calMonth + '/' + #cellDateDay + '/' + #calYear; Local: 'dateDispStyle' = 'currMonDayCorner'; /if; else; Local: 'cellDate' = #calMonth + '/' + #cellDateDay + '/' + #calYear; Local: 'dateDispStyle' = 'currMonDayCorner'; /if; //-------------------------------------------------- If: (Date_Format: (Date), -Format='%D') == (Date_Format: Date(#cellDate), -Format='%D'); Local: 'dateDispStyle' = 'todayCorner'; /If; /*************************************** * DATE LINK * ****************************************/ Local: 'calDisplay' = #calDisplay +'
' + #cellDateDay + '
'; //-------------------------------------- Local: 'calDisplay' = #calDisplay + '
'; Local: 'calDisplay' = #calDisplay + '
'; Local: 'calDisplay' = #calDisplay + '
'; Local: 'calDisplay' = #calDisplay + ''; Return: (Local: 'calDisplay'); /Define_Tag; /If; ]

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft