I am happy to announce quotes.module a module that displays a block containing a random quote. Quotes can be added one at a time or mass-imported. They can also be edited and deleted as needed.

Installation is all web based (no .sql file) — I despise the sql-file install method. I am especially seeking feedback on this functionality.

As it is brand new (just committed to CVS) you will find it in the contributions repository. All your really need is the quotes.module file, but the INSTALL file will provide some more info.

Comments

Boris Mann _Old Blogger.com Account_’s picture

I love the install -- very civilized. Be interesting to see how you handle "upgrades", where the current quotes.module file is replaced with a new one.

I was pleasantly surprised when I created an author with an href link around the name and it just worked.

The only change I would want right away is to change the CSS classes -- they should be quotes-quote and quotes-author (- instead of _). This is a validation issue -- classes with underscores have problems.

Such a nice module has of course gotten my mind whirring -- it's great as is, I'm just putting down ideas here. And you are on the drupal-dev list, are you not?

Of course, there are many "features" that could be added, such as:
- taxonomy for quotes, with one block per taxonomy
- quotes as nodes: then you can have the whole range of options available
- "personal quotes" -- much like a personal gallery, you could have quotes for each user
- creating an overview page for "quote" --> see all the quotes, filter quotes by author, etc.
- if you had quote-as-node, people could easily create things like a "quote of the day" by promoting it to the front page

New fields:
- author-link
- source field (i.e. Huckleberry Finn, page 23)
- source-link

I've got it up and running at http://drupal-cvs.bmannconsulting.com.

--
Boris Mann

jhriggs’s picture

Thanks for the comments/thoughts/suggestions, Boris!

I'm really glad you like the installation. Perhaps it will be the start of a trend! Upgrades should be seamless and transparent unless there is a table change in which case the status table will show the installed version and the current (new) version. The new version will have an "Install" button (just like the initial install) that will perform any table creation/alteration.

You are right about the CSS classes. I originally coded them to use dashes...stupid replace all...it should have known what I meant!

Great ideas on enhancements. I had thought of using nodes, but wasn't sure if there would be much benefit from it. I am open to it, though. Implementation ideas are welcomed.

One thing I forgot to put in the README/INSTALL is that if you have cache turned on, anonymous users will not get random quotes as a single one is cached until someone logged-in forces the cache to be invalidated.

I am fixing the underscore-dash problem with the class names and updating the README/INSTALL to note the cache issue. The new versions are now in CVS. You can try the upgrade, Boris. It should be transparent (it just happens — no install necessary).

adrian’s picture

In how you are doing the installation , for possibly extending it across all modules.

I feel the current method of module installation is troublesome, especially regarding different database support.

I want to move my development platform to postgres sometime in the future.

jhriggs’s picture

I agree that it is troublesome. It would be nice to have some standard API/hooks for installation. Perhaps on the module screen the module cannot be enabled (checked) until it is installed. If installation is necessary, the checkbox would be replaced by an Install button. Once installed, the module could be enabled via the checkbox or (if necessary) removed with a Remove button. (This is all a little PostNuke-esque. Their module installation/activation/deactivation/removal, while not perfect and tied to MySQL, is much more elegant than running manual sql.)

The current setup is especially a pain if you are running multiple sites/configurations with one install. Every time you install or upgrade a module, you have to apply the sql to all the different sites' databases.

As for how I am doing it in this module, I am simply using DDL queries. It should not be a problem to use DDL in queries so long as the correct DDL for the current database-type is used. I am not currently doing this, but you should be able to check the current database package by looking at the $db_url from the site configuration. (Is it still around after Drupal's initialization? Or is there another variable that indicates the DB-type?)

bjpirt’s picture

Here's another vote for the installation method. I was considering something like this myself, but shall use this implementation for the module I'm writing at the moment (if you dont mind)

As others have commented, there probably should be a hook in the core for this so we can get rid of manually executing the sql, which is just plain unfriendly.

Good module.

Ben

jhriggs’s picture

Feel free to use anything you want from the module. Isn't that the beauty of open source? The more people who subscribe to a more elegant installation method, the better. I know Adrian R. has used a similar installation procedure for a couple of things.

Anonymous’s picture

I've run the install. I noticed a few things I had to change... MySQL choked on the use of brackets {} around the table names so I had to remove them. Also, I am not seeing the Management Menu anywhere in the admin. Can anyone point me in the right direction to troubleshoot this?

paul@montypics.com
www.murphymaphia.com

jhriggs’s picture

This module is designed for Drupal 4.3.0. You will need to upgrade to the release candidate or CVS for it to work properly.

Ido-1’s picture

I also vote for this installation system, very handy :)

I'd like to know if there is a way to make the block quotes on top of the main content area? Just below the path.