Example #1
0
      print '<tr class="evenTableRow">'
    print '<td>' + deals[i].vendor.encode('utf-8') + '</td>'
    print '<td>' + deals[i].itemName.encode('utf-8') + '</td>'
    print '<td>' + deals[i].itemDescription.encode('utf-8') + '</td>'
    if deals[i].isMyDeal:
      print '<td><a href="javascript:void(0)" onclick="removeDealFromList(\'' + str(deals[i].key()) + '\');"><img src="/img/remove.png" alt="Remove Deal" /></a></td>'
    else :
      print '<td><a href="javascript:void(0)" onclick="addDealFromList(\'' + str(deals[i].key()) + '\');"><img src="/img/add.png" alt="Add Deal" /></a></td>'
    print '</tr>'
  print '</table>'

print 'Content-Type: text/html \n'

form = cgi.FieldStorage()
showMyDeals = form.getfirst("myDeals", "no")
searchString = form.getfirst("search", "")

if showMyDeals == 'yes':
  myDeals = shopplyDeals.getAllMyDeals(searchString)
  if myDeals:
    dealsToTable(myDeals)
  else:
    print "<h1>You don't have any saved deals</h1>"
else:
  myDeals = shopplyDeals.getAllDeals(searchString)
  if myDeals:
    dealsToTable(myDeals)
  else:
    print "<h1>Your search generated no results.</h1>"

Example #2
0
#!/usr/bin/env python

import shopplyDeals

print 'Content-Type: text/html \n'
print '<div id="container">'

allDeals = shopplyDeals.getAllDeals("")
objectCount = 0

for deal in allDeals:
  print '<div class="coverflow" id="object' + str(objectCount) + '" title="' + str(deal.key()) + '" onclick="moveCenter(' + str(objectCount) + ');">'
  print '<div class="vendorLogo"><img src="' + deal.vendorGraphic.encode('utf-8') + '" alt="' + deal.vendor.encode('utf-8') + '" /></div>'
  print '<div class="itemGraphic"><img src="' + deal.itemGraphic.encode('utf-8') + '" alt="' + deal.itemName.encode('utf-8') + '" /></div>'
  print '<div class="itemName">' + deal.itemName.encode('utf-8') + '</div>'
  print '<div class="itemDescription">' + deal.itemDescription.encode('utf-8') + '</div>'
  print '<div class="averageSavings">Average saving: $' + str(deal.averageSavings) + '</div>'
  print '</div>'
  objectCount += 1

print '</div>'

print '<div id="browseLinks">'
print '<div class="arrowLink">'
print '<a href="javascript:void(0)" onclick="moveLeft();"><img src="/img/moveLeft.png" alt="Move Left" /></a>'
print '</div>'
# print '<div id="addToDeals" onclick="addToDeals();">'
# print 'Add to Deals'
# print '</div>'
print '<div class="arrowLink">'
print '<a href="javascript:void(0)" onclick="addToDeals();"><img src="/img/addToDeals.png" alt="Add To Deals" /></a>'