Commit 3d88cb2b authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Merge branch 'master' into 'issue#151'

# Conflicts:
#   ui/nG6/class.tx_nG6_eid.php
parents f7ee077c 567d5ee8
...@@ -743,7 +743,7 @@ class Analysis (Component): ...@@ -743,7 +743,7 @@ class Analysis (Component):
raise Exception("Error while trying to rsync " + old_path + " to " + new_absolute_path + "\n" + raise Exception("Error while trying to rsync " + old_path + " to " + new_absolute_path + "\n" +
"Command : " + str_cmd + "\n" + "Error code : " + str(retcode) + "\n") "Command : " + str_cmd + "\n" + "Error code : " + str(retcode) + "\n")
else: else:
print ("rsync could not be launched because the source and destination are the same, from " + old_path + " to " + new_absolute_path + "\n") str_cmd = "Source and destination directories are the same : " + old_path + " , ignored.\n"
new_retention = ng6conf.get_retention_date(space_id, self.date) new_retention = ng6conf.get_retention_date(space_id, self.date)
...@@ -751,4 +751,4 @@ class Analysis (Component): ...@@ -751,4 +751,4 @@ class Analysis (Component):
t3mysql.update_fields('tx_nG6_analyze', str(self.id), ['directory','retention_date'], [str("/"+new_relative_path),new_retention] ) t3mysql.update_fields('tx_nG6_analyze', str(self.id), ['directory','retention_date'], [str("/"+new_relative_path),new_retention] )
return [retcode, str_cmd] return [retcode, str_cmd]
\ No newline at end of file
...@@ -446,6 +446,7 @@ class CasavaNG6Workflow(NG6Workflow): ...@@ -446,6 +446,7 @@ class CasavaNG6Workflow(NG6Workflow):
if self.is_casava: if self.is_casava:
self.group_prefix = list((Utils.get_group_basenames(self.get_all_reads(), "read")).keys()) self.group_prefix = list((Utils.get_group_basenames(self.get_all_reads(), "read")).keys())
logging.getLogger("ng6").debug("CasavaNG6Workflow._preprocess enter" + str(self.group_prefix))
def _process_casava_18(self, casava_directory, project_name, lane_number, input_files): def _process_casava_18(self, casava_directory, project_name, lane_number, input_files):
logging.getLogger("ng6").debug("CasavaNG6Workflow._process_casava_18 enter") logging.getLogger("ng6").debug("CasavaNG6Workflow._process_casava_18 enter")
...@@ -643,10 +644,14 @@ class CasavaNG6Workflow(NG6Workflow): ...@@ -643,10 +644,14 @@ class CasavaNG6Workflow(NG6Workflow):
concatenatefastq = None concatenatefastq = None
filtered_read1_files = [] filtered_read1_files = []
filtered_read2_files = [] filtered_read2_files = []
filtered_index_files = []
analysis_files = []
saved_files = [] saved_files = []
logging.getLogger("ng6").debug("illumina_process entering") logging.getLogger("ng6").debug("illumina_process entering")
if self.is_casava : if self.is_casava :
logging.getLogger("ng6").debug("illumina_process self.is_casava") logging.getLogger("ng6").debug("illumina_process self.is_casava")
analysis_files = self.get_all_reads("read1") + self.get_all_reads("read2")
if len(self.log_files) > 0 : if len(self.log_files) > 0 :
add_log = self.add_component("BasicAnalysis", [self.log_files,"Log Files","Log files generated during primary analysis","-","-","-","gz", "","log.gz"]) add_log = self.add_component("BasicAnalysis", [self.log_files,"Log Files","Log files generated during primary analysis","-","-","-","gz", "","log.gz"])
...@@ -657,39 +662,48 @@ class CasavaNG6Workflow(NG6Workflow): ...@@ -657,39 +662,48 @@ class CasavaNG6Workflow(NG6Workflow):
demultiplex_stats = self.add_component("Demultiplex10XStats", [self.get_all_reads("read1"), self.undetermined_reads1, self.get_files_index("read1")]) demultiplex_stats = self.add_component("Demultiplex10XStats", [self.get_all_reads("read1"), self.undetermined_reads1, self.get_files_index("read1")])
else : else :
demultiplex_stats = self.add_component("DemultiplexStats", [self.get_all_reads("read1"), self.undetermined_reads1]) demultiplex_stats = self.add_component("DemultiplexStats", [self.get_all_reads("read1"), self.undetermined_reads1])
#analysis files for fastq illumina and fastqc analysis
if self.keep_reads != "all" : if self.keep_reads != "all" :
logging.getLogger("ng6").debug("illumina_process self.keep_reads != all") logging.getLogger("ng6").debug("illumina_process self.keep_reads != all")
logging.getLogger("ng6").debug("illumina_process BEFORE FASTQILLUMINAFILTER self.get_all_reads() = " + ",".join(self.get_all_reads())) logging.getLogger("ng6").debug("illumina_process BEFORE FASTQILLUMINAFILTER self.get_all_reads() = " + ",".join(self.get_all_reads()))
logging.getLogger("ng6").debug("illumina_process self.group_prefix = " + ",".join(self.group_prefix)) logging.getLogger("ng6").debug("illumina_process self.group_prefix = " + ",".join(self.group_prefix))
# fastq illumina filter # fastq illumina filter
fastqilluminafilter = self.add_component("FastqIlluminaFilter", [self.runobj,self.get_all_reads(), self.keep_reads, self.group_prefix])
fastqilluminafilter = self.add_component("FastqIlluminaFilter", [self.runobj, self.get_all_reads(), self.keep_reads, self.group_prefix])
logging.getLogger("ng6").debug("illumina_process fastqilluminafilter = " + ",".join(filtered_read1_files))
# list filtered files # list filtered files
if self.is_paired_end() : if self.is_paired_end() :
# split read 1 and read 2 from filtered files list # split read 1 and read 2 from filtered files list
[filtered_read1_files, filtered_read2_files] = Utils.split_pair(fastqilluminafilter.fastq_files_filtered, (self.group_prefix is not None)) if self.is_10Xcasava :
[filtered_read1_files, filtered_read2_files, filtered_index_files] = Utils.split_pair_and_index(fastqilluminafilter.fastq_files_filtered, (self.group_prefix is not None))
else:
[filtered_read1_files, filtered_read2_files] = Utils.split_pair(fastqilluminafilter.fastq_files_filtered, (self.group_prefix is not None))
else: else:
filtered_read1_files = fastqilluminafilter.fastq_files_filtered filtered_read1_files = fastqilluminafilter.fastq_files_filtered
filtered_read2_files = [] filtered_read2_files = []
filtered_index_files = []
filtered_read1_files = sorted(filtered_read1_files) filtered_read1_files = sorted(filtered_read1_files)
filtered_read2_files = sorted(filtered_read2_files) filtered_read2_files = sorted(filtered_read2_files)
filtered_index_files = sorted(filtered_index_files)
else: else:
fastqilluminafilter = None fastqilluminafilter = None
filtered_read1_files = self.get_all_reads("read1") filtered_read1_files = self.get_all_reads("read1")
filtered_read2_files = self.get_all_reads("read2") filtered_read2_files = self.get_all_reads("read2")
filtered_index_files = self.get_all_reads("index")
# archive the files # archive the files
#TODO : if self.group_prefix == None, the create the output of fastqilluminafilter in the run.get_work_directory() #TODO : if self.group_prefix == None, the create the output of fastqilluminafilter in the run.get_work_directory()
saved_files = filtered_read1_files + filtered_read2_files + self.get_all_reads("index") saved_files = filtered_read1_files + filtered_read2_files + filtered_index_files
logging.getLogger("CasavaNG6Workflow").debug("illumina_process saved_files = " + ",".join(saved_files)) logging.getLogger("CasavaNG6Workflow").debug("illumina_process saved_files = " + ",".join(saved_files))
reads_prefixes = None reads_prefixes = None
if self.group_prefix != None : if self.group_prefix != None :
# concatenate fastq # concatenate fastq
reads_prefixes = list((Utils.get_group_basenames(saved_files, "read")).keys()) reads_prefixes = list((Utils.get_group_basenames(saved_files, "read")).keys())
logging.getLogger("CasavaNG6Workflow").debug("illumina_process read_predixes = " + ",".join(reads_prefixes))
logging.getLogger("CasavaNG6Workflow").debug("illumina_process saved_files = " + ",".join(saved_files)) logging.getLogger("CasavaNG6Workflow").debug("illumina_process saved_files = " + ",".join(saved_files))
concatenatefastq = self.add_component("ConcatenateFilesGroups", [self.runobj,saved_files,reads_prefixes]) concatenatefastq = self.add_component("ConcatenateFilesGroups", [self.runobj,saved_files,reads_prefixes])
saved_files = concatenatefastq.concat_files saved_files = concatenatefastq.concat_files
...@@ -700,8 +714,11 @@ class CasavaNG6Workflow(NG6Workflow): ...@@ -700,8 +714,11 @@ class CasavaNG6Workflow(NG6Workflow):
fastqilluminafilter = None fastqilluminafilter = None
filtered_read1_files = self.get_all_reads("read1") filtered_read1_files = self.get_all_reads("read1")
filtered_read2_files = self.get_all_reads("read2") filtered_read2_files = self.get_all_reads("read2")
filtered_index_files = self.get_all_reads("index")
saved_files = self.get_all_reads() saved_files = self.get_all_reads()
# reads prefixes
reads_prefixes =list((Utils.get_group_basenames(analysis_files, "read")).keys())
# add raw # add raw
addrawfiles = self.add_component("AddRawFiles", [self.runobj, saved_files, self.compression]) addrawfiles = self.add_component("AddRawFiles", [self.runobj, saved_files, self.compression])
contam = [] contam = []
...@@ -711,6 +728,9 @@ class CasavaNG6Workflow(NG6Workflow): ...@@ -711,6 +728,9 @@ class CasavaNG6Workflow(NG6Workflow):
contam.append(self.get_resource("yeast_bwa")) contam.append(self.get_resource("yeast_bwa"))
except : pass except : pass
logging.getLogger("CasavaNG6Workflow").debug("illumina_process files_analysis = " + ",".join(filtered_read1_files))
logging.getLogger("CasavaNG6Workflow").debug("illumina_process files_analysis = " + ",".join(filtered_read2_files))
logging.getLogger("CasavaNG6Workflow").debug("illumina_process files_analysis = " + ",".join(filtered_index_files))
# contamination_search # contamination_search
if contam : if contam :
if self.contamination_databank: contam.extend(self.contamination_databank) if self.contamination_databank: contam.extend(self.contamination_databank)
......
...@@ -494,7 +494,7 @@ class Run(object): ...@@ -494,7 +494,7 @@ class Run(object):
raise Exception("Error while trying to rsync " + old_path + " to " + new_absolute_path + "\n" + raise Exception("Error while trying to rsync " + old_path + " to " + new_absolute_path + "\n" +
"Command : " + str_cmd + "\n" + "Error code : " + str(retcode) + "\n") "Command : " + str_cmd + "\n" + "Error code : " + str(retcode) + "\n")
else: else:
print ("rsync could not be launched because the source and destination are the same, from " + old_path + " to " + new_absolute_path + "\n") str_cmd = "Source and destination directories are the same : " + old_path + " , ignored.\n"
new_retention = ng6conf.get_retention_date(space_id, self.date) new_retention = ng6conf.get_retention_date(space_id, self.date)
......
...@@ -202,7 +202,7 @@ class t3MySQLdb(object): ...@@ -202,7 +202,7 @@ class t3MySQLdb(object):
right_level_id = qresult.rows[0][0] right_level_id = qresult.rows[0][0]
sql = "INSERT INTO tx_nG6_project (pid, tstamp, crdate, cruser_id, description, name, hidden, space_id) \ sql = "INSERT INTO tx_nG6_project (pid, tstamp, crdate, cruser_id, description, name, hidden, space_id) \
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s')" % (self.cfg_reader.get_pid(), crdate, crdate, admin_id, VALUES ('%s','%s','%s','%s','%s','%s','%s','%s')" % (self.cfg_reader.get_pid(), crdate, crdate, admin_id,
self.esc_q(pdescription), self.esc_q(name), hidden, space_id) self.esc_q(pdescription), self.esc_q(name), int(hidden), space_id)
qresult = self.execute(sql, commit = True) qresult = self.execute(sql, commit = True)
project_id = qresult.lastrowid project_id = qresult.lastrowid
self.execute("INSERT INTO fe_rights (fe_user_id, project_id, right_id) VALUES ('%s','%s','%s')" % (admin_id, project_id, right_level_id), self.execute("INSERT INTO fe_rights (fe_user_id, project_id, right_id) VALUES ('%s','%s','%s')" % (admin_id, project_id, right_level_id),
...@@ -320,7 +320,7 @@ class t3MySQLdb(object): ...@@ -320,7 +320,7 @@ class t3MySQLdb(object):
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, self.esc_q(name), '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, self.esc_q(name),
calendar.timegm(date.timetuple()), directory, self.esc_q(species), calendar.timegm(date.timetuple()), directory, self.esc_q(species),
self.esc_q(data_nature), self.esc_q(type), nb_sequences, self.esc_q(data_nature), self.esc_q(type), nb_sequences,
full_seq_size, self.esc_q(description), hidden, self.esc_q(sequencer),retention_date, "stored","0","0","0") full_seq_size, self.esc_q(description), int(hidden), self.esc_q(sequencer),retention_date, "stored","0","0","0")
qresult = self.execute(sql, commit = True) qresult = self.execute(sql, commit = True)
run_id = qresult.lastrowid run_id = qresult.lastrowid
...@@ -471,7 +471,7 @@ class t3MySQLdb(object): ...@@ -471,7 +471,7 @@ class t3MySQLdb(object):
if description: if description:
set_values.append( "description='%s'" % self.esc_q(description)) set_values.append( "description='%s'" % self.esc_q(description))
if hidden: if hidden:
set_values.append( "hidden=%s" % hidden ) set_values.append( "hidden=%s" % int(hidden) )
if sequencer: if sequencer:
set_values.append( "sequencer='%s'" % self.esc_q(sequencer)) set_values.append( "sequencer='%s'" % self.esc_q(sequencer))
if storage_size: if storage_size:
...@@ -673,7 +673,8 @@ class t3MySQLdb(object): ...@@ -673,7 +673,8 @@ class t3MySQLdb(object):
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Analyze functions # Analyze functions
def add_analysis(self, aclass, name, description, cruser_login, date, directory, software, version, params, is_editable, retention_date, hidden=1, parent_uid=0): def add_analysis(self, aclass, name, description, cruser_login, date, \
directory, software, version, params, is_editable, retention_date, hidden=1, parent_uid=0):
""" """
Update an Analyze Update an Analyze
@param aclass : the class of the analysis @param aclass : the class of the analysis
...@@ -703,7 +704,7 @@ class t3MySQLdb(object): ...@@ -703,7 +704,7 @@ class t3MySQLdb(object):
'%s', '%s', '%s', '%s', '%s', '%s' ,'%s', '%s', '%s', '%s', '%s', '%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, aclass, '%s', '%s', '%s', '%s', '%s', '%s' ,'%s', '%s', '%s', '%s', '%s', '%s', '%s')" % ( self.cfg_reader.get_pid(), crdate, crdate, cruser_id, aclass,
self.esc_q(name), self.esc_q(description), crdate, self.esc_q(name), self.esc_q(description), crdate,
directory, self.esc_q(software), self.esc_q(version), directory, self.esc_q(software), self.esc_q(version),
hidden, self.esc_q(params), analysis_is_editable, parent_uid, retention_date, "stored","0","0","0") int(hidden), self.esc_q(params), analysis_is_editable, parent_uid, retention_date, "stored","0","0","0")
qresult = self.execute(sql, commit= True) qresult = self.execute(sql, commit= True)
analysis_id = qresult.lastrowid analysis_id = qresult.lastrowid
...@@ -1065,4 +1066,4 @@ class t3MySQLdb(object): ...@@ -1065,4 +1066,4 @@ class t3MySQLdb(object):
qresult = self.execute(sql) qresult = self.execute(sql)
return [ r[0] for r in qresult.rows ] return [ r[0] for r in qresult.rows ]
\ No newline at end of file
...@@ -290,7 +290,44 @@ class Utils(object): ...@@ -290,7 +290,44 @@ class Utils(object):
return [read_1_list, read_2_list] return [read_1_list, read_2_list]
@staticmethod
def split_pair_and_index ( file_list, is_casava=False ):
"""
Return the list of read 1, the list of read 2 and the list of index read from a list
@param file_list : the list
@param is_casava : files names in file_list are in CASVAVA format
"""
read_1_list = []
read_2_list = []
read_index_list = []
logging.getLogger("Utils").debug("split_pair_and_index. Entering")
if is_casava:
logging.getLogger("Utils").debug("split_pair_and_index. is_casava")
for file in file_list:
logging.getLogger("Utils").debug("split_pair_and_index. file = " + file)
basename_without_ext = os.path.basename(file).split(".")[0]
file_name_fields = basename_without_ext.split(Utils.CASAVA_FILENAME_SEPARATOR)
read_tag = file_name_fields[Utils.CASAVA_FILENAME['read']-1]
if read_tag == "R1":
read_1_list.append(file)
elif read_tag == "R2":
read_2_list.append(file)
else:
read_index_list.append(file)
else:
sorted_list = sorted( file_list )
logging.getLogger("Utils").debug("split_pair_and_index. file_list = " + ", ".join(file_list))
logging.getLogger("Utils").debug("split_pair_and_index. sorted_list = " + ", ".join(sorted_list))
for i in range(0,len(sorted_list),3):
logging.getLogger("Utils").debug("split_pair_and_index. sorted_list[i] = " + sorted_list[i])
logging.getLogger("Utils").debug("split_pair_and_index. sorted_list[i+1] = " + sorted_list[i+1])
logging.getLogger("Utils").debug("split_pair_and_index. sorted_list[i+1] = " + sorted_list[i+2])
read_1_list.append(sorted_list[i])
read_2_list.append(sorted_list[i+1])
read_index_list.append(sorted_list[i+2])
return [read_1_list, read_2_list, read_index_list]
@staticmethod @staticmethod
def get_group_basenames( file_list, group_by ): def get_group_basenames( file_list, group_by ):
""" """
...@@ -361,6 +398,17 @@ class Utils(object): ...@@ -361,6 +398,17 @@ class Utils(object):
return "".join(dec) return "".join(dec)
""" """
@staticmethod
def get_project_dirname(project_id, project_name):
return "Project_%s.%s" % ( re.sub( r"[\s\/]", "_", project_name), project_id )
@staticmethod
def get_run_dirname(run_id, run_name):
return "Run_%s.%s" % ( re.sub( r"[^A-Za-z0-9]", "_", run_name), run_id)
@staticmethod
def get_analyse_dirname(analyse_id, analyse_name):
return "Analyse_%s.%s"%( re.sub( r"[\s\/]", "_", analyse_name), analyse_id )
@staticmethod @staticmethod
def get_directories_structure_and_content(ng6_username, data_folder, output_folder, prefixed_ids): def get_directories_structure_and_content(ng6_username, data_folder, output_folder, prefixed_ids):
from ng6.t3MySQLdb import t3MySQLdb from ng6.t3MySQLdb import t3MySQLdb
...@@ -372,20 +420,21 @@ class Utils(object): ...@@ -372,20 +420,21 @@ class Utils(object):
try : user_id = t3mysql.get_user_id(ng6_username) try : user_id = t3mysql.get_user_id(ng6_username)
except : pass except : pass
for prefixed_id in prefixed_ids.split(';') : for prefixed_id in prefixed_ids.split(';') :
vals = prefixed_id.split('_') vals = prefixed_id.split('_')
prefix = vals[0] prefix = vals[0]
id = vals[1] id = vals[1]
if prefix == "data" or prefix == "run" : if prefix == "data" or prefix == "run" :
run = t3mysql.select_run_informations(id) run = t3mysql.select_run_informations(id)
source_dir = data_folder +'/'+ run['directory'] source_dir = data_folder +'/'+ run['directory']
project_name = "Project_%s.%s" % ( re.sub( r"[\s\/]", "_", run['project_name']), run['project_id'] ) project_name = Utils.get_project_dirname(run['project_id'],run['project_name'])
#run_name = "Run_%s.%s" %( run['name'].replace(' ', '_').replace('/', '_'), id ) #run_name = "Run_%s.%s" %( run['name'].replace(' ', '_').replace('/', '_'), id )
run_name = "Run_%s.%s" % ( re.sub( r"[^A-Za-z0-9]", "_", run['name']), id) run_name = Utils.get_run_dirname(id,run['name'])
raw_data_dir = os.path.join( output_folder, project_name, run_name, "RawData" ) raw_data_dir = os.path.join( output_folder, project_name, run_name, "RawData" )
print (run, source_dir,project_name,run_name)
if source_dir not in src_directories : if source_dir not in src_directories :
src_directories.append(source_dir) src_directories.append(source_dir)
if raw_data_dir not in dest_directories : if raw_data_dir not in dest_directories :
...@@ -394,7 +443,7 @@ class Utils(object): ...@@ -394,7 +443,7 @@ class Utils(object):
if prefix == "run" : if prefix == "run" :
for analyse_id, analyse_values in t3mysql.get_user_run_analysis(user_id, id, 'tx_nG6_analyze.name').items() : for analyse_id, analyse_values in t3mysql.get_user_run_analysis(user_id, id, 'tx_nG6_analyze.name').items() :
analysis_dir = data_folder + '/' + analyse_values["directory"] analysis_dir = data_folder + '/' + analyse_values["directory"]
analysis_name = "Analyse_%s.%s"%( re.sub( r"[\s\/]", "_", analyse_values['name']), analyse_id ) analysis_name = Utils.get_analyse_dirname(analyse_id, analyse_values['name'] )
dest_analysis_dir = os.path.join( output_folder, project_name, run_name, analysis_name ) dest_analysis_dir = os.path.join( output_folder, project_name, run_name, analysis_name )
if analysis_dir not in src_directories : if analysis_dir not in src_directories :
...@@ -409,19 +458,19 @@ class Utils(object): ...@@ -409,19 +458,19 @@ class Utils(object):
if source_dir not in src_directories : if source_dir not in src_directories :
src_directories.append(source_dir) src_directories.append(source_dir)
project_name = "Project_%s.%s" % ( re.sub( r"[\s\/]", "_", analyse["project_name"]), analyse["project_id"]) project_name = Utils.get_project_dirname(analyse['project_id'],analyse['project_name'])
# it's a run analysis # it's a run analysis
if analyse["run_id"]: if analyse["run_id"]:
run_name = "Run_%s.%s" % ( re.sub( r"[\s\/]", "_", analyse["run_name"]), analyse["run_id"]) run_name = Utils.get_run_dirname(analyse["run_id"], analyse["run_name"])
analysis_name = "Analyse_%s.%s" % ( re.sub( r"[\s\/]", "_", analyse["name"]), id) analysis_name = Utils.get_analyse_dirname(id, analyse['name'] )
dest_analysis_dir = os.path.join( output_folder, project_name, run_name, analysis_name ) dest_analysis_dir = os.path.join( output_folder, project_name, run_name, analysis_name )
if dest_analysis_dir not in dest_directories : if dest_analysis_dir not in dest_directories :
dest_directories.append(dest_analysis_dir) dest_directories.append(dest_analysis_dir)
# it's a project analysis # it's a project analysis
else : else :
analysis_name = "Project_analyses/%s.%s" % ( re.sub( r"[\s\/]", "_", analyse["name"]), id) analysis_name = "Project_"+ Utils.get_analyse_dirname(id, analyse['name'] )
dest_analysis_dir = os.path.join( output_folder, project_name, analysis_name ) dest_analysis_dir = os.path.join( output_folder, project_name, analysis_name )
if dest_analysis_dir not in dest_directories : if dest_analysis_dir not in dest_directories :
dest_directories.append(dest_analysis_dir) dest_directories.append(dest_analysis_dir)
...@@ -439,6 +488,9 @@ class Utils(object): ...@@ -439,6 +488,9 @@ class Utils(object):
@staticmethod @staticmethod
def rsync_getcmd( source, destination): def rsync_getcmd( source, destination):
if source == "" or not os.path.isdir(source) :
return [ 0, "Source directory '" + source + "' doesn't exist, ignored."]
if not source.endswith("/"): if not source.endswith("/"):
source+="/" source+="/"
cmd = ["rsync", "-avh", "--perms", "--times", "--remove-sent-files", source, destination] cmd = ["rsync", "-avh", "--perms", "--times", "--remove-sent-files", source, destination]
......
<?php <?php
/*************************************************************** /***************************************************************
* Copyright notice * Copyright notice
......
...@@ -50,8 +50,6 @@ ...@@ -50,8 +50,6 @@
<div class="sub-content sc-top-bottom"> <div class="sub-content sc-top-bottom">
<div class="ng6-content-header-left"> <div class="ng6-content-header-left">
<h2>###STATUS_HEADER###</h2>
<p>###STATUS_MESSAGE###</p>
<!-- ###LOGIN_FORM### --> <!-- ###LOGIN_FORM### -->
<form action="###ACTION_URI###" target="_top" method="post" onsubmit="###ON_SUBMIT###" class="form-horizontal"> <form action="###ACTION_URI###" target="_top" method="post" onsubmit="###ON_SUBMIT###" class="form-horizontal">
<fieldset> <fieldset>
...@@ -130,8 +128,6 @@ ...@@ -130,8 +128,6 @@
<div class="sub-content sc-top-bottom"> <div class="sub-content sc-top-bottom">
<div class="ng6-content-header-left"> <div class="ng6-content-header-left">
<h2>###STATUS_HEADER###</h2>
<p>###STATUS_MESSAGE###</p>
<!-- ###LOGIN_FORM### --> <!-- ###LOGIN_FORM### -->
<form action="###ACTION_URI###" target="_top" method="post" onsubmit="###ON_SUBMIT###" class="form-horizontal"> <form action="###ACTION_URI###" target="_top" method="post" onsubmit="###ON_SUBMIT###" class="form-horizontal">
<fieldset> <fieldset>
......
...@@ -286,6 +286,7 @@ please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE## ...@@ -286,6 +286,7 @@ please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE##
return($config_file_content); return($config_file_content);
} }
//Return a php array containing the section relative to the given space_id
static function get_retention_policy_from_space_id($space_id = "default"){ static function get_retention_policy_from_space_id($space_id = "default"){
$config_file_content = tx_nG6_utils::get_config_content(); $config_file_content = tx_nG6_utils::get_config_content();
...@@ -420,6 +421,8 @@ please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE## ...@@ -420,6 +421,8 @@ please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE##
} }
} }
......
/*************************************************************** /***************************************************************
* Copyright notice * Copyright notice
* *
...@@ -1590,7 +1591,7 @@ function deletePRAHandler() { ...@@ -1590,7 +1591,7 @@ function deletePRAHandler() {
url: val_url, url: val_url,
success: function(val, status, xhr) { success: function(val, status, xhr) {
// return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error // return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error
if (val == "0") { if (val == '0') {
// Uncheck all checkboxes // Uncheck all checkboxes
$(':checked').each(function(i){ $(':checked').each(function(i){
$(this).attr('checked',false); $(this).attr('checked',false);
...@@ -1599,11 +1600,11 @@ function deletePRAHandler() { ...@@ -1599,11 +1600,11 @@ function deletePRAHandler() {
location.reload(); location.reload();
} else { } else {
$("#modal-label-tmpl").html("Error"); $("#modal-label-tmpl").html("Error");
if (val == "1") { if (val == '1') {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>You don't have write permission on the specified directory.</div>"); $("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>You don't have write permission on the specified directory.</div>");
} else if (val == "2") { } else if (val == '2') {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>An error occurred during login. Most likely you didn't enter the username or password correctly. Be certain that you enter them precisely as they are, including upper/lower case.</div>"); $("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>An error occurred during login. Most likely you didn't enter the username or password correctly. Be certain that you enter them precisely as they are, including upper/lower case.</div>");
} else if (val == "3") { } else if (val == '3') {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>An error occurred during server connection. Please contact the site administrator.</div>"); $("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>An error occurred during server connection. Please contact the site administrator.</div>");
} }
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>'); $("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
...@@ -2237,8 +2238,68 @@ function setChangeSpaceForm(){ ...@@ -2237,8 +2238,68 @@ function setChangeSpaceForm(){
//When clicking 'migrate' //When clicking 'migrate'
$("#run_workflow").click(function(){ $("#run_workflow").click(function(){
$('#change_space_id_form').wfform('run');
var params = simpleQueryParams(location.href),
project_id = params["tx_nG6_pi1[project_id]"];
//We show a modal to check if the given SSH user + password is ok
var switch_space_auth_html = [
'<div class="tx-nG6-pi1-login">',
' This functionality is only available if you have an account on the ' + $("#server_name").val() + ' server. <br /> <br /> ',
' <form class="form-horizontal" id="tx-nG6-pi1-login-form" >',
' <div class="input-group" style="margin-left:50px">',
' <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>',
' <input class="form-control" style="width:200px" type="text" id="user_login_val" name="user_login_val" placeholder="Username"/>',
' </div><br/>',
' <div class="input-group" style="margin-left:50px">',
' <span class="input-group-addon"><i class="glyphicon glyphicon-wrench"></i></span>',
' <input class="form-control" style="width:200px" type="password" id="user_pwd_val" name="user_pwd_val" placeholder="Password"/>',
' </div>',
' </form>',
'</div>'
].join('');
$("#modal-label-tmpl").html("Migrate");
$("#modal-body-tmpl").html(switch_space_auth_html);
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>' +
'<button id="modal-btn-migrate" class="btn btn-primary"><i class="glyphicon glyphicon-trash"></i> Migrate</button>');
$("#ng6modal").modal();
$("#modal-btn-migrate").click(function(){
var params = simpleQueryParams(location.href),
project_id = params["tx_nG6_pi1[project_id]"];