コード例 #1
0
ファイル: inv_admin.py プロジェクト: scottlinuxden/pmt
def pageInit(subHeading=None, formJS=0):
    table_data = declarations.define_tables()
    print "<HTML>"
    print "<HEAD>"
    if formJS:
        pmt_utils.generate_form_javascript(table_data, 'inventory',
                                           'inv_admin', 0)
    else:
        pmt_utils.javaScript("inv_admin")
    pmt_utils.title("Inventory")
    print "</HEAD>"
    pmt_utils.bodySetup()
    pmt_utils.mainHeading('Inventory')
    if subHeading != None:
        pmt_utils.subHeading(subHeading)
    pmt_utils.formSetup("inv_admin", declarations.pmt_info['db_name'],
                        "inv_admin", "return submitForm(document.inv_admin)")

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

    if dbResult['status'] != 'success':
        db = None
        status = dbResult['message']
    else:
        db = dbResult['result']
        status = 'success'

    return status, table_data, db
コード例 #2
0
ファイル: passwd_admin.py プロジェクト: scottlinuxden/pmt
def display_form(form, alerts):

    username = ''
    current_password = ''
    new_password = ''
    verify_password = ''

    if form.has_key('username'):
        username = form['username'].value
    if form.has_key('current_password'):
        current_password = form['current_password'].value

    if form.has_key('new_password'):
        new_password = form['new_password'].value

    if form.has_key('verify_password'):
        verify_password = form['verify_password'].value

    print '<html><head><title>Password Maintenance</title></head>'
    #    print '<body bgcolor="#B7BAB7" TEXT="#000000">
    print '<body background="/%s/icons/circ_bg.jpg">' % (
        declarations.pmt_info['db_name'])
    #    print '<H1>Password Maintenance</H1>'
    pmt_utils.mainHeading('Maintenance')
    pmt_utils.subHeading('Change Password')

    print '<form action="/%s-cgi-bin/passwd_admin.pyc" method="POST" enctype="application/x-www-form-urlencoded">' % (
        declarations.pmt_info['db_name'])

    print '<TABLE BORDER=0>'

    print '<TR><TD><B>Username</B>:</TD><TD><input name="username" type="text" size="9" maxlength="9" value="%s"></TD></TR>' % (
        username)

    print '<TR><TD><B>Current Password:</B></TD><TD><input name="current_password" type="password" size="8" maxlength="8" value="%s"></TD></TR>' % (
        current_password)

    print '<TR><TD><B>New Password:</B></TD><TD><input name="new_password" type="password" size="8" maxlength="8" value="%s"></TD></TR>' % (
        new_password)

    print '<TR><TD><B>Verify Password:</B></TD><TD><input name="verify_password" type="password" size="8" maxlength="8" value="%s"></TD></TR>' % (
        verify_password)

    print '<TR><TD COLSPAN=2>'
    pmt_utils.alertsArea(form, alerts)
    print '</TD></TR>'

    print """</TABLE>
    <HR>
    <input name="submit" type="submit" value="Update Password">
    <p align="right"><A HREF="mailto:[email protected]">Contact Support Team</a>"""

    print """</form>
コード例 #3
0
def displayLogin(alert=None):
    print "<HTML>"
    print "<HEAD>"
    pmt_utils.javaScript("upload")
    pmt_utils.title("Upload")
    print "</HEAD>"
    pmt_utils.bodySetup()
    pmt_utils.mainHeading('Upload')
    pmt_utils.subHeading('Login')
    pmt_utils.formSetup("upload",declarations.pmt_info['db_name'],
    		    "upload","return submitForm(document.upload)")
    pmt_utils.usernamePasswordDisplay()
    if alert!=None:
        pmt_utils.alertsArea(form,alert)
    print "<hr><INPUT TYPE='submit' NAME='submit' value='Submit' >"
    if form.has_key('dest'):
        print '<INPUT TYPE=hidden NAME=dest value="%s">' % form['dest'].value
コード例 #4
0
ファイル: cvsweb.py プロジェクト: scottlinuxden/pmt
def displayLogin(form,alert=None):
	print "<HTML>"
	print "<HEAD>"
	pmt_utils.javaScript("cvsweb")
	pmt_utils.title("Development Library")
	print "</HEAD>"
	pmt_utils.bodySetup()
	pmt_utils.mainHeading('Development Library')
	pmt_utils.subHeading('Login')
	pmt_utils.formSetup("cvsweb",
			    db_name,
			    "cvsweb",
			    "return submitForm(document.cvsweb)")
	pmt_utils.usernamePasswordDisplay()
	if alert!=None:
		pmt_utils.alertsArea(form, alert)
	print "<hr><INPUT TYPE='submit' NAME='submit' value='Submit' >"
コード例 #5
0
def displayLogin(form, alert=None):
    print "<HTML>"
    print "<HEAD>"
    pmt_utils.javaScript("list_docs")
    pmt_utils.title("Data Item Listing")
    print "</HEAD>"
    pmt_utils.bodySetup()
    pmt_utils.mainHeading('Data Item Listing')
    pmt_utils.subHeading('Login')
    java = "return submitForm(document.list_docs)"
    pmt_utils.formSetup("list_docs", db_name, "list_docs", java)
    pmt_utils.usernamePasswordDisplay()
    if alert != None:
        pmt_utils.alertsArea(form, alert)
    print "<hr><INPUT TYPE='submit' NAME='submit' value='Submit' >"
    if form.has_key('directory'):
        if string.find(form['directory'].value, '..') >= 0:
            sys.exit()
        print "<INPUT TYPE='hidden' NAME='directory' "
        print "value='%s'>" % form['directory'].value
コード例 #6
0
ファイル: options.py プロジェクト: scottlinuxden/pmt
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
pmt_utils.htmlContentType()
form = pmt_utils.getFormData()
db_name=declarations.pmt_info['db_name']
username,password=pmt_utils.getUserPass(form)

print "<HTML>"
print "<HEAD>"
pmt_utils.title("Edit Project Options")
print "</HEAD>"
pmt_utils.bodySetup()
pmt_utils.mainHeading("Project Option Manager")
pmt_utils.subHeading("Add/Delete Options")

if username!=None:

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

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

    db=dbResult['result']
コード例 #7
0
def display_form(display_files=0,alerts=None):
    print "<HTML>"
    print "<HEAD>"
    pmt_utils.javaScript("doc_maintenance")
    pmt_utils.title("Documentation Maintenance")
    print "</HEAD>"
    pmt_utils.bodySetup()
    pmt_utils.mainHeading('Documentation Maintenance')
    pmt_utils.subHeading('Create and Delete Folders/Files')
    pmt_utils.formSetup("doc_maintenance",db_name,"doc_maintenance",None)

    dbResult=pmt_utils.connectDB(declarations.pmt_info['browser_username'],
                                 declarations.pmt_info['browser_password'],
                                 declarations.pmt_info['db_name'])
    if dbResult['status']!='success':
        exit(dbResult['message'])

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

    if not pmt_utils.hasPriv(db,username,'folder_admin'):
        msg="User %s does not have folder maintenance priviledges" % username
        exit(msg)
        
    print '<hr><br><CENTER><B>Delete Folders/Files</B></CENTER>'
    stripped_db=string.lower(string.strip(db_name))
    os.chdir(os.path.join('/home',stripped_db,'documents'))

    file_list = os_utils.walk_list_files(
        directory_name='.',
        list_only_files=0,
        exclude_list = [],
        include_file_type=1)

    if len(file_list) > 25:
        list_size = 25
    else:
        list_size = len(file_list)

    print '<BLINK><B>WARNING:</B></BLINK><br>'
    print 'Any folders or files that you select for deletion are '
    print 'permanently deleted.  You should have a local backup of '
    print 'any folders/files you delete in case you really did not mean '
    print 'to delete.  Backups are crucial.  You have been warned.'
    print '<p>Selecting a folder will delete the folder and all files '
    print 'under it including sub folders.  '
    print 'Select folder names with caution.'
    print '<p>Your deletes will not be confirmed.  '
    print 'When you press [Delete Folders/Files] your files are deleted.'

    print '<BR><CENTER><B>Select folders/files to delete</B>:<BR>'
    print '<SELECT NAME="files_to_remove" SIZE="8" MULTIPLE>'
    for curfile in file_list:
        print '<OPTION>%s' % (curfile)
    print "</SELECT><br>"
    java_call="return execute('delete_folder','1')"
    print '<input name="delete_folder" type="button" '
    print 'value=" Delete Folders/Files " onClick="%s">' % java_call
    print '<input name ="website_name_hidden" '
    print 'type="hidden" value="%s">' % (db_name)
    print "<hr><BR><BR>"

    print '<CENTER><B>Create Folder</B></CENTER><BR>'
    print '<B>Folder Name</B>:&nbsp;'
    print '<input name="folder" type="text" size="50" maxlength="100"><BR>'
    java_call="return execute('create','1')"
    print '<input name="create" type="button" '
    print 'value=" Create Folder " onClick="%s">' % java_call
    print '<input name ="website_name_hidden" '
    print 'type="hidden" value="%s"><hr>' % (db_name)

    if alerts != None:
        pmt_utils.alertsArea(form,alerts)

    print '</CENTER>'

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

    print '</form>'
    print '<p align="right">'
    print '<A HREF="mailto:[email protected]">Contact Support Team</a>'
    print "</body></html>"
コード例 #8
0
def display_form(display_files=0, alerts=None):
    print "<HTML>"

    print "<HEAD>"

    pmt_utils.title("Site Maintenance (Clean)")

    print "</HEAD>"

    pmt_utils.bodySetup()

    pmt_utils.mainHeading('Site Maintenance')

    pmt_utils.subHeading('Clean')

    pmt_utils.formSetup("clean_site", declarations.pmt_info['db_name'],
                        "clean_site", None)

    if not display_files:
        print '<TABLE BORDER=0><TR><TD><B>Username</B>:</TD><TD><input name="username" type="text" size="9" maxlength="9"></TD></TR><TR><TD><B>Password:</B></TD><TD><input name="password" type="password" size="8" maxlength="8"></TD></TR></TABLE>'

    if display_files:

        os.chdir(
            os.path.join(
                '/home',
                string.lower(string.strip(declarations.pmt_info['db_name'])),
                'documents'))

        file_list = os_utils.walk_list_files(directory_name='.',
                                             list_only_files=0,
                                             exclude_list=[],
                                             include_file_type=1)

        if len(file_list) > 25:
            list_size = 25
        else:
            list_size = len(file_list)

        print """
		<CENTER>
		<TABLE BORDER=0>
		<CAPTION><BLINK><B>WARNING:<B></BLINK></CAPTION>
		<TR><TD WIDTH=300>
		Any files that you select for deletion are permanently deleted.  You should have a local
		backup of any files you delete in case you really did not mean to delete.
		Backups are crucial.  You have been warned.
		<p>Selecting a directory will delete the directory and all files under it including subdirectories.
		Select directory names with caution.
		<p>Your deletes will not be confirmed.  When you press [Delete Selected Files] your files
		are deleted.</TD></TR></TABLE>
		"""
        print '<BR><CENTER><B>Select files to delete</B>:<BR><SELECT NAME="files_to_remove" SIZE="%d" MULTIPLE>' % (
            list_size)

        for curfile in file_list:
            print '<OPTION>%s' % (curfile)

        print "</SELECT><BR>"

    if alerts != None:
        pmt_utils.alertsArea(form, alerts)

    print '</CENTER>'

    print """
	<CENTER>
    <HR>
	"""

    if display_files:
        print '<input name="submit" type="submit" value="Delete Selected Files">'
    else:
        print '<input name="submit" type="submit" value="Login">'

    print '</CENTER>'

    if display_files:

        print '<input name ="website_name_hidden" type="hidden" value="%s">' % (
            declarations.pmt_info['db_name'])

    print """
コード例 #9
0
def sendDataItem(email):
    print "<HTML>"
    print "<HEAD>"
    pmt_utils.title("Email Data")
    print "</HEAD>"
    pmt_utils.bodySetup(onLoad=None)
    pmt_utils.mainHeading('Send Email')
    link = '/%s-cgi-bin/email.pyc' % declarations.pmt_info['db_name']
    print '<form method=post action=%s>' % link
    print '<table>'
    print '<tr><td>To:</td><td><input type=text name=to_box></td>'
    print '<tr><td>From:</td><td>'
    print '<input type=hidden name=from_box value="%s">%s</td>' % (email,
                                                                   email)
    print '<tr><td>Subject:</td><td><input type=text name=subject></td>'
    print '<tr><td>Comments:</td><td>'
    pmt_utils.textarea('', 'comments', '', '4', '20', None, None)
    print '</td></table><hr><table>'

    path, filename = os.path.split(form['fullpath'].value)
    index = string.find(path, 'documents')
    path = path[index + 9:]
    if path == '': path = '/'

    content = "An error has occurred while loading this page."
    if filename == "b00kmarkz":
        abs_filename = "/home/%s/documents/%s/b00kmarkz" % (db_name, path)
        bookmarks = open(abs_filename, 'r')
        lines = bookmarks.readlines()
        for line in lines:
            words = string.split(line)
            id = words[0]
            if id == form['id'].value:
                i = 3
                while words[i] != '|':
                    i = i + 1

                href = words[i + 1]
                content = 'The data item can be accessed from %s' % href
        bookmarks.close()
    else:
        content = 'The data item %s can be accessed from:\n' % form[
            'name'].value
        content = content + '/%s-cgi-bin/list_docs.pyc' % form['project'].value
        content = content + '?project_name=%s' % form['project'].value
        content = content + '&directory=%s' % path

    htmlContent = string.replace(content, '\n', '<br>')
    print htmlContent

    print '<input type=hidden name=content value="%s">' % urllib.quote(content)
    print '<input type=hidden name=username '
    print 'value="%s">' % username
    print '<input type=hidden name=project value="%s">' % form['project'].value
    print '<input type=hidden name=fullpath '
    print 'value="%s">' % form['fullpath'].value
    print '<input type=hidden name=name value="%s">' % form['name'].value

    link = '/%s-cgi-bin/email.pyc' % declarations.pmt_info['db_name']
    print '<HR><input type=submit name=send value="Send Email" '
    print 'onClick="return goto_url(' + "'" + link + "'" + ')">'
    print '</form>'
コード例 #10
0
if form.has_key('to_box'):
    #from email.py: send email
    pmt_utils.bodySetup(onLoad=None)
    sendEmail()

elif form.has_key('key') and form.has_key('table'):
    # from ecp,pai,spr: get recipient and subject

    table_data = declarations.define_tables()

    print "<HTML>"
    print "<HEAD>"
    pmt_utils.title("Email Data")
    print "</HEAD>"
    pmt_utils.bodySetup(onLoad=None)
    pmt_utils.mainHeading('Send Email')
    print '<hr>'

    db = pmt_utils.connectDB(declarations.pmt_info['browser_username'],
                             declarations.pmt_info['browser_password'],
                             declarations.pmt_info['db_name'])
    if db['status'] != 'success':
        print "Cannot connect to database"
        sys.exit
    else:
        db = db['result']

    sql = "select email from project_members "
    sql = sql + "where member_username='******'" % username

    email = pmt_utils.executeSQL(db, sql)
コード例 #11
0
ファイル: web_cvs_export.py プロジェクト: scottlinuxden/pmt
if db_name == 'save':
    cvs_db_name = 'ifc'
else:
    cvs_db_name = db_name
cvsroot = '/home/cvsroot/%s' % cvs_db_name
web_cvs_dir = '/home/%s/cvs_exports/' % db_name
encapsulation_types = ['tar']

#------------------------------------------------------------------------
if form.has_key('module_name'):

    print '<html><head>'
    pmt_utils.title("Web CVS Export")
    print '</head>'
    pmt_utils.bodySetup()
    pmt_utils.mainHeading("Web CVS Export")

    print '<TABLE BORDER=0>'
    print '<TR><TD>'

    if not form.has_key('encapsulation_type'):
        msg = "No encapsulation type specified"
        exit(msg)
    elif string.upper(string.strip(form['encapsulation_type'].value)) == 'TAR':
        module_filename = string.strip(form['module_name'].value) + '.tar.gz'
    elif string.upper(string.strip(form['encapsulation_type'].value)) == 'ZIP':
        module_filename = string.strip(form['module_name'].value) + '.zip'

    module_path = None
    module_list_file = cvsroot + '/CVSROOT/%s.modules' % db_name
    #print "<BR>module_list_file:%s<BR>" % module_list_file
コード例 #12
0
ファイル: project_admin.py プロジェクト: scottlinuxden/pmt
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>"
コード例 #13
0
ファイル: project_admin.py プロジェクト: scottlinuxden/pmt
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>"
コード例 #14
0
ファイル: project_admin.py プロジェクト: scottlinuxden/pmt
def doSave():
    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 = "Project Info could not be saved, could not connect to db\n"
        pmt_utils.alertsArea(form, msg + dbResult['message'])
        # generate function button row
        project_adminButtons('save')

        # generate hidden fields for form
        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>"
        return

    db = dbResult['result']

    # save the Form
    dbResult = pmt_utils.saveForm(table_data, db, None, "project_info",
                                  " WHERE id = '1'", form)

    # if the form was not successfully saved
    if dbResult['status'] != 'success':
        msg = "Project Info could not be saved due to an error during save,\n"
        pmt_utils.alertsArea(form, msg + dbResult['message'])
    else:
        table_data = declarations.define_tables()
        table_data = pmt_utils.formToTableData(table_data, 'project_info',
                                               form)
        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 successfully saved")

    # generate function button row
    project_adminButtons('save')

    # generate hidden fields for form
    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>"
コード例 #15
0
def display_form():
    print "<html>"
    print "<head>"
    print "<title>Documentation Maintenance</title></head>"
    print '<body background="/%s/icons/circ_bg.jpg">' % (db_name)

    pmt_utils.mainHeading("Upload")
    pmt_utils.subHeading("Single File, Zip, or Tarfile upload:")

    print '<P><form action="/%s-cgi-bin/upload.pyc" method="POST" enctype="multipart/form-data">' % db_name
    print '<TABLE BORDER=0>'

    # display the name of the data item
    print "<TR><TD><B>Data Item Name</B>:</TD><TD>"
    pmt_utils.textbox(None, 'name',  "", '40', '80',  None,  None)
    print "</TD></TR>"

    # display the version field
    print "<TR><TD><B>Version:</B></TD><TD>"
    pmt_utils.textbox(None,  'version',  "",  '40',  '80',  None,  None)
    print "</TD></TR>"

    # display the description field
    print "<TR><TD><B>Description:</B></TD><TD>"
    pmt_utils.textarea(None,   'description',   "",   '5',   '40',   None,   None)
    print "</TD></TR>"

    print '<TR><TD><B>Filename</B>:</TD>'
    print '<TD><input name="archive" type="file" size="40" maxlength="100"></TD></TR>'
    if form.has_key('dest'):
        dest=form['dest'].value
    else: dest=''
    print '<TR><TD><B>Destination Folder</B>:</TD><TD>'
    print '<input name="folder" type="text" size="40" maxlength="100" value="%s">' % dest
    print '</TD></TR></TABLE>'
    
    print '<input name="permissions" type="checkbox" value="permissions">'
    print 'Set file permissions after upload<BR>'

    print '<input name="extract" type="checkbox" value="extract">'
    print 'Extract archive on server<BR>'
    print '<input name="submit" type="submit" value="Upload File">'
    print '</form>'

    print '<HR>'

    print '<H3>Introduction</H3>'
    print '<P>This maintenance function will allow authorized users to upload a single file or file archive to their website.  The tar file may be compressed with gzip.  The archive file size when extracted should not'
    print 'exceed your maximum allowable disk space allotment for your site which is %d MB (%d bytes).  If this happens all files that exceed the allotment will not be stored in your website.  It is therefore suggested that you maintain a complete copy of your site locally and change your local copy to how you would like it on www.isrparc.org, create the archive of your local copy and upload the archive to www.isrparc.org.  The archive filename should end with .zip, .tar.gz, or .tgz</P>' % (upload_ceiling/(1024*1024),upload_ceiling)

    print '<P>You may upgrade your disk space allotment via an e-mail request to the www.isrparc.org <A HREF="mailto:[email protected]">support team</A>.</P>'
    print '<H3>Directions for Uploading Archives</H3>'
    print '<P>You may upload a winzip, gzip, or tar file to your website.'
#    print 'The contents of the archive should match the following directory tree structure, in other words the directories listed below should be the top level directories when the archive is created.</P>'
    print '<P>All files including files in zip and tar archive should not have spaces in their name.</P>'
    print '<P>Filenames can have mixed case and are not governed by an 8.3 filename name specification.'
#    print '<P>If the file you are uploading is not a zip or tar archive, the file will be placed in the documents directory for the website you specify.'
#    print '<P>Allowable subdirectories in your archive file</P>'
#    print '<UL>'
#    print '<LI>documents'
#    print '</UL>'
#    print '<P>NOTE: Do <b>NOT</B> put a subdirectory called cgi-bin in your archive file. This can damage the Documentation Management engine at your website, if installed.</P>'
#    print '<P>Example (Windows 9x Systems at MS-DOS prompt):</p>'
#    print 'cd C:\<BR>'
#    print 'mkdir website<BR>'
#    print 'cd C:\website<BR>'
#    print 'mkdir documents<BR>'
#    print '<P>Put all of your document files: MS Word, Excel, Power Point, Adobe Acrobat, ASCII text under the documents directory'
#    print '<p>zip all files under c:\website directory but do not zip the directory c:\website</p>'
#    print '<P>If your archive has other directories in it besides the above mentioned names, these directories will not be accessed by the www.isrparc.org server and will be merely wasting your websites disk space allotment.  This Site Maintenance Upload program does not check the integrity of your archive file so it is imperative that you specify your archive as mentioned above.  Future updates will verify the contents of the archive file you are uploading.</P>'
    print '<p align="right"><A HREF="mailto:[email protected]">Contact Support Team</a>'


    print '</body>'
    print '</html>'