Esempio n. 1
0
File: app.py Progetto: pnjha/DropBox
def search():

    userId = RetrieveSessionDetails('userId')
    fileName = request.form.get('fileName')

    print("sddfffffffffffffffffffffffffffffffffffffffffffff1",fileName)
    print("sddfffffffffffffffffffffffffffffffffffffffffffff2",userId)

    UserData = BusinessLayer.searchFile(userId,fileName)
    
    print("sddfffffffffffffffffffffffffffffffffffffffffffff",UserData)

    if UserData != None:

        userclassInstance = UserClass()
        userclassInstance.setUserDetails(RetrieveSessionDetails('userId'),
        RetrieveSessionDetails('userName'),"passwd","name","email","phone")
        userclassInstance.setCurrentFolderId("0")
        userclassInstance.setCurrentFolderName("Search Result")
        userclassInstance.setHomeFolderId(RetrieveSessionDetails('homeFolderId'))

        UserData['UserDetails'] = userclassInstance        
        print("Search Result: ",UserData['FileDetails'][0].filename)

        return render_template('index.html',**UserData)

    else:
        homeFolder = BusinessLayer.getHomeFolderId(userId)
        return redirect(url_for('index',folderId = homeFolder.folderid))
Esempio n. 2
0
def search():

    userId = RetrieveSessionDetails('userId')
    fileName = request.form.get('fileName')

    if fileName == '':
        currentFolderId = RetrieveSessionDetails('currentFolderId')
        return redirect(url_for('index', folderId=currentFolderId))

    UserData = BusinessLayer.searchFile(userId, fileName)

    if UserData != None:
        # UserData['searchStatus'] = 'True'

        userclassInstance = UserClass()
        userclassInstance.setUserDetails(RetrieveSessionDetails('userId'),
                                         RetrieveSessionDetails('userName'),
                                         "passwd", "name", "email", "phone")
        userclassInstance.setCurrentFolderId("0")
        userclassInstance.setCurrentFolderName("Search Result")
        userclassInstance.setHomeFolderId(
            RetrieveSessionDetails('homeFolderId'))

        UserData['UserDetails'] = userclassInstance
        UserData["AllFilesource"] = "NotAllFileSource"
        UserData["sourceParameter"] = "searchSource"

        print("Search Result: ", UserData['FileDetails'][0].filename)
        return render_template('index.html', **UserData)
        # return redirect(url_for('indexSearch',folderId = homeFolder.folderid))

    else:
        homeFolder = BusinessLayer.getHomeFolderId(userId)
        # UserData['searchStatus'] = 'False'
        AddToSession('searchResult', 'False')
        return redirect(url_for('index', folderId=homeFolder.folderid))