Commit 376b87da authored by Leigh B Stoller's avatar Leigh B Stoller

Couple of tweaks for Mike.

parent 223c1989
<?php
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -151,6 +151,7 @@ while ($row = mysql_fetch_array($query_result)) {
$blob["imageid"] = $imageid;
$blob["description"] = $row["description"];
$blob["imagename"] = $row["imagename"];
$blob["created"] = DateStringGMT($row["created"]);
$blob["pid"] = $row["pid"];
$blob["pid_idx"] = $row["pid_idx"];
$blob["global"] = $row["global"];
......@@ -162,7 +163,7 @@ while ($row = mysql_fetch_array($query_result)) {
CreateURL("showimageid",
URLARG_IMAGEID, $imageid);
$images[$imageid] = $blob;
$images[] = $blob;
}
echo "<script type='text/plain' id='images-json'>\n";
echo htmlentities(json_encode($images)) . "\n";
......
......@@ -21,6 +21,13 @@ $(function ()
});
$('#main-body').html(html);
// Format dates with moment before display.
$('.format-date').each(function() {
var date = $.trim($(this).html());
if (date != "") {
$(this).html(moment($(this).html()).format("lll"));
}
});
// This activates the popover subsystem.
$('[data-toggle="popover"]').popover({
placement: 'auto',
......@@ -71,8 +78,8 @@ $(function ()
filter_liveSearch : true,
},
headers: {
3: {sorter: false},
4: {sorter: false},
5: {sorter: false},
},
});
......@@ -104,8 +111,8 @@ $(function ()
var filters = $.tablesorter.getFilters($('#images-table'));
// The "any" filter needs a value or everything disappears.
// If there is a term in the search box, it will have a value.
if (filters[6] === undefined) {
filters[6] = "";
if (filters[7] === undefined) {
filters[7] = "";
}
if ($('#my-images').is(":checked")) {
tmp.push("creator");
......@@ -126,11 +133,11 @@ $(function ()
}
if (tmp.length) {
// regex search, plain | does not work.
filters[5] = "/" + tmp.join("|") + "/";
filters[6] = "/" + tmp.join("|") + "/";
}
else {
// Hmm, an empty string will get everything.
filters[5] = "WHY";
filters[6] = "WHY";
}
console.info("SetFilters", filters);
$.tablesorter.setFilters($('#images-table'), filters, true);
......
......@@ -77,6 +77,7 @@
<th>Name</th>
<th>Creator</th>
<th>Project</th>
<th>Created</th>
<th class="sorter-false">Description</th>
<th class="sorter-false">URN</th>
<th class="hidden-column">Filters</th>
......@@ -85,7 +86,7 @@
<tbody>
<% var creator_re = /(creator|project)/; %>
<% var project_re = /project/; %>
<% _.each(images, function(value, imageid) { %>
<% _.each(images, function(value, index) { %>
<tr>
<% if (isadmin) { %>
<td><a href="<%- value.url %>"><%= value.imagename %></a></td>
......@@ -104,6 +105,7 @@
<% } else { %>
<td><%= value.pid %></td>
<% } %>
<td class="format-date"><%- value.created %></td>
<td><%- value.description %></td>
<td align="center">
<a href="#"
......
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