Commit ea41c8fb authored by Jerome Mariette's avatar Jerome Mariette
Browse files

make analysis done by users editable

parent f3d0b6c2
......@@ -889,6 +889,7 @@ CREATE TABLE IF NOT EXISTS `tx_nG6_analyze` (
`software` varchar(255) NOT NULL DEFAULT '',
`version` varchar(255) NOT NULL DEFAULT '',
`params` text NOT NULL,
`is_editable` boolean NOT NULL DEFAULT FALSE,
PRIMARY KEY (`uid`),
KEY `parent` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
......@@ -1098,4 +1099,4 @@ INSERT INTO `tx_nG6_project` (`uid`, `pid`, `tstamp`, `crdate`, `cruser_id`, `de
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
\ No newline at end of file
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
......@@ -106,6 +106,7 @@ class Analysis (Component):
self.results = {}
self.run = None
self.project = None
self.is_editable = False
# Set the temp folder to the ng6 temp folder
ng6conf = NG6ConfigReader()
......@@ -262,7 +263,7 @@ class Analysis (Component):
else: parent_uid = 0
self.id = t3mysql.add_analysis(self.__class__.__name__, self.name, self.description,
datetime.date.today(), self.directory, self.software, self.version,
self.options, parent_uid=parent_uid)
self.options, self.is_editable, parent_uid=parent_uid)
# Then add all results link to this analysis
for file in self.results:
......
......@@ -384,7 +384,7 @@ class t3MySQLdb(object):
#--------------------------------------------------------------------
# Analyze functions
def add_analysis(self, aclass, name, description, date, directory, software, version, params, hidden=1, parent_uid=0):
def add_analysis(self, aclass, name, description, date, directory, software, version, params, is_editable, hidden=1, parent_uid=0):
"""
Update an Analyze
@param aclass : the class of the analysis
......@@ -397,18 +397,21 @@ class t3MySQLdb(object):
@param params : the software params used
@param hidden : is the analysis hidden
@param parent_uid : the analysis parent uid
@param is_editable : True if analysis has been added by an user
"""
conn = connect(self.host, self.user, self.passwd, self.db)
curs = conn.cursor()
crdate = str(time.mktime(datetime.date.today().timetuple())).split(".")[0]
if is_editable : analysis_is_editable = 1
else : analysis_is_editable = 0
req = "INSERT INTO tx_nG6_analyze (pid,tstamp,crdate,class,name,description,date,directory,software,version,"
req += "hidden,params,parent_uid) VALUES ('" + str(self.cfg_reader.get_pid())+ "','" + str(crdate) + "','"
req += "hidden, params, is_editable, parent_uid) VALUES ('" + str(self.cfg_reader.get_pid())+ "','" + str(crdate) + "','"
req += str(crdate) + "','" + aclass + "','" + name.replace("'", "\'") + "','" + description.replace("'", "\'") + "','"
req += str(crdate) + "','" + directory + "','" + software.replace("'", "\'") + "','"
req += version.replace("'", "\'") + "','" + str(hidden) + "','" + params.replace("'", "\'") + "','" + str(parent_uid) + "')"
req += version.replace("'", "\'") + "','" + str(hidden) + "','" + params.replace("'", "\'") + "','"
req += str(analysis_is_editable) + "','" + str(parent_uid) + "')"
curs.execute(req)
analysis_id = conn.insert_id()
req = "SELECT directory FROM tx_nG6_analyze WHERE uid=" + str(analysis_id)
curs.execute(req)
analysis_directory = curs.fetchone()
......
......@@ -447,6 +447,7 @@ class tx_nG6_db {
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.params AS analyze_params, '.
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.is_editable AS analyze_is_editable, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid, '.
'tx_nG6_analyze.hidden AS analyze_hidden ',
'FROM' => 'tx_nG6_project '.
......@@ -474,6 +475,7 @@ class tx_nG6_db {
'version' => $row['analyze_version'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description'],
'is_editable' => $row['analyze_is_editable'],
'parent_id' => $row['analyze_parent_uid']
);
}
......@@ -509,6 +511,7 @@ class tx_nG6_db {
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.params AS analyze_params, '.
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.is_editable AS analyze_is_editable, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid, '.
'tx_nG6_analyze.hidden AS analyze_hidden ',
'FROM' => 'tx_nG6_analyze '.
......@@ -538,6 +541,7 @@ class tx_nG6_db {
'version' => $row['analyze_version'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description'],
'is_editable' => $row['analyze_is_editable'],
'parent_id' => $row['analyze_parent_uid']
);
}
......@@ -863,6 +867,7 @@ class tx_nG6_db {
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.hidden AS analyze_hidden, '.
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.is_editable AS analyze_is_editable, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid ',
'FROM' => 'tx_nG6_run_analyze '.
'INNER JOIN tx_nG6_analyze ON tx_nG6_analyze.uid = tx_nG6_run_analyze.analyze_id ',
......@@ -888,6 +893,7 @@ class tx_nG6_db {
'version' => $row['analyze_version'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description'],
'is_editable' => $row['analyze_is_editable'],
'parent_id' => $row['analyze_parent_uid']
);
}
......@@ -924,6 +930,7 @@ class tx_nG6_db {
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.hidden AS analyze_hidden, '.
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.is_editable AS analyze_is_editable, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid ',
'FROM' => 'tx_nG6_analyze '.
'INNER JOIN tx_nG6_run_analyze ON tx_nG6_analyze.uid = tx_nG6_run_analyze.analyze_id '.
......@@ -954,6 +961,7 @@ class tx_nG6_db {
'version' => $row['analyze_version'],
'date' => $row['analyze_date'],
'description' => $row['analyze_description'],
'is_editable' => $row['analyze_is_editable'],
'parent_id' => $row['analyze_parent_uid']
);
}
......@@ -1154,6 +1162,7 @@ class tx_nG6_db {
'tx_nG6_analyze.date AS analyze_date, '.
'tx_nG6_analyze.description AS analyze_description, '.
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.is_editable AS analyze_is_editable, '.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid ',
'FROM' => 'tx_nG6_project '.
'INNER JOIN tx_nG6_project_analyze ON tx_nG6_project.uid = tx_nG6_project_analyze.project_id '.
......@@ -1183,7 +1192,8 @@ class tx_nG6_db {
'description' => $row['analyze_description'],
'parent_id' => $row['analyze_parent_uid'],
'software' => $row['analyze_software'],
'version' => $row['analyze_version']
'version' => $row['analyze_version'],
'is_editable' => $row['analyze_is_editable']
);
}
return $result;
......@@ -1202,6 +1212,7 @@ class tx_nG6_db {
'tx_nG6_analyze.software AS analyze_software, '.
'tx_nG6_analyze.version AS analyze_version, '.
'tx_nG6_analyze.description AS analyze_description,'.
'tx_nG6_analyze.is_editable AS analyze_is_editable,'.
'tx_nG6_analyze.parent_uid AS analyze_parent_uid ',
'FROM' => 'tx_nG6_project '.
'INNER JOIN tx_nG6_project_run ON tx_nG6_project_run.project_id = tx_nG6_project.uid '.
......@@ -1229,7 +1240,8 @@ class tx_nG6_db {
'description' => $row['analyze_description'],
'software' => $row['analyze_software'],
'parent_id' => $row['analyze_parent_uid'],
'version' => $row['analyze_version']
'version' => $row['analyze_version'],
'is_editable' => $row['analyze_is_editable']
);
}
return $result;
......
......@@ -52,8 +52,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</td>
<td>{$new_element.data.description}</td>
{/if}
<td>{$new_element.data.software}</td>
<td>{$new_element.data.version}</td>
{if $new_element.data.is_admin}
{if $new_element.data.is_editable}
<td class="editable">
<span class="editable" data-type="textarea" data-pk="{$new_element.data.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_analyze&field=software" data-original-title="Enter software name">{$new_element.data.software}</span>
</td>
<td class="editable">
<span class="editable" data-type="textarea" data-pk="{$new_element.data.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_analyze&field=version" data-original-title="Enter software version">{$new_element.data.version}</span>
</td>
{else}
<td>{$new_element.data.software}</td>
<td>{$new_element.data.version}</td>
{/if}
{else}
<td>{$new_element.data.software}</td>
<td>{$new_element.data.version}</td>
{/if}
</tr>
{/if}
{* recall *}
......
......@@ -34,6 +34,7 @@ class BasicAnalyse (Analysis):
self.compression = compression
self.delete = delete
self.archive_name = archive_name
self.is_editable = True
def define_analysis(self): pass
......
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