09

collective.preventactions

Sometimes we have some folders or some documents which should have not been deleted.

But our customers/users have deleted them and it occurs some errors on application.

So we decided to create a new package to prevent delete or/and move actions.

 

How it works

We add marker interface to objects which can not be deleted or renamed (= moved).

We subscribe all IItem objects to OFS.interfaces.IObjectWillBeRemovedEvent and OFS.interfaces.IObjectWillBeMovedEvent

When one of these events is received, and object is marked as not deleted or not renamed, we raised an exception and object is not deleted or moved.

 

In the futur, we expect to add a dashboard to have a view of all contents with these markers interfaces to easily use it.

 

You can also set some contents not deleteable (for example) as this in your setuphandler :

from collective.preventactions.interfaces import IPreventDelete
from plone import api
from zope.interface import alsoProvides


def post_install(context):
obj = api.content.get('/Plone/content-not-deleteable')
alsoProvides(obj, IPreventDelete)

 

Now you can have a look at source code of package and try it.

 

 


New package: collective.geo.faceted

Why did we create collective.geo.faceted ?

We use collective.geo suite for geolocatisation for some of our projects. We also use eea.facetednavigation to easily find content into our website or application.

So we decided to add a map view for eea.facetednavigation and we created collective.geo.faceted.

How it works

Leaflet

We prefer to use Leaflet than OpenLayers, because it seems easier to use for us.

So we decided to use collective.geo.leaflet machinery for map creation.

GeoJson

We use geojson standard to add points on map. It is a famous standard used to geo content.

The view created for "faceted" will simply update the geojson and this geojson will also update the map. For the generation of geojson, we extended collective.geo.json view.

Viewlet

Map is added into a viewlet dedicated to the faceted view. We choose to use a viewlet out of 'content-core slot'  (content-core slot is used by faceted to update automatically the  contents). Indeed each technology (faceted and map) uses singular  javascript , it seems better to not mix both technology.

Plone objects are on map  and they are updated thanks to these lines of code:

jQuery(document).ready(function() {
  jQuery(Faceted.Events).bind(
    Faceted.Events.AJAX_QUERY_SUCCESS,
    update_map
  );
});

This code fetches "faceted" events when "faceted" has modifed its criterias and used update_map javascript function to update new geojson on map.

Image is better than words:

Future

This package is tested for Plone 4 with plone.app.contenttypes used as default Plone content types.

Maybe in future we should add a profile like plone5  e.g. example.p4p5 or create a branch plone4 on github and make master branch used to plone5.

 


Document Actions