start on Tree buttons to call Asset Helpers
This commit is contained in:
parent
b9e879b7aa
commit
f6831953bd
2 changed files with 88 additions and 2 deletions
|
|
@ -916,6 +916,14 @@ __DATA__
|
|||
<div id="yui-tabs" class="yui-content">
|
||||
<div id="viewTab"><iframe src="<tmpl_var viewUrl>" name="view"></iframe></div>
|
||||
<div id="treeTab">
|
||||
<div id="treeButtons">
|
||||
<input type="button" id="treeUpdate" value="^i18n('update');" />
|
||||
<input type="button" id="treeDelete" value="^i18n('delete');" />
|
||||
<input type="button" id="treeCut" value="^i18n('cut');" />
|
||||
<input type="button" id="treeCopy" value="^i18n('copy');" />
|
||||
<input type="button" id="treeDuplicate" value="^i18n('duplicate');" />
|
||||
<input type="button" id="treeCreateShortcut" value="^i18n('create shortcut');" />
|
||||
</div>
|
||||
<div id="treeCrumbtrail"></div>
|
||||
<div id="treeDataTableContainer"></div>
|
||||
<div id="treePagination"></div>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ WebGUI.Admin = function(cfg){
|
|||
this.i18n = new WebGUI.i18n( {
|
||||
namespaces : {
|
||||
'WebGUI' : [ '< prev', 'next >', 'locked by' ],
|
||||
'Asset' : [ 'rank', '99', 'type', 'revision date', 'size', 'locked', 'More', 'unlocked', 'edit' ]
|
||||
'Asset' : [ 'rank', '99', 'type', 'revision date', 'size', 'locked', 'More', 'unlocked', 'edit',
|
||||
'update', 'delete', '43', 'cut', 'Copy', 'duplicate', 'create shortcut'
|
||||
]
|
||||
},
|
||||
onpreload : {
|
||||
fn : _init
|
||||
|
|
@ -1374,7 +1376,8 @@ WebGUI.Admin.AssetTable.prototype.formatLockedBy
|
|||
WebGUI.Admin.AssetTable.prototype.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" '
|
||||
elCell.innerHTML = '<input type="text" id="' + oRecord.getData("assetId") + '_rank" '
|
||||
+ 'name="' + oRecord.getData("assetId") + '_rank" '
|
||||
+ 'value="' + rank + '" size="3" '
|
||||
+ '/>';
|
||||
// TODO: Add onchange handler to select row
|
||||
|
|
@ -1588,6 +1591,24 @@ WebGUI.Admin.AssetTable.prototype.buildQueryString
|
|||
return query;
|
||||
};
|
||||
|
||||
/**
|
||||
* getSelected( )
|
||||
* Return an array of the selected asset IDs
|
||||
*/
|
||||
WebGUI.Admin.AssetTable.prototype.getSelected
|
||||
= function ( ) {
|
||||
var assetIds = [];
|
||||
var row = this.dataTable.getFirstTrEl();
|
||||
while ( row ) {
|
||||
var check = this.findCheckbox( row );
|
||||
if ( check.checked ) {
|
||||
assetIds.push( check.value );
|
||||
}
|
||||
row = this.dataTable.getNextTrEl( row );
|
||||
}
|
||||
return assetIds;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* WebGUI.Admin.Tree
|
||||
|
|
@ -1609,10 +1630,67 @@ WebGUI.Admin.Tree
|
|||
formatter: bind( this, this.formatRank )
|
||||
} );
|
||||
|
||||
// Add button behaviors
|
||||
this.btnUpdate = new YAHOO.widget.Button( "treeUpdate", {
|
||||
type : "button",
|
||||
label : window.admin.i18n.get('Asset','update'),
|
||||
onclick : { fn: this.update, scope: this }
|
||||
} );
|
||||
|
||||
this.btnDelete = new YAHOO.widget.Button( "treeDelete", {
|
||||
type : "button",
|
||||
label : window.admin.i18n.get('Asset','delete'),
|
||||
onclick : { fn: this.trash, scope: this }
|
||||
} );
|
||||
|
||||
this.btnCut = new YAHOO.widget.Button( "treeCut", {
|
||||
type : "button",
|
||||
label : window.admin.i18n.get('Asset','cut'),
|
||||
onclick : { fn: this.cut, scope: this }
|
||||
} );
|
||||
|
||||
this.btnCopy = new YAHOO.widget.Button( "treeCopy", {
|
||||
type : "button",
|
||||
label : window.admin.i18n.get('Asset','Copy'),
|
||||
onclick : { fn: this.copy, scope: this }
|
||||
} );
|
||||
|
||||
this.btnDuplicate = new YAHOO.widget.Button( "treeDuplicate", {
|
||||
type : "button",
|
||||
label : window.admin.i18n.get('Asset','duplicate'),
|
||||
onclick : { fn: this.duplicate, scope: this }
|
||||
} );
|
||||
|
||||
this.btnCreateShortcut = new YAHOO.widget.Button( "treeCreateShortcut", {
|
||||
type : "button",
|
||||
label : window.admin.i18n.get('Asset','create shortcut'),
|
||||
onclick : { fn: this.shortcut, scope: this }
|
||||
} );
|
||||
|
||||
this.init();
|
||||
};
|
||||
YAHOO.lang.extend( WebGUI.Admin.Tree, WebGUI.Admin.AssetTable );
|
||||
|
||||
/**
|
||||
* update( e )
|
||||
* Update the selected assets' rank
|
||||
*/
|
||||
WebGUI.Admin.Tree.prototype.update
|
||||
= function ( e ) {
|
||||
// Get the new ranks
|
||||
var assetIds = this.getSelected();
|
||||
var payload = {}; // Request data payload
|
||||
for ( var i = 0; i < assetIds.length; i++ ) {
|
||||
var assetId = assetIds[i];
|
||||
payload[ assetId ] = {
|
||||
rank : document.getElementById( assetId + "_rank" ).value
|
||||
};
|
||||
}
|
||||
|
||||
// Send the request
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* buildQueryString ( )
|
||||
* Build a query string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue