Esempio n. 1
0
def doView():
    status, table_data, db = pageInit('View', formJS=1)

    if status != 'success':
        message = "Could not connect to db.\n%s" % (status)
        exit(message)

    # Get user data from db
    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'project_members', form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message = "Unable to get member data from db.\n" + dbResult['message']
        exit(message)

    # Display user data
    result = dbResult['result']
    table_data = pmt_utils.dbToTableData(table_data, 'project_members',
                                         result[0])
    table_data['project_members']['member_username']['display'] = 'read-only'
    table_data['project_members']['member_role']['display'] = 'read-only'
    table_data['project_members']['member_password']['display'] = 'Hidden'
    pmt_utils.display_form(table_data, 'project_members', editable=0)

    # Add buttons, and company info
    url = '/%s-cgi-bin/contact_list.pyc?performDbQuery=1' % db_name
    pmt_utils.viewFunctionButtons(url, '/%s/html/contactsum.html' % (db_name))
    pageEnd(table_data, db)
Esempio n. 2
0
def doView():
    status,table_data,db=pageInit("View",formJS=1)
    if status != 'success':
        message='Could not connect to db.\n%s' % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)
        
    if status != 'success':
        exit(details)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(table_data,
                                                          'spr',
                                                          form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message="Item data could not be retrieved.\n" + dbResult['message']
        exit(message)
        
    result = dbResult['result']
    table_data = pmt_utils.dbToTableData(table_data, 'spr', result[0])
    display_questionnaire(db,table_data, 'read-only')

    listing_url='/%s-cgi-bin/spr_admin.pyc?performDbQuery=1' % (db_name)
    help_url='/%s/html/sprsum.html' % (db_name)
    emailButton(username,form['key_id'].value,listing_url, help_url)
    pageEnd(table_data,db)
Esempio n. 3
0
def doView():

    status,table_data,db=pageInit('View',formJS=1)
    if status != 'success':
        message="Could not connect to db.\n%s" % status
        exit(message)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(table_data,
                                                          'project_members',
                                                          form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)
    if dbResult['status'] != 'success':
        message="Unable to get project member data.\n%s" % dbResult['message']
        exit(message,table_data,db)

    # Display user data
    result = dbResult['result']
    table_data=pmt_utils.dbToTableData(table_data,'project_members',result[0])
    pmt_utils.display_form(table_data, 'project_members', 0)

    # Add buttons and hidden fields
    listing_url='/%s-cgi-bin/project_members_admin.pyc?performDbQuery=1' % (db_name) 
    help_url='/%s/html/contactsum.html' % db_name
    pmt_utils.viewFunctionButtons(listing_url, help_url)
    pageEnd(table_data,db)
Esempio n. 4
0
def doEdit():
    status, table_data, db = pageInit("Edit", formJS=1)

    if status != 'success':
        message = "Could not connect to the database\n" + status
        exit(message.table_data, db)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details, table_data, db)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'ecp', form["key_id"].value)

    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message = "Could not retrieve item.\n" + dbResult['message']
        exit(message, table_data, db)

    result = dbResult['result']
    table_data = pmt_utils.dbToTableData(table_data, 'ecp', result[0])
    display_questionnaire(db, table_data, 'edit')
    pmt_utils.alertsArea(form, "Item data retrieved successfully")

    del_priv = pmt_utils.hasPriv(db, username, 'del_ecp')
    list_url = '/%s-cgi-bin/ecp_admin.pyc?performDbQuery=1' % (db_name)
    help_url = "/%s/html/ecp_intro.html" % db_name
    editFunctionButtons(form["key_id"].value, list_url, help_url, del_priv)

    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')

    pmt_utils.textbox(None, 'analyst_signature',
                      table_data['ecp']['analyst_signature']['value'], '40',
                      '40', None, None, 'hidden')
    pmt_utils.textbox(None, 'swm_analysis_signature',
                      table_data['ecp']['swm_analysis_signature']['value'],
                      '40', '40', None, None, 'hidden')
    pmt_utils.textbox(None, 'swm_completion_signature',
                      table_data['ecp']['swm_completion_signature']['value'],
                      '40', '40', None, None, 'hidden')
    pmt_utils.textbox(None, 'gccb_signature',
                      table_data['ecp']['gccb_signature']['value'], '40', '40',
                      None, None, 'hidden')
    pmt_utils.textbox(None, 'ccb_signature',
                      table_data['ecp']['ccb_signature']['value'], '40', '40',
                      None, None, 'hidden')
    pmt_utils.textbox(None, 'qa_completion_signature',
                      table_data['ecp']['qa_completion_signature']['value'],
                      '40', '40', None, None, 'hidden')
    pmt_utils.textbox(None, 'test_completion_signature',
                      table_data['ecp']['test_completion_signature']['value'],
                      '40', '40', None, None, 'hidden')
    pageEnd(table_data, db)
Esempio n. 5
0
def doEdit():

    status, table_data, db = pageInit("Edit", formJS=1)

    if status != 'success':
        message = "Could not connect to the database.\n" + status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'inventory', form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message = "Could not retrieve item to edit.\n" + dbResult['message']
        exit(message)

    result = dbResult['result']
    table_data = pmt_utils.dbToTableData(table_data, 'inventory', result[0])
    display_questionnaire(db, table_data, 'edit')
    pmt_utils.alertsArea(form, "Item data retrieved successfully")

    pmt_utils.textbox(
        None, 'prop_id_assigned_by_signature',
        table_data['inventory']['prop_id_assigned_by_signature']['value'],
        '40', '40', None, None, 'hidden')

    listing_url = '/%s-cgi-bin/inv_admin.pyc?performDbQuery=1' % (db_name)
    help_url = '/%s/html/sprsum.html' % (db_name)
    po_id = table_data['inventory']['po_id']['value']
    print '<input type=hidden name=po_id value="%s">' % po_id

    if form.has_key("return_to_po"):
        print '<input type=hidden name=return_to_po value=1>'
        java = "return goto_url('/%s-cgi-bin/po_admin.pyc?action=edit&key_id=%s')" % (
            db_name, table_data['inventory']['po_id']['value'])
        html = '<INPUT NAME="edit" type="button" value=" Return to PO " onClick="%s">' % java
        print '<BR><BR>'
        print html

    editFunctionButtons(form["key_id"].value, listing_url, help_url)
    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')

    pageEnd(table_data, db)
Esempio n. 6
0
def doEdit():

    status,table_data,db = pageInit('Edit',formJS=1)
    
    if status!='success':
        message="Could not connect to db.\n%s" % status
        exit(message)
        
    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(table_data,
							  'project_members',
							  form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message="Could not get project member data.\n%s" % dbResult['message']
        exit(message)

    result = dbResult['result']
    table_data=pmt_utils.dbToTableData(table_data,'project_members',result[0])
    pmt_utils.display_form(table_data,'project_members', 1,'useValues', 1, db)

    # get user privileges and display them
    sqlStatement = "select * from priviledges where " +\
                   "member_username='******'" % (result[0]['member_username'])
    dbResult = pmt_utils.executeSQL(db, sqlStatement)
    if dbResult['status'] != 'success':
        message="Could not get privileges from db.\n%s" % dbResult['message']
        exit(message,table_data,db)

    result = dbResult['result']
    table_data = pmt_utils.dbToTableData(table_data,'priviledges', result[0])
    displayPriviledges(result[0], table_data)
    pmt_utils.alertsArea(form,"Project member data retrieved successfully")

    listing_url= '/%s-cgi-bin/project_members_admin.pyc?performDbQuery=1' % (db_name)
    help_url='/%s/html/contactsum.html' % db_name
    pmt_utils.editFunctionButtons(form["key_id"].value,listing_url,help_url)
    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')
    
    pageEnd(table_data,db)
Esempio n. 7
0
def doEdit():
    status, table_data, db = pageInit('Edit', formJS=0)

    if status != 'success':
        message = "Could not connect to db.\n%s" % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'project_members', form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message = "Unable to get member data from db.\n" + dbResult['message']
        exit(message)

    result = dbResult['result']

    table_data = pmt_utils.dbToTableData(table_data, 'project_members',
                                         result[0])

    table_data['project_members']['member_username']['display'] = 'read-only'
    table_data['project_members']['member_password']['display'] = 'Hidden'
    table_data['project_members']['member_role']['display'] = 'read-only'

    pmt_utils.display_form(table_data, 'project_members', 1, 'useValues', 1,
                           db)
    pmt_utils.alertsArea(form, "Member data retrieved successfully")

    listing_url = '/%s-cgi-bin/contact_list.pyc?performDbQuery=1' % db_name
    help_url = '/%s/html/contactsum.html' % (db_name)
    editFunctionButtons(form['key_id'].value, listing_url, help_url)

    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')

    pageEnd(table_data, db)
Esempio n. 8
0
def doView():
    status, table_data, db = pageInit("View", formJS=1)
    if status != 'success':
        message = 'Could not connect to db.\n%s' % status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        exit(details)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'inventory', form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message = "Item data could not be retrieved.\n" + dbResult['message']
        exit(message)

    result = dbResult['result']
    table_data = pmt_utils.dbToTableData(table_data, 'inventory', result[0])
    display_questionnaire(db, table_data, 'read-only')

    listing_url = '/%s-cgi-bin/inv_admin.pyc?performDbQuery=1' % (db_name)
    help_url = '/%s/html/sprsum.html' % (db_name)
    emailButton(username, form['key_id'].value, listing_url, help_url)

    po_id = table_data['inventory']['po_id']['value']
    print '<input type=hidden name=po_id value="%s">' % po_id

    if form.has_key("return_to_po"):
        print '<input type=hidden name=return_to_po value=1>'
        java = "return goto_url('/%s-cgi-bin/po_admin.pyc?action=edit&key_id=%s')" % (
            db_name, table_data['inventory']['po_id']['value'])
        html = '<INPUT NAME="view" type="button" value=" Return to PO " onClick="%s">' % java
        print '<BR><BR>'
        print html

    pageEnd(table_data, db)
Esempio n. 9
0
def doEdit():

    status, table_data, db = pageInit('Edit', formJS=1)

    if status != 'success':
        message = "Could not connect to the database.\n" + status
        exit(message)

    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)
    if status != 'success':
        exit(details)

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'pai', form["key_id"].value)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        message = "Could not retrieve action item to edit.\n" + dbResult[
            'message']
        exit(message)

    result = dbResult['result']
    table_data = pmt_utils.dbToTableData(table_data, 'pai', result[0])
    pmt_utils.display_form(table_data, 'pai', 1, 'useValues', 1, db)

    pmt_utils.alertsArea(form, "Action item data retrieved successfully")

    listing_url = '/%s-cgi-bin/pai_admin.pyc?performDbQuery=1' % (db_name)
    help_url = '/%s/html/pai_intro.html' % (db_name)
    del_priv = pmt_utils.hasPriv(db, username, 'del_pai')
    editFunctionButtons(form["key_id"].value, listing_url, help_url, del_priv)

    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')

    pageEnd(table_data, db)
Esempio n. 10
0
def edit_project_info(performDbQuery=0, onLoad=None, queryFields=None):

    table_data = declarations.define_tables()
    print "<HTML>"
    print "<HEAD>"
    pmt_utils.javaScript("project_admin")
    pmt_utils.title("Project Administration")
    print "</HEAD>"

    pmt_utils.bodySetup(onLoad)
    pmt_utils.mainHeading('Project Administration')
    pmt_utils.subHeading('Project Info')
    pmt_utils.formSetup("project_admin", db_name, "project_admin",
                        "return submitForm(document.project_admin)")

    if username == None:
        pmt_utils.usernamePasswordDisplay()
        project_adminButtons(button_name='edit')
        pmt_utils.textbox(None, 'key_id', '1', '10', '10', None, None,
                          'hidden')
        pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
        pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')
        print "</FORM>"
        try:
            pmt_utils.trailer(table_data, db)
            db.close()
        except NameError:
            pass
        print "</BODY>"
        print "</HTML>"
        return

    dbResult = pmt_utils.connectDB(declarations.pmt_info['browser_username'],
                                   declarations.pmt_info['browser_password'],
                                   declarations.pmt_info['db_name'])

    # could not connect to db
    if dbResult['status'] != 'success':
        pmt_utils.alertsArea(
            form, "Can not connect to database,\n" + dbResult['message'])
        project_adminButtons()
        print "</FORM>"
        try:
            pmt_utils.trailer(table_data, db)
            db.close()
        except NameError:
            pass
        print "</BODY>"
        print "</HTML>"
        return

    db = dbResult['result']
    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)

    if status != 'success':
        print '<form method=post action=/%s-cgi-bin/project_admin.pyc>' % db_name
        pmt_utils.usernamePasswordDisplay(username)
        pmt_utils.alertsArea(form, 'Can not verify you as a valid user')
        print '<hr><input name=reload type=submit value="Query">'
        print '<input name=action value=edit type=hidden>'
        print '</form>'
        sys.exit()

    if pmt_utils.hasPriv(db, username, 'project_data') != 1:
        print '<form method=post action=/%s-cgi-bin/project_admin.pyc>' % db_name
        pmt_utils.usernamePasswordDisplay(username)
        msg = 'User %s does not have project admin privileges>' % username
        pmt_utils.alertsArea(form, msg)
        print '<hr><input name=reload type=submit value="Query">'
        print '<input name=action value=edit type=hidden>'
        print '</form>'
        sys.exit()

    if form.has_key('key_id'):
        key_id = form['key_id'].value
    else:
        key_id = '1'
    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'project_info', key_id)
    dbResult = pmt_utils.executeSQL(db, sqlStatement)
    if dbResult['status'] != 'success':
        msg = "Could not retrieve project information\n" + dbResult['message']
        pmt_utils.alertsArea(form, msg)
    else:
        result = dbResult['result']
        table_data = pmt_utils.dbToTableData(table_data, 'project_info',
                                             result[0])
        table_data['project_info']['id']['value'] = '1'
        pmt_utils.display_form(table_data, 'project_info', 1, 'useValues', 1,
                               db)
        pmt_utils.alertsArea(form,
                             "Project Information retrieved successfully")

    project_adminButtons(button_name='save')
    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')

    print "</FORM>"
    try:
        pmt_utils.trailer(table_data, db)
        db.close()
    except NameError:
        pass

    print "</BODY>"
    print "</HTML>"
Esempio n. 11
0
def doEdit():
    table_data = declarations.define_tables()
    print "<HTML>"
    print "<HEAD>"
    pmt_utils.generate_form_javascript(table_data, 'project_info',
                                       'project_admin', 0)
    pmt_utils.title("Project Info Administration")
    print "</HEAD>"

    pmt_utils.bodySetup()
    pmt_utils.mainHeading('Project Info Administration')
    pmt_utils.subHeading('Edit Project Info')
    pmt_utils.formSetup("project_admin", db_name, "project_admin",
                        "return submitForm(document.project_admin)")

    dbResult = pmt_utils.connectDB(declarations.pmt_info['browser_username'],
                                   declarations.pmt_info['browser_password'],
                                   declarations.pmt_info['db_name'])

    if dbResult['status'] != 'success':
        msg = "Could not connect to the database\n"
        pmt_utils.alertsArea(form, msg + dbResult['message'])
        sys.exit()

    db = dbResult['result']
    status, details = db_authentication.password_valid(db,
                                                       crypt_salt=db_name,
                                                       username=username,
                                                       password=password)
    if status != 'success':
        print '<form method=post action=/%s-cgi-bin/project_admin.pyc>' % db_name
        pmt_utils.usernamePasswordDisplay(username)
        pmt_utils.alertsArea(form, 'Can not verify you as a valid user')
        print '<hr><input name=reload type=submit value="Query">'
        print '<input name=action value=edit type=hidden>'
        print '</form>'
        sys.exit()

    if pmt_utils.hasPriv(db, username, 'project_data') != 1:
        print '<form method=post action=/%s-cgi-bin/project_admin.pyc>' % db_name
        pmt_utils.usernamePasswordDisplay(username)
        msg = 'User %s does not have project admin privileges' % username
        pmt_utils.alertsArea(form, msg)
        print '<hr><input name=reload type=submit value="Query">'
        print '<input name=action value=edit type=hidden>'
        print '</form>'
        sys.exit()

    sqlStatement = pmt_utils.selectAllColumnsSqlStatement(
        table_data, 'project_info', '1')
    dbResult = pmt_utils.executeSQL(db, sqlStatement)

    if dbResult['status'] != 'success':
        msg = "Could not retrieve project info to edit\n"
        pmt_utils.alertsArea(form, msg + dbResult['message'])
    else:
        result = dbResult['result']
        table_data = pmt_utils.dbToTableData(table_data, 'project_info',
                                             result[0])
        table_data['project_info']['id']['value'] = '1'
        pmt_utils.display_form(table_data, 'project_info', 1, 'useValues', 1,
                               db)
        pmt_utils.alertsArea(form, "Project Info retrieved successfully")

    project_adminButtons('save')
    pmt_utils.textbox(None, 'key_id', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'action', '', '10', '10', None, None, 'hidden')
    pmt_utils.textbox(None, 'item_no', '', '8', '8', None, None, 'hidden')
    print "</FORM>"
    pmt_utils.trailer(table_data, db)
    db.close()
    print "</BODY>"
    print "</HTML>"