Page 1 of 2
Just a little something with lightbox, need help making it a module
Posted: Thu Mar 22, 2007 11:39 pm
by biffs
Hello all,
I've just started out using CMSms, tailoring it for my needs and everything.
I tried out the Album module and I really like it for showing multiple images in a gallery.
What I've done is modified the FCKeditor Insert Image button so that any single images inserted into a content item can use the lightbox effect just by chosing the effect on the image dialog. Below it, you can also specify a title. I know this can be done manually by just editing the source in FCKeditor, but I made it a bit eaiser for people who have less time to be donig that all the time.
It uses the same lightbox2.0/prototype/scriptalous set of scripts, or the smaller slimbox/mootools (which Im using) both work with this plugin.
Anyways, I'd also like to make it module, possibly included with the Album one because it goes so nicely with it, but I really dont know how to do it. I registered for the developers page, but beyond that.... clueless.
Heres a screencap of the thing in action....
and a link to it....
http://testing.biffopolis.com/index.php?page=test
[gelöscht durch Administrator]
Re: Just a little something with lightbox, need help making it a module
Posted: Fri Mar 23, 2007 12:47 pm
by skypanther
I guess it's up to you whether you create this as its own module or add it to the Album module. It sounds like a great addition to Album (I'd love to use it!). If the other developers on that project agree, then you can work with them to add in the functionality.
You'll need to interact with SVN (the subversion respository). See info here
http://dev.cmsmadesimple.org/docman/vie ... isesvn.htm
You might find helpful some of the info on the "How to create and manage a project" page at
http://dev.cmsmadesimple.org/docman/vie ... roject.htm
Good luck and have fun!
Tim
Re: Just a little something with lightbox, need help making it a module
Posted: Fri Mar 23, 2007 4:53 pm
by biffs
Ok, im also a little fuzzy about how to implement it as a module, ie. using the xml file and everything. The code revisions are very small, so would it be alright to just release it as a 'copy this file here, find XXXXX in file, add after XXXXX and your done'?
Re: Just a little something with lightbox, need help making it a module
Posted: Fri Mar 23, 2007 5:26 pm
by biffs
Ok, I've requested a new project in the developers section, mainly because it does not require the Album mod to function. When that gets up and running, I'll place the required code changes in there and maybe someone can make it into a real module.
Re: Just a little something with lightbox, need help making it a module
Posted: Fri Mar 23, 2007 9:39 pm
by biffs
Its online in the developers page,
http://dev.cmsmadesimple.org/projects/image-effects/
I've released the code changes I made, but it is not in any sort of final stages. I could really use some help on making it a proper xml file or something. Thanks
Re: Just a little something with lightbox, need help making it a module
Posted: Sat Mar 24, 2007 5:42 pm
by skypanther
I assume you have this code running on a CMSMS install either locally or on some web server. In the admin pages, go to the Modules page. Next to your module is an XML button. Click it to export your module as an XML file. That's it!
Tim
Re: Just a little something with lightbox, need help making it a module
Posted: Sat Mar 24, 2007 8:24 pm
by biffs
no, it doest show up in the modules section because I haven't made it a module. Like I said, i have no idea how to make it an installable xml file.
It is running on my website, because all I did was modify two files within the FCKeditor module, and added a few lines to the template header.
I really have no understanding at all of how a module in CMSMS works. the data in the xml files are encoded, so its impossible for me to see anything in those - the only thing I can make out is the filenames.
Re: Just a little something with lightbox, need help making it a module
Posted: Mon Mar 26, 2007 12:45 pm
by skypanther
Okay, start by not worrying about the XML files. They're just a convenient form of delivery. The actual code behind any module is the PHP files. In your case, you've modified the FCKEditor module. So, your code is in its PHP files. If you wanted to share your code modifications, you'd have to send those files to someone. But, there's already an FCKEditor module so you can't really redistribute those module files. Install, you'll need to make your own module. To do so, you will need to make a copy of the FCKEditor module (which you've modified) and rename it.
Make a copy of the FCKEditorX directory (in your Modules folder) calling it your module's name. Next, start modifying the files--you have to replace the old module name with your module's name. This means changing the name of the main class file, the name of the class within the PHP file, and probably a few dozen other places in the code, too. Make sure you rename all the database table names too. Check the install and uninstall routines. Update the language file. To make sure you have it working, you should uninstall the existing FCKEditorX module. Otherwise, those spots where you've missed changing a name might work but will do so by calling code from the FCKEditorX module rather than yours.
When you have all the code updated with your module's name, go back into the CMSMS admin panel and open the Modules page. You should see yours listed there, as uninstalled. Click the install button. If you've done everything right, your module will install and you'll have the FCKEditor available again with your modifications but through your module and not the FCKEditorX module. If you missed something, you'll either get an install error or the module will fail during use. Go back and look for more places where you need to change the name.
Once you're sure everything is working, you'll be ready to distribute the files. Create a Zip or tar/gz of your module's directory. You'll upload that to your module's files pages in the Forge. Next, go into the CMSMS admin and export the XML file as I described previously. You'll also upload this to the Forge. Users of your module will be able to choose which to download and install.
Does this help?
Tim
Re: Just a little something with lightbox, need help making it a module
Posted: Mon Mar 26, 2007 3:38 pm
by biffs
wow, that seems like quite a bit of legwork.
When the user installs my new (FCKeditor) module, will it overwrite their own FCKeditor module, will it just make revisions to it, or will there be two versions of the FCKeditor installed (original plus mine)?
Is this the only way to release a modification such as what I've done here? is there anther way?
It seems like alot of work to make an installable module when the only thing that is going on is adding about 10-15 lines of code into two or three files.
Re: Just a little something with lightbox, need help making it a module
Posted: Mon Mar 26, 2007 5:18 pm
by skypanther
When the user installs my new (FCKeditor) module, will it overwrite their own FCKeditor module, will it just make revisions to it, or will there be two versions of the FCKeditor installed (original plus mine)?
It won't overwrite their FCKEditor, that is, assuming you've renamed everything, changed all the database table names, etc. And they would end up with two versions of the FCKEditor installed.
It seems like alot of work to make an installable module when the only thing that is going on is adding about 10-15 lines of code into two or three files.
Indeed. Instead of creating a separate module, you could:
- Send it to the developers of the FCKEditor module to see if they would include it
- Upload the modified files as a patch to the FCKEditor module (see that project's page, click the Patches link, and upload the files)
Tim
Re: Just a little something with lightbox, need help making it a module
Posted: Mon Mar 26, 2007 5:49 pm
by biffs
Well i dont think that the FCKeditor project would integrate this because its specifically for cms made simple
and I'm not sure it would be a good option for the FCKeditor module project here on CMSMS, because it requires additional libraries to be installed (either album or a lightbox library).
What we need is a script similar to easyMOD (for phpbb). It takes a *.mod file and will do all the find/replaces for you, as well upload any necessary files. Im pretty sure it does not modify the database structure though.
EasyMOD
http://www.phpbb.com/community/viewtopi ... &sk=t&sd=a
Re: Just a little something with lightbox, need help making it a module
Posted: Mon Mar 26, 2007 6:22 pm
by Dee
Maybe it could be turned into a FCKEditor
plugin somehow?
Regards,
D
BTW: after applying the changes from the instructions I get this javascript error:
sLnkRel is not defined
editor/dialog/fck_image/fck_image.js
Line 270 (I'm using FCKEditor 2.4 from the FCKeditorX SVN version)
code:
SetAttribute( oLink, 'rel', sLnkRel );
Re: Just a little something with lightbox, need help making it a module
Posted: Mon Mar 26, 2007 6:41 pm
by biffs
oh wow, didnt realize that mistake in there.
Sorry about that.
Change
Code: Select all
SetAttribute( oLink, 'rel', sLnkRel );
to:
SetAttribute( oLink, 'rel', GetE('txtRel').value);
in editor/dialog/fck_image/fck_image.js
Re: Just a little something with lightbox, need help making it a module
Posted: Wed Mar 28, 2007 3:26 pm
by biffs
Ok, I've modified that section and re-uploaded the mod, so its ready to go.
check it out on the forge.
http://dev.cmsmadesimple.org/projects/image-effects/
Re: Just a little something with lightbox, need help making it a module
Posted: Thu Apr 05, 2007 1:12 am
by biffs
I had someone asking about this, so I thought I would post it here instead of it being in my PM box.
To get
Greybox to work in a similar way to what I've done with lightbox, follow these directions:
Copy the greybox folder to /lib/greybox/ on your server
First off, add the required info for greybox to work to your template:
Code: Select all
{literal}
<__script__ type="text/javascript">
var GB_ROOT_DIR = "http://mydomain.com/greybox/";
</__script>
{/litera}
but change the value of GB_ROOT_DIR to wherever you put it eg.
www.yoursite.com/lib/greybox/
Next, add the following to your current template - actually if you plan on using this instead of light box, then remove the lightbox associated code that you added earlier
Code: Select all
<__script__ type="text/javascript" src="lib/greybox/AJS.js"></__script>
<__script__ type="text/javascript" src="lib/greybox/AJS_fx.js"></__script>
<__script__ type="text/javascript" src="lib/greybox/gb_scripts.js"></__script>
<link href="lib/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
Now, (assuming that you've installed the lightbox module), edit the following files:
/modules/FCKeditorX/FCKeditor/editor/dialog/fck_image.html
find:
Code: Select all
<option value="lightbox">Light Box</option>
after add:
Code: Select all
<option value="gb_image[]">Grey Box</option>
/modules/FCKeditorX/FCKeditor/editor/dialog/fck_link.html
find:
Code: Select all
<tr>
<td>
<span fckLang="DlgGenRel">Style</span><br />
<input id="txtAttStyle" style="WIDTH: 100%" type="text" />
</td>
</tr>
after, add:
Code: Select all
<tr>
<td><span fcklang="DlgLnkRel">Effect</span><br />
<select id="txtRel" />
<option value="">Nothing</option>
<option value="gb_page[500, 500]">Grey Box</option>
</select></td></tr>
- you can change the 500, 500 to whatever dimensions you want.
/modules/FCKeditorX/FCKeditor/editor/dialog/fck_link/fck_link.js
find:
Code: Select all
GetE('txtAttCharSet').value = oLink.charset ;
after, add:
Code: Select all
GetE('txtRel').value = oLink.rel;
find:
Code: Select all
SetAttribute( oLink, 'charset' , GetE('txtAttCharSet').value ) ;
after, add:
Code: Select all
SetAttribute( oLink, 'rel', GetE('txtRel').value);
so, if you have followed me so far, that should do it, like i said, as long as you have the lightbox mod installed