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 registerUser(): error = None if request.method == 'POST': email = request.form['email'] pswd = request.form['psw'] repswd = request.form['repswd'] userName = request.form['username'] name = request.form['name'] phone = "9878989890" if (pswd != repswd): error = "Passwords do not match" return render_template('login.html', error=error) userexist = BusinessLayer.isUserExist(userName) if userexist == True: error = "This username is already is use" return render_template("login.html", error=error) else: ucobj = UserClass() ucobj.setUserDetails(7, userName, name, pswd, email, phone) UserData = BusinessLayer.RegisterUser(ucobj) destination = "/".join( [APP_STORAGE_PATH, UserData['UserDetails'].userName + "_home"]) if not os.path.isdir(destination): os.mkdir(destination) return render_template("login.html") else: return render_template('404.html')
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))