138 - Create a Joomla! v 1.5 Slideshare Module

Google's Highly Open Participation Program tries to get young students into Open Source and Joomla! specifically. Everyone is welcome, there are not limits. You can be a coder, documenter, tester, translator to help out. Jump in and start helping!
AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Sat Dec 15, 2007 11:28 pm

Description - still says: A module to view SlideShare presentations.

In the description, need to give detailed explanation of how to use plugin - with examples of different options for user, tag and group.

I do not know how to use this - I tried {SlideShare user=AmyStephen}, but it did not work. (In fact, those values were not removed from the article when I viewed the frontend, and the plugin is enabled.)

$total_poss_slides and $content; not initialized in code;

lowercase --> {SlideShare (2 places)

allow sizing of object - might be best to allow the width to be set - you calculate height. That way, you can keep it proportional, and still allow users to control what most impacts their site - the width.
// Load the Javascript and CSS
$document->addScript( '/joomla/plugins/content/slideshare//javascript.js' );
$document->addStyleSheet( '/joomla/plugins/content/slideshare//css.php?bg_color_1=' . $output->bg_color_1 . etc..
Let me guess...you have installed in a subdirectory named Joomla!?  ;)

Look at the examples I gave above - addScript( JURI::base()

This should be moduled after loadmodule - which fires on prepare content. Copy loadmodule and try to structure your code exactly like that.

I don't think it's quite ready yet. Let me know how to use it - again, try to get those instructions into the description. I'll look for your next post.

Thanks!
Amy :)

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Sun Dec 16, 2007 3:22 am

Ok, I was able to fix most of the things that you mentioned, but I do have a few questions.

First, the instructions for using this, with examples and such, is pretty long.  I tried to use HTML formatting in the tag, but when I use a little bit, it's ignored, and when I use a lot, I get an error when installing.  I looked in some of the other plugins that have HTML in their descriptions, but they all use language files to put it in.  Is there any way that I can add HTML without using language files?  I checked on dev.joomla.org, but wasn't able to find anything.  In the meantime, I've created a README.txt file, and included it in the zip (it's not installed with the plugin, though).  In the description, I just said to go read that file.

Second, do you want it to be {slideshare ...} instead of {SlideShare ...} ?  I only capitalized it as that is the way that it is on their website.

I'm finishing up the code to modify the width and height, so once I'm done with that, I'll upload the modified code.

Edit: Ok, I made the suggested changes (except for the two noted above).  Attached is the updated code.
You do not have the required permissions to view the files attached to this post.
Last edited by jgirata on Sun Dec 16, 2007 4:47 am, edited 1 time in total.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Sun Dec 16, 2007 6:24 am

{SlideShare User AmyStephen 0}

That builds the box - with this text, below - but nothing else.
User: AmyStephen          Current Slide:
Total Slides: 0
Also, name your article SlideShare and see if the title "goes away."

Sorry to be your first "stupid user!"  :P

I'll watch for your response,
Amy :)

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Mon Dec 17, 2007 1:05 am

As I was going through the SlideShare documentation looking for info about setting the limit to 0, I found that you are only allowed to send 1000 API requests per day from each key (and all the plugins would use my key).  Since I figured that 1000 requests could add up pretty quickly, so I have it now writing everything that is retrieved from the SlideShare server to the MySQL database, and updating every 24 hours.  If, by some act of God, there are more than 1000 unique requests per day, then I'll just sign up for another SlideShare developer key, and change it in the download :P

Anyway, that's why I haven't just corrected the issues you posted.  I'm still testing and debugging this.  I'll post the code after I've played with it a little longer.

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Thu Dec 20, 2007 8:46 pm

Ok, everything works.  The only problem I'm having is with the install.sql and uninstall.sql files.  I created them, and modified the slideshare.xml install file correctly (I think), but it's not running the SQL.  I think I did everything that they did in the tutorial, but it's still not working.  Attached is the updated code.  Any help would be highly appreciated :)

P.S.  Sorry it's been so long.  I had this done a few days ago, but I just had a band concert yesterday, so we've been having extra practices and stuff to get ready, so I didn't have much time  :-\

Edit:  I just updated my code to Joomla! v1.5 RC4, and found a bug that was preventing the parameters from loading.  I didn't see it when I had RC3, so I guess it was from a change in the code.  Either way, I've updated the download, and it's fixed.  Now, my only problem is the install.sql file :-\
You do not have the required permissions to view the files attached to this post.
Last edited by jgirata on Sat Dec 22, 2007 4:03 pm, edited 1 time in total.

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Sat Dec 22, 2007 4:04 pm

Bump?  Anyone able to help?

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7897
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by mcsmom » Sat Dec 22, 2007 11:41 pm

I'll take a look ... no promises I'll know what's happening though.  :)


It installed smoothly for me, but it gave me a parse error when i went to the front end. It references line 11, but it's doubtful the problem is there.

I think the problem may be that the sql files have to be in the administrator ... there was a post about that earlier.


http://forum.joomla.org/index.php/topic ... msg1122557

Also, I believe in your xml file you have uninstall with 2 Ls but the file name you have is uninstal.sql.
Last edited by mcsmom on Sun Dec 23, 2007 12:17 am, edited 1 time in total.
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Sun Dec 23, 2007 1:23 am

John -

On my localhost, this works with your example code: {SlideShare tag creative 25}

+++

I am still getting the same error when I use {SlideShare User AmyStephen 0}:

Image

+++

On my hosted solution, using your example from readme: {SlideShare tag creative 25} the code from the plugin is being displayed on the webpage - even when the plugin is not in use:

Image

+++

John - I'm crushed here for you! You had this going so well! Somewhere after December 11 and before the last time I tested, I think changes were made that are causing problems. There are a couple of local variables ($values, $tags) not initialized in RSStoArray.

In slideshare.php $content has not been initialized:

Code: Select all

$row->text = preg_replace('/' . $matches[0][$i] . '/i', $content, $row->text);
You have two // in this line:

Code: Select all

		$document->addStyleSheet( JURI::base() . 'plugins/content/slideshare//css.php?bg_color_1=' . $output->bg_color_1 . '&bg_color_2=' . $output->bg_color_2 . '&border_color='. $output->border_color . '&width=' . $output->width . '&height=' . $output->height, 'text/css', null, array( ' id' => 'StyleSheet' ) );
In plgSlideShareChangeDimensions function, $width3 and $height3 are not initialized.

Not sure what to say...do you happen to have a copy of the file from the 11th?

I'll try to look for your post.
Amy :)

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Sun Dec 23, 2007 2:28 am

I can just download the ZIP that was attached to the post before I started changing everything.  The problem is that SlideShare only lets you make 1000 API calls per day, so I have to store everything in the database.  Everything seems to work fine for me from a fresh install... even after I completely deleted Joomla and dropped the database when I installed RC4.

I still can't get the install.sql file to load.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Fri Dec 28, 2007 5:54 am

jgirata -

Where are you at on this task? Still working on this?

When you say you are unable to get install.sql to load, what do you mean?

Thanks,
Amy :)

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Fri Dec 28, 2007 3:47 pm

Sorry for the inactivity.  I've been busy with the holiday and stuff, and wasn't able to get on.  I rewrote a good bit of the code, and reorganized it all, so that it's easier to work with.  I'm just having a problem with the SlideShare API when I try to get presentations by group.

About install.sql:  when I install the plugin, the SQL in the install.sql file isn't running.  It (Joomla!) says that the plugin installed correctly, but the new table isn't created.  Attached is the latest version of my code.  Everything except filtering by group and the install SQL works for me.  Here is the SQL to run if you want to manually edit your database.

Code: Select all

DROP TABLE IF EXISTS `jos_plgslideshare`;

CREATE TABLE `jos_plgslideshare` (
	`time` VARCHAR( 10 ) NOT NULL ,
	`type` TEXT NOT NULL ,
	`value` TEXT NOT NULL ,
	`limit` TEXT NOT NULL ,
	`total_slides` TEXT NOT NULL ,
	`slide_titles` TEXT NOT NULL ,
	`first_embed_code` TEXT NOT NULL ,
	`first_slide_title` TEXT NOT NULL ,
	`label` TEXT NOT NULL
) ENGINE = MYISAM;
I'm running this on my computer using XAMPP.  I'm going to install Joomla! on my server later today, though, and see how it holds up there (I hope there's no difference, but with my luck, there will be plenty).
You do not have the required permissions to view the files attached to this post.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Tue Jan 01, 2008 3:05 am

I pm'ed someone to see if he can help with the install question.

Thanks!
Amy :)

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jlleblanc » Tue Jan 01, 2008 5:46 am

Hi there,

The short answer is that modules and plugins cannot run SQL files on installation the way you can do with components. However, there may be some ways around that we can look at. I'll take a closer look at your code tomorrow and get back to you.
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jlleblanc » Tue Jan 01, 2008 4:15 pm

AmyStephen wrote:
On my hosted solution, using your example from readme: {SlideShare tag creative 25} the code from the plugin is being displayed on the webpage - even when the plugin is not in use:

Image
This issue looks like a quick fix: it's very likely that Amy's host has short tags turned off. Change <? to <?php and the problem should clear up.
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jlleblanc » Tue Jan 01, 2008 6:08 pm

Now that I've had a chance to look things over, I have a few suggestions. Even though it would be easier for people to use your account without getting their own API key, I think the folks at SlideShare would rather people get their own. If someone started to abuse your plugin (or even just the key), they might shut down your account and you'd be out of luck. You can use backend parameters to store the key and include some documentation to walk people through the process of getting one.

You might try caching the information on the filesystem instead of using the DB. The quickest way of doing this would be to use PHP's serialize() function to get a string representation of an array of data, writing it to a file, then reading it back using unserialize().

If you still want to use database caching, I would like to get the other judges feedback on allowing a component to be a part of the project. While you could code the plugin to check to see if the database table is there before doing the cache (adding it if it isn't), this still wouldn't provide a way of deleting the table on uninstallation. I've used components and plugins together in this way before. Although it does create another package that end users have to install, it's the cleanest way of getting this project done "correctly."

Any project involving a 3rd party service always adds an additional layer that you have to test and work with. You're doing a good job with it.  :)
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Wed Jan 02, 2008 7:01 pm

Ok, I've changed it so that it stores all the information to plgSlideShare/cache.txt instead of the database.  It writes correctly, but when I try to get the array out of the file with unserialize(), I get this error message:
Warning: unserialize() [function.unserialize]: Node no longer exists in C:\xampp\htdocs\joomla\plugins\content\plgSlideShare.php on line 165
I've looked up the error message, and it says that that's a common error when working with SimpleXML objects, it never mentions arrays.

Here's lines 160 - 165:

Code: Select all

$file = file('plugins/content/plgSlideShare/cache.txt');
foreach($file as $line)
{
	$parts = explode('		', $line);
	$timestamp = (int)$parts[0];
	$array = unserialize($parts[1]);
Any ideas?

Attached is the (mostly) updated fie.
You do not have the required permissions to view the files attached to this post.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Thu Jan 03, 2008 7:35 am

The error Joe talked about being related to the tag is now gone.  8)

How do I get an API key so that I can continue testing?

Thanks!
Amy :)

Edit:
To get an API Key - http://www.slideshare.net/developers/applyforapi

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jlleblanc » Sun Jan 06, 2008 12:33 am

Hi John,

I tested the new code with my API key and have some suggestions. First, be sure to turn on PHP notices. On the first load, line 177 throws a notice because $old_lines isn't initialized. Move line 166 to 161 and the notice will go away.

As far as the process goes, you could put your cache timestamp into the array with everything else, which will help you avoid needing a foreach() and explode(). You can use multidimensional associative arrays here to your advantage. Instead of appending each new slide to the end of the cache file, unserialize the existing array and add to it.
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Tue Jan 08, 2008 6:14 am

You know, I'm not even certain where we are at with this task, anymore. It was looking so good right away.

jgirata - Are you nearing the end? Please let us know if there is something we can do to help.

Thanks!
Amy :)

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Fri Jan 11, 2008 9:59 pm

Sorry, we were in the middle of finals.  I have two problems... getting info by groups using the API, and using the serialize.  I hope to rectify both those issues tonight.

User avatar
mcsmom
Joomla! Exemplar
Joomla! Exemplar
Posts: 7897
Joined: Thu Aug 18, 2005 8:43 pm
Location: New York
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by mcsmom » Fri Jan 18, 2008 8:38 pm

You mentioned this before, but i would urge you to lower case slideshare. People are much less likely to make mistakes that way.
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Sun Jan 20, 2008 10:15 pm

I've gotten everything to work except being able to retrieve slides by group; the API still won't bring back the information.  If it's alright with you guys, I'd like to just drop that feature.

Attached is my updated code.
You do not have the required permissions to view the files attached to this post.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Mon Jan 21, 2008 7:45 am

jgirata - certainly, that's fine to skip the group at this time.

I cannot seem to find my key from previous testing - or - to get slideshare to send it to me.

Would someone please PM me their key for testing? Then, we can get this finalized! :P

Also, jgirata - if you don't already have a JoomlaCode repository, please get one and post the URL on your Google Task sheet. They don't have more space for us - so - we are just posting links when we close a task

Tomorrow is the last day to claim a new task. I'll look for this key to get moving.

Thanks!
Amy :)

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Mon Jan 21, 2008 10:16 pm

I have a JoomlaCode account somewhere.  I'll have to find it and upload the code to that.  Also, I've PMed you my key.

Edit:  No I didn't.  It says your inbox if full.
Last edited by jgirata on Mon Jan 21, 2008 10:18 pm, edited 1 time in total.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Mon Jan 21, 2008 10:26 pm

Try me again - deleted a few pieces.  :P

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Mon Jan 21, 2008 10:46 pm

Ok, it sent :)

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Tue Jan 22, 2008 3:30 am

I cannot get this to run.

This syntax is from your readme. Is that correct?

{SlideShare tag creative 25}

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7018
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by AmyStephen » Tue Jan 22, 2008 3:45 am

Finally! The syntax has been changed to lowercase.

Go ahead and update your Readme file - upload the zip file to your Google page - and I'll mark this closed.

I am sorry for all the trouble you have had with the API issues. This is a really cool extension and it's one I plan to use. It's a great way to share a lot of resources on your site quickly, that your visitors will find interesting.

I hope you also have a JoomlaCode and Joomla! Extension Directory listing. I'd like to the JED link, when you get it, so post it back here if you choose.

Thanks so much for your considerable work, your patience, your wonderful attitude, and for providing the Joomla! community with easy access to SlideShare!

Amy :)

jgirata
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sat Dec 08, 2007 8:11 pm

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jgirata » Tue Jan 22, 2008 10:33 pm

Well, I created an account on Joomla! Code a while ago, but I can't figure out how to upload files.  I have a project created, and I can access the admin area, but I don't know how to upload.

User avatar
jlleblanc
Joomla! Guru
Joomla! Guru
Posts: 963
Joined: Fri Aug 19, 2005 12:37 am
Location: Washington, DC / NoVA
Contact:

Re: 138 - Create a Joomla! v 1.5 Slideshare Module

Post by jlleblanc » Wed Jan 23, 2008 2:20 pm

jgirata wrote: Well, I created an account on Joomla! Code a while ago, but I can't figure out how to upload files.  I have a project created, and I can access the admin area, but I don't know how to upload.
After you create a project, you also have to create a release. Once you've added a release, you can upload files.
Joseph L. LeBlanc: http://www.jlleblanc.com
Frontend components start here: /components/com_[name]/[name].php
Backend components start here: /administrator/components/com_[name]/admin.[name].php


Locked

Return to “Google's Highly Open Participation Contest”