Example #1
0
def post_handler(req, issue, options):
    db = ibis.IBISDatabase(MAIN_SERVER)
    fs = util.FieldStorage(req, 1)
    #
    req.write(preamble(title="Issue %s" % issue, subtitle=[]))
    req.write('<pre>\n')
    req.write('  disp = [%s]\n' % fs['disp'])
    req.write('  disp_orig = [%s]\n' % fs['disp_orig'])
    nt = stripcr(fs['title'])
    req.write('  new title      = [%s]\n' % html_escape(nt))
    req.write('  new title hash = [%s]\n' % longhash(nt))
    req.write('  old title hash = [%s]\n' % fs['title_hash'])
    req.write('</pre>\n')

    req.write('Processing actions:<br>\n')
    req.write('<hr>\n')
    d = fs['disp']
    if d == "undecided":
        d = ""
    if d != fs['disp_orig']:
        req.write("Set disposition to <b>%s</b>.<br>\n" % d)
        db.mark(issue, 'disposition', d)
    req.write('<hr>\n')
    req.write('<a href="%s?edit=1">[Back to Edit]</a>&nbsp;&nbsp;' % issue)
    req.write('<a href="%s">[View]</a><br>' % issue)
Example #2
0
def edit_handler(req, issue, options):  # `issue' is a misnomer
    db = ibis.IBISDatabase(MAIN_SERVER)
    info = db.issue_info(issue)
    subtitle = []
    issue_owner = info[1]
    issue_disp = info[2]
    issue_title = db.unescape(info[3])
    issue_desc = db.unescape(info[4])
    subtitle.append(issue_title)
    req.write(preamble(title="Issue %s" % issue, subtitle=subtitle))
    dir = os.path.split(req.filename)[0]
    form = open(os.path.join(dir, "editform.html")).read()
    fillin = {
        'issue': issue,
        'title': html_escape(issue_title),
        'desc': html_escape(issue_desc),
        'owner': issue_owner,
        'is_undecided': '',
        'is_taken': '',
        'is_declined': '',
        'is_future': '',
        'disp': issue_disp,
        'title_hash': longhash(issue_title),
        'desc_hash': longhash(issue_desc)
    }

    if issue_disp:
        fillin['is_' + issue_disp] = 'SELECTED '
    else:
        fillin['is_undecided'] = 'SELECTED '

    req.write(form % fillin)
Example #3
0
def fup_page(session, req, item, args):
    fup = args['fup']
    db = ibis.IBISDatabase(session.server)
    db.setSession(session)

    if req.method == 'POST':
        fs = util.FieldStorage(req, 1)
        if fup == 'note':
            db.add_note(item, stripcr(fs['title']), stripcr(fs['desc']),
                        'text/plain')
        else:
            db.followup(item, fup, stripcr(fs['title']), stripcr(fs['desc']),
                        None)
        iparent = string.split(item, '.')
        item = iparent[0]
        return do_redirect(session, req,
                           "%s?sid=%s&t=%d" % (item, session.id, time.time()))
    else:
        p = get_processor(req, "fup-specialize")
        z = db.item_details_xml(item)
        r = p.runString(z,
                        topLevelParams={
                            'timestamp': right_now(),
                            'sid': session.id,
                            'user': session.user,
                            'fuptype': fup
                        })
        req.write(r)
        return apache.OK
Example #4
0
def annotate_item(session, req, item, args):
    if req.method != "POST":
        raise 'Expected POST method'
    fs = util.FieldStorage(req)
    db = ibis.IBISDatabase(session.server)
    db.add_note(item, stripcr(fs['title']), stripcr(fs['desc']), fs['mime'])
    return redirect_item(session, req, item, args)
Example #5
0
def detail_page(session, req, item, args):

    p = get_processor(req, "detail")
    db = ibis.IBISDatabase(session.server)
    db.setSession(session)

    z = db.item_details_xml(item)
    r = p.runString(z,
                    topLevelParams={
                        'timestamp': right_now(),
                        'withedit': 'yes',
                        'sid': session.id
                    })
    req.write(r)
    return apache.OK
Example #6
0
def parent_links(req, issue):
    db = ibis.IBISDatabase(MAIN_SERVER)
    n = 0
    req.write(
        '<table width="100%%" cellspacing="0" cellpadding="0" border="0" bgcolor="#eeeeff">\n'
    )
    for h in db.issue_heritage(issue):
        req.write('<tr>\n')
        req.write( '<td><code>%s (<a href="%s">%s</a>)</code> ' \
                   % (("&nbsp;" * (n*2)),
                      h[0],
                      h[0]) )
        req.write('%s</td>' % db.unescape(h[6]))
        req.write('</tr>\n')
        n = n + 1
    req.write('</table>')
Example #7
0
def edit_item(session, req, item, args):
    if req.method != "POST":
        raise 'Expected POST method'
    fs = util.FieldStorage(req, 1)

    #import sys
    #fst = fs['title']
    #sys.stderr.write( "title       => %s\n" % `fst` )
    #sys.stderr.write( "H(title)    => %s\n" % longhash(fst) )
    #sys.stderr.write( "H(S(title)) => %s\n" % longhash( stripcr( fst ) ) )
    #sys.stderr.write( "H_saved     => %s\n" % fs['title_hash'] )
    #
    #fst = fs['desc']
    #sys.stderr.write( "title       => %s\n" % `fst` )
    #sys.stderr.write( "H(title)    => %s\n" % longhash(fst) )
    #sys.stderr.write( "H(S(title)) => %s\n" % longhash( stripcr( fst ) ) )
    #sys.stderr.write( "H_saved     => %s\n" % fs['desc_hash'] )

    new_title = None
    new_desc = None
    new_origin = None
    new_domain = None
    new_owner = None

    v = stripcr(fs['title'])
    if longhash(v) != fs['title_hash']:
        new_title = v

    v = stripcr(fs['desc'])
    if longhash(v) != fs['desc_hash']:
        new_desc = v

    if fs['originator'] != fs['originator_orig']:
        new_origin = fs['originator']

    if fs['owner'] != fs['owner_orig']:
        new_owner = fs['owner']

    db = ibis.IBISDatabase(session.server)
    db.edit(item, new_title, new_desc, new_origin, new_owner, new_domain)

    if fs['disp'] != fs['disp_orig']:
        db.mark(item, 'disposition', fs['disp'])

    return redirect_item(session, req, item, args)
Example #8
0
def view_handler(req, issue, options):
    db = ibis.IBISDatabase(MAIN_SERVER)
    deepq = options.has_key('deep')
    verboseq = options.has_key('verbose')
    content = db.issue_block(issue, deepq, verboseq)
    #subtitle = [ "<code>%s</code>" % req.path_info,
    #             "<code>%s</code>" % req.args ]
    subtitle = []

    if deepq:
        subtitle.append('<a href="%s">[shallow view]</a>' % issue)
    else:
        subtitle.append('<a href="%s?deep=1">[deep view]</a>' % issue)

    req.write(preamble(title="Issue %s" % issue, subtitle=subtitle))
    parent_links(req, issue)
    req.write('<pre>\n')
    req.write(content)
    req.write('</pre>\n')
Example #9
0
def followup_handler(req, item, options):
    db = ibis.IBISDatabase(MAIN_SERVER)
    info = db.issue_info(item)
    subtitle = []
    issue_owner = info[1]
    req.write(
        preamble(title="Item %s %s" % (item, longfup[options['fup']]),
                 subtitle=subtitle))
    parent_links(req, item)

    if followup_text.has_key(options['fup']):
        msg = followup_text[options['fup']]
    else:
        msg = "Preparing a followup to: <code>(%(id)s)</code> %(title)s."

    req.write(msg % {'title': db.unescape(info[3]), 'id': item})

    dir = os.path.split(req.filename)[0]
    form = open(os.path.join(dir, "followupform.html")).read()
    fillin = {'parent_id': item, 'followup': options['fup'], 'owner': info[1]}
    req.write(form % fillin)
Example #10
0
def issueblock_page(session, req, item, args):
    if '.' in item:
        return do_redirect(
            session, req,
            "%s?sid=%s" % (string.split(item, '.')[0], session.id))

    db = ibis.IBISDatabase(session.server)
    db.setSession(session)

    z = db.issue_block_xml(item, args.has_key('deep'))
    if args.has_key('deep'):
        depth_uri_flag = '&deep=1'
    else:
        depth_uri_flag = ''

    r = applyProcessor(session, req, "navigate", z, {
        'withedit': 'yes',
        'depth': depth_uri_flag
    })
    req.write(r)
    return apache.OK
Example #11
0
def followup_post_handler(req, item, options):
    db = ibis.IBISDatabase(MAIN_SERVER)
    fs = util.FieldStorage(req, 1)
    req.write(preamble(title="Item %s Followup" % item, subtitle=[]))
    d = fs['disp']
    if d == "undecided":
        d = ""
    #
    req.write('<pre>\n')
    new_title = string.strip(stripcr(fs['title']))
    new_desc = string.strip(stripcr(fs['desc']))

    req.write('  Type = [%s]\n' % options['fup'])
    req.write('  Title = [%s]\n' % html_escape(new_title))
    req.write('  Desc = [%s]\n' % html_escape(new_desc))
    req.write('  Owner = [%s]\n' % fs['owner'])
    req.write('  Disposition: [%s]\n' % d)
    req.write('</pre>\n')
    req.write('<hr>\n')
    z = db.followup(item, options['fup'], new_title, new_desc, d)
    req.write('Opened new item <b>%s</b>\n' % z)
    req.write('<hr>\n')
    req.write('<a href="%s?edit=1">[Edit New Item]</a>&nbsp;&nbsp;' % z)
    req.write('<a href="%s">[View]</a><br>' % z)