Commit ec9fed5a authored by Servan42's avatar Servan42
Browse files

Cleaned.

parent 81adf1b4
......@@ -32,7 +32,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.selectedDelivrable = null;
filesCtrl.showFileUploadWindow = function(val){
console.log("filesCtrl.showFileUploadWindow called", val);
filesCtrl.selectedDelivrable = null;
filesCtrl.showFileUpload = val;
filesCtrl.currentScreen='fileUpload' ;
......@@ -42,7 +41,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.initStandardUploader = function(){
console.log("filesCtrl.initStandardUploader called");
// if($scope.uploaderReady) return;
// $scope.uploaderReady = true;
$.getScript("https://apis.google.com/js/api.js");
......@@ -62,7 +60,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
init: {
PostInit: function() {
console.log("filesCtrl.initStandardUploader.PostInit called");
//alert("init");
......@@ -71,12 +68,10 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
$(".plupload_start").hide();
},
FilesAdded: function(up, files, info) {
console.log("filesCtrl.initStandardUploader.FilesAdded called", up, files, info);
up.start();
},
FileUploaded: function(up, file, info) {
console.log("filesCtrl.initStandardUploader.FileUploaded called", up, file, info);
if (JSON.parse(info.response).error) {
file.status = plupload.FILE_SIZE_ERROR;
}
......@@ -89,7 +84,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
},
Error: function(up, args) {
console.log("filesCtrl.initStandardUploader.Error called", up, args);
// Called when error occurs
if (args.code==-600) $alertFactory.processAlert("error", 400533, "uploadFile");
else $alertFactory.processAlert("error", 400, "uploadFile");
......@@ -98,7 +92,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
},
ChunkUploaded: function(up, file, info) {
console.log("filesCtrl.initStandardUploader.ChunkUploaded called", up, file, info);
console.log('[ChunkUploaded] File:', JSON.stringify(file), "Info:", JSON.stringify(info));
}
}
......@@ -109,7 +102,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.initCloudUploader = function(){
console.log("filesCtrl.initCloudUploader called");
// if(filesCtrl.uploaderReady) return;
// filesCtrl.uploaderReady = true;
$.getScript("https://apis.google.com/js/api.js");
......@@ -127,7 +119,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
init: {
PostInit: function() {
console.log("filesCtrl.initCloudUploader.PostInit called");
//alert("init");
$("#integrations").detach().appendTo(".plupload_buttons");
......@@ -135,7 +126,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
$(".plupload_start").hide();
},
FilesAdded: function(up, file, info) {
console.log("filesCtrl.initCloudUploader.FilesAdded called", up, file, info);
$fileFactory.getUploadUrl($scope._getProject(),function(data){
$("#pluploadUploader").pluploadQueue().settings.url = data.details;
up.start();
......@@ -144,7 +134,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
FileUploaded: function(up, file, info) {
console.log("filesCtrl.initCloudUploader.FileUploaded called", up, file, info);
if (JSON.parse(info.response).error) {
file.status = plupload.FILE_SIZE_ERROR;
}
......@@ -156,7 +145,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
},
ChunkUploaded: function(up, file, info) {
console.log("filesCtrl.initCloudUploader.ChunkUploaded called", up, file, info);
// Called when file chunk has finished uploading
console.log('[ChunkUploaded] File:', JSON.stringify(file), "Info:", JSON.stringify(info));
}
......@@ -168,7 +156,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.initUploader = function(){
console.log("filesCtrl.initUploader called");
$fileFactory.getMaxUploadSize(function(data) {
if (data.status == "success") {
filesCtrl.maxFileSize = data.details;
......@@ -189,17 +176,14 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.browseFile = function(deliverable){
console.log("filesCtrl.browseFile called", deliverable);
console.log("clic");
}
filesCtrl.pickDrive = function(deliverable){
console.log("filesCtrl.pickDrive called", deliverable);
console.log("click")
$integrationsFactory.checkStatus($scope,$http,{apiScope:["drive"],provider:"GOOGLE"});
}
filesCtrl.onFileUploaded = function(file,list){
console.log("filesCtrl.onFileUploaded called", file, list);
var data = {};
if(file.origin=="GOOGLE"){
$("#pluploadForm").hide();
......@@ -222,7 +206,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.addFolder = function(folder,list){
console.log("filesCtrl.addFolder called", folder, list);
var data = {};
if(folder=="." || folder=="..") return false;
data.file = {target_name:$scope._hashCode((new Date()).getTime()+folder),name:folder,size:"0",lastModifiedDate:(new Date()).getTime(),type:"folder"};
......@@ -238,7 +221,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.formatFiles = function(data,list,params){
console.log("filesCtrl.formatFiles called", data, list, params);
var fileNames = [];
data.details.sort(function(a,b){
......@@ -274,8 +256,11 @@ 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){
console.log("filesCtrl.getFiles called", folderId, list);
//filesCtrl.currentScreen='fileList'
filesCtrl.refreshQuota();
list = [];
......@@ -300,8 +285,11 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
})
}
/**
* @description
* Called when you click on a file/folder.
*/
filesCtrl.selectFile = function(file){
console.log("filesCtrl.selectFile called", file);
if(filesCtrl.selectedFile!=file){
if(!file){
$rightMenuFactory.openRightMenu(filesCtrl.listDelivrables, 'deliverables')
......@@ -344,7 +332,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.getFileInfos = function(file){
console.log("filesCtrl.getFileInfos called", file);
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){
......@@ -356,7 +343,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.previewFile = function(file,showThumbnail){
console.log("filesCtrl.previewFile called", file, showThumbnail);
if(filesCtrl.loading) return;
filesCtrl.loading = true;
$fileFactory.get_file_previewFile($scope._getProject(),file.name, file.id, file.fileName,showThumbnail,function(data){
......@@ -374,7 +360,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.downloadFile=function(file,url){
console.log("filesCtrl.downloadFile called", file, url);
if(url){
window.prompt("Url du fichier", $scope._urls.server+"download.php?fileName="+file.fileName+"&name="+file.name);
}
......@@ -385,7 +370,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.getFile = function(file,url){
console.log("filesCtrl.getFile called", file, url);
if(file.type=="folder"){
//filesCtrl.currentScreen='fileList';
if(file.name==".."){
......@@ -424,7 +408,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.refreshQuota = function (){
console.log("filesCtrl.refreshQuota called");
$projectFactory.getProjectQuotas($scope._getProject(), function(data){
if(data.status == "success"){
filesCtrl.quotas= data.details[0];
......@@ -432,15 +415,19 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
})
}
/**
* Called first.
*/
filesCtrl.deleteFile = function(file){
console.log("filesCtrl.deleteFile called", file);
filesCtrl.fileToDelete=file;
filesCtrl.confirmDeletion=true;
}
/**
* Called second.
*/
filesCtrl.delete=function(){
console.log("filesCtrl.delete called");
if(filesCtrl.fileToDelete){
var file=filesCtrl.fileToDelete;
$scope._showAlert({status:2,message:$languageFactory._labels.alerts_deleteFile});
......@@ -464,7 +451,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.postComment = function(data,file){
console.log("filesCtrl.postComment called", data, file);
$fileFactory.post_file_addFileComment($scope._getProject(), file.id, filesCtrl.comment.content,function(data){
if(data.status == "success"){
filesCtrl.getComments(file);
......@@ -477,7 +463,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.getComments = function(file){
console.log("filesCtrl.getComments called", file);
$fileFactory.get_file_getFileComments($scope._getProject(), file.id, function(data){
if(data.status == "success"){
file.comments = data.details;
......@@ -495,7 +480,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.renameFilePrompt = function(){
console.log("filesCtrl.renameFilePrompt called");
var name="";
filesCtrl.stopEvent=true;
filesCtrl.selectedFile.name = filesCtrl.selectedFile.name.toString();
......@@ -510,7 +494,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.copyFilePrompt = function(){
console.log("filesCtrl.copyFilePrompt called");
filesCtrl.selectedFile.name = filesCtrl.selectedFile.name.toString();
var name = filesCtrl.selectedFile.name
var index = name.lastIndexOf(".");
......@@ -533,7 +516,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.openFoldersTree = function(callback){
console.log("filesCtrl.openFoldersTree called", callback);
$fileFactory.get_folder_tree($scope._getProject(),function(data){
if(data.status == "success"){
filesCtrl.foldersTree = data.details;
......@@ -545,7 +527,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.moveFilePrompt = function(){
console.log("filesCtrl.moveFilePrompt called");
filesCtrl.openFoldersTree(filesCtrl.moveFile);
}
......@@ -574,7 +555,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
});
filesCtrl.renameFile = function(newName){
console.log("filesCtrl.renameFile called", newName);
$fileFactory.post_file_renameFile($scope._getProject(),filesCtrl.selectedFile.id, newName,function(data){
if(data.status == "success"){
var id;
......@@ -586,7 +566,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.moveFile = function(fileId,newParentId){
console.log("filesCtrl.moveFile called", fileId, newParentId);
var session = $scope._getSession();
if(!fileId) fileId = filesCtrl.selectedFile.id;
if(!newParentId) newParentId = filesCtrl.foldersTreeSelectedElement.id;
......@@ -601,45 +580,38 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.backToFileList = function(){
console.log("filesCtrl.backToFileList called");
//filesCtrl.currentScreen='fileList';
filesCtrl.selectedFile = null;
filesCtrl.showFileUpload=false;
}
filesCtrl.selectFolderTree = function(element){
console.log("filesCtrl.selectFolderTree called", element);
filesCtrl.foldersTreeSelectedElement = element;
if(element.open) element.open = false;
else element.open = true;
}
filesCtrl.submitFolderTree = function(){
console.log("filesCtrl.submitFolderTree called");
filesCtrl.selectFolderTreeCallback();
$("#foldersTree").hide();
}
filesCtrl.cancelFolderTree = function(){
console.log("filesCtrl.cancelFolderTree called");
filesCtrl.selectFolderTreeCallback = null;
filesCtrl.foldersTreeSelectedElement = null;
$("#foldersTree").hide();
}
filesCtrl.closeModalPreview = function(){
console.log("filesCtrl.closeModalPreview called");
filesCtrl.getFiles(filesCtrl.currentFile.id,[]);
filesCtrl.previewUrls = null;
}
filesCtrl.showNewFolder = function(mode){
console.log("filesCtrl.showNewFolder called", mode);
filesCtrl.showPopup=true;
filesCtrl.popupMode=mode;
}
filesCtrl.cancelManager=function(){
console.log("filesCtrl.cancelManager called");
filesCtrl.showPopup=false;
filesCtrl.confirmDeletion=false;
}
......@@ -650,7 +622,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.getDeliverables = function(){
console.log("filesCtrl.getDeliverables called");
var session = $scope._getSession();
//get_deliverable_getDeliverableRequestsByProject
//
......@@ -675,7 +646,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
filesCtrl.init = function(){
console.log("filesCtrl.init called");
/*var h = $(window).height();
$("#fileList").css("height", h-200)*/
......@@ -717,7 +687,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
};
filesCtrl.isSelected=function(file){
console.log("filesCtrl.isSelected called", file);
if(filesCtrl.selectedFile && (file.id==filesCtrl.selectedFile.id)){
return "selected";
}
......@@ -728,7 +697,6 @@ root.controller('FileOverviewCtrl', ['$scope', '$stateParams','$http','$dropList
}
filesCtrl.setScreen=function(screen){
console.log("filesCtrl.setScreen called", screen);
filesCtrl.currentScreen=screen;
}
/*if($scope._getProject()) filesCtrl.init("");
......
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