Пример #1
0
def getGrid(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    prevMo = getPrevMonth(Y, M)
    prevMoLWk = prevMo[-1]
    thisMo = getThisMonth(Y, M)
    nextMo = getNextMonth(Y, M)
    nextMoFWk = nextMo[0]
    DEX = 0
    for day in thisMo[0]: # first week of the month
        if not day:
            thisMo[0][DEX] = prevMoLWk[DEX]
        DEX += 1
    DEX = 0
    for day in thisMo[-1]: # last week of the month
        if not day:
            thisMo[-1][DEX] = nextMoFWk[DEX]
        DEX += 1
    return thisMo
Пример #2
0
def getGrid(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    prevMo = getPrevMonth(Y, M)
    prevMoLWk = prevMo[-1]
    thisMo = getThisMonth(Y, M)
    nextMo = getNextMonth(Y, M)
    nextMoFWk = nextMo[0]
    DEX = 0
    for day in thisMo[0]:  # first week of the month
        if not day:
            thisMo[0][DEX] = prevMoLWk[DEX]
        DEX += 1
    DEX = 0
    for day in thisMo[-1]:  # last week of the month
        if not day:
            thisMo[-1][DEX] = nextMoFWk[DEX]
        DEX += 1
    return thisMo
Пример #3
0
    def writeContent(self):
        wr = self.writeln
        IS_SITE_ADMIN = is_site_admin(self.request())

        wr('<h1>%s</h1>' % (self.title()))

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            ERROR = None
            form = self.request().fields()
            wr(form)

            fobj = form.get('datafile')
            try:
                filename = fobj.filename
            except:
                ERROR = 'You must select a file to upload.'

            if ERROR:
                self.render_form_error('Constitution Upload Error', ERROR)
            else:
                save_constitution(form)
                self.response().sendRedirect('Constitution')

        else:

            ci = get_constitution_info()
            if ci:
#                effdate = '/'.join(ci.get('date', []))
                effdate = ci.get('date', '')
                filename = ci.get('datafile', '')
                msg = ci.get('message', '')
                fileurl = os.path.join(DOC_CONST_DIR.replace(BASEDIR, ''), filename)
                wr('<p>Here\'s where you\'ll find the latest version of the ACVAA Constitution and Bylaws. Please click the link below to download it to your computer.</p>')
                wr('<h3><a href="%s">%s</a></h3>' % (fileurl, filename))
                wr('<p style="font-weight: bold;">Effective date: %s</p>' % (effdate))
                if msg:
                    wr('<p>%s</p>' % (msg))
            else:
                wr('<p>There is no ACVAA Constitution document available at this time.</p>')

            if IS_SITE_ADMIN:
                wr('<hr>')
                wr('<h2>Upload Constitution Document</h2>')
                wr('<form name="chooseDateForm" id="chooseDateForm" action="Constitution" method="POST" enctype="multipart/form-data">')
                YR, MO, DY = getYMD()
                wr('<P>')
                wr('<b>Effective Date of Constitution</b>')
                wr('<br />')
                wr('Date: <input type="text" id="datepicker" name="date">')
#                self.render_date_picker (YR, MO, DY)
                wr('</P>')

                wr('<P>')
                wr('<b>Message</b> (optional)')
                wr('<br />')
                wr('<textarea name="message" rows="5" cols="40"></textarea>')
                wr('</P>')

                wr('<P>')
                wr('<b>Upload Document</b>')
                wr('<br />')
                wr('<input type="file" name="datafile">')
                wr('</P>')
    
                wr('<P>')
                wr('<input type="submit" value="Save &amp; Upload Constitution">')
                wr('</P>')
                wr('</form>')
Пример #4
0
    def writeContent(self):
        wr = self.writeln
        IS_SITE_ADMIN = is_site_admin(self.request())

        wr('<h1>%s</h1>' % (self.title()))

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            ERROR = None
            form = self.request().fields()
            wr(form)

            fobj = form.get('datafile')
            try:
                filename = fobj.filename
            except:
                ERROR = 'You must select a file to upload.'

            if ERROR:
                self.render_form_error('Constitution Upload Error', ERROR)
            else:
                save_constitution(form)
                self.response().sendRedirect('Constitution')

        else:

            ci = get_constitution_info()
            if ci:
                effdate = '/'.join(ci.get('date', []))
                filename = ci.get('datafile', '')
                msg = ci.get('message', '')
                fileurl = os.path.join(DOC_CONST_DIR.replace(BASEDIR, ''), filename)
                wr('<p>Here\'s where you\'ll find the latest version of the ACVAA Constitution and Bylaws. Please click the link below to download it to your computer.</p>')
                wr('<h3><a href="%s">%s</a></h3>' % (fileurl, filename))
                wr('<p style="font-weight: bold;">Effective date: %s</p>' % (effdate))
                if msg:
                    wr('<p>%s</p>' % (msg))
            else:
                wr('<p>There is no ACVAA Constitution document available at this time.</p>')

            if IS_SITE_ADMIN:
                wr('<hr>')
                wr('<h2>Upload Constitution Document</h2>')
                wr('<form name="chooseDateForm" id="chooseDateForm" action="Constitution" method="POST" enctype="multipart/form-data">')
                YR, MO, DY = getYMD()
                wr('<P>')
                wr('<b>Effective Date of Constitution</b>')
                wr('<br />')
                wr('Date: <input type="text" id="datepicker" name="date">')
#                self.render_date_picker (YR, MO, DY)
                wr('</P>')

                wr('<P>')
                wr('<b>Message</b> (optional)')
                wr('<br />')
                wr('<textarea name="message" rows="5" cols="40"></textarea>')
                wr('</P>')

                wr('<P>')
                wr('<b>Upload Document</b>')
                wr('<br />')
                wr('<input type="file" name="datafile">')
                wr('</P>')
    
                wr('<P>')
                wr('<input type="submit" value="Save &amp; Upload Constitution">')
                wr('</P>')
                wr('</form>')
Пример #5
0
def getNextMonth(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    nY, nM = Y, M + 1
    if M == 12: nY, nM = Y + 1, 1
    return convertGrid(nY, nM, calendar.monthcalendar(nY, nM))
Пример #6
0
def getThisMonth(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    return convertGrid(Y, M, calendar.monthcalendar(Y,M))
Пример #7
0
def getPrevMonth(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    lY, lM = Y, M - 1
    if M == 1: lY, lM = Y-1, 12
    return convertGrid(lY, lM, calendar.monthcalendar(lY, lM))
Пример #8
0
def getNextMonth(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    nY, nM = Y, M + 1
    if M == 12: nY, nM = Y + 1, 1
    return convertGrid(nY, nM, calendar.monthcalendar(nY, nM))
Пример #9
0
def getThisMonth(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    return convertGrid(Y, M, calendar.monthcalendar(Y, M))
Пример #10
0
def getPrevMonth(Y=None, M=None):
    if not Y or not M: Y, M, D = getYMD()
    lY, lM = Y, M - 1
    if M == 1: lY, lM = Y - 1, 12
    return convertGrid(lY, lM, calendar.monthcalendar(lY, lM))