Forums | Mahara Community
Plugin to share the page on twitter, facebook, evernote
02 May 2011, 8:21 AM
I had a shot at writing a plugin for Mahara. A difficulty I am having is to figure out how to get the script included in the header of a page template, within the Mahara environment (I have just downloaded it, I am not really familiar with it).
I manually modified web,php to add a reference to both jQuery (isn't jQuery, at least partially embedded in the tiny_mce directory?) and the jquery plugin in use. I would assume that this is not the expected way to do this (ideally, the plugin should be added to the blocktype folder and no other file modified).
If one wanted to use jQuery to write mahara blocks in the form of jQuery modules, what would be the best way to proceed?
Here is a zip file with the socialbuttons plugin. Mahara 1.3.3 was used during development.
02 May 2011, 10:09 AM
Quick look at Mahara 1.4 on gitorious. jQuery 1.3.2 is included and, within the creativecommons blocktype, there is a function
With a quick try, I couldn't get it to work in 1.3.3. I will try with 1.4 tomorrow.
03 May 2011, 1:23 AM
Please check http://mahara.org/view/view.php?id=35645
No everlast support though :(
03 May 2011, 9:19 AM
Thanks Gregor! I had run a search for plugins on mahara.org but didn't come across these ones.
Though the social buttons was really a pretense. I wanted to check if blocktypes could be created that run jQuery plugins. There are huge numbers of jQuery plugins that would help make the portfolio more dynamic / modern / engaging.
I have been playing with jQuery quite a bit recently, and it really is not too difficult to write or rewrite its plugins in a way that the interactive content can be provided by not very technical users. Check out the widgeds project for examples.
I was researching how difficult it would be to turn them into Mahara blocktypes with customizable content.
03 May 2011, 2:30 PM
Could you please explain in more detail, what blocktypes will do (what you want to achieve)?
03 May 2011, 5:49 PM
If the user added 4 gallery blocks on his page, the gallery plugin should be added once and only once to the header of the document.
The only way I have found to guarantee that outcome in 1.3.3 was to add two lines to the web.php file.
mahara/view/web.php line 96, added
To include the jQuery library there makes sense (though it needs to be checked that doing so is not gonna break any of the mochikit functionalities).
What Rusian mentioned would do perfectly : "adding header modification methods to Mahara few month ago. I did not have a chance to implement that though. Hopefully soon Mahara will have that functionality "
Where it starts to be tricky is deciding what to do with third party plugins. Two frequent dependencies are on jquery.timer and jquery.scrollTo. If different plugins, written by different authors that cannot be expected to have any knowledge of each other contributions, both use these plugins but different version numbers of it, what does happen?
To guarantee the absence of conflict, you can require to have them included in the private scope of the plugin. But this may lead to some performance hit, with code unnecessarily repeated across plugins.
The next best option would be to have a third party / vendor folder within the jquery folder that seems to be part of the distribution for the next version of Mahara. At least for third party helpers that are repeatedly used across plugins and can be of some size (jquery-ui). Developers encouraged to develop against these versions. But this option is not as full proof. Conflicts are bound to happen.
All in all, I am trying to understand what is possible, what discussions if any have already taken place on this topic, and what the roadmap is, if any
03 May 2011, 3:15 PM
Nice to see you here in the forums. :-)
Gregor has been working on a blocktype to display flickr and picasa slideshows, but I don't think that this code is already live.
03 May 2011, 6:05 PM
Thanks for the kind words. I had run a few searches on this Mahara website or on Google to try and get an idea of what existed, but came out without much.
The 1.4version on gitorious is dated as of yesterday, includes jquery but not the twitter or the image gallery blockypes. What's the best way to find out about the community contributed plugins and the ones currently in development?
03 May 2011, 8:19 PM
I added Gregor's new plugins to the wiki page at http://wiki.mahara.org/Plugins so that they are not only accessible from his profile page.
Evan had worked on a flickr gallery when he was a Summer of Tech student some time ago. I don't think that he contributes to Mahara anymore. After Gregor mentioned his work on the slideshow plugin, we did not pursue Evan's code further as that would not have had the functionality that Gregor is putting into his slideshow plugin. I don't think the slideshow plugin is ready yet. Therefore, it's not yet on Gregor's page. He is very good in updating the community on any of his plugins.
Plugins that are not part of core Mahara are not on the 1.4 branch in GIT, but they are maintained by the developers themselves. I found a branch of Gregor on GIT, but it doesn't look like that there are any of his plugins.
04 May 2011, 3:11 AM
Thanks Kristina, that's very helpful