small problem with order, quicksearch working, code could be better.

This commit is contained in:
naomiaro 2011-01-06 01:00:33 -05:00
parent ff02a42514
commit ee0a8310de
3 changed files with 16 additions and 11 deletions

View file

@ -1838,11 +1838,11 @@ class StoredFile {
} }
if(!is_null($order)) { if(!is_null($order)) {
$ob = " ORDER BY ".$g_metadata_xml_to_db_mapping[$order["category"]]. ", id " .$order["order"]; $ob = " ORDER BY ".$g_metadata_xml_to_db_mapping[$order["category"]]." ".$order["order"].", id ";
$sql = $sql . $ob; $sql = $sql . $ob;
} }
else{ else{
$ob = " ORDER BY artist_name, id asc"; $ob = " ORDER BY artist_name asc, id";
$sql = $sql . $ob; $sql = $sql . $ob;
} }

View file

@ -1,10 +1,10 @@
<div class="paginationControl">
<p> <p>
<?php if ($this->pageCount): ?> <?php if ($this->pageCount): ?>
<div class="paginationControl">
<?php echo $this->firstItemNumber; ?> - <?php echo $this->lastItemNumber; ?> <?php echo $this->firstItemNumber; ?> - <?php echo $this->lastItemNumber; ?>
of <?php echo $this->totalItemCount; ?> of <?php echo $this->totalItemCount; ?>
</p> </p>
<p> <p>
<!-- First page link --> <!-- First page link -->
<?php if (isset($this->previous)): ?> <?php if (isset($this->previous)): ?>
@ -50,7 +50,7 @@
<?php else: ?> <?php else: ?>
<span class="disabled">Last</span> <span class="disabled">Last</span>
<?php endif; ?> <?php endif; ?>
</div>
<?php endif; ?> <?php endif; ?>
</p> </p>
</div>

View file

@ -8,15 +8,20 @@ function setUpQuickSearch() {
string = $(this).val(); string = $(this).val();
$.post(url, {search: string}, function(json){ $.post(url, {search: string}, function(json){
var html; var html, data;
//hacky way until I can figure out paginator better. //hacky way until I can figure out paginator better.
html = json.html.replace(/quick-search\/format\/json/g, "index"); html = json.html.replace(/quick-search\/format\/json/g, "index");
$("#library_content") var el = $(html);
.empty()
.append(html); data = el.find("tr:not(:first-child)");
setLibraryContents(data);
var lib = $("#library_content");
lib.find("div.paginationControl").remove();
lib.append(el[2]);
setUpLibrary();
}); });
}); });