mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 17:59:21 +02:00
Text field to query a specific page. Fix #157.
This commit is contained in:
parent
fad56ec7b6
commit
2ca1ae9f01
4 changed files with 23 additions and 2 deletions
|
@ -52,7 +52,6 @@ function ajaxState(url, input) {
|
|||
});
|
||||
} // ajaxState
|
||||
|
||||
|
||||
// processContents
|
||||
// Iterate over a response and do any updates we received.
|
||||
function processContents(data) {
|
||||
|
|
|
@ -169,6 +169,19 @@ switch ($_REQUEST['action']) {
|
|||
$browse->set_offset($value);
|
||||
}
|
||||
break;
|
||||
case 'custom':
|
||||
$value = intval($value);
|
||||
$limit = $browse->get_offset();
|
||||
if ($limit > 0 && $value > 0) {
|
||||
$total = $browse->get_total();
|
||||
$pages = ceil($total / $limit);
|
||||
|
||||
if ($value <= $pages) {
|
||||
$offset = ($value - 1) * $limit;
|
||||
$browse->set_start($offset);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
ob_start();
|
||||
$browse->show_objects();
|
||||
|
|
|
@ -246,3 +246,11 @@ a.tag_size1, a.tag_size2, a.tag_size3, a.tag_size4 { text-decoration: none; }
|
|||
border: 2px solid #ff9d00;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
#browse_custom_value {
|
||||
margin-left: 5px;
|
||||
height: 20px;
|
||||
width: 50px;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
}
|
|
@ -169,8 +169,9 @@ if ($pages > 1 && $start > -1) {
|
|||
} // end else
|
||||
} // end foreach up
|
||||
?>
|
||||
<?php } ?>
|
||||
<input type="text" id="browse_custom_value" name="value" value="<?php echo $current_page; ?>" onKeyUp="delayRun(this, '500', 'ajaxState', '<?php echo Ajax::url('?page=browse&action=options&browse_id=' . $browse->id . '&option=custom'); ?>', 'browse_custom_value');">
|
||||
<?php
|
||||
}
|
||||
} // if stuff
|
||||
?>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue