Exemplo n.º 1
0
def makepage(user):

    _p.chdir(user)

    projects, count = p.project.getProjects()

    warning = ""
    if user.startswith("guest"):
        warning = """
        <div class="alert">
        Warning: Any data you upload to this guest account will be removed two days after the last time this account was used.
        If you want to save your data for a longer time, you can create a personal account.
        </div>
        """

    try:
        f = open("maxprojects", "r")
        maxprojects = int(f.read().strip())
        f.close()
    except:
        maxprojects = _c.maxprojects

    if user.startswith("demo"):
        template = "p-user-demo.html"
    elif count >= maxprojects:
        template = "p-user-full.html"
    else:
        template = "p-user.html"

    sys.stdout.write(_h.head())
    sys.stdout.write(
        _h.getBody(template).format(
            {
                "warning": warning,
                "projects": projects,
                "username": user,
                "appurl": _c.appurl,
                "count": maxprojects,
                "helpmap": _h.help("homemap"),
                "helpshmap": _h.help("homedisperse"),
                "helppseudo": _h.help("homepseudo"),
                "helpdata": _h.help("homedata"),
                "helptype": _h.help("hometype"),
                "helpdatatype": _h.help("homedatatype"),
                "helpmtdstring": _h.help("homemtdstring"),
                "helpmtdnum": _h.help("homemtdnum"),
                "helpmtdbin": _h.help("homemtdbin"),
                "helpuserdef": _h.help("homeuserdef"),
                "helpremove": _h.help("homeremove"),
                "helpadvca": _h.help("homeca"),
            }
        )
    )
    sys.stdout.write(_h.foot())
Exemplo n.º 2
0
def makepage(user):

    _p.chdir(user)

    projects, count = p.project.getProjects()

    warning = ''
    if user.startswith('guest'):
        warning = '''
        <div class="alert">
        Warning: Any data you upload to this guest account will be removed two days after the last time this account was used.
        If you want to save your data for a longer time, you can create a personal account.
        </div>
        '''

    try:
        f = open('maxprojects', 'r')
        maxprojects = int(f.read().strip())
        f.close()
    except:
        maxprojects = _c.maxprojects

    if user.startswith('demo'):
        template = 'p-user-demo.html'
    elif count >= maxprojects:
        template = 'p-user-full.html'
    else:
        template = 'p-user.html'

    sys.stdout.write(_h.head())
    sys.stdout.write(_h.getBody(template).format({
        'warning':warning,
        'projects':projects,
        'username':user,
        'appurl':_c.appurl,
        'count':maxprojects,
        'helpmap': _h.help('homemap'),
        'helpshmap': _h.help('homedisperse'),
        'helppseudo': _h.help('homepseudo'),
        'helpdata': _h.help('homedata'),
        'helptype': _h.help('hometype'),
        'helpdatatype': _h.help('homedatatype'),
        'helpmtdstring': _h.help('homemtdstring'),
        'helpmtdnum': _h.help('homemtdnum'),
        'helpmtdbin': _h.help('homemtdbin'),
        'helpuserdef': _h.help('homeuserdef'),
        'helpremove':_h.help('homeremove'),
        'helpadvca':_h.help('homeca'),
        }))
    sys.stdout.write(_h.foot())
Exemplo n.º 3
0
def makepage(user):

    _p.chdir(user)

    projects, count = p.project.getProjects()

    warning = ''
    if user.startswith('guest'):
        warning = '''
        <div class="alert">
        Warning: Any data you upload to this guest account will be removed two days after the last time this account was used.
        If you want to save your data for a longer time, you can create a personal account.
        </div>
        '''

    if _c.usermode == 'single':
        template = 'p-user-single.html'
    elif user.startswith('demo'):
        template = 'p-user-demo.html'
    elif count >= _c.maxprojects:
        template = 'p-user-full.html'
    else:
        template = 'p-user.html'

    sys.stdout.write(_h.head())
    sys.stdout.write(_h.getBody(template).format({
        'warning':warning,
        'projects':projects,
        'username':user,
        'appurl':_c.appurl,
        'count':_c.maxprojects,
        'helpmap': _h.help('homemap'),
        'helpshmap': _h.help('homedisperse'),
        'helppseudo': _h.help('homepseudo'),
        'helpdata': _h.help('homedata'),
        'helptype': _h.help('hometype'),
        'helpdatatype': _h.help('homedatatype'),
        'helpmtdstring': _h.help('homemtdstring'),
        'helpmtdnum': _h.help('homemtdnum'),
        'helpmtdbin': _h.help('homemtdbin'),
        'helpuserdef': _h.help('homeuserdef'),
        'helpremove':_h.help('homeremove'),
        'helpadvca':_h.help('homeca'),
        }))
    sys.stdout.write(_h.foot())
Exemplo n.º 4
0
#!/usr/bin/env python
"""
--documentation--
"""

__author__ = "Peter Kleiweg"
__version__ = "0.1"
__date__ = "2010/02/18"

#| imports

import cgitb; cgitb.enable(format="html")

import sys

from u.config import appurls
from u.html import head, foot, getBody
from u.login import username
import p.user

#| main

if username:
    p.user.makepage(username)
else:
    body = getBody('login.html').format(vars())
    sys.stdout.write(head())
    sys.stdout.write(body)
    sys.stdout.write(foot())