<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()
Beispiel #2
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()
Beispiel #3
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()
Beispiel #4
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()
Beispiel #5
0
            redirect('http://127.0.0.1/cgi-bin/allResourcesRequests.py')
        break
else:
    content = """
    <h2 align="center" style='color:white'>Неправильний логін або пароль.Спробуйте ще раз</h2>
	<div style='height:20%;width:60%;margin-left:15%;margin-top:20px;'>
	<div style='width:380px;height:120px;margin-left:30%;margin-top:80px;background-color:#FC0;text-align:center;padding:20px;'>
	                           <h2 style='margin-top:-10px;'>Авторизація</h2>
						<form action="auth.py" method="post">
									<p><b style='padding-right:57.5px;float:left;font-size:20px;margin-left:0px;'>Логін:</b>
                                      <input charset="cp1251" type="text" style="float:right;" name="login" size="30">
                                   </p>
                                   <br/>
                                   <p><b style='padding-right:57.5px;float:left;font-size:20px;'>Пароль:</b>
                                      <input charset="cp1251" type="password" style="float:right;" name="password" size="30">
                                   </p>
                                   <br/>
                                   <p style='margin-top:15px;margin-left:306px;'><input charset="cp1251" type="submit"
                                       style='height:20pt;font:14pt sans-serif; margin: 2pt; margin-right: 25%;text-align:center;
                                       background-color:blue;color:white;border-collapse:collapse;' value="Увійти"></p>
						</form>
				</div>
	</div>
"""
    blocks.enc_print(
        blocks.page %
        (blocks.styles, 'Авторизація', blocks.header, content, blocks.footer))

dictToShelve(db, shlv)
shlv.close()
Beispiel #6
0
form = cgi.FieldStorage()

firstName = form['firstName'].value
secondName = form['secondName'].value
surName = form['surName'].value
age = int(form['age'].value)
email = form['email'].value
phone = form['phone'].value
categories = []
for category in ["B", "C1", "C", "D1", "D"]:
    if category in form.keys(): categories.append(category)
note = form['note'].value if 'note' in form.keys() else ""

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

db['requests'].append(
    Request(firstName, secondName, surName, age, email, phone, categories,
            note))

blocks.startPage()
blocks.enc_print(blocks.page % (
    blocks.styles +
    '<meta http-equiv="refresh" content="4;URL=http://127.0.0.1/cgi-bin/index.py">',
    'Дякуємо за відправлення', blocks.header, blocks.thanksContent,
    blocks.footer))

dictToShelve(db, shlv)
shlv.close()
Beispiel #7
0
import blocks

blocks.startPage()
blocks.enc_print(
    blocks.page %
    (blocks.styles, "VHelp", blocks.header, blocks.mainContent, blocks.footer))
Beispiel #8
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()
Beispiel #9
0
import blocks

blocks.startPage()
blocks.enc_print(blocks.page %
                 (blocks.styles, 'Відправити заявку', blocks.header,
                  blocks.registrationForm, blocks.footer))
Beispiel #10
0
    page = adminPage.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.storageCoordinatorsHeader, page, blocks.adminFooter))

elif type(db['logined']).__name__ == 'Volunteer' or type(
        db['logined']).__name__ == 'Driver':
    ID = db['logined'].storageID
    storage = db['storages'][ID]

    for resource in storage.resources:
        resources += rootResourcesString % (
            resource.name, resource.kind, str(
                resource.quantity), str(resource.mass), str(resource.volume))
    for volunteerID in storage.volunteers:
        volunteer = db['volunteers'][volunteerID]
        if type(volunteer).__name__ == 'Volunteer':
            volunteers += rootVolunteersString % (
Beispiel #11
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()
Beispiel #12
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()