ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

asp shell to calendar with events feed from Iseries

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • asp shell to calendar with events feed from Iseries

    PHP Code:
    <%@ LANGUAGE="VBScript" %>
    <% 
          
         
    Option Explicit
       Dim FirstDay
       Dim Nextday
       Dim LastDay
       Dim counter
       Dim ThisMonth
       Dim Monthname
       Dim counter2
       Dim Daycounter
       Dim checkdaylast
       Dim checkdayfirst 
       Dim checkworkday
       Dim Workday
       Dim startcalendar
       Dim date8
       
       Dim cmd
    rsconnection
     
    '=======================================================================
      '
    Create DB objects
      
      Set cmd 
    Server.CreateObject("ADODB.Command")
      
    Set rs Server.CreateObject("ADODB.Recordset")
      
    Set Connection Server.CreateObject("ADODB.Connection")    
      
           
        
    Connection.Open "Provider=IBMDA400;User ID=xxxxxxxxxx;Password=xxxxxxxxxx;Data Source=10.10.10.10;"

    '=======================================================================


       Firstday = DateSerial(Year(Date), Month(Date) , 1) 
       checkdayfirst = DatePart("w", Firstday)

       LastDay = DateSerial(Year(Date), Month(Date)+ 1 , 1-1) 
       checkdaylast = Day(LastDay)
       ThisMonth = month(firstday) 
         
         Select Case ThisMonth
        case 1
        monthname = "January" 
        case 2
        monthname = "February" 
        case 3
        monthname = "March" 
        case 4
        monthname = "April" 
        case 5
        monthname = "May" 
        case 6
        monthname = "June" 
        case 7
        monthname = "July"
        case 8
        monthname = "August" 
        case 9
        monthname = "September" 
        case 10
        monthname = "October"  
        case 11
        monthname = "November" 
        case 12
        monthname = "December" 
      end select
       
         %> 
      
      
         
    <html>
      <head>
        <meta name="generator" content=
        "HTML Tidy for Windows (vers 1 June 2005), see www.w3.org">
        <title>
          Calendar
        </title>
        <link href="intranet.css" type="text/css" rel="STYLESHEET">
      </head>
      <body>
        <table cellspacing="0" cellpadding="0" width="75%" border="0">
          <tr>
            <td width="100%" >
              <table  cellspacing="0" cellpadding="0" width="100%"
              border="0">
                <tbody>
                  <tr>
                  
                    <td valign="top" width="100%" height="100%">
                      <table  cellspacing="0" cellpadding="1" width=
                      "100%" border="0">
                        <tbody>
                          <tr>
                         
                            <td valign="top" width="100%" height="100%">
                              <table cellspacing="0" cellpadding="1"
                              width="100%" border="0">
                                <tbody>
                                  <tr>
                                    <td class="MainBodyText"  width=
                                    "100%" >
                                      <table  cellspacing="0"
                                      cellpadding="0" width="100%" border="0"
                                      >
                                        <tbody>
                                       
                                          <tr>
                                            <td valign="top">
                                              <table class="CalendarTable"
                                              cellspacing="0" cellpadding="5"
                                              width="100%" border="0">
                                                <tbody>
                                                  <tr>
                                                    <td class="CalendarMonthDown"
                                                    ></td>
                                                    <td class="CalendarMonth"
                                                    colspan="5">
                                                     <div align="center" >
                                                      <%response.write(Monthname) &_
                                                      "&nbsp &nbsp" & Year(Firstday)%>
                                                      
                                                      </div>
                                                    </td>
                                                    <td class="CalendarMonthUp"
                                                    ></td>
                                                  </tr>
                                                  <tr>
                                                  
                          <!-- start of the seven days !-->   
                                                
                                                    <td class="CalendarDayOfWeek"
                                                    width="14%">
                                                      Sunday
                                                    </td>
                                                    <td class="CalendarDayOfWeek"
                                                     width="14%">
                                                      Monday
                                                    </td>
                                                    <td class="CalendarDayOfWeek"
                                                     width="14%">
                                                      Tuesday
                                                    </td>
                                                    <td class="CalendarDayOfWeek"
                                                     width="14%">
                                                      Wednesday
                                                    </td>
                                                    <td class="CalendarDayOfWeek"
                                                     width="14%">
                                                      Thursday
                                                    </td>
                                                    <td class="CalendarDayOfWeek"
                                                     width="14%">
                                                      Friday
                                                    </td>
                                                    <td class="CalendarDayOfWeek"
                                                    width="14%">
                                                      Saturday
                                                    </td>
                      
                       <!-- end of the seven days !-->        
                                                
                                                
                                                  </tr>
                                                  <tr>
                                  
                                                    
                         <!-- start the days loop !--> 
                         <%
                         counter = 0
                         counter2 = 0
                         daycounter = 0
                         startcalendar = ""
                         Do Until counter = 35 
                        
                         counter=counter+1
                         counter2 = counter2 +1
                         
                         workDay = DateSerial(Year(Date), Month(Date) , daycounter + 1) 
                         checkworkday = DatePart("w", workDay)
                         
                         if checkworkday = counter then
                          startcalendar = "Y"
                         end if
                         
                         if startcalendar = "Y" then
                         daycounter = daycounter + 1
                         
                         if daycounter  <= checkdaylast then                     
                         response.write("<td class=""CalendarDay"" valign=""top"">")
                         response.write(daycounter)
                         
                         ' 
    here is where you check for events in calendar file'
                         '
    build the decimal eight date'
                         Date8 = DateSerial(Year(Date), Month(Date) , daycounter) 
                          '
    response.write("<br>" date8)
                         if 
    daycounter 1 then
                          response
    .write("<p class=""CalendarEventLink""> test string long seventeen more data going for the maximum </p>")
                         
    end if
                          
                          
                          
                                              
                         
    response.write("</td>")
                         else
                         
    response.write("<td class=""CalendarDayOtherMonth"" valign=""top"">")
                         
    response.write(" &nbsp </td>")
                         
    end if  
                                              
                         else
                         
    response.write("<td class=""CalendarDayOtherMonth"" valign=""top"">")
                         
    response.write(" &nbsp </td>")
                         
    end if   
                         
                         
    'count to seven when hit then end previous </TR>'
                         'and open new <TR>' 
                         
                         
                         
    if counter2 7 then
                          response
    .write("</tr> <tr class=""CalendarDay"">")                 
                          
    counter2 
                         end 
    if
                                           
                         
                         
    loop 
                         
    %> 
                         <!-- 
    end the days loop !-->                           
                                 
                                                  </
    tr>
                                                </
    tbody>
                                              </
    table>
                                            </
    td>
                                          </
    tr>
                                        </
    tbody>
                                      </
    table>
                                    </
    td>
                                  </
    tr>
                                </
    tbody>
                              </
    table>
                            </
    td>
                            <
    td>
                              <
    img height="1" src="images/spacer.gif"
                              
    width="8">
                            </
    td>
                          </
    tr>
                        </
    tbody>
                      </
    table>
                    </
    td>
                  </
    tr>
                </
    tbody>
              </
    table>
            </
    td>
          </
    tr>
          <
    tr>
            <
    td></td>
          </
    tr>
        </
    table>
      </
    body>
    </
    html
    Attached Files
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com
Working...
X