[Midas] tree browser action list

Mona Wong mona at sdsc.edu
Thu Jul 5 13:18:53 EDT 2012


> I just tried your JS code in a module of mine and it worked.  Here are the relevant parts of my Notification.php to make this work

	Hmm, that's what I have also:

<?php

class Annio_Notification extends MIDAS_Notification
{
    public $moduleName = 'annio';

    public function init()
    {
        $this->addCallBack ( 'CALLBACK_CORE_ITEM_VIEW_ACTIONMENU',
            'getActionMenu', 1 );
        $this->addCallBack ( 'CALLBACK_CORE_GET_FOOTER_LAYOUT',
            'getFooterScript' );
    }

    public function getActionMenu ( $params )
    {
        $webroot = Zend_Controller_Front::getInstance()->getBaseUrl();

        return '<li><a href="/midas/' . $this->moduleName .
            '/Launcher/start?itemid=' . $params['item']->item_id .
            '"><img src="' .  $webroot .
            '/core/public/images/icons/edit.png"/>' .
            $this->t ( ' Annotate image' ) . '</a></li>';
    }

    public function getFooterScript ( $param )
    {
        return '<script type="text/javascript" src="' .
            Zend_Controller_Front::getInstance()->getBaseUrl() . '/modules/' .
            $this->moduleName .  '/public/js/annio.js"></script>';
    }

}

	And here is my midas/modules/annio/public/js/annio.js:

$(document).ready(function() {
    alert ( "MONA!" );
    midas.registerCallback('CALLBACK_CORE_RESOURCES_SELECTED', 'annio', function(params) {
        alert ( "params = " + params );
        if(params.items.length > 0) {
            var html = '<li>Start Annio';
            html += '</li>';

            params.selectedActionsList.append(html);
        }
    });
});

	And when I run it, the "MONA" alert shows up but not the params alert and I see no additional entries on the right side of Midas UI:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2012-07-05 at 10.15.13 AM.png
Type: image/png
Size: 76825 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/midas/attachments/20120705/1d1f6747/attachment-0002.png>
-------------- next part --------------


> Also, note that this works for "selecting" rather than "highlighting" an item, which means you have to check the checkbox.

	I do have checkbox checked and there are no error in the Safari error console.

	By the way, how can I add an entry on the right side when the user simply highlights a file (no checkbox)?

Mona

*********************************************
    Mona Wong
    Web & iPad Application Developer
    San Diego Supercomputer Center

    You are the light you wish to see.
*********************************************





More information about the Midas mailing list