Esempio n. 1
0
    def _getAnswer(self):
        if not self._startDT or not self._endDT:
            return ""

        if HolidaysHolder.isWorkingDay(self._startDT) and HolidaysHolder.isWorkingDay(self._endDT):
            return ""

        if isWeekend(self._startDT) or isWeekend(self._endDT):
            return _("weekend chosen")

        return _("holidays chosen")
Esempio n. 2
0
    def _getAnswer(self):
        if not self._startDT or not self._endDT:
            return ""

        if  HolidaysHolder.isWorkingDay( self._startDT ) and \
            HolidaysHolder.isWorkingDay( self._endDT ):
            return ""

        if isWeekend(self._startDT) or isWeekend(self._endDT):
            return _("Warning: weekend chosen")

        return _("Warning: holidays chosen")
Esempio n. 3
0
 def _displayMonth(self):
     month = self._month
     year = self._year
     today = date.today()
     res = []
     for day in range(1, calendar.monthrange(year, month)[1] + 1):
         if day == 1:
             for i in range(calendar.weekday(year, month, day)):
                 res.append("<td></td>")
         #calendar.weekday(year,month,day) in (5,6):
         if HolidaysHolder.isWorkingDay(datetime(year, month, day)):
             bgcolor = "#FFFFFF"
         else:
             bgcolor = "#EEEEEE"
         if date(year, month, day) == today:
             bgcolor = "#ccffcc"
         if self._date != '':
             (d, m, y) = self._date.split("-")
             if date(year, month, day) == date(int(y), int(m), int(d)):
                 bgcolor = "#ffcccc"
         res.append(
             """<td align="right" bgcolor="%s"><a href="" onClick="SetDate(%s,%s,%s);">%s</a></td>"""
             % (bgcolor, day, month, year, day))
         if calendar.weekday(year, month, day) == 6:
             res.append("</tr><tr>")
     str = _("""
             <table>
                 <tr>
                     <td colspan="7" align="center"><b>
                     <a href="javascript:PreviousYear();">&lt;&lt;</a>
                     &nbsp;
                     <a href="javascript:PreviousMonth();">&lt;</a>
                     %s %s
                     <a href="javascript:NextMonth();">&gt;</a>
                     &nbsp;
                     <a href="javascript:NextYear();">&gt;&gt;</a>
                     </b></td>
                 </tr>
                 <tr>
                     <td align="right" bgcolor="#CCCCCC">_("Mo")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Tu")</td>
                     <td align="right" bgcolor="#CCCCCC">_("We")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Th")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Fr")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Sa")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Su")</td>
                 </tr>
                 <tr>
                     %s
                 </tr>
             </table>
           """) % (datetime(1900, month,
                            1).strftime("%B"), year, "\n".join(res))
     return str
Esempio n. 4
0
 def _displayMonth( self ):
     month = self._month
     year = self._year
     today = date.today()
     res = []
     for day in range(1,calendar.monthrange(year,month)[1]+1):
         if day == 1:
             for i in range(calendar.weekday(year,month,day)):
                 res.append("<td></td>")
         #calendar.weekday(year,month,day) in (5,6):
         if HolidaysHolder.isWorkingDay( datetime( year, month, day ) ):
             bgcolor="#FFFFFF"
         else:
             bgcolor="#EEEEEE"
         if date(year,month,day) == today:
             bgcolor="#ccffcc"
         if self._date != '':
             (d,m,y) = self._date.split("-")
             if date(year,month,day) == date(int(y),int(m),int(d)):
                 bgcolor="#ffcccc"
         res.append( """<td align="right" bgcolor="%s"><a href="" onClick="SetDate(%s,%s,%s);">%s</a></td>"""%(bgcolor,day,month,year,day ))
         if calendar.weekday(year,month,day) == 6:
             res.append("</tr><tr>")
     str = _("""
             <table>
                 <tr>
                     <td colspan="7" align="center"><b>
                     <a href="javascript:PreviousYear();">&lt;&lt;</a>
                     &nbsp;
                     <a href="javascript:PreviousMonth();">&lt;</a>
                     %s %s
                     <a href="javascript:NextMonth();">&gt;</a>
                     &nbsp;
                     <a href="javascript:NextYear();">&gt;&gt;</a>
                     </b></td>
                 </tr>
                 <tr>
                     <td align="right" bgcolor="#CCCCCC">_("Mo")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Tu")</td>
                     <td align="right" bgcolor="#CCCCCC">_("We")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Th")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Fr")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Sa")</td>
                     <td align="right" bgcolor="#CCCCCC">_("Su")</td>
                 </tr>
                 <tr>
                     %s
                 </tr>
             </table>
           """) %(datetime(1900,month,1).strftime("%B"), year, "\n".join(res))
     return str