Commit 08a3f4c2 authored by Leigh B Stoller's avatar Leigh B Stoller

Separate profile creator from updater so we do not reassign the profile

to the person updating it. Minor changes to the templates for display.
parent 911067a2
...@@ -405,11 +405,13 @@ sub NewVersion($$) ...@@ -405,11 +405,13 @@ sub NewVersion($$)
goto bad goto bad
if (! DBQueryWarn("insert into apt_profile_versions ". if (! DBQueryWarn("insert into apt_profile_versions ".
" (name,profileid,version,pid,pid_idx, ". " (name,profileid,version,pid,pid_idx, ".
" creator,creator_idx,created,uuid, ". " creator,creator_idx,updater,updater_idx, ".
" created,uuid, ".
" parent_profileid,parent_version,rspec, ". " parent_profileid,parent_version,rspec, ".
" script,paramdefs) ". " script,paramdefs) ".
"select name,profileid,'$newvers',pid,pid_idx, ". "select name,profileid,'$newvers',pid,pid_idx, ".
" '$uid','$uid_idx',now(),uuid(),'$profileid', ". " creator,creator_idx,'$uid','$uid_idx',".
" now(),uuid(),'$profileid', ".
" '$version',rspec,script,paramdefs ". " '$version',rspec,script,paramdefs ".
"from apt_profile_versions as v ". "from apt_profile_versions as v ".
"where v.profileid='$profileid' and ". "where v.profileid='$profileid' and ".
......
...@@ -377,6 +377,7 @@ if (! isset($create)) { ...@@ -377,6 +377,7 @@ if (! isset($create)) {
$defaults["profile_script"] = $profile->script(); $defaults["profile_script"] = $profile->script();
} }
$defaults["profile_creator"] = $profile->creator(); $defaults["profile_creator"] = $profile->creator();
$defaults["profile_updater"] = $profile->updater();
$defaults["profile_created"] = $defaults["profile_created"] =
DateStringGMT($profile->created()); DateStringGMT($profile->created());
$defaults["profile_published"] = $defaults["profile_published"] =
......
<?php <?php
# #
# Copyright (c) 2000-2015 University of Utah and the Flux Group. # Copyright (c) 2000-2016 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -72,7 +72,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -72,7 +72,7 @@ while ($row = mysql_fetch_array($query_result)) {
$pid = $row["pid"]; $pid = $row["pid"];
$created = $row["created"]; $created = $row["created"];
$published = $row["published"]; $published = $row["published"];
$creator = $row["creator"]; $creator = ($version == 0 ? $row["creator"] : $row["updater"]);
$rspec = $row["rspec"]; $rspec = $row["rspec"];
$desc = ''; $desc = '';
......
...@@ -105,6 +105,8 @@ class Profile ...@@ -105,6 +105,8 @@ class Profile
function version() { return $this->field('version'); } function version() { return $this->field('version'); }
function creator() { return $this->field('creator'); } function creator() { return $this->field('creator'); }
function creator_idx() { return $this->field('creator_idx'); } function creator_idx() { return $this->field('creator_idx'); }
function updater() { return $this->field('updater'); }
function updater_idx() { return $this->field('updater_idx'); }
function pid() { return $this->field('pid'); } function pid() { return $this->field('pid'); }
function pid_idx() { return $this->field('pid_idx'); } function pid_idx() { return $this->field('pid_idx'); }
function created() { return $this->field('created'); } function created() { return $this->field('created'); }
......
...@@ -90,6 +90,7 @@ $defaults["profile_name"] = $profile->name(); ...@@ -90,6 +90,7 @@ $defaults["profile_name"] = $profile->name();
$defaults["profile_rspec"] = $profile->rspec(); $defaults["profile_rspec"] = $profile->rspec();
$defaults["profile_version"] = $profile->version(); $defaults["profile_version"] = $profile->version();
$defaults["profile_creator"] = $profile->creator(); $defaults["profile_creator"] = $profile->creator();
$defaults["profile_updater"] = $profile->updater();
$defaults["profile_pid"] = $profile->pid(); $defaults["profile_pid"] = $profile->pid();
$defaults["profile_created"] = DateStringGMT($profile->created()); $defaults["profile_created"] = DateStringGMT($profile->created());
$defaults["profile_published"] = DateStringGMT($profile->published()); $defaults["profile_published"] = DateStringGMT($profile->published());
......
...@@ -40,8 +40,19 @@ ...@@ -40,8 +40,19 @@
<td><a href='user-dashboard.php?user=<%= formfields.profile_creator %>'> <td><a href='user-dashboard.php?user=<%= formfields.profile_creator %>'>
<%- formfields.profile_creator %></a></td> <%- formfields.profile_creator %></a></td>
</tr> </tr>
<% if (formfields.profile_version != 0) { %>
<tr>
<td>Updated by:</td>
<td><a href='user-dashboard.php?user=<%= formfields.profile_updater %>'>
<%- formfields.profile_updater %></a></td>
</tr>
<% } %>
<tr> <tr>
<td>Created:</td> <% if (formfields.profile_version == 0) { %>
<td>Created:</td>
<% } else { %>
<td>Updated:</td>
<% } %>
<td class='format-date' style='word-wrap:break-word;'> <td class='format-date' style='word-wrap:break-word;'>
<%- formfields.profile_created %></td> <%- formfields.profile_created %></td>
</tr> </tr>
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
</tr> </tr>
<tr> <tr>
<td>Version:</td><td> <td>Version:</td><td>
<% if (history) { %> <% if (history) { %>
<a href='profile-history.php?uuid=<%= profile_uuid %>'> <a href='profile-history.php?uuid=<%= profile_uuid %>'>
<%- fields.profile_version %></a> <%- fields.profile_version %></a>
<% } else { %> <% } else { %>
<%- fields.profile_version %> <%- fields.profile_version %>
<% } %> <% } %>
</td></tr> </td></tr>
<tr> <tr>
<td>Project:</td> <td>Project:</td>
<td><%- fields.profile_pid %></td> <td><%- fields.profile_pid %></td>
...@@ -31,8 +31,18 @@ ...@@ -31,8 +31,18 @@
<td>Creator:</td> <td>Creator:</td>
<td><%- fields.profile_creator %></td> <td><%- fields.profile_creator %></td>
</tr> </tr>
<% if (fields.profile_version != 0) { %>
<tr>
<td>Updated by:</td>
<td><%- fields.profile_updater %></td>
</tr>
<% } %>
<tr> <tr>
<td>Created:</td> <% if (fields.profile_version == 0) { %>
<td>Created:</td>
<% } else { %>
<td>Updated:</td>
<% } %>
<td class='format-date' style='word-wrap:break-word;'> <td class='format-date' style='word-wrap:break-word;'>
<%- fields.profile_created %></td> <%- fields.profile_created %></td>
</tr> </tr>
......
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