Drupal, Gallery2, FCKeditor and G2Image integration mini-HOWTO

This mini-HOWTO will guide you though the integration procedure for both Drupal and Gallery2, with assistance of FCKeditor and G2Image. If you hope to insert your photo album images into Drupal without a heavily embed style, this should be your cup of tea.

Why not integrate with Drupal's gallery.module?

The most simple answer should be: keep everything simple. I hope to keep my Drupal and Gallery2 installation isolated for a simpler management, as different system coming with different specific requirement. What I only hope to do is to reuse the existing resource coming from Gallery2, so user don't need to upload a single image twice.

Why not use Drupal's image.module + img_assist.module?

They are in different design so I use both solution. I use image.module + img_assist.module for tiny amount Drupal-only images, for fast layout design and so on, e.g. insert some image when writing a blog post as like as this mini-HOWTO. You won't hope to: 1. create a new album in Gallery2, 2. upload images and manage their title, 3. go back to Drupal and choice your image though FCKeditor, how fancy!

Demo Drupal and Gallery2 setup

In this HOWTO I will install Drupal and Gallery2 as path below:

www2:/# ls -la /var/www/
total 60
drwxr-xr-x 13 www-data www-data 4096 2009-11-07 12:49 .
drwxr-xr-x 18 root     root     4096 2009-05-29 09:13 ..
lrwxrwxrwx  1 www-data www-data   10 2009-11-07 12:49 content -> drupal-6.x
drwxr-xr-x  9 www-data www-data 4096 2009-07-02 04:55 drupal-6.13
drwxr-xr-x 10 www-data www-data 4096 2009-11-07 12:13 drupal-6.14
lrwxrwxrwx  1 www-data www-data   11 2009-10-27 14:40 drupal-6.x -> drupal-6.14
lrwxrwxrwx  1 www-data www-data   11 2009-11-07 12:49 gallery -> gallery-2.x
drwxr-xr-x 11 www-data www-data 4096 2009-11-06 16:01 gallery-2.3-developer
lrwxrwxrwx  1 www-data www-data   21 2009-10-30 09:14 gallery-2.x -> gallery-2.3-developer

Why a lot of symlink? Because whenever upgrade is required, I just need to download the new version and relocate the symlink target. No path or URL will be changed.

So if my server with URL http://example.com/ and Apache DocumentRoot on /var/www, Drupal and Gallery2 will be accessible though:

http://example.com/content/
http://example.com/gallery/

Moreover, Drupal's FCKeditor is already installed in:

/var/www/drupal-6.x/sites/all/modules/fckeditor

Where G2Image already installed in:

/var/www/drupal-6.x/sites/all/modules/fckeditor/plugins/g2image/

Download G2Image here, and also read its general installation guideline.

G2Image Drupal-specific configuration

Edit the /var/www/drupal-6.x/sites/all/modules/fckeditor/fckeditor.config.js, and add the following line:

FCKConfig.Plugins.Add( 'g2image' ) ;

I add the G2Image button to both DrupalFull and DrupalFiltered, so it should look like:

['Image','G2Image','Flash','Table','Rule','Smiley','SpecialChar','DrupalBreak'],

Now edit the /var/www/drupal-6.x/sites/all/modules/fckeditor/plugins/g2image/config.php as below:

$g2ic_gallery2_path = "/var/www/gallery-2.x/";
$g2ic_embedded_mode = TRUE;
$g2ic_use_full_path = TRUE;
$g2ic_gallery2_uri = '/gallery/main.php';

Ok that's all :D

Test the setup

Create a new node, activate the FCKeditor, and you should have something similar as below:
drupal_g2image-001.pngdrupal_g2image-001.png

When click on the G2Image button, you should able to browse your album, select and insert your images:
drupal_g2image-002.pngdrupal_g2image-002.png

Once insert your editor should look like:
drupal_g2image-003.pngdrupal_g2image-003.png

Ok so now save the node and review it. Enjoy :D


Koha on Debian Lenny + Squeeze mixed HOWTO

From Koha.org:

Koha is a full-featured open-source ILS. Developed initially in New Zealand by Katipo Communications Ltd and first deployed in January of 2000 for Horowhenua Library Trust, it is currently maintained by a team of software providers and library technology staff from around the globe.

This HOWTO will guide you though Koha 3.0.x installation on Debian Lenny + Squeeze mixed environment (Why in Debian mixed but not stable only? Well... This is my normal procedure with 3rd party tarball package...)


Bookmarks for WinXP installation related

Complete guideline:
http://unattended.msfn.org/
http://simonslick.com/Microsoft/Windows/XP/Service%20Pack%203/

Additional driver pack:
http://www.driverpacks.net/
http://forum.driverpacks.net/viewtopic.php?id=1756
http://forum.driverpacks.net/viewtopic.php?id=2264

Hotfixes downloader:
http://wud.jcarle.com/

Onepiece's EN-US Windows XP Post-SP3 All-in-One Update Pack:
http://www.ryanvm.net/forum/viewtopic.php?t=6438

Fix missing wallpaper after sysprep:
http://support.microsoft.com/kb/329677

Integrate everything:
http://www.nliteos.com/
http://www.ryanvm.net/msfn/

Detail procedure (for RAW ISO):

  1. Copy source CD with nLite, w/o SP3.
  2. (Optional) Splitstream SP3 with nLite.
  3. Splitstream Post-SP3 AIO package with nLite (NOTE: NOT with RyanVM).
  4. Splitstream additional drivers with DrivePacks (NOTE: NOT with nLite).
  5. Tweak options and services with nLite, and create ISO.
  6. Test it with VirtualBox.
  7. (Optional, refer to my other HOWTO) Copy I386 to harddisk and start installation with local source.

Detail procedure for installed WindowsXP:

  1. Manually download update packages and install it.
  2. Run Windows Update and check with any missing.
  3. Create SAD DrivePack installer and update with it.


Exim4-LDAP 0.0.7 released

Exim4-LDAP 0.0.7 is a development release, which fix a lot of hidden bugs, more comprehensive clone of Qmail-LDAP individual account features, better documentation and coding syntax, and even more. I am confident that the code is stable enough for wider testing by the community, download now.

Spotlight changes include:

  • Add support with Qmail-LDAP accountStatus attribute.
  • Add support with Qmail-LDAP deliveryProgramPath attribute.
  • Activate home_directory in transport with relative patch support.
  • Add LDAP_MAILROOT support if homeDirectory is not absolute.
  • Debug program pipe transport.
  • Add sample LDIF for demo user demo@example.com.
  • Document installation guideline in INSTALL.

Please refer to /usr/share/doc/exim4-ldap/changelog.gz for complete changelog. Changes since 0.0.5:


iTalc master snapin for FOG with 7-Zip SFX

This article will detail the procedures about create snapin for FOG with 7-Zip SFX, which re-package iTalc installation tarball for deploy iTale master application (IMA). This skill can also apply for deploy other program installation.

Background

I am now handling a computer lab with FOG. All computers are installed with iTalc client for classroom management during lesson. I have create a single OS image for all computers, but there is an exception for teacher's computer: it should install with IMA but not only client. Basically I have 2 choices:

  1. Create 2 different OS image: 1 for all student computer where the other for teacher computer ONLY.
    This will GREATLY increase my work load in order to keep both image sync with latest update, software and setting. This is the most simple but the most silly solution.
  2. Clone all computer with single image, and MANUALLY install the IMA for teacher computer after cloning.
    From some point of view it is suitable because IMA installation require more steps than usual: I will need to copy the private keys for setup VNS connection, and also deploy pre-configured classroom setup so all student computer will appear in IMA. But this is not a good solution, too. I am not able to use schedule cloning in FOG because I will need to preform manual setup later.

So the best solution should be FOG snapin. Create a snapin with silent install, therefore FOG will automatically deploy it to client once it is ready after cloning. We will also able to deploy single snapin to individual computer whenever required. But there exists a down side too: not every installation file support silent install. Therefore I will need to "re-package" the program for my purpose.

Technical detail

This solution will need some basic skill for both 7-Zip and Windows batch scripting. The idea would be:

  1. Prepare all required (both original and additional) files for installation under a directory.
  2. Write a simple batch script with "wrap" the original setup.exe with additional parameter and procedure.
  3. Package the target directory as 7-Zip archive.
  4. Write a simple 7-Zip SFX configuration file for the following step.
  5. Create a 7-Zip SFX archive as final product.

Any down side? Yes, for sure. As this is just a simple "wrapper" of original installer, we will still need to preform some manual setup procedure once the snapin is start. Therefore it is not total "automatically". But the benefit is very simple: you will not need to write a complete installer for re-package, and the procedure is easy for master.

I will comment the benefit of this method as: no additional software installation will be missed (the snapin will remind you), and we don't need to prepare the setup file elsewhere (don't need to keep the CD/setup.exe/etc).

Procedure for IMA re-package

First download iTalc installation tarball from SourceForge and unzip it to somewhere, etc, C:\Download\italc-1.0.9.

Next, copy the exported public key as C:\Download\italc-1.0.9\italc_dsa_key.pub, and start the installation as normal. We will now install IMA as normal. Point the exported public key location as . (a single dot, which means current directory). Before installation complete, click "Save installation settings". It will save the setup procedure as C:\Download\italc-1.0.9\installsettings.xml and so we can reuse it within our own batch script.

We need to private keys for IMA, too. I guess you should already have that with a functional iTalc setup. Copy the keys from C:\Program Files\iTALC\keys to C:\Download\italc-1.0.9\keys. We will copy it to new system with batch script.

(Optional, but strongly suggested) Run iTalc IMA in local computer once, setup the "classroom", and add all required student computers into it. Once complete, copy the setup from C:\Documents and Settings\Administrator\Application Data\iTALC to C:\Download\italc-1.0.9 (both globalconfig.xml and personalconfig.xml). Again, we will copy it to new system with batch script.

Let's create the batch installation script now, e.g. C:\Download\italc-1.0.9\keys\setup.bat:

setup installsettings.xml

mkdir "C:\Program Files\iTALC\keys\private\admin\"
copy keys\private\admin\*.* "C:\Program Files\iTALC\keys\private\admin\"

mkdir "C:\Program Files\iTALC\keys\private\supporter\"
copy keys\private\supporter\*.* "C:\Program Files\iTALC\keys\private\supporter\"

mkdir "C:\Program Files\iTALC\keys\private\teacher\"
copy keys\private\teacher\*.* "C:\Program Files\iTALC\keys\private\teacher\"

mkdir "C:\Program Files\iTALC\keys\public\admin\"
copy keys\public\admin\*.* "C:\Program Files\iTALC\keys\public\admin\"

mkdir "C:\Program Files\iTALC\keys\public\supporter\"
copy keys\public\supporter\*.* "C:\Program Files\iTALC\keys\public\supporter\"

mkdir "C:\Program Files\iTALC\keys\public\teacher\"
copy keys\public\teacher\*.* "C:\Program Files\iTALC\keys\public\teacher\"

mkdir "C:\Documents and Settings\Default User\Application Data\iTalc\"
copy globalconfig.xml "C:\Documents and Settings\Default User\Application Data\iTalc\"
copy personalconfig.xml "C:\Documents and Settings\Default User\Application Data\iTalc\"

mkdir "C:\Documents and Settings\Administrator\Application Data\iTalc\"
copy globalconfig.xml "C:\Documents and Settings\Administrator\Application Data\iTalc\"
copy personalconfig.xml "C:\Documents and Settings\Administrator\Application Data\iTalc\"

You directory should look like this.You directory should look like this.

Run the script once and check the result. The IMA should install with silent mode.

Now package everything with 7-Zip. I do so with the GUI mode, and you may handle this with what you like. Create the 7-Zip archive as C:\Download\italc-1.0.9.7z.

UPDATE (20090907): I just figure out 7-ZIP SFX Maker v2.0 which may simplify the following task. NOTE: We should prepare the target *.7z file in advance so the above step should still useful; from my point of view, the following steps are quite strict forward, too.

Prepare the 7-Zip SFX configure file as C:\Download\italc.txt:

;!@Install@!UTF-8!
Title="italc-1.0.9"
BeginPrompt="Do you want to install the italc-1.0.9?"
RunProgram="setup.bat"
;!@InstallEnd@!

Download 7-Zip extra package and extract it. Copy the 7zSD.sfx to C:\Download.

Now the final step: combine everything with following command:

copy /b 7zSD.sfx + italc.txt + italc-1.0.9.7z italc-1.0.9.exe

Sample output.Sample output.Your directory should now look like this.Your directory should now look like this.

Again, check the product by double click and run it. It should prompt up a message before start, and then everything should go on smoothly.

The message promptedThe message promptedAnd it is now running automatically.And it is now running automatically.

Create snapin in FOG

Once the re-package is ready, we can now create it as FOG snapin. That is very simple:

  1. Create a new snapin package in FOG,
    Create a new snapinCreate a new snapin
  2. Link a host with it,
    Link the snapin with a hostLink the snapin with a host
  3. And deploy it.
    Deploy snapin in host advance taskDeploy snapin in host advance task

The FOG client in target computer will cron check with snapin task, download and start it whenever possible. The rest will just as like as what we test the package within local computer. The installer will start and you should take care of it.

In case of *.msi installer, you should use the following parameters:

  1. Set Snapin Run With: to the path of msiexec.exe (i.e.: c:\windows\system32\msiexec.exe)
  2. Set Snapin Run With Arguments: to /i
  3. Set Snapin Arguments: to /qn

Conclusion

This article guide you though how to repackage software with 7-Zip and simple batch script. It is simple enough so you can apply for any other software, even as simple as starting Firefox installer with FOG snapin. You may also preform more additional task with the batch script, e.g. copy default user setup of Firefox to target computer within FOG snapin, too.

References

http://www.fogproject.org/wiki/index.php?title=FOGUserGuide#Snap-ins
http://www.fogproject.org/wiki/index.php?title=Make_Snapins_Using_FOSS


Exim4-LDAP 0.0.5 initial released

Exim4-LDAP is my latest development progress. It is a Debian package that depends on exim4-heavy-daemon and slapd, which utilize Qmail-LDAP schema as backend database schema for seamless migration. Unlink Qmail-LDAP which required for manual source patching and compile, Exim4-LDAP just define additional authentication/router/transfer rules within configuration files. The ultimate goal of this research project is going to integrate with Samba-LDAP-PAM (for both Windows/Linux Single-Sign-On), RADIUS (for other services SSO) and even other services such as webmail. The project is now hosting in SourceForge.net with .deb available, download now.

Here I will draft some simple installation guideline which not yet included in source package document. I am now testing this with a newly installed Debian Lenny sandbox.


Configurate OpenLDAP in mirror mode replication

I am going to share some user account & directory with NFS among 2~3 servers. Traditionally we can use NFS+NIS solution, but I would like to try out NFS+LDAP+PAM/NSS plus OpenLDAP mirror mode replication.

For LDAP + PAM/NSS, please refer to my other article: LDAP + Samba PDC + PAM/NSS on Debian Lenny HOWTO

Add OpenLDAP mirror mode replication to existing server

Refer to OpenLDAP Software 2.4 Administrator's Guide: Replication, just add the following EXTRA setup to /etc/ldap/slapd.conf:

# Global section
serverID        1
loglevel        sync stats
moduleload      syncprov
rootdn          "cn=admin,dc=example,dc=com"
rootpw          CHANGE

# syncprov specific indexing
index entryCSN                          eq
index entryUUID                         eq

# syncrepl Provider for primary db
overlay syncprov
syncprov-checkpoint 100 10
syncprov-sessionlog 100

# syncrepl directive
syncrepl      rid=001
              provider=ldap://server2.example.com
              bindmethod=simple
              binddn="cn=admin,dc=example,dc=com"
              credentials=CHANGE
              searchbase="dc=dc=example,dc=com"
              schemachecking=on
              type=refreshAndPersist
              retry="60 +"

mirrormode on

Copy & paste this setup to your server2, change the serverID and provider accordingly.

My suggested procedure for deploy

  1. Shutdown both master/slave OpenLDAP server with:
    /etc/init.d/slapd stop
  2. Backup existing LDAP database under home directory:
    slapcat > ~/master.ldif
  3. Transfer the master.ldif to slave server.
  4. Transfer the master /etc/ldap/slapd.conf to slave server, and update it accordingly.
  5. Flush and import existing LDAP database in slave server:
    rm -rf /var/lib/ldap/*
    slapadd -l ~/master.ldif
    slapindex
    chown -Rf openldap:openldap /var/lib/ldap
  6. Start master server, and then slave server with:
    /etc/init.d/slapd start

My main tips: Always BACKUP before critical action :D

Debug the replication

As we turn on the syslog of slapd, we can keep trace it with:

tail -f -n 50 /var/log/syslog | grep slapd

Try to update some record from either master/slave server, check the log, and also browse the replication result in other server. Done :D


Update my 3ware 9650SE firmware + driver + software

I just figure out that 3ware had a new release of firmware and tools for my 9650SE RAID controller. BTW, as Debian unofficial APT is now legacy without update, I search for package original author webiste: http://jonas.genannt.name/

P.S. According to release note, need to upgrade driver and software BEFORE (prior) upgrade the firmware:

Important: Older drivers and software are not compatible with this release
Drivers and software released prior to 9.5.2 are not fully compatible with the firmware in
this release. Please upgrade to a 3ware driver and software that is 9.5.2 (or newer) prior
to updating the firmware on your 9690SA and/or 9650SE controllers.

Upgrade driver and software

Just simply add the following line to /etc/apt/sources.list:

And import key with:

Run aptitude, update package list, search package and install/upgrade. Done :D

Upgrade firmware

Download the firmware from the following link:
http://www.3ware.com/download/Escalade9690SA-Series/9.5.2/9.5.2-9650-Upg...


Connection seems much stable now

HGC ask PCCW for technical support, and so they change the connection between my flat (block 2) to server room (block 4). As HGC providing services with VDSL and rent the LAST telecoms connection from PCCW, so HGC can't solve the problem alone. Anyway, the disconnect problem is now improved.

I guess the problem should due to the status of my flat: the building itself is already 10+ years old, where I am the FIRST one who buy and use this flat. So the telecoms connections didn't been use for around 10 years, it should then decayed.

Well... Here is the syslog from Linksys W310N + DD-WRT as reference, which show the current status (they fix it on 16:27:56):

Aug  3 12:07:14 gw user.info syslog: WAN is up. IP: 221.127.134.215
Aug  3 12:14:39 gw user.info syslog: WAN is up. IP: 221.127.238.69
Aug  3 12:22:38 gw user.info syslog: WAN is up. IP: 221.127.237.15
Aug  3 12:30:18 gw user.info syslog: WAN is up. IP: 221.127.238.91
Aug  3 12:38:27 gw user.info syslog: WAN is up. IP: 221.127.238.244
Aug  3 12:59:03 gw user.info syslog: WAN is up. IP: 221.127.236.57
Aug  3 13:07:52 gw user.info syslog: WAN is up. IP: 221.127.133.13
Aug  3 16:14:32 gw user.info syslog: WAN is up. IP: 221.127.171.173
Aug  3 16:27:56 gw user.info syslog: WAN is up. IP: 221.127.239.201
Aug  4 00:00:38 gw user.info syslog: WAN is up. IP: 221.127.236.182


Syndicate content