Commit 1b82157a authored by Anthony Geourjon's avatar Anthony Geourjon
Browse files

Merge branch 'EDCAMPUS-27-front-bugs-systeme-fichier-dossiers' into 'master'

Edcampus 27 front bugs systeme fichier dossiers

See merge request !27
parents b58fdb10 07ac7f8e
......@@ -16,15 +16,8 @@
<a ng-class="{'active':filesCtrl.currentScreen == 'list'}"><i class="fa fa-list-ul tab-icon"></i><p>{{::_labels.listView}}</p></a>
</li>
<div class="dropdown" style="float:right">
<button class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">{{::_labels.addBtn}}</button>
<ul class="dropdown-menu custom">
<li style="padding-left: 10px" class="pointerOn" ng-click="filesCtrl.showNewFolder('newFolder')">
<i style="margin-right:10px" class="fa fa-folder"></i>{{::_labels.newFolder}}
</li>
<li style="padding-left: 10px" class="pointerOn" ng-click="filesCtrl.showNewFolder('import')" class="ng-binding">
<i style="margin-right:10px" class="fa fa-upload"></i>{{::_labels.importFiles}}
</li>
</ul>
<button class="dropdown-toggle" ng-click="filesCtrl.showNewFolder('newFolder')">{{::_labels.newFolder}}</button>
<button class="dropdown-toggle" ng-click="filesCtrl.showNewFolder('import')">{{::_labels.importFiles}}</button>
</div>
</ul>
......
......@@ -41,8 +41,8 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.initStandardUploader = function(){
if($scope.uploaderReady) return;
$scope.uploaderReady = true;
// if($scope.uploaderReady) return;
// $scope.uploaderReady = true;
$.getScript("https://apis.google.com/js/api.js");
$("#pluploadUploader").pluploadQueue({
......@@ -61,6 +61,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
init: {
PostInit: function() {
//alert("init");
$("#integrations").detach().appendTo(".plupload_buttons");
$(".plupload_add").hide();
......@@ -97,13 +98,12 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
});
plupload.addI18n({importFrom:$languageFactory._labels.importFrom,"Stop Upload":"Arrêter l'envoi.","Upload URL might be wrong or doesn't exist.":"L'URL d'envoi est soit erronée soit n'existe pas.","tb":"To","Size":"Taille","Close":"Fermer","Init error.":"Erreur d'initialisation.","Add files to the upload queue and click the start button.":"Ajoutez des fichiers à la file d'attente de téléchargement et appuyez sur le bouton 'Démarrer l'envoi'","Filename":"Nom du fichier","Image format either wrong or not supported.":"Le format d'image est soit erroné soit pas géré.","Status":"État","HTTP Error.":"Erreur HTTP.","Start Upload":$languageFactory._labels.startUploadBtn,"mb":"Mo","kb":"Ko","Duplicate file error.":"Erreur: Fichier déjà sélectionné.","File size error.":"Erreur de taille de fichier.","N/A":"Non applicable","gb":"Go","Error: Invalid file extension:":"Erreur: Extension de fichier non valide:","Select files":"Sélectionnez les fichiers","%s already present in the queue.":"%s déjà présent dans la file d'attente.","File: %s":"Fichier: %s","b":"o","Uploaded %d/%d files":"%d fichiers sur %d ont été envoyés","Upload element accepts only %d file(s) at a time. Extra files were stripped.":"Que %d fichier(s) peuvent être envoyé(s) à la fois. Les fichiers supplémentaires ont été ignorés.","%d files queued":"%d fichiers en attente","File: %s, size: %d, max file size: %d":"Fichier: %s, taille: %d, taille max. d'un fichier: %d","Drag files here.":"Glissez directement ici","Runtime ran out of available memory.":"Le traitement a manqué de mémoire disponible.","File count error.":"Erreur: Nombre de fichiers.","File extension error.":"Erreur d'extension de fichier","Error: File too large:":"Erreur: Fichier trop volumineux:","Add Files":$languageFactory._labels.myComputerFiles});
}
filesCtrl.initCloudUploader = function(){
if(filesCtrl.uploaderReady) return;
filesCtrl.uploaderReady = true;
// if(filesCtrl.uploaderReady) return;
// filesCtrl.uploaderReady = true;
$.getScript("https://apis.google.com/js/api.js");
$("#pluploadUploader").pluploadQueue({
runtimes : 'html5,flash,html4',
......@@ -132,6 +132,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
})
},
FileUploaded: function(up, file, info) {
if (JSON.parse(info.response).error) {
file.status = plupload.FILE_SIZE_ERROR;
......@@ -183,7 +184,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.onFileUploaded = function(file,list){
var data = {};
if(file.origin=="GOOGLE"){
$("#pluploadForm").hide();
......@@ -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);
}
})
......@@ -256,6 +256,10 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
}
/**
* @description
* Called when it is needed to display the files of a certain folder.
*/
filesCtrl.getFiles = function(folderId,list){
//filesCtrl.currentScreen='fileList'
filesCtrl.refreshQuota();
......@@ -267,6 +271,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;
......@@ -280,9 +285,11 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
})
}
/**
* @description
* Called when you click on a file/folder.
*/
filesCtrl.selectFile = function(file){
console.log(file);
if(filesCtrl.selectedFile!=file){
if(!file){
$rightMenuFactory.openRightMenu(filesCtrl.listDelivrables, 'deliverables')
......@@ -305,7 +312,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"},
......@@ -313,7 +320,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
file.actions=actions;
file.factory=$fileFactory;
console.log(file.factory);
console.log("file.factory", file.factory);
filesCtrl.selectedFile=file;
$rightMenuFactory.openRightMenu(file, 'details');
}
......@@ -328,7 +335,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
console.log("on récup les infos");
if(!file.id || file.id=="0") return filesCtrl.getFile(file);
$fileFactory.get_file_details($scope._getProject(), file.id, function(data){
console.log(data);
console.log("data", data);
filesCtrl.getFile(data.details[0]);
if(file.type=="folder") filesCtrl.selectedFile = null;
});
......@@ -375,7 +382,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.filePath.push(file)
filesCtrl.currentFolder += "/"+file.name;
}
console.log(filesCtrl.currentScreen);
console.log("filesCtrl.currentScreen", filesCtrl.currentScreen);
}
filesCtrl.getFiles(file.id,[]);
......@@ -408,12 +415,18 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
})
}
/**
* Called first.
*/
filesCtrl.deleteFile = function(file){
filesCtrl.fileToDelete=file;
filesCtrl.confirmDeletion=true;
}
/**
* Called second.
*/
filesCtrl.delete=function(){
if(filesCtrl.fileToDelete){
var file=filesCtrl.fileToDelete;
......@@ -422,7 +435,8 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
$fileFactory.delete_file($scope._getProject(),file.id, function(data){
filesCtrl.confirmDeletion=false;
if(data.status == "success"){
filesCtrl.getFiles(0,filesCtrl.files);
// If there is a bug upon deletion that places you in the wrong folder, that is because filesCtrl.fileToDelete.parentId wasn't updated for some reason, good luck to find why.
filesCtrl.getFiles(filesCtrl.fileToDelete.parentId,filesCtrl.files);
$scope._showAlert({status:1,message:$languageFactory._labels.alerts_deleteFileSuccess});
}
......@@ -468,6 +482,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.renameFilePrompt = function(){
var name="";
filesCtrl.stopEvent=true;
filesCtrl.selectedFile.name = filesCtrl.selectedFile.name.toString();
var index = filesCtrl.selectedFile.name.lastIndexOf(".");
if(index !=-1) name = filesCtrl.selectedFile.name.substring(0,index);
else name = filesCtrl.selectedFile.name;
......@@ -479,6 +494,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.copyFilePrompt = function(){
filesCtrl.selectedFile.name = filesCtrl.selectedFile.name.toString();
var name = filesCtrl.selectedFile.name
var index = name.lastIndexOf(".");
name = name.substring(0,index)+"_copy"+name.substring(index);
......@@ -520,6 +536,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
case "renameFilePrompt":
if(params.result.data) {
filesCtrl.selectedFile.name = filesCtrl.selectedFile.name.toString();
var index = filesCtrl.selectedFile.name.lastIndexOf(".");
var ext;
if(index>-1) ext = "."+filesCtrl.selectedFile.name.substring(index+1);
......@@ -610,7 +627,7 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
//
$deliverableFactory.get_deliverable_getDeliverableRequestsByProject($scope._getProject(),function(data){
console.log(data.details);
console.log("data.details", data.details);
//filesCtrl.listDelivrables = data.details[0].map(function(a){a.type="deliverable";return a});
if($scope._userGroups[$scope._getSession().group]=='STUDENT'){
filesCtrl.listDelivrables=$deliverableFactory.formatAllDeliverablesRequests(data.details,"student");
......@@ -621,16 +638,17 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
console.log(filesCtrl.listDelivrables);
console.log("filesCtrl.listDelivrables", filesCtrl.listDelivrables);
$rightMenuFactory.openRightMenu(filesCtrl.listDelivrables, 'deliverables');
});
}
filesCtrl.init = function(){
/*var h = $(window).height();
$("#fileList").css("height", h-200)*/
$("#fileList").css("height", h-200)*/
$integrationsFactory.onStatusReceived($scope,"GOOGLE",function(result){
......@@ -669,7 +687,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
};
filesCtrl.isSelected=function(file){
if(filesCtrl.selectedFile && (file.id==filesCtrl.selectedFile.id)){
return "selected";
}
......@@ -692,7 +709,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}])
function getSize(value){
value = parseInt(value);
......@@ -706,10 +722,6 @@ function getSize(value){
}
root.filter("getSize", function() { // register new filter
return getSize;
......
......@@ -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