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))
def index(folderId): userId = RetrieveSessionDetails('userId') AddToSession('currentFolderId', folderId) foldername = BusinessLayer.getPathForFolder(userId, folderId) foldername = foldername[:-1] AddToSession('currentFolderName', foldername) #keyToAdd = 'PFDEL_'+foldername #AddToSession('directory_home',foldername) UserData = BusinessLayer.getFolderContents(userId, folderId) UserData["sourceParameter"] = "NotsearchIndex" UserData["AllFilesource"] = "NotAllFileSource" # if BusinessLayer.getHomeFolderId(folderId) == folderId: # UserData["homefolder"] = "home" # else: # UserData["homefolder"] = "nothome" userclassInstance = UserClass() userclassInstance.setUserDetails(RetrieveSessionDetails('userId'), RetrieveSessionDetails('userName'), "passwd", "name", "email", "phone") userclassInstance.setCurrentFolderId( RetrieveSessionDetails('currentFolderId')) userclassInstance.setCurrentFolderName( RetrieveSessionDetails('currentFolderName')) userclassInstance.setHomeFolderId(RetrieveSessionDetails('homeFolderId')) UserData['TotalSize'] = RetrieveSessionDetails('TotalSize') UserData['UserDetails'] = userclassInstance return render_template('index.html', **UserData)
def allfiles(): userId = RetrieveSessionDetails('userId') UserData = BusinessLayer.getAllFiles(userId) userclassInstance = UserClass() userclassInstance.setUserDetails(RetrieveSessionDetails('userId'),RetrieveSessionDetails('userName'),"passwd","name","email","phone") userclassInstance.setCurrentFolderId('0') userclassInstance.setCurrentFolderName("All files") userclassInstance.setHomeFolderId(RetrieveSessionDetails('homeFolderId')) UserData['UserDetails'] = userclassInstance return render_template('index.html',**UserData)
def index(folderId): userId = RetrieveSessionDetails('userId') AddToSession('currentFolderId',folderId) foldername = BusinessLayer.getPathForFolder(userId,folderId) foldername = foldername[:-1] AddToSession('currentFolderName',foldername) #keyToAdd = 'PFDEL_'+foldername #AddToSession('directory_home',foldername) UserData = BusinessLayer.getFolderContents(userId, folderId) userclassInstance = UserClass() userclassInstance.setUserDetails(RetrieveSessionDetails('userId'),RetrieveSessionDetails('userName'),"passwd","name","email","phone") userclassInstance.setCurrentFolderId(RetrieveSessionDetails('currentFolderId')) userclassInstance.setCurrentFolderName(RetrieveSessionDetails('currentFolderName')) userclassInstance.setHomeFolderId(RetrieveSessionDetails('homeFolderId')) UserData['TotalSize'] = RetrieveSessionDetails('TotalSize') UserData['UserDetails'] = userclassInstance return render_template('index.html', **UserData)
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))