예제 #1
0
def display():
    form = cgi.FieldStorage()

    page = FDH_page()
    page.init(css = ('/styles/image.css'))
    page.script(src='/javascript/popupmenu.js', type='text/javascript')
    page.script.close()
    page.script(src='/javascript/image_menu.js', type='text/javascript')
    page.script.close()

    try:
        src = form['src'].value
        username = ''
        if 'username' in form:
            username = form['username'].value
        user_id = form['user_id'].value
        photo_id = form['photo_id'].value

        page.img(src=src, id=photo_id)
        page.script('setMenu("%s");'%(photo_id), type="text/javascript")

        return page
    except Exception, e:
        page.p(e.message)
        return page
예제 #2
0
if user:
    user = api.getUserFromAll()
    page.h3(user['username'], onclick='alert("'+user['id']+'");')
    page.a('rss', href='rss.py?user_id=%s'%(user['id']),)
    page.br()
    photos = api.getUserPhotos(user['id'])
    existing = Existing().grepPhotosExists(photos)
    existing_ids = map(lambda e:e['id'], existing)
    urls = api.getPhotoURLFlickr(photos, True, True)
    for id in urls:
        if id in existing_ids:
            style = 'border:1px red solid;'
        else:
            style = 'border:1px blue solid;'
        page.img(src=urls[id], width=100, height=80, alt=id, onclick='alert("'+id+'");', style=style)
else:
    page.h3("showing last photos of your contacts")

#     params = {"contacts":"ff", "min_upload_date":"1287399869", "extra":"url_sq"}
#     photos = api.searchPhotos(params)
    photos = api.getContactsLatestPhotos()
    p = {}
    for photo in photos:
        p[photo['id']] = photo['owner']
    urls = api.getPhotoURLFlickr(photos, True, True)

    for id in urls:
        page.img(src=urls[id], width=100, height=80, alt=id, onclick='alert("user: '******'; image: '+id+'");')

print page