diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 3d5ddc205..41ab97cab 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -269,15 +269,18 @@ WebGUI.Admin.prototype.editAsset /** * gotoAsset( url ) * Open the appropriate tab (View or Tree) and go to the given asset URL - * Cannot go to a URL that has parameters in Tree view */ WebGUI.Admin.prototype.gotoAsset = function ( url ) { - if ( this.currentTabName() == "view" ) { + if ( this.tabBar.get('activeIndex') > 1 ) { + this.tabBar.selectTab( 0 ); + this.currentTab = "view"; + } + if ( this.currentTab == "view" ) { window.frames[ "view" ].location.href = url; this.treeDirty = 1; } - else if ( this.currentTabName() == "tree" ) { + else if ( this.currentTab == "tree" ) { // Make tree request // XXX this is currently failing... arg is eg /home?func=pasteList&assetId=x4wzjypIRIaDFISifViMgA which should be okay // XXX FIXME: a lot of Tree view operations fail after this point. where the View version just directly goes to the URL, the Tree view tries to modify the URL to pass the extjs-style grid's parameters back. this winds up creating unworkable URLs that try to do two things at once, with two '?'s, two 'op='s, etc. there are two ways to fix this: if we're trying to go to an asset (gotoAsset) and we're in Tree view, flop back to View mode first; or else two distinct requests, one for the remote request (which might generate additional requests to draw in dialog boxes, progress bars, forms, etc) and then when that's all done, refresh the grid view. WebGUI.Admin.prototype.pasteAsset takes the route of flopping to Tree view first. @@ -478,53 +481,27 @@ WebGUI.Admin.prototype.updateClipboard */ WebGUI.Admin.prototype.addPasteHandler = function ( elem, assetId ) { - var self = this; + var self = this; YAHOO.util.Event.on( elem, "click", function(){ // Update clipboard after paste in case paste fails var updateAfterPaste = function(){ - self.requestUpdateClipboard(); - self.afterNavigate.unsubscribe( updateAfterPaste ); + this.requestUpdateClipboard(); + this.afterNavigate.unsubscribe( updateAfterPaste ); }; - - self.afterNavigate.subscribe(updateAfterPaste, self); + self.afterNavigate.subscribe(updateAfterPaste, self ); self.pasteAsset( assetId ); }, self ); }; -/** - * currentTabName() - * Returns the name of the current tab, either "tree" or "view", for callbacks that need to distinguish them - */ -WebGUI.Admin.prototype.currentTabName -= function() { - if ( this.tabBar.get('activeIndex') > 1 ) { - this.tabBar.selectTab( 0 ); - this.currentTab = "view"; - } - return this.currentTab; -} - - /** * pasteAsset( id ) * Paste an asset and update the clipboard */ WebGUI.Admin.prototype.pasteAsset = function ( id ) { - if ( this.currentTabName() == "view" ) { - var url = appendToUrl( this.currentAssetDef.url, 'func=pasteList&assetId=' + id ); - this.gotoAsset( url ); - } - else if ( this.currentTabName() == "tree" ) { - this.tabBar.set('activeIndex', 0); - // as above... - var url = appendToUrl( this.currentAssetDef.url, 'func=pasteList&assetId=' + id ); - this.treeDirty = true; - // this.gotoAsset( url ); // the change notification handler hasn't run yet at this point (and doesn't until we're done here) so this thinks we're still in the Tree view, so we have to do this directly - window.frames[ "view" ].location.href = url; - this.treeDirty = 1; - } - + var url = appendToUrl( this.currentAssetDef.url, 'func=pasteList&assetId=' + id ); + console.log(url); + this.gotoAsset( url ); }; /** @@ -1929,6 +1906,170 @@ WebGUI.Admin.Tree }; YAHOO.lang.extend( WebGUI.Admin.Tree, WebGUI.Admin.AssetTable ); +/** + * runHelperForSelected( helperId ) + * Run the named asset helper for each selected asset + * Show the status of the task in a dialog box + */ +WebGUI.Admin.Tree.prototype.runHelperForSelected += function ( helperId, title ) { + var self = this; + var assetIds = this.getSelected(); + + // alert("ok"); + + // Open the dialog with two progress bars + var dialog = new YAHOO.widget.Panel( 'helperForkModalDialog', { + "width" : '350px', + fixedcenter : true, + constraintoviewport : true, + underlay : "shadow", + close : true, + visible : true, + draggable : false + } ); + dialog.setHeader( title ); + dialog.setBody( + '