fixed pagination in asset manager

This commit is contained in:
JT Smith 2008-10-23 19:03:45 +00:00
parent cbbf85d765
commit 7dc7034861
2 changed files with 18 additions and 30 deletions

View file

@ -402,7 +402,10 @@ sub www_manage {
my $extras = $session->url->extras;
$session->style->setRawHeadTags( <<ENDHTML );
<script type="text/javascript">
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.6.0/build/logger/assets/skins/sam/logger.css">
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/logger/logger-min.js"></script>
<script type="text/javascript">
WebGUI.AssetManager.extrasUrl = '$extras';
YAHOO.util.Event.onDOMReady( WebGUI.AssetManager.initManager );
</script>

View file

@ -48,8 +48,7 @@ WebGUI.AssetManager.findRow
WebGUI.AssetManager.formatActions ( )
Format the Edit and More links for the row
*/
WebGUI.AssetManager.formatActions
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatActions = function ( elCell, oRecord, oColumn, orderNumber ) {
elCell.innerHTML
= '<a href="' + oRecord.getData( 'url' ) + '?func=edit;proceed=manageAssets">Edit</a>'
+ ' | '
@ -93,8 +92,7 @@ WebGUI.AssetManager.formatActions
WebGUI.AssetManager.formatAssetIdCheckbox ( )
Format the checkbox for the asset ID.
*/
WebGUI.AssetManager.formatAssetIdCheckbox
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatAssetIdCheckbox = function ( elCell, oRecord, oColumn, orderNumber ) {
elCell.innerHTML = '<input type="checkbox" name="assetId" value="' + oRecord.getData("assetId") + '"'
+ 'onchange="WebGUI.AssetManager.toggleHighlightForRow( this )" />';
};
@ -103,8 +101,7 @@ WebGUI.AssetManager.formatAssetIdCheckbox
WebGUI.AssetManager.formatAssetSize ( )
Format the asset class name
*/
WebGUI.AssetManager.formatAssetSize
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatAssetSize = function ( elCell, oRecord, oColumn, orderNumber ) {
elCell.innerHTML = oRecord.getData( "assetSize" );
};
@ -112,8 +109,7 @@ WebGUI.AssetManager.formatAssetSize
WebGUI.AssetManager.formatClassName ( )
Format the asset class name
*/
WebGUI.AssetManager.formatClassName
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatClassName = function ( elCell, oRecord, oColumn, orderNumber ) {
elCell.innerHTML = '<img src="' + oRecord.getData( 'icon' ) + '" /> '
+ oRecord.getData( "className" );
};
@ -122,8 +118,7 @@ WebGUI.AssetManager.formatClassName
WebGUI.AssetManager.formatLockedBy ( )
Format the asset class name
*/
WebGUI.AssetManager.formatLockedBy
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatLockedBy = function ( elCell, oRecord, oColumn, orderNumber ) {
var extras = WebGUI.AssetManager.extrasUrl;
elCell.innerHTML
= oRecord.getData( 'lockedBy' )
@ -142,8 +137,7 @@ WebGUI.AssetManager.formatLockedBy
WebGUI.AssetManager.formatRank ( )
Format the input for the rank box
*/
WebGUI.AssetManager.formatRank
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatRank = function ( elCell, oRecord, oColumn, orderNumber ) {
var rank = oRecord.getData("lineage").match(/[1-9][0-9]{0,5}$/);
elCell.innerHTML = '<input type="text" name="' + oRecord.getData("assetId") + '_rank" '
+ 'value="' + rank + '" size="3" '
@ -162,8 +156,7 @@ WebGUI.AssetManager.DefaultSortedBy = {
/*---------------------------------------------------------------------------
WebGUI.AssetManager.BuildQueryString ( )
*/
WebGUI.AssetManager.BuildQueryString
= function ( state, dt ) {
WebGUI.AssetManager.BuildQueryString = function ( state, dt ) {
var query = "recordOffset=" + state.pagination.recordOffset
+ ';orderByDirection=' + ((state.sorting.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "DESC" : "ASC")
+ ';rowsPerPage=' + state.pagination.rowsPerPage
@ -176,8 +169,7 @@ WebGUI.AssetManager.BuildQueryString
WebGUI.AssetManager.formatRevisionDate ( )
Format the asset class name
*/
WebGUI.AssetManager.formatRevisionDate
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatRevisionDate = function ( elCell, oRecord, oColumn, orderNumber ) {
var revisionDate = new Date( oRecord.getData( "revisionDate" ) * 1000 );
var minutes = revisionDate.getMinutes();
if (minutes < 10)
@ -192,8 +184,7 @@ WebGUI.AssetManager.formatRevisionDate
WebGUI.AssetManager.formatTitle ( )
Format the link for the title
*/
WebGUI.AssetManager.formatTitle
= function ( elCell, oRecord, oColumn, orderNumber ) {
WebGUI.AssetManager.formatTitle = function ( elCell, oRecord, oColumn, orderNumber ) {
elCell.innerHTML = '<span class="hasChildren">'
+ ( oRecord.getData( 'childCount' ) > 0 ? "+" : "&nbsp;" )
+ '</span> <a href="' + oRecord.getData( 'url' ) + '?op=assetManager;method=manage">'
@ -206,8 +197,7 @@ WebGUI.AssetManager.formatTitle
WebGUI.AssetManager.initManager ( )
Initialize the www_manage page
*/
WebGUI.AssetManager.initManager
= function (o) {
WebGUI.AssetManager.initManager = function (o) {
var assetPaginator = new YAHOO.widget.Paginator({
containers : ['pagination'],
pageLinks : 7,
@ -280,7 +270,6 @@ WebGUI.AssetManager.initManager
WebGUI.AssetManager.DataSource,
{
initialRequest : 'recordOffset=0',
generateRequest : WebGUI.AssetManager.BuildQueryString,
dynamicData : true,
paginator : assetPaginator,
sortedBy : WebGUI.AssetManager.DefaultSortedBy
@ -336,8 +325,7 @@ WebGUI.AssetManager.initManager
WebGUI.AssetManager.removeHighlightFromRow ( child )
Remove the highlight from a row by removing the "highlight" class.
*/
WebGUI.AssetManager.removeHighlightFromRow
= function ( child ) {
WebGUI.AssetManager.removeHighlightFromRow = function ( child ) {
var row = WebGUI.AssetManager.findRow( child );
if ( YAHOO.util.Dom.hasClass( row, "highlight" ) ) {
YAHOO.util.Dom.removeClass( row, "highlight" );
@ -349,8 +337,7 @@ WebGUI.AssetManager.removeHighlightFromRow
Check the assetId checkbox in the row that contains the given child.
Used when something in the row changes.
*/
WebGUI.AssetManager.selectRow
= function ( child ) {
WebGUI.AssetManager.selectRow = function ( child ) {
// First find the row
var node = WebGUI.AssetManager.findRow( child );
WebGUI.AssetManager.addHighlightToRow( child );
@ -369,8 +356,7 @@ WebGUI.AssetManager.selectRow
WebGUI.AssetManager.toggleHighlightForRow ( checkbox )
Toggle the highlight for the row based on the state of the checkbox
*/
WebGUI.AssetManager.toggleHighlightForRow
= function ( checkbox ) {
WebGUI.AssetManager.toggleHighlightForRow = function ( checkbox ) {
if ( checkbox.checked ) {
WebGUI.AssetManager.addHighlightToRow( checkbox );
}
@ -384,8 +370,7 @@ WebGUI.AssetManager.toggleHighlightForRow
Toggles the entire row by finding the checkbox and doing what needs to be
done.
*/
WebGUI.AssetManager.toggleRow
= function ( child ) {
WebGUI.AssetManager.toggleRow = function ( child ) {
var row = WebGUI.AssetManager.findRow( child );
// Find the checkbox