示例#1
0
   <input charset="cp1251" type="text" style="float:right;" name="firstName" size="40">
  </p>
  <p><b style='padding-right:30px;'>По-батькові:</b>
   <input charset="cp1251" type="text" style="float:right;" name="secondName" size="40">
  </p>
  <p><b style='padding-right:10px;'>Прізвище:</b>
   <input charset="cp1251" type="text" style="float:right;" name="surName" size="40">
  </p>
  <p><b style='padding-right:82.5px;'>Вік:</b>
   <input charset="cp1251" type="text" style="float:right;" name="age" size="40">
  </p>
  <p><b style='padding-right:57.5px;'>Логін:</b>
   <input charset="cp1251" type="text" style="float:right;" name="login" size="40">
  </p>
  <p><b style='padding-right:40px;'>Пароль:</b>
   <input charset="cp1251" type="text" style="float:right;" name="password" size="40">
  </p>
  <input charset="cp1251" type="submit" style="height:20pt;font:14pt sans-serif; margin: 2pt; margin-right: 0%;text-align:center;margin-top:5px;
                                       background-color:blue;color:white;border-collapse:collapse;" value="Додати">
</form>
</DIV>
"""

blocks.startPage()
import shelve
db = shelve.open("db")
blocks.enc_print(blocks.page %
                 (blocks.styles, 'Додати ресурс',
                  blocks.getHeader(db['logined']), form, blocks.adminFooter))
db.close()
示例#2
0
<tr style="font-size:18px;text-align:center;">
					<td width="80px">%s</td>
					<td width="200px">%s</td>
					<td width="150px">%s</td>
					<td width="100px">%s</td>
				</tr>

"""

requests = """"""

db = shelve.open("db")
i = 0
for request in db['resourcesRequests']:
    requests += "<br />"
    strings = """"""
    for resource in request.resources:
        strings += rootResourceString % (resource.code, resource.name,
                                         resource.kind, resource.quantity)
    requests += rootResourcesRequestString % (request.location,
                                              str(len(request.resources)),
                                              resourcesTable % strings, str(i))
    i += 1

blocks.startPage()
blocks.enc_print(
    blocks.page %
    (blocks.styles, "Заявки на ресурси", blocks.getHeader(
        db['logined']), content % requests, blocks.adminFooter))

db.close()
示例#3
0
for response in responses:
    driver = response[0]
    car = response[1]
    mass = response[2]
    RaceResponses += rootRaceResponseString % (
        "%s %s %s" % (driver.firstName, driver.secondName, driver.surName),
        car.name, str(mass))

if random.randint(0, 1):
    for i in range(len(db['storages'][ID].carpark)):
        if db['storages'][ID].carpark[i].status == "В дорозі" and db[
                "storages"][ID].carpark[i] in [
                    response[1] for response in responses
                ]:
            db['storages'][ID].carpark[i].status = "Вільний"
            break

f = open("response.html", "w")
html = page % (blocks.styles, "Звіт відправленого рейсу",
               blocks.getHeader(db['logined']), raceResponsePage %
               (location1, location2, location1, location2, RaceResponses),
               blocks.adminFooter)

f.buffer.write(html.encode('utf8') + b'\n')
f.close()

dictToShelve(db, shlv)
shlv.close()

blocks.startPage()
redirect("http://127.0.0.1/response.html")
示例#4
0
import sys, blocks, shelve, cgi
from structures import *

ID = cgi.FieldStorage().keys()[0]

shlv = shelve.open("db")
db = shelveToDict(shlv)

blocks.startPage()
blocks.enc_print(
    blocks.page %
    (blocks.styles, 'Склад №' + str(ID), blocks.getHeader(db['logined']),
     blocks.genStorageContent(db, int(ID)), blocks.adminFooter))

dictToShelve(db, shlv)
shlv.close()
示例#5
0
import blocks, sys, shelve

content = """
<DIV class='regisform' id='registrationContainerResurses' > 
		<h1 style='text-align:center;padding-top:20px;'>Заявка на ресурси</h1> 
		<form method="post" action="resourcesRequest2.py"> 
			<div style='padding:5px;'> 
				<p>
					<b style='padding-right:75px;'>Адреса пункту потреби :</b> 
					<input charset="cp1251" type="text" style="float:right;" name="location" size="30" charset="cp1251" /> 
				</p> 
				<p>
					<b style='padding-right:30px;'>Кількість найменувань товару :</b> 
					<input charset="cp1251" type="text" style="float:right;margin-top:-20px;" name="n" size="30" charset="cp1251"/> 
				</p> 
			</div> 
			
			<p><input charset="cp1251" type="submit" class="ButtonStoradge" value="Відправити" charset="cp1251" /></p> 
		</form> 
		"""
db = shelve.open("db")

blocks.startPage()
blocks.enc_print(blocks.page %
                 (blocks.styles, "Заявка на ресурси",
                  blocks.getHeader(db['logined']), content, blocks.footer))

db.close()
示例#6
0
strings = """<form action="delNeed.py" method="post"></form>"""

blocks.startPage()

shlv = shelve.open("db")
db = shelveToDict(shlv)
if type(db['logined']).__name__ == 'MainCoordinator':
    i = 0
    for need in db['needs']:
        strings += rootAdminString % (need.name, need.kind, need.quantity,
                                      str(i), str(i))
        i += 1
    adminPage = adminPage.replace('$Strings$', strings)
    blocks.enc_print(
        blocks.page %
        (blocks.styles, 'Потреби волонтерської організації',
         blocks.getHeader(db['logined']), adminPage, blocks.adminFooter))
else:
    for need in db['needs']:
        strings += rootString % (need.name, need.kind, str(need.quantity))
        footer = blocks.footer if db['logined'] is None else blocks.adminFooter

    blocks.enc_print(blocks.page %
                     (blocks.styles, 'Потреби волонтерської організації',
                      blocks.getHeader(db['logined']),
                      table.replace('$Strings$', strings), footer))

dictToShelve(db, shlv)
shlv.close()
示例#7
0
    page = page.replace('$Header$', '')
    page = page.replace('$ID$', str(ID))
    page = page.replace(
        '$MainCoord$', ' '.join([
            db['volunteers'][storage.coordinator].firstName,
            db['volunteers'][storage.coordinator].secondName,
            db['volunteers'][storage.coordinator].surName
        ]))
    page = page.replace('$Roomines$', str(int(storage.roomines)))
    page = page.replace('$Resources$', resources)
    page = page.replace('$Volunteers$', volunteers)
    page = page.replace('$Drivers$', drivers)
    page = page.replace('$Carpark$', carpark)

    blocks.enc_print(
        blocks.page %
        (blocks.styles, 'Cклад № %s' % str(ID), blocks.getHeader(
            db['logined']), page, blocks.adminFooter))

else:
    if type(db['logined']).__name__ == 'HumanResourcesCoordinator':
        redirect('http://127.0.0.1/cgi-bin/requests.py')
    elif type(db['logined']).__name__ == 'MainCoordinator':
        redirect('http://127.0.0.1/cgi-bin/globalResources.py')
    else:
        if db['logined'] is None: redirect('http://127.0.0.1/cgi-bin/login.py')
        else: redirect('http://127.0.0.1/cgi-bin/index.py')

dictToShelve(db, shlv)
shlv.close()
示例#8
0
        content+="<br/>"
        
for person in db['volunteers'].values() :
    cval = type(person).__name__
    if cval =='HumanResourcesCoordinator' :
        content+=blocks.administrator%(person.firstName,person.secondName,person.surName,str(person.age),"Кадровий координатор")
        content+="<br/>"

for person in db['volunteers'].values() :
    cval = type(person).__name__
    if cval =='StorageCoordinator' :
            content+=blocks.storageCoordinator%(person.firstName,person.secondName,person.surName,str(person.age),db['storages'][person.storageID].address)
            content+="<br/>"

for person in db['volunteers'].values() :
    cval = type(person).__name__
    if cval =='Driver' :
        content+=blocks.driver%(person.firstName,person.secondName,person.surName,str(person.age),','.join(person.categories),db['storages'][person.storageID].address)
        content+="<br/>"
        
for person in db['volunteers'].values() :
    cval = type(person).__name__
    if cval =='Volunteer' :
        content+=blocks.volunteer%(person.firstName,person.secondName,person.surName,person.age,db['storages'][person.storageID].address)
        content+="<br/>"
        
blocks.enc_print(blocks.page%(blocks.styles,'Список волонтерів',blocks.getHeader(db['logined']),content,blocks.footer))

dictToShelve(db,shlv)
shlv.close()
示例#9
0
					   dkK8/S1j7boVV6nn08cgljOPPvzcUU88Dhm0ine3WIfEU+W6BdWAYPjAMHxiGDwzDB4bhA8PwgWH4wFCR851POhBPq5AasmZEAcmOt3/QGqZ3Fif7k8JQCRgqAUMYwlALGCoBQxjCUAsYKgFDGMJQ
					   CxgqAUMYwlALGCoBQxjCUAsYKgFDGMJQCxgqAUMYwlALGCoBQxjCUAvSk11sQWJIe5wu2hI+TmxJDNeU55LfohfCrYBEnw4vCY+W5y/RnvCUbEJzVeOc8PaDeh5FW7LfRE71LR+6ry2JZUT4hTFG9
					   imfEdUdHYx9/ar2NDcO5ILuqu35E0kVRbE/PG+6rE0fyJJ6Tfn5vl27Mr0sh+X19ucOl/nLm9HTnjYV9ZX3WdUYNel5+7L/etBfI417L1F5JDgAAAAASUVORK5CYII='
					   height='150' width='160'></DIV>
		<DIV class='driversGroup'>
			<p style='font-size:33px;color:#000080'>Склад № %s</p>
			<p style='font-size:18px;'>Адреса:</p><p style='font-size:18px;'> %s</p>
			<form action="genStorage.py" method="post">
				<a href="#"><input charset="cp1251" class='ButtonStoradge' name="%s" type="submit" value="Показати більше" /></a>
			</form>
		</div>	
	  </div>
"""

db = shelve.open("db")

storageList = """"""
for storage in db['storages'].values():
    storageList += rootStorageView % (storage.ID, storage.address, storage.ID)

if type(db['logined']).__name__ == 'MainCoordinator':
    storageList += '<a href="addStorage.py" style="color:#FF0000">Додати склад</a>'

blocks.startPage()
blocks.enc_print(
    blocks.page %
    (blocks.styles, 'Список складів', blocks.getHeader(
        db['logined']), storageList, blocks.adminFooter))

db.close()