1
0
Fork 0
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:
SUTJael 2014-05-06 18:50:33 +02:00
parent fad56ec7b6
commit 2ca1ae9f01
4 changed files with 23 additions and 2 deletions

View file

@ -52,7 +52,6 @@ function ajaxState(url, input) {
}); });
} // ajaxState } // ajaxState
// processContents // processContents
// Iterate over a response and do any updates we received. // Iterate over a response and do any updates we received.
function processContents(data) { function processContents(data) {

View file

@ -169,6 +169,19 @@ switch ($_REQUEST['action']) {
$browse->set_offset($value); $browse->set_offset($value);
} }
break; 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(); ob_start();
$browse->show_objects(); $browse->show_objects();

View file

@ -246,3 +246,11 @@ a.tag_size1, a.tag_size2, a.tag_size3, a.tag_size4 { text-decoration: none; }
border: 2px solid #ff9d00; border: 2px solid #ff9d00;
margin: 0px; margin: 0px;
} }
#browse_custom_value {
margin-left: 5px;
height: 20px;
width: 50px;
text-align: center;
padding: 0;
}

View file

@ -169,8 +169,9 @@ if ($pages > 1 && $start > -1) {
} // end else } // end else
} // end foreach up } // 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 <?php
}
} // if stuff } // if stuff
?> ?>
&nbsp; &nbsp;