jesse's blog

Views integration with the relation module

Submitted by jesse on

​Introduction

Relations is an awesome new module for Drupal 7. It essentially allows you to link any entities together and which are themselves fieldable. I can think of limitless ways in which this can be super useful. However, the topic of this blog posting is not to heap praise on relations and explain in detail what they can be used for; I'll let you discover that yourselves. The intention is rather to give a practical example of how to create views of separate entity types tied together with relations. Something that I've had to play around with for hours to figure out. Perhaps this will save you some time.

Note: ​At the time of writing this the functionality I'm discussing only exists in the dev release of relation. Beta3 does contain this. If people from the future are reading this blog the functionality was commited Jan 21st by chx.

​An Example relation

Just read about this example on the d.o. issue queue where someone needed help with the views integration. So, lets say we create a relation that defines a relationship between a user and nodes called 'follow'. So that is to say a user can select particular nodes they deem interesting and choose to follow them.

Note: ​This could be accomplished other ways as well such as using the flags module, but we'll ignore that for now and consider that a relation can probably give us more functionality. 

We add a field to the 'follow' relation called 'category' to categorize the nodes which the user is following.

So now what we have is a directional relation user -> node ​with the single field 'category'.

Chase Paymentech Module for Ubercart

Submitted by jesse on

Announcing the uc_chasepaymentech module for Ubercart!

This is a module that adds Chase Paymentech hosted checkout as a payment method to Ubercart. There isn't currently a module that integrates Ubercart with Chase paymentech. Although Chase based their hosted checkout on Authorize.net's framework, their specific implementation and methods of response verification are slightly different in functionality. There is not a sensible way to go about modifying the Authorize.net module that ships with Ubercart to incorporate Chase Paymentech without rewriting the entire Authorize.net module to make it more generic and adaptable to other Payment Companies and their implementations of the authorize.net framework. However, this may be an option for the future.

Ubercart as a donation system + Moneris as a Payment Gateway

Submitted by jesse on

Hopefully this blog entry will help a few people overcome some of the hurdles in setting up a donations system. We are a drupal shop so all the following is for drupal 6.

In this case the client simply wanted to have a way to collect donations from supporters of their political campaign. The only real constraint was that it needed to integrate with the Moneris payment gateway system. I was looking at creating a custom donation system and integration to Moneris, but in the end opted to use Ubercart. Ubercart is an awesome beast of a Shopping cart system that has many great features and useful contribs, 90% of which I did not need to take advantage of. However, Ubercart, in an extremely stripped down form, looked like it could offer everything I needed in terms of accepting and tracking donations. There was also an existing UC Moneris contrib module that looked pretty simple.

What you will find in this blog

The "CLUMPS" module

Submitted by jesse on

Clumps is a module that I have just written and will eventually be releasing. Its currently about 90% finished. The name was hastily chosen from a google search for a synonym to section. It is also still up for debate so feel free to comment if you can think of a good name.

All relatively good ideas start with a relatively complex, or annoying, problem.

Protagonist:

A site was required that split off into two separate sides with different paths say /sideone and /sidetwo. Most content is to be different, but some should be shared including menus and menu items. Doesn't sound like a very complicated problem does it? The content that is different will obviously be easy in that you can set the url aliases to /sideone/page1, /sidetwo/page2, etc.

Problem:

The complicated part comes when you consider how to maintain that context separation of which side you are on for the shared content. In this case the shared content had to be prefixed with the /sideone or /sidetwo. Regardless, there are a couple tricky problems here:

  1. how do you know which side of the site you were working on once you've gone to one of the shared pages?
  2. For that matter how do you have a menu display only the relevant items for a particular side as well as the shared items?
  3. How do you have the shared menu item knowledgeable about the context of which side of the site you are on?

tinyMCE: Adding css styles to menu style pull-down

Submitted by jesse on

As designers, something that we all wish at one point or another is for non-technical users to be able to style their contributed content according to the styles we have defined in style sheets. Users usually want to be able to easily do this as well. If a WYSIWYG is involved it often means a user will be selecting colours and fonts that will end up inline with the element; hard coded in the HTML like <div style="{background-color='green'; font-size='2em';}" >. It can also be time consuming to have to go and style everything a user inputs if it doesn't exactly fit your design model.

For tinyMCE, there is a nice feature that allows you to add styles to a 'style' pull-down menu. Here is how you can go about setting that up:

1. Add and enable the Wysiwyg module

2. Go to Site Configuration >> Wysiwyg

3. click 'edit' beside Full HTML -- TinyMCE

4. click 'buttons and plugins' to open the buttons settings. In here you will want to check 'font style', 'remove format', 'HTML block format'

5. click 'CSS' to open the css settings. Here there are several fields:

  • Block Formats: are the tags a user can enclose their content in. It appears in the editors 'Format' pull-down. These are up to you.
  • Editor CSS: Selects where the 'Styles' pull-down inherits its options from. By default it is set to 'Use Theme CSS' which means the admin theme's CSS. Set this to 'Define CSS' so it will inherit from the CSS of your choice.
  • CSS Path: The path(s) to the CSS file(s) you want the CSS classes to be pulled from. I find the full path works best. See Style sheet instructions below for further details.
  • CSS Classes: Optionally you can use this to filter the styles that you want to appear in the pull-down list. If left blank it all styles will appear in the pull-down.

Subscribe to RSS - jesse&#039;s blog