Group tagcloud widget for group custom layout v0.1

Release Notes

0.1

There is commented-out code that is intended to take advantage of the tagcloud plugin's capacity to change the sort order of tags, but I can't work out how to make that work, yet.

It would be nice to limit the results of selecting a tag to only show items belonging to the group: right now it shows all uses of the tag from across the site. Again, too tricky for a beginner like me!

The title for the widget is sanitized to remove risky HTML. Note that the current widgets for group custom layout (version 1.3) do not yet do this.

Not yet tested on 1.7.5 release of Elgg and the group custom layout. Seems OK on 1.7.4, tested in two installations.

  • ah thanks.. another addition :)

    i missed replying to your messages as i have been busy here.. 

    i'll integrate your code into the main one if you like?

  • @tunist - it would be great to have this in the main distro - thanks! Do check the sanity of the code: I *think* it is OK but am a beginner with Elgg code.

    While you're there updating the plugin, would it be possible to sanitise the HTML for the free HTML widget and titles of widgets? I think a 'filter_tags'  function should do the trick.

    Jon

  • you are welcome!

    what do you mean by 'sanitise' the HTML widget? strip out code that is not valid HTML? i haven't looked at that widget in any detail so i'm not sure what it's already doing (i didn't write the baseline version of the plugin)..

    where you say 'titles of widgets', do you mean the names of the widgets as they appear in the widget manager - e.g. izap_videos etc?

    if so, you can change them within the language file for 'group_custom_plugin'.

    n.b. i have 'tag_cumulus' installed on my development site, which you can see here: 

    http://community2.infiniteeureka.com/pg/groups/289/permaculture-and-green-community/

    i may integrate that into the plugin at some point once i've finished the rest of my site..

    ideally i'd like the tags to update differently for different pages so that the tags are relevant to the content on display.

  • RE sanitisation: yes, the idea is to strip out things like JavaScript, iFrames etc and clean up messy code using the built-in Elgg function. Just means changing in (at least) the view.php for that widget:

    echo $widget->html_content;

    to

    echo filter_tags($widget->html_content);

    In our installation we have also done that to the edit.php so mistakes don't haunt their originators. We have a closed site so our problems are not malicious coders, but over-ambitious or careless ones could easily cause damage.

    It would be nice to do the same for the titles of widgets, ie the titles (mostly editable) that appear in the edit views for them, not the widget names that appear in the widget manager. I haven't tested the theory but it looks like one could use any arbitrary HTML in them. 

    Re tag cumulus, I quite like the plugin but it can be a bit distracting and lack of accessibility is a big concern. Of course, that is true for several bits of Elgg, especially those drag and drop things we all love. Would be nice to find a way of dealing with that one day! 

    The tag cloud integration I've provided here only shows the current group's tags. Because it only displays in the group profile, not when viewing other content, that is about as contextual as it can get. However,  the search results when you click on them are for those tags across the site - it, still useful but it would be nice to contextualise those to only the group's results. 

     

  • i've now updated the html widget in group_custom_layout to include refined tag checking and fixed another bug thanks to the solution being posted in the community here..

    i looked at incorporating your tagcloud widget into it too, but haven't been able to get the tagcloud to display.. i have group_tag_cloud at the bottom of the tools list.. but still no show.

    any idea why that might be?

    thanks

  • Great re the HTML widget! I've been trying to work out how to make that use built-in editor but no luck yet - because group custom layout somewhat bypasses Elgg form handling I can't work out how to use TinyMCE without very clunkily explicitly including TinyMCE code, which is not elegant, not maintainable and no good for those using a different rich text editor.

    Tagcloud *should* just attach itself and use either built-in function or the tagcloud plugin. If the latter is not installed it *may* remove itself as it tests for presence of the tagcloud plugin - I've disabled it and it still works, but not tried it on a system without that installed at all. 

    It's possible it might be something to do with how it initialises. In principle, it should be possible to incorporate it with the group custom layout directly as that's how I made it  - I modified the group custom layout, checked it worked, then just extracted the relevant bits into separate files so that I didn't have to create yet another fork of the code. So, should be possible to add the widget code to the widget views, the contents of en.php to that in group custom layout and the widget init code to start.php in group custom layout and it should work without modification.

  • i haven't played with adding a texteditor to any pages here, so i don't have much to say that might help you get that elegantly resolved.. let me know if you do though, i'll add it in to the main plugin too :)

    re: tagcloud - thanks - yes, i did already move the code to group_custom_layout but it didn't function.. so then i looked at running group_tag_cloud instead, but that didn't work either.

    i do have tagcloud installed and it is working on the individual member profiles as a widget, but not in the groups.

    i looked through the code but didn't yet find a reason for the widget not appearing on the group page.. the option is presented for group tagcloud in the drag+drop list of widgets on the edit_layout page but when added to a group page it doesn't appear at all.

    i'll let you know if i find the cause. :)

  • You fellas are on it! This GCL from Nick is what I see as the beginning of the groups area, not the end.

  • Any news on this? I got the same symptom - i can add the widget to the custom layout, but it doesn't show up. I also noticed that the Settings-Link doesn't appear if you drag the widget into a column. This widget would be a treat...

  • This is curious, Herschel! We've had it working on 4 different sites. The main thing that I can think of that would cause it not to be shown but to appear on the widget list were if the tagcloud plugin were either not enabled or appeared further down the list of plugins as there is a line that checks for it in the plugin's view.php. Could that be the case? Apart from that, I'm at a loss as to what could cause it, unless there are too few tags to show up: I believe that there is a minimum set in the tagcloud plugin itself but am not sure what that minimum may be. Seems OK with 5 tags or more, at least.

    I did wonder if it might be a version issue (only tested to 1.7.4) but the fact that it appears on the widget list for editing makes me think that is unlikely. Are you able to modify the widget once it has been saved in the group custom layout? You should be able to specify the number of tags to show. If so, it will narrow down the options and I can explore other fixes. 

  • hi jondron! sorry for not responding - i was quite eaten up by work in the last few weeks. but thanks for trying to help. i tried it now on another site - with the same result. in the group layout i'm able to add this widget to the group page but again - no settings link in the layout and no widget on the group homepage. we already have more than 20 tags, so this shouldn't be the problem. the plugin is enabled. no, i'm not able to modify the settings - there's no link for the setting in the group layout.

    Even if i put some static text into the view.php of grouptagcloud nothing shows up in the group layout. I have the impression, that the view script doesn't get called at all. The start.php does, if i put a die() into it php dies as expected.

  • Curiouser and curiouser.

    If you can't change settings it sounds like edit.php is not loading properly either.

    What version of Elgg do you run?

    Have you had problems with any other group custom layout widgets?

    Jon

     

     

     

Jon Dron

Prof at Athabasca University

Stats

  • Category: Widgets
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 598
  • Recommendations: 0

Other Projects

View Jon Dron's plugins