New Notice Dashlet and Improvements for Developers

cancel
Showing results for 
Search instead for 
Did you mean: 

New Notice Dashlet and Improvements for Developers

wabson
Active Member II
0 2 2,883
Following hot on the heels of the 4.2.a release from last week, it's great to see 4.2.b going out this week with another bunch of improvements before DevCon. I've been able to help get a few more changes into the this release, which provide a new dashlet and several improvements for developers.

Notice Dashlet



This dashlet may already be familiar to some of you who have used the add-ons available from Share Extras.



The Notice Dashlet allows site managers to add a custom notice that will be displayed to all site members, and allows this to be done directly from the dashlet itself. Now you no longer need to create a wiki page just to display some basic text on the dashboard!





New Bubbling event for dashlet resize notifications



If you've developed any complex dashlets to render maps or other graphics, you'll appreciate that it's important to know the vertical height of the dashlet when you render your content. That is easy to get via the Dom or using YUI2's YAHOO.util.Dom.getRegion() function, but what if the user resizes the dashlet?



Now the resizer module can notify your listeners via the new Bubbling event dashletResizeEnd. This is fired when the resizing has been completed and passes a number of parameters in the event arguments, including the new height of the dashlet, the dashlet element and component IDs and the Dom element representing the dashlet. To subscribe to the event, simply define a new custom function in your dashlet class prototype and bind it to the event in the dashlet class constructor, e.g.

YAHOO.Bubbling.on('dashletResizeEnd', this.onDashletResize, this);


In your custom function you can then take any further action which is necessary, e.g. informing a map instance that the element bounds have changed.

More options for Data List actions



The ability to add custom UI actions to Share's Document Library is well documented and the add-ons site has a number of extensions which utilize this capability. But did you know the same thing can be done for data list items?



Until now the number of actions that can be displayed in the UI has been effectively capped at three. But now you can easily add new actions of your own there too. Thanks to the work done by Dave Draper these definitions can easily be inserted into the application by using an extensibility module to customize the datagrid.get and actions-common.get components.







As an example, the following code could be used to add the Sample Datalist Action provided by Share Extras to your datalist items, as part of an extensibility module.

if (model.widgets)

{

   for (var i = 0; i < model.widgets.length; i++)

   {

      var widget = model.widgets[i];

      if (widget.id == 'DataGrid')

      {

         // These two lines only needed if you want to show the action in the 'actions' cell,

         // otherwise a 'More actions' menu will be created to display it.

         //widget.options.splitActionsAt = 4;

         //widget.options.actionsColumnWidth = 105; // splitActionsAt * 25 + 5

         // Add the action definition - this will be action-specific

         model.actionSet.push({

            id: 'onActionSample', // Change to match your handler function name

            type: 'action-link',

            permission: '',

            href: '',

            label: 'actions.datalist.mycustom' // Change to match your custom label in datagrid.get.properties

         });

      }

   }

}


If you have attempted to customize the existing Edit and Create data list actions with your own custom form configuration, then you may also appreciate the ability to increase the width of the modal dialogs used here, which previously were fixed-width.

Better handling of missing custom previewers



This will mainly be of interest to developers and administrators working with custom viewers in the web preview component, such as the pdf.js viewer in Share Extras's Media Viewers add-on, and is a topic which I'll be talking about in San Jose next month.



Previously, if the files implementing the viewer were unavailable for some reason then an error would be thrown in the client-side component. With this change the component now logs that the viewer class could not be found, and this will also be printed on the screen if no other viewers can be found.
2 Comments