Commit 4d48183b authored by Servan42's avatar Servan42
Browse files

Fixed some functions and WIP

parent 0490b471
......@@ -213,7 +213,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
$fileFactory.add_file($scope._getProject(),data.file, filesCtrl.currentFile.id,function(data){
if(data.status == "success"){
filesCtrl.showPopup=false;
filesCtrl.showPopup=false;
filesCtrl.getFiles(filesCtrl.currentFile.id,list);
}
})
......@@ -257,6 +257,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.getFiles = function(folderId,list){
console.log("getFiles called", folderId, list);
//filesCtrl.currentScreen='fileList'
filesCtrl.refreshQuota();
list = [];
......@@ -267,6 +268,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
$scope._showAlert({status:2,message:$languageFactory._labels.alerts_loadingFiles});
// Getting the files from the current project.
$fileFactory.get_file_getFiles($scope._getProject(),folderId,false,function(data){
if(data.status == "success"){
filesCtrl.parentFolder = null;
......@@ -278,11 +280,31 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
$scope._showAlert({status:3,message:$languageFactory._labels.alerts_loadingFilesFailure});
}
})
// The code right under is not a good solution to display the inherited files in the children project
// because inherited files are already dislayed in the children project, marked with a special icon,
// if and only if there is already at least one file in the children project.
// Getting the files from the parent project
/*
if($scope._getProjectParent()){
$fileFactory.get_file_getFiles($scope._getProjectParent().id,folderId,false,function(data){
if(data.status == "success"){
filesCtrl.parentFolder = null;
filesCtrl.currentFile.id = folderId;
filesCtrl.formatFiles(data,list,{});
}
else{
$scope._showAlert({status:3,message:$languageFactory._labels.alerts_loadingFilesFailure});
}
})
}
*/
}
filesCtrl.selectFile = function(file){
console.log(file);
console.log("selectFile called", file);
if(filesCtrl.selectedFile!=file){
if(!file){
$rightMenuFactory.openRightMenu(filesCtrl.listDelivrables, 'deliverables')
......@@ -305,7 +327,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
else if(file && file.type == "folder"){
console.log("on sélectionne le dossier");
//filesCtrl.getFile(file);
// filesCtrl.getFile(file);
$fileFactory.setCurrentFile(file);
var actions=
[{"position":"right","size":"small","class":"transparent-button","width":"fullWidth"},
......@@ -363,6 +385,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.getFile = function(file,url){
console.log("getFile called");
if(file.type=="folder"){
//filesCtrl.currentScreen='fileList';
if(file.name==".."){
......@@ -409,12 +432,14 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.deleteFile = function(file){
console.log("Calling filesCtrl.deleteFile with the following parameter:", file);
filesCtrl.fileToDelete=file;
filesCtrl.confirmDeletion=true;
}
filesCtrl.delete=function(){
console.log("Calling filesCtrl.delete");
if(filesCtrl.fileToDelete){
var file=filesCtrl.fileToDelete;
$scope._showAlert({status:2,message:$languageFactory._labels.alerts_deleteFile});
......
......@@ -274,6 +274,7 @@ controller('CommonCtrl', ['$scope','$serverFactory','$routeParams','$rootScope',
$scope._currentProjectId = value;
$scope._currentParentProject = parent;
$scope._currentProjectName = fullName;
}
......@@ -290,9 +291,9 @@ controller('CommonCtrl', ['$scope','$serverFactory','$routeParams','$rootScope',
}
$scope._getProjectParent=function(){
if(!$scope._currentProjectParent) $scope._currentProjectParent = localStorage.currentProjectParent
if($scope._currentProjectParent){
return $scope._currentProjectParent;
if(!$scope._currentParentProject) $scope._currentParentProject = localStorage.currentProjectParent
if($scope._currentParentProject){
return $scope._currentParentProject;
}
else{
return false;
......@@ -445,7 +446,7 @@ controller('CommonCtrl', ['$scope','$serverFactory','$routeParams','$rootScope',
if(data.status == "success" && data.details){
$scope._setProject(data.details["id"],data.details["fullName"]);
$scope._setProject(data.details["id"],data.details["fullName"],data.details["parent"]);
$scope._projectChildren = data.details["children"];
$scope._projectParent = data.details["parent"];
//$rightFactory.checkProject($scope._getProject(),true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment