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; my $extras = $session->url->extras;
$session->style->setRawHeadTags( <<ENDHTML ); $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'; WebGUI.AssetManager.extrasUrl = '$extras';
YAHOO.util.Event.onDOMReady( WebGUI.AssetManager.initManager ); YAHOO.util.Event.onDOMReady( WebGUI.AssetManager.initManager );
</script> </script>

View file

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