示例#1
0
def userProfile(username):
   userFile = open("html/userProfile.html", "r")
   userPage = userFile.read()
   userFile.close()
   
   #listener = ""
   if userActions.isListeningTo(username):
      listenFile = open("html/unlisten.html")
      listener = listenFile.read()
      listener = listener % {"username":username}
   else:
      listenFile = open("html/listen.html")
      listener = listenFile.read()
      
   listenFile.close()
   listener = listener % {"username":username}
   
   bleatFile = open("html/bleat.html", "r")
   bleatHTML = bleatFile.read()
   bleatFile.close()
   
   
   bleatArr = bleatActions.viewAllBleatsByUser(username)
   bleatString = ""
   
   for bleat in bleatArr:
      userProfilePic = userActions.getProfilePic(str(bleat[1]))
      bleatString += bleatHTML % {"bleatid":str(bleat[0]),"username":str(bleat[1]), "time":str(bleat[2]), "longitude":str(bleat[3]),
      "latitude":str(bleat[4]), "bleat":str(bleat[5]), "inReplyTo":str(bleat[6]), "profilepic":userProfilePic}
   
   user, = userActions.getUserInfoByUserName(username)
   
   return userPage % {"username":username, "fullName":str(user[3]), "bleats":bleatString, "listener":listener, "profilepic":str(user[8]), "homeLatitude":str(user[4]), "homeLongitude":str(user[5]), "homeSuburb":str(user[6]), "profileText":str(user[10])}
示例#2
0
def userHome(username):
   #retrieving the html to print
   userHomeFile = open("html/userHome.html", "r")
   userHome = userHomeFile.read()
   userHomeFile.close()
   
   bleatFile = open("html/bleat.html", "r")
   bleatHTML = bleatFile.read()
   bleatFile.close()
   
   userArr = userActions.getUserInfoByUserName(username)
   userInfo = userArr[0]
   
   #bleatArr = bleatActions.viewAllBleatsByUser(username)
   bleatArr = bleatActions.viewAllRelevantBleats(username)
   bleatString = ""
   
   for bleat in bleatArr:
      userProfilePic = userActions.getProfilePic(str(bleat[1]))
      bleatString += bleatHTML % {"bleatid":str(bleat[0]), "username":str(bleat[1]), "time":str(bleat[2]), 
         "longitude":str(bleat[3]), "latitude":str(bleat[4]), "bleat":str(bleat[5]),
         "inReplyTo":str(bleat[6]), "profilepic":userProfilePic}
   
   #print userHome % { "user":str(userInfo[0]), "fullName":str(userInfo[3]), "bleats": bleatString}
   return userHome % { "bleats": bleatString, "user":str(userInfo[0]), "fullName":str(userInfo[3]),
                        "profilepic":str(userInfo[8]), "homeLatitude":str(userInfo[4]), "homeLongitude":str(userInfo[5]), "homeSuburb":str(userInfo[6]), "profileText":str(userInfo[10])}
示例#3
0
def reply(replyToID):
    bleatArr = bleatActions.getBleatByID(replyToID)
    bleat = bleatArr[0]  #since the return is a list, getting the first element

    bleatFile = open("html/bleatOnly.html")
    bleatHTML = bleatFile.read()
    bleatFile.close()

    user, = userActions.getUserInfoByUserName(str(bleat[1]))

    bleatHTML = bleatHTML % {
        "username": str(bleat[1]),
        "time": str(bleat[2]),
        "longitude": str(bleat[3]),
        "latitude": str(bleat[4]),
        "bleat": str(bleat[5]),
        "inReplyTo": str(bleat[6]),
        "profilepic": str(user[8])
    }

    replyFile = open("html/reply.html", "r")
    replyPage = replyFile.read()
    replyFile.close()

    return replyPage % {"bleat": bleatHTML, "bleatID": replyToID}
示例#4
0
def userProfile(username):
    userFile = open("html/userProfile.html", "r")
    userPage = userFile.read()
    userFile.close()

    #listener = ""
    if userActions.isListeningTo(username):
        listenFile = open("html/unlisten.html")
        listener = listenFile.read()
        listener = listener % {"username": username}
    else:
        listenFile = open("html/listen.html")
        listener = listenFile.read()

    listenFile.close()
    listener = listener % {"username": username}

    bleatFile = open("html/bleat.html", "r")
    bleatHTML = bleatFile.read()
    bleatFile.close()

    bleatArr = bleatActions.viewAllBleatsByUser(username)
    bleatString = ""

    for bleat in bleatArr:
        userProfilePic = userActions.getProfilePic(str(bleat[1]))
        bleatString += bleatHTML % {
            "bleatid": str(bleat[0]),
            "username": str(bleat[1]),
            "time": str(bleat[2]),
            "longitude": str(bleat[3]),
            "latitude": str(bleat[4]),
            "bleat": str(bleat[5]),
            "inReplyTo": str(bleat[6]),
            "profilepic": userProfilePic
        }

    user, = userActions.getUserInfoByUserName(username)

    return userPage % {
        "username": username,
        "fullName": str(user[3]),
        "bleats": bleatString,
        "listener": listener,
        "profilepic": str(user[8]),
        "homeLatitude": str(user[4]),
        "homeLongitude": str(user[5]),
        "homeSuburb": str(user[6]),
        "profileText": str(user[10])
    }
示例#5
0
def reply(replyToID):
   bleatArr = bleatActions.getBleatByID(replyToID) 
   bleat = bleatArr[0]  #since the return is a list, getting the first element
   
   bleatFile = open("html/bleatOnly.html")
   bleatHTML = bleatFile.read()
   bleatFile.close()
   
   user, = userActions.getUserInfoByUserName(str(bleat[1]))
   
   bleatHTML = bleatHTML % {"username":str(bleat[1]), "time":str(bleat[2]), "longitude":str(bleat[3]),
      "latitude":str(bleat[4]), "bleat":str(bleat[5]), "inReplyTo":str(bleat[6]), "profilepic":str(user[8])}
   
   replyFile = open("html/reply.html", "r")
   replyPage = replyFile.read()
   replyFile.close()
   
   return replyPage % {"bleat":bleatHTML, "bleatID":replyToID}
示例#6
0
def userHome(username):
    #retrieving the html to print
    userHomeFile = open("html/userHome.html", "r")
    userHome = userHomeFile.read()
    userHomeFile.close()

    bleatFile = open("html/bleat.html", "r")
    bleatHTML = bleatFile.read()
    bleatFile.close()

    userArr = userActions.getUserInfoByUserName(username)
    userInfo = userArr[0]

    #bleatArr = bleatActions.viewAllBleatsByUser(username)
    bleatArr = bleatActions.viewAllRelevantBleats(username)
    bleatString = ""

    for bleat in bleatArr:
        userProfilePic = userActions.getProfilePic(str(bleat[1]))
        bleatString += bleatHTML % {
            "bleatid": str(bleat[0]),
            "username": str(bleat[1]),
            "time": str(bleat[2]),
            "longitude": str(bleat[3]),
            "latitude": str(bleat[4]),
            "bleat": str(bleat[5]),
            "inReplyTo": str(bleat[6]),
            "profilepic": userProfilePic
        }

    #print userHome % { "user":str(userInfo[0]), "fullName":str(userInfo[3]), "bleats": bleatString}
    return userHome % {
        "bleats": bleatString,
        "user": str(userInfo[0]),
        "fullName": str(userInfo[3]),
        "profilepic": str(userInfo[8]),
        "homeLatitude": str(userInfo[4]),
        "homeLongitude": str(userInfo[5]),
        "homeSuburb": str(userInfo[6]),
        "profileText": str(userInfo[10])
    }