Open University contrib - newsfeed system

Open University contrib - newsfeed system

by sam marshall -
Number of replies: 35
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
(I couldn't spot a more appropriate forum, however moderators please move this if there is a better one.)

Hi all. Here at the Open University we have been a bit lax at releasing our customised features for others to use. In some cases, that's because nobody else wants them, and er... this one might be a case in point smile

However, here is the newsfeed system!

newsfeed.zip (180KB)

(The URL for that is a temporary home only. Anyone know how to put this into moodle contrib? I don't think I have access.)

What this lets you do is create feeds (think RSS/Atom feed) which display as a block on a course page, with click-through to view full messages. Within the interface you can:
  • Post messages (surprise), in a managed way (post then approve, with optional email workflow if you want different people to do the posting/approving). Messages are standard title/html/attachments.
  • Aggregate in an arbitrary manner (i.e. include 3 feeds within another one).
  • Include external feeds (RSS and Atom) within the system. (I.e. you can use this as a rather weird alternative to the standard RSS block if you like.)
  • Allow students to access feeds directly as standard Atom feeds via Firefox 2, IE 7 or any other feed reader.
  • Create timed messages that don't appear to students until a particular date. Roll forward these standard messages into a future presentation of the course. Etc.
Requires Moodle 1.8, PHP 5, and might (hopefully doesn't, but beyond making it use xmldb, I didn't make any effort to check) require Postgres. Hasn't really been tested (well, it has, but not since I modified it for public release). Obviously you should try this thoroughly on test servers before considering production use, for goodness' sake don't install it on a real server.

I did the release based on a current update of MOODLE_18_STABLE so the patches might or might not actually work on stock 1.8, hopefully they do.

Unfortunately due to the legacy implementation (we needed roles, but implemented this way before Moodle got roles) installation involves a rather crappy patch to accesslib and one other file. Apart from that it is implemented as a block... sort of.

There are full install instructions in README.txt, and a sort of user manual (Word format, sorry) is also included in the zip.

If anyone tries this, let me know how you get on.

We plan to release other OU custom features in future, some of which will even plug in without having to patch things! The study calendar course format for instance is pretty cool.

--sam


Average of ratings: -
In reply to sam marshall

Re: Open University contrib - newsfeed system

by Dan Poltawski -
Hi Sam,

I kinda just kinda wanted to say 'Thanks!', because a lot of these contirbutions get released and don't always get recognition. I've not had a through look through the module & indeed I probably wont use it in the first instance, however the fact its available to work further upon is great.

So thanks to all contrib developers! (and maybe I can put work into removing the patching requirement when In get a spare moment!)

Dan.
Average of ratings: Useful (1)
In reply to Dan Poltawski

Re: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Thanks for that, appreciated smile

It'll take a lot more than a 'spare moment' to get rid of the patch requirement, though... (The [surprisingly small, considering] patch creates a new context level. Yes, ouch. Overall the roles implementation is horrible to use. We need to make newsfeeds part of courses and leech off the course roles. But then what do we do with non-course feeds?! argh. Anyhow I'm done with it now, no more time to change it at present.)

Tim has helped me figure out (by which I mean 'stood over me telling me what to do at each step) how to put it in contrib cvs and into the Moodle extensions database, so it is in there now (the database entry will not appear in public until approved). This means the official download link, which should hopefully work from tomorrow, will probably be:

http://download.moodle.org/patches/newsfeed.zip

--sam
In reply to sam marshall

Svar: Re: Open University contrib - newsfeed system

by Daniel Håkansson -

Hi i have been trying to set up this news feed block on my 1.8.2 moodle installation, in th eadmin page it said that it hade set up the database correct.  but when i try to create a new folder i just get this error "Unexpected value for select" do you have any ide on whats wrong?

Kind regards Daniel

In reply to Daniel Håkansson

Re: Svar: Re: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Are you running a Postgres database, and PHP 5 or above? If not, it probably doesn't work on your system. Sorry.

If you are, um... well... it used to work for us smile

[We are now running 1.9 beta 2 here, but we used to run 1.8.]

We are (at long last) working on a dramatically refactored version of the newsfeed system that does not require any evil patches and should install on a standard Moodle 1.9. It also behaves in a more normal kind of way in general. Hopefully it will even run on mysql! Although I don't know if we will actually test it there. Maybe...

I'm hoping this will be released to contrib in March or April (code should be done next month sometime but probably we will wait until it's been internally tested before releasing it).

--sam
In reply to sam marshall

Re: Svar: Re: Open University contrib - newsfeed system

by Martín Langhoff -

It also behaves in a more normal kind of way in general. Hopefully it will even run on mysql!

Hmmm - having a hard time parsing that -- the two sentences contradict eachother: Normal != MySQL

wink

In reply to Martín Langhoff

Re: Svar: Re: Open University contrib - newsfeed system

by Michael Penney -

Speaking of Normal & MySQL:

Helping Dolphins Fly

MySQL_Logo.jpg/a>

We announced big news today - our preliminary results for our fiscal second quarter, and as importantly, that we're acquiring MySQL AB.

http://blogs.sun.com/jonathan/entry/winds_of_change_are_blowing

wide eyes...

In reply to Michael Penney

Re: Svar: Re: Open University contrib - newsfeed system

by Martín Langhoff -
What did happen to the greek guy that flew to close to the sun?

(Just joking! Sun's buyout is good news IMHO - and now there's a far better chance for the InnoDB->Falcon transition. I was fearing an Oracle buyout -- and hoping it'd lead to a complete PostgreSQL takeover of the FOSS scene. Ah well.)
In reply to sam marshall

Re: Svar: Re: Open University contrib - newsfeed system

by He Loirs -
Hi, I use a MySQL database and I have the same error. (Unexpected value for select) Do you already know when you release your plug-in for Moodle 1.9? And will it work with MySQL? I'm still waiting for it...
In reply to He Loirs

Re: Svar: Re: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Sorry!

Basically to answer your questions... we have realised that the revisions required to make it work 'nicely' in Moodle 1.9 are greater than we had thought. (It was originally designed for 1.6 - and because of that we had to do some 'odd' things that didn't fit into standard Moodle framework.)

With each internal release we are gradually moving closer to 'normal' behaviour. I think our next (September) release will be pretty close although there is still one thing missing: backup and restore. (You can use backup/restore to copy a newsfeed but only if the original still exists; it doesn't really back up the messages.)

We're hoping to do a public release of the newsfeed code (minus backup and restore, as noted) after it goes through testing for our internal September release, including fixes so that it works on MySQL. I haven't quite confirmed a schedule for this, but hopefully in late September.

--sam


In reply to sam marshall

Re: Svar: Re: Open University contrib - newsfeed system

by Niall Julian -
We've had Newsfeed installed on our site (Moodle 1.9.3 & PHP 5) and so far I can't setup a new feed. I get as far as filling out the feed settings but when I register the feed I just get a blank screen. When I try to view the feed I get an error message:

Error: get_context_instance() called with incorrect context level "46"

Any ideas?

Thanks,

Niall
In reply to Niall Julian

Re: Svar: Re: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi,

We haven't actually provided a version of newsfeed for 1.9, if I remember correctly - there didn't seem to be much interest in it. I think it's pretty cool but, well, there you go.

Internally, we do have a new version of newsfeed, which removes the need for utterly stupid* changes to core code (like this contextlevel one which is why your version's not working). This should install onto a standard 1.9. However it needs some minor changes to cope with running on non-OU moodle, and I haven't yet packaged it for a public release. I'm busy this week, but if you'd like, I can look at that next week?

--sam

* There was a good reason for it at the time. Mostly to do with porting code developed for 1.6 before there was a roles system.


In reply to sam marshall

Re: Svar: Re: Open University contrib - newsfeed system

by Alan Arnold -
Sam, we'd also be very interested in this at the University of Canberra (1.9.3+, PHP5, Postgres) - Alan
In reply to Alan Arnold

Re: Svar: Re: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
OK, I've put that in my calendar for next week so we'll see how it goes!

(btw it's good that you are using Postgres, but we think it's now database-independent too. At least, it works in oracle, insofar as anything works in oracle...)

--sam
In reply to sam marshall

Re: Svar: Re: Open University contrib - newsfeed system

by Niall Julian -
Thanks for the details Sam. Yes we would be very interested in this. We're hoping to use this as our main news system for our site (don't like the default moodle news).
In reply to sam marshall

Open University contrib - newsfeed system (new version)

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
A rather overdue update is now in CVS, and I've edited the modules and plugins page about it. It's available for download from tomorrow (Friday 30th). Don't download it before then or you'll get a buggy half-done version.

Download and info page

The good news is:

1) It is now a standard block, no patches are required
2) Now works on 1.9.x (only)
3) Tested in MySQL 5 as well as Postgres 8

There are still a few weird things about it but Derek Woolhead did large changes to make it work more sensibly as a moodle block. The main change is a conceptual one: each feed === a block. You can't have a feed without a block, deleting the block deletes the feed, etc. This has been live on our systems for a while now.

Just now, I fixed MySQL problems and made other minor changes to tidy it up for this release (eg hiding features which don't make sense outside the OU).

Hopefully it's of interest. So if anyone wants the ability to post news items (without using a forum) and aggregate these feeds together, e.g. have course news and faculty/programme news - or possibly just to aggregate external Atom/RSS feeds - then this block can probably do it.

--sam



In reply to sam marshall

Re: Open University contrib - newsfeed system (new version)

by Niall Julian -
Sam your a star! Thanks a lot for doing the fixes. I'll get our server people to install it, once its ready smile

I'll post back on here with some feedback once I've had a play.
In reply to sam marshall

Re: Open University contrib - newsfeed system (new version)

by Anil Sharma -
Hi Sam

I installed the latest version today on Moodle 1.9.3 and it gets installed without any errors.

i've installed the block inside a course that has 5 forums, all with RSS enabled. RSS is also enabled at site level.

However, when i goto the option called "Includes" in the settings of News Feed block, I don't get a list of all the forums that have RSS enabled so I can choose them. I jsut get a course name and the "Available Feeds" option is blank.

Am i doing something wrong ? This is the first time im installing this block, but i assume its similar to the normal RSS block, thats installed in the course and working fine.
In reply to Anil Sharma

Re: Open University contrib - newsfeed system (new version)

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Yep, you're doing something wrong. smile Well, or the system is confusing. Your call.

'Includes' only aggregates newsfeed blocks. You cannot directly include an RSS/Atom feed on its own. Instead you have to first make a newsfeed block which includes that feed. It doesn't matter whether the feeds are from within Moodle or across the world, it still counts as 'external' to the newsfeed system and can't be directly included.

So if you want to aggregate the feeds from the forums, you need to:

1) Create a newsfeed block for each forum. Set it to 'External' and paste in the URL of the forum's RSS feed.

2) Create a newsfeed block for the combined feed. Set it to 'Internal'. Once it's set up, go to the 'Includes' page and add all the other blocks.

3) Hide all the other blocks (but don't delete them!)

There are good technical reasons why it works this way (the 'include' option is dynamic and needs the data to be already retrieved in the database; and we wanted to get away from sort of nebulous representations of feeds which were just confusing, so are trying to centre it on the feed = block condition) but from a user interface point of view maybe it's a bit confusing.

It probably makes a bit more sense if you know that the primary purpose of newsfeed is to post course news, and the aggregation is primarily designed so that you can also have a 'programme news' block somewhere and have messages posted to that programme block appear in all of the course blocks automatically. The RSS/Atom input support is actually a bit incidental. smile Hopefully it can still be useful though even if it might be a pain to set up sometimes...

If there's enough demand from within the University to schedule it, we might consider making it so you aggregate multiple RSS/Atom feeds within a single block, which should alleviate these user interface problems. Unfortunately this sort of improvement (we can already do X, but it would be better if it were easier to set up) tends to get a lower priority than things you actually can't do at all, so I don't really see it being scheduled.

By the way, if any experienced PHP/Moodle developer wants to make that improvement - and you've already had a look at the code and think you understand it enough to make the change - please let me know. I probably have time to write up a design spec which would ensure you implement it 'right', or of course you can write your own design spec that I could review. We'd welcome such a contribution, but since the code is a bit complicated, I'm not necessarily expecting that anyone will step forward. smile

--sam
In reply to sam marshall

Re: Open University contrib - newsfeed system (new version)

by Niall Julian -
Hi Sam, just to let you all installed at this end and working well. Thanks for your efforts! smile

Quick query regarding editing the main newsfeed page. I'd like to add a logo img to the top (just to say 'Latest News') of the posted news items. Which page do I need to edit to do this? Is it the viewfeed.php?

Thanks,

Niall
In reply to sam marshall

Re: Open University contrib - newsfeed system (new version)

by Niall Julian -
We've got a niggle with the newsfeed block on our frontpage. The other day all posts suddenly started showing the 'Updated' date which is strange as I hadn't touched all of them. The problem is when this appears it pushes the text outside the menu block in Firefox and Safari. In IE 6 it pushes out the whole border of every block on the the left side of the page which is quite bad. Strangely enough IE 8 behaves ok. I've reduced the em size in the css but this has only had a small impact. Adding widths to the css only affects IE 8. Is there a way to turn off the 'Updated' date code?
In reply to Niall Julian

Re: Open University contrib - newsfeed system (new version)

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
You might try adding the wordwrap option in CSS. I can't remember how this works, but you can tell IE to wordwrap even if there is no blank space (ie middle of words). Although, there should be blank space in the dates? So I don't see why it doesn't wrap anyway. Hmmm.... Maybe there is a no-wrap css that needs overriding.

There is no option in the code to turn off the updated date; you'd have to hack it. Sorry.

By the way this will have been caused by your server's timezone in DST switch - things which were previously midnight (treated as 'date only, no time') have switched to being 01:00 or 23:00 or whatever. Do you have the timezone configured correctly on the server?

--sam
In reply to sam marshall

Re: Open University contrib - newsfeed system (new version)

by Leo Brehm -
Would anyone know how I might let students of courses add their own RSS feeds to there My Moodle page with this block? Right now I have changed the setting to everyone as admin but students still are not allowed to add feeds.

Thanks in advance,
Leo
Moodle 1.9.4
MacOS X Server
Xserve

In reply to Leo Brehm

Re: Open University contrib - newsfeed system (new version)

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Unfortunately we don't use the My Moodle page here, so have not tested it.

I think there is code in the block_newsfeed.php that lists the pages on which the block is allowed to appear. Probably this only allows the course page. You might like to try hacking this code to add the my moodle page to the list (I don't know what the format is - best see other blocks), but it may be necessary to change other areas of block code to make it work too, I don't know.

Sorry,

--sam
In reply to sam marshall

Re: Open University contrib - newsfeed system (new version)

by Niall Julian -
Thanks for the reply Sam, sorry didn't notice it at the time, inbox was full of email...

I actually managed to adjust the font size of the dates making them much smaller (but still readable). So that solved it for now. Might look into the word wrap option though.

The timezone niggle went away actually so I assume the server was corrected. It only lasted for a day or so, so I think it was just a temporary glitch. Will check though.

In reply to sam marshall

Re: Open University contrib - newsfeed system

by Nacho Aguilar -
Hi everybody,

We have been using 'Newsfeed block' without any problem under Moodle 1.9.4 and so on.
When we decided to upgrade to version 1.9.7, we have found that Moodle only shows a blank page.

After some work we have found that Newsfeed block is the problem. There is not any error message or php log, we have uninstalled newsfeed block and Moodle is working ok.

At this time we have uninstalled this block but we would appreciate any help,
because we used it a lot in our site.

Thanks in advance.
In reply to Nacho Aguilar

Re: Open University contrib - newsfeed system

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Did you turn on Debugging in your quest to get an error message?
In reply to Tim Hunt

Re: Open University contrib - newsfeed system

by Nacho Aguilar -
Yes, we did. But we haven't got any information.
In reply to Nacho Aguilar

Re: Open University contrib - newsfeed system

by Nacho Aguilar -
Hi,

Happy new year everybody.

Has anyone tested the block in Moodle 1.9.7? Any roblem? Is it everything ok?

Thanks in advance.
In reply to Nacho Aguilar

Re: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi,

We have 1.9.7 on our development and test servers at the moment, I haven't noticed the newsfeed being broken.

Our live servers are still 1.9.5 so I would not say there has been major testing yet.

It is also possible that our version of newsfeed might not be in synch with the contrib version. However, fundamentally I don't think we have a problem.

I would also like to know if anyone else has tried it in 1.9.7.

--sam
In reply to sam marshall

Re: Open University contrib - newsfeed system

by Niall Julian -
Sam, we tried to upgrade to 1.9.7 but couldn't. According to our Moodle Partner they went through all 3rd party plugins one by one and found that the update failed when Newsfeed was installed. Here is what they said:

'There were not actually any errors even with debugging turned on. All we were getting was a blank page after the confirmation of modules & blocks which made it difficult to debug. It then would not continue through the install process'.

Not a whole lot to go an there really. They performed the upgrade on a copy of the site rather than on the live system. So for the moment we are sticking with 1.9.5 until we work out what the issue is.
In reply to Niall Julian

Re: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Thanks for confirmation!

I have found time to test it and tracked this down - we made a change to the local version here and forgot to apply it to the community version. The newsfeed code defined a function require_sesskey but this function was later added to standard Moodle. Consequently the function definition is duplicated and PHP gives a fatal error. (Note: With error display on, you should actually see this error - I did.)

The fixed version is now in cvs (MOODLE_19 branch) and will be updated in the zip file that you can download from the contrib database page from tomorrow. You can tell the new version because its database version is 2009033100; the previous one was a bit older.

I have tested the fix against latest MOODLE_19 (1.9.7+) and it now works. Apart from noting that the course page didn't crash smile I did a very basic test - created an internal feed, posted a message, approved it, made sure I could see it - and it seems to be OK.

This update also includes some other changes to the OU version which we forgot to update in the contrib one. These are just minor bugfixes. (For example there was an incorrect restriction on MIME type which meant you couldn't attach powerpoint files to messages.)

Note: The new version is supposed to still work against older moodles (1.9.4 or whatever) because I put the function definition inside an if statement so it is still there if required. This isn't tested, though.

--sam

PS Apologies for this and thanks for reporting it. I think we didn't really realise that other people were actually using this feature so it hasn't been as high on our 'make sure to keep the contrib verison working' list as some other projects.
Average of ratings: Useful (1)
In reply to sam marshall

Re: Open University contrib - newsfeed system

by Niall Julian -
Sam thats great! Thanks for checking this out and providing the fix. Our Moodle Partner will check out the fix tomorrow. Will let you know how it goes.

Yes we use Newsfeed on our site to replace the default moodle news. It works well for us. You can check it out here:

http://learnzone.macmillan.org.uk/blocks/newsfeed/ui/viewfeed.php?newsfeedid=4&courseid=1


I need to do some tweaking to the look & feel and we need to make more use of the RSS feed but it does the job really well. We've got 10k users and haven't had any complaints since we introduced it smile

In reply to sam marshall

Re: Open University contrib - newsfeed system

by Giorgio Riva -

Hi Sam, thanks for this module, it's very useful.

I've installed your module on the e-learning platforms of the university I work for.

I would like to report a visualization error that occurs with an external Atom Feed. The special characters of items' title are displayed not decoded (i.e. ' ...).

The solution I found is to modify the get_atom_entry function in sharedui.php.

I've added htmlspecialchars_decode function in line 242

$title=htmlspecialchars_decode(get_single_element_text($entry,'title'));

and then I've removed htmlspecialchars function in line 245

$middlebit=$title;

What do you think? Is it a problem of that feed, a "bug" of the module or something different (Locale, Charset, ...)?

 

This is the link of the feed: http://www.google.com/reader/public/atom/user%2F02152757331788633312%2Flabel%2FNotizie%20per%20gli%20studenti

The problem occurs only with titles.

 

Thanks in advice.

In reply to sam marshall

در پاسخ به: Open University contrib - newsfeed system

by محمد یوسفی -

hi

i'm use moodle version 1.9.12+ . newsfeed block install Success in my system but i want edit newsfeed block and save my setting, I get faced with a warning :

Failed to edit news feed: Error inserting row into newsfeed

please help me .

 

In reply to محمد یوسفی

Re: در پاسخ به: Open University contrib - newsfeed system

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Are you sure it installed correctly when you went to the admin Notifications page? Sounds like the database table is probably missing.

--sam