Nov 05 2012
Nov 05

String Overrides is a pretty sweet module for getting the text on your site more exactly like the client wants.  In general it works with any t function – what I didn’t realize at first is that this means it’ll override variables embedded in the t function as well.

So I was looking for some text that was on the site and initially was doing a search for a pretty long string, not realizing that within the string were several variables that were to be replaced… so by shortening the search to a few words within the string – specifically grep with the flags -H (for the filename) and -r (for recursive search within the modules directory) I got the following

grep -H -r "entities with this value set" .*
./field_analytics/field_analytics.reports.inc:    $headers = array(t('Value'), t('Number of %bundle entities with this value set', $replacements), t('Percentage of total %bundle entities with this value set', $replacements));
../contrib/field_analytics/field_analytics.reports.inc:    $headers = array(t('Value'), t('Number of %bundle entities with this value set', $replacements), t('Percentage of total %bundle entities with this value set', $replacements));

So then it was obvious – the %bundle was actually pulling in a variable and thus doing the search for what seemed like the string was failing, however doing a string override with “Number of %bundle entities with this value set” worked beautifully

String overrides working with HTML and variables in t functions

String overrides working with HTML and variables in t functions

Anyhow, this may be old news to some, but it totally saved my weekend… Aloha

Sep 24 2012
Sep 24

What with this being a library and all it became necessary to get a document management solution rolling.  Initially looked at  File Depot and may go back to that again, however it wasn’t working cleanly out-of-the-box… the desktop integration though may bring it back…  Also I really like PlUpload for its HTML5ness and potential to work on iOS devices, however it doesn’t mesh with CKEditor – our WYSIWYG of choice, and that’s a major requirement.

So without further ado…

webfm tools

webfm tools

Set up default directories and such

Set up default directories and such

Configure the wysiwyg editor

Configure the wysiwyg editor

Open up the webfm module

Open up the webfm module

The webfm module in action

The webfm module in action

Sep 13 2012
Sep 13

CCK Signup is a fun module that is very drupal in the sense that it really just extends a bunch of modules you may already have.  Here’s a brief tutorial on using Rules to handle some basic notifications.  Say you want to know when someone has dropped a class.

 

Your initial rule conditions

Your initial rule conditions

  1. get a new rule set up and set the initial condition to be “After deleting content”
  2. Set the next condition to be “content has type”
  3. Select the signup type of content
  4. Lastly choose to send an email to an arbitrary email address – in this case let’s say it’s you, the webmaster
  5. Send the email.  Thanks to the Tokens module you can reference content from the fields in the deleted content Using tokens in the emails

    Using tokens in the emails

    Send an email to an arbitrary email

    Send an email to an arbitrary email

    select the type of content

    select the type of content

    Content has type as condition

    Content has type as condition

Aug 08 2012
Aug 08

Feeds is a lovely utility that has blossomed greatly in Drupal 7. As with Drupal 6 both Feeds and Feeds Tamper are Features compatible and now even more versatile with add-ons like Feeds SQL.  There are a several caveats to getting Feeds happy when working with CSV formats.  I’m coming from a Mac environment, often mapping excel spreadsheets over in to Drupal.  These are my ongoing notes, am doing a lot in Feeds and will keep this post as a list of my remarkably consistent failures.  (NB: if you’re in D6 Node Import just seems way more forgiving on all these points, just not nearly as “Drupal Hep”)

Remember to get your csv UTF-8 compatible – I like Text Wrangler for this – especially when coming from Micro$oft Excel your content may have some odd-ball encoding. So if saving as Windows, Unix, or MS-Dos CSV fails on you just open up your CSV file in there and resave

CSV fix in textwrangler

CSV fix in textwrangler

saving csv from excel for feeds

saving csv from excel for feeds

 

 

 

 

 

 

 

Caveats:  Another common quandary with Feeds is using it with fields outside of core CCK or Entities. While it’ll map to CCK Select Other it has a tough time, especially with multiple values.  Even with the values put in the drop-down selection area it always mapped to “Other” and then stuck in the value.

Unlike in Drupal 6 this field will throw errors if indexed, doesn’t seem to work with the Facet API, or be good for much of nothin’. Perhaps Select Or will work better, however it seems to have view limitations too.  So while none of this reflects on Feeds it’s worth noting because you may end up needing some UI tidbits… it may map to them, but it’s

Aug 02 2012
Aug 02

I love excel’s vlookup tool. it’s great for replacing stuff in one spreadsheet using key values and whatnot

UPDATE content_type_er_resources AS t
LEFT JOIN collections_resources AS e
ON e.id = t.field_er_resource_uid_value
SET t.field_er_resource_notes_value = e.res_notes

this is essentially the same thing in sql and it saved a bunch of time.

Jul 16 2012
Jul 16

There are many forum links with numerous hacks detailing how to create a single exposed filter that combines search across multiple fields.   In Views 3 and Drupal 6 or 7 it is as simple as installing the Views Filter Populate
Setting up groups for views populate filter

Setting up groups for views populate filter

And that’s about it – just configure the new global filter to include your desired fields

Configure views filters populate

Configure views filters populate - include the fields you want searched

There isn’t much to know about this module, although I certainly haven’t tested it against dates or numbers, and I rather doubt that works. For text it works like a charm though – http://www.youtube.com/watch?v=AwZj8o2v4uM for the folks who like videos here’s your 1:45 of fun

One filter, two fields... yum

One filter, two fields... yum


Thanks + add any questions or comments below
Jun 21 2012
Jun 21

Increasingly our web pages are being bookmarked on iOS devices.  This is a good thing, however we had traditionally been using long titles on our pages and these were clumsy for end users when trying to store bookmarks.  Like 90,000 other websites we have chosen Page Title to solve this issue.  It works well with Tokens and Views and is probably one of those modules you should just install.

Here’s your 1:30 video http://www.youtube.com/watch?v=DMvXVJ2mbGQ

and a couple of screen shots for the really curious types.  It’s a simple module to install and use. Made by several of Drupal giants robertDouglass, JohnAlbin, and nicholasThompson.

Turn on page titles in the content type area

Turn on page titles in the content type area

Enjoy refreshing page titles independent of your content title

Enjoy refreshing page titles independent of your content title

May 17 2012
May 17

Sometimes Drupal opens up a big can of whoop-up process on ya, and Rules Scheduler is one of those gems.  Rule Scheduler allows you to use rule triggers to schedule rule sets.

Use Case:Ever want to send an email the day before a scheduled event?  We use CCK Sign-up and wanted to send an email to users one week before an event, as well as the day of.  We also needed to send teachers views of the roster of students

Here’s the 2 minute mojo on it http://www.youtube.com/watch?v=55HwOzFHoB8 and it just highlights the mistakes I was making.

The recipe came out of Drupal documentaiton, and these two tutorials got me 90% of the way:

working with scheduled rules

working with scheduled rules

And I thought I was home free, however I ran in to a pretty stupid problem that took me a minute to understand = all the identifiers need to have tokens in them with unique values or else they overwrite themselves in the database.

Solution? Easy = add some tokens – [node:nid] worked for me

The nicely scheduled rules

The nicely scheduled rules

Another fun feature in this project was revisiting one of my favorite modules: Rules Views Integration.  The cool thing about scheduling a rendered view in a rule set is that the rule gets rendered at the last minute and so you can schedule (in our case) a class roster to go out and it’ll have the most up to date information possible at the time of sending.

NB: I also ran in to a problem where cron wasn’t sending my emails initially.  I have no idea why it was stuck, however Ultimate Cron has been a good friend of late and unlocking and running the tab got it back on track = I haven’t seen it stall in a few weeks now.

Ultimate Cron unlock and run run run

Ultimate Cron unlock and run run run

 

Something else I haven’t gotten into yet, however, is the use of the Rules Scheduler Views.   Something tells me there is some magic to be had in there, used correctly.  At this point however I’m just using the off-the-shelf defaults.   I know of no Views Bulk Operations for scheduled rules, so perhaps the default info is all there is to know.  In any case, it’s an elegant solution to working with drupal’s cron functions.

May 11 2012
May 11

Use Case: We want patrons to find our forms easily.  If they need help finding something they should be able to go to a search bar, type in “consultation request”  and get to our consultation request form.

The Challenge:  First off Solr doesn’t index the node/add/your-content-type-here pages by default – I’m certain there’s some workaround, however it’s not obvious (dear readers are welcome to retort).  Secondly none of the form results should be indexed by solr in the first place – we certainly don’t need our patron’s requests showing up anywhere ever.

The Hack: Form Block allows you to make content types available as blocks.  Pretty straightforward, click a few buttons, go to the context editor, and woo-ha = forms in a block = we took the pages that were already returning for the queries we were interested in and just added the form to those pages.

Here’s the VERY brief overview – 1:30 seconds or so worth http://www.youtube.com/watch?v=gzvq-t1m03A that goes over turning a content type into a block as well as adding the block to a context using the context editor that comes with the admin toolbar

Form Block settings in content type

Form Block settings in content type

Now is also a good time to mention that if you are using context’s the Admin toolbar is almost required – it really extends the UI giving you a drag and drop interface for your blocks within every context active on a given page.

Adding node form in the context editor

Adding node form in the context editor

Form Nodes in context Editor

Form Nodes in context Editor

A form in a block!

A form in a block!

May 10 2012
May 10

Use case: Our patrons don’t really think of “saving” their class signups, nor do they often care to preview the request form that they recently filled in.

Quick solution: Using Jammer (admin/settings/jammer) we are able to easily remove the preview (delete, or submit) button on selected content types.  This is also a place to remove path, menu, author and several other fields.

Jammer - remove preview

Jammer - remove preview

Saving makes sense for admins, however our patrons really don’t think of saving their work – they’re submitting requests. Making a happier UI is part of the work we do to keep our patrons around, so we use more vernacular terms to mo betta stuff.  The obvious limitation here is that it overrides EVERY string rendered

Simple string overrides simplify succinctly

Simple string overrides simplify succinctly

in drupal (not in the content, of course)

If anyone knows of a module that’ll let us customize buttons on a per content basis please chime in – not interested in writing tpl.php’s for every one of these though – it’s just not that big a deal yet. Speaking of UI thanks Vid @ the University of Oregon (rss added to the left here) for their work with Taxonomy Super Select Styling http://pages.uoregon.edu/vid/2011/01/21/put-taxonomy-super-select-check-boxes-into-1-2-or-3-columns/

Apr 24 2012
Apr 24

JSON is a data exchange tool that has some distinct advantages over XML as Dare Obasanjo notes.  Using Feeds JSON Path Parser to ingest JSON and Views Datasource to output JSON we are hoping to open up our data to web services.  This tutorial is just about Views Datasource, hopefully we’ll get on the eating side of things with feeds soon!

For the two minute magic here you go http://www.youtube.com/watch?v=yc9Uc-2WczI

Usually when we write up documentation it’s to explain something we understand reasonably well (or at least think we do) on this post we’re grateful to Doug Chestnut over at Alderman for recommending JSON, twistor and infojunkie at drupal.org for banging up some code.

This is just a brief review of a simple views plugin with a lot of potential. In general it is becoming more and more apparent that having web services is rapidly eclipsing the value of web sites.  Web services means being able to extend your integral core data to other developers without the shrouds of silly design and such that stem from institutional committee design.  Put the data in the hands of designers and let them run with it.

Settings for JSON

Settings for JSON

All said and done what this means for developers who may have a use for our electronic journals and books data is that by changing a URL they may have direct access to our work as JSON objects – something that SOLR may ingest directly as of 3.1 – for an example on our development server http://drupal.hsl.virginia.edu/e-resource-journals-json/Biochemistry now returns the JSON output of the regular taxonomy view http://drupal.hsl.virginia.edu/e-resource-journals-taxonomy/Biochemistry

JSON Style in views

JSON Style in views

 

Of course now that we have all these lovely services who is it we’re servicing?  That’s a question we’re still working on the answer to, however given that UVa’s main library is outputting JSON and running SOLR we’re hoping we may be able to streamline and consolidate some of our work for our patrons  (fyi for the VIRGO JSON the string change is slightly different http://search.lib.virginia.edu/catalog?q=chestnut now becomes http://search.lib.virginia.edu/catalog.json?q=chestnut- still a simple way of handling data objects.

Additional resources:

http://jsonviewer.stack.hu/ a handy tool for JSON viewing

Apr 17 2012
Apr 17

Our online exhibits need an attractive home page. To make the view we decided upon Views Fluid Grid for the display (using imagecache of course to fix the width of the images). We use taxonomies extensively in our site to help create contexts among other things so using a term view to list all of our exhibits is a natural extension of the library philosophy. Since not all of our exhibits are hosted on the same site we added a term field to provide a space for a dedicated home page on each exhibit. We also used taxonomy image to make the page more attractive.

Views Fluid Grid Output

Views Fluid Grid Output

It’s a bit long winded at ~3 minutes, but hopefully thorough enough for anyone following along http://www.youtube.com/watch?v=j0fnqBOAj7k

As a result all our archivists must do to add a new exhibit to the home page is add a new taxonomy term to the archival taxonomy and the image and term description are posted to the fluid grid page.

Taxonomy term with a single term field

Taxonomy term with a single term field

The settings within the view itself are pretty straightforward -

Views Fluid Grid settings

Views Fluid Grid settings

and the main thing to remember is that you’ll want to go to imagecache and create a scaled and cropped fixed width preset- this keeps all your pictures the same size and works well with variable sized images.

ImageCache Presets scaled and cropped

ImageCache Presets scaled and cropped

and you’ll also want to change the link output to reference your term field.  Any questions or comments welcome, take care and have a great day.

Replace the link with your term field

Replace the link with your term field

Apr 16 2012
Apr 16

The more I use the activity module the more I like it.  It is a simple module that does one thing well = it keeps track of what is happening on the site, and it leverages other modules like core Triggers, Views, and Tokens to create a useful intuitive activity page.  In our use case we wanted to have the ability to track certain roles working with certain nodes – and having the output styled in views is just icing on the cake.

http://www.youtube.com/watch?v=Ual2-oPLIko

To start with you’ll need to go to /admin/build/activity/create and add activity templates.  Because of how this module was designed I believe it would be pretty simple to extend this module to monitor almost anything.. we just needed to know when certain roles updated or created certain node types, so that was pretty simple.

Setting up an activity template

Setting up an activity template

The use of tokens in the message display section makes for readable and useful messaging

Add tokens for readability

Add tokens for readability

After creating your template(s) you now need to go over to views and add an “Activity” type view – here again – it’s just so cool that you’re extending what is already there and working well… it just makes for an easier time + one less thing to learn!

Adding the Activity in Views

Adding the Activity in Views

With the View going the rules are pretty much the same as for all views – it’s worth noting that if you want to filter by User Role you’ll need to add the “Activity: User” relationship – this adds all of the typical user fields to your filters as well as your fields.  Likewise if you need more information on the nodes you may add the Activity: Node relationship – it’s not always that important since many of the information may be stored in the tokens.  It’s nice to know that you may access those fields if you need to though – just add the relationship and fields + filters as desired.  Nice work on this module folks = well thought out and well implemented.  Thanks!

Setting up the activity views

Setting up the activity views

The final outcome = another view

The final outcome = another view

Apr 12 2012
Apr 12

We wanted to pass information to a view from a node and have the results pulled together inline.  Using node reference CCK fields to pass our arguments along w are able to make the edit and review process simpler for our team.  For the Quick video here is your link http://www.youtube.com/watch?v=TdrugF9pAfU

Adding the token for a referenced node

Adding the token for a referenced node

We also set the build mode to “Edit page” as well as “Full Node” for convenience in editing.

Views Attach build modes

Views Attach build modes

now we can add all the fields we need from the referenced node and have them appear in your full node and node edit pages.

We have chosen to use a token from the node – a node reference field – as our argument that we pass along to the view.

The view loaded into the content type

The view loaded into the content type

The views is loaded into the content type which makes it pretty simple to organize.

The final output has our tabled view inserted into our content = yay ;)

Attached table view in our content

Attached table view in our content

Mar 31 2012
Mar 31

Views Or allows you to define filter blocks with multiple alternatives in drupal views.

for the video inclined here’s the two minute walk through – http://www.youtube.com/watch?v=pWE78xQK3Z0

A bit sleepy this morning and forgot coffee.  It shows, I know.

Use case: we have some old data – some of it comes in with the number 0 meaning blank, some of the rows contain the word NULL and some of the rows are empty. All three variations mean the same thing. We want to create a single view with all three options open – if it’s the number 0 OR the word NULL or simply empty.

Views Or adds to your filters options

Views Or adds to your filters options

Installation and usage: Install as usual – obviously you’ll need views installed…. To use you will need to add all three of the new fields into your filters block. First will be the “Begin alternatives” then the “Next alternative between your filters, (repeated for as many alternatives as you need) and lastly you’ll need to “end alternatives.”

Views or fields in the filters area

Views or fields in the filters area


All the pretty fields need to be reorganized

All the pretty fields need to be reorganized

As a lazy lad I like to just add them all at once and then move the options around afterwards, do whatever your gods tell you to…

The final views or arrangement

The final views or arrangement

Programmatically what this has achieved is

AND ((UPPER(node_data_field_er_acq_uid.field_er_acq_uid_value) = UPPER(‘NULL’)) OR (node_data_field_er_acq_uid.field_er_acq_uid_value IS NULL))

In any case it’s a pretty simple module – installs well and saved us from cruddy data. Merci a bunch to all

Mar 28 2012
Mar 28

Views field view allows you to pass an argument to a view and return results.

For the video inclined here’s the 2 minute feed http://www.youtube.com/watch?v=dUoL_ARPLcI

Use Case:  we’ve got a lot of variables being tallied in different views.  Views in general seems an awkward tool for tabulating values.  Tools like views calc and group by work ok for getting a sum or count here and there, but try mixing several together in one view and the errors start to fly.  May just be I don’t have my head around them, in any case they are not intuitive.   For a given organic group node I need to know how many posts there are total (not a problem, that field comes with organic group views integration), and how many of these posts have been completed in a certain way.

Views field view added to fields in view

Views field view added to fields in view

Choose a view and add fields from the view as argument tokens

Choose a view and add fields from the view as argument tokens

Creating this separate view is simple, but now I want to link the main view to the small view tally.  Views Field View let’s you pick a view and pass it an argument to filter the results per row.  In this case we load a node id into our main view and pass the argument over to the Views Field View – creating a new field with the correct info on a per row basis = Nice!

The only thing that doesn’t work is that it does not actually load this view in the order the rows are listed.  Because of this it does not work well with Views PHP.  Although the rows are listed in this global php field the actual data is not available because for some reason the field is not loaded in the order one might imagine it to be.   It’d be really handy to be able to use these variables in calculations, however it’s just not obvious at all how to do that.

Views PHP and VIews Field View don't work together

Views PHP and VIews Field View don't work together

 

Mar 23 2012
Mar 23
Custom apachesolr results

Custom apachesolr results

We’ve been getting some questions about how we customize our apachesolr results by content type.  The answer:  very simply.  We use views php.  Views php allows us several new field type in views including a place to put custom PHP. It also has the advantage of allowing you to pull in variables already loaded into your view.  Thus while it is possible to write queries to the database in the php area, it is not necessary.  Moreover if you have need to tables not typically available in views you may use the data module to gain access.

For the video inclined here is a link to our 2 minutes on views php http://www.youtube.com/watch?v=cAehdUVrVDs

While there are several fields available in the Views PHP field I tend to use the output field area.  To hide the actual complete results

Using available variables in views php

Using available variables in views php

this makes it so that you can add a few lines of logic and have the results better reflect the information.  For our librarians we output their profile picture linked to their email address, for our web results we provide link descriptions etc.

Excluding results from display allows the results to be available to views php without cluttering the patrons view

Excluding results from display allows the results to be available to views php without cluttering the patrons view

Just remember to exclude your fields from display so that the user isn’t presented with  hundreds of fields and you’re good to go.

Mar 19 2012
Mar 19

Note to all:  Feeds doesn’t seem to connect with user profiles http://drupal.org/node/1060230 = stay tuned for the fix in part 2 (hint use user import also)

Organic groups is a great way to organize groups and cascade permissions – in this example we tested against 45,000 users in 3 different roles going in to 500 groups.

While Node import did the heavy lifting for the group node creation feeds came ahead for user imports.  Node Import just has a few more settings for group node creation than does feeds.

This project came about as a conversion from an unmaintainable drupal 6 site that we converted into off-the-shelf drupal.
Modules used:

Feeds Tamper to assign multiple groups from a signle field   group node id's and role assignments in a spreadsheet

group node id's and role assignments in a spreadsheet

Feeds Tamper to assign multiple groups from a signle field

feeds tamper for role id

feeds tamper for role id

Something to remember with feeds – it can get a bit wonky over file line endings and encoding – more so than node import from what I’ve seen. These are the settings that have worked for me coming from mac excel -> open in text wrangler and resave with windows cr/lf and utf-8 encoding

Feeds Settings

Feeds Settings

The settings are pretty straightforward.

A few things to remember before you upload:

  • if you plan on making node aliases do that before you upload – views bulk operations is slower than molasses updating url aliases.  Same goes for auto node titles if you’re using them.
  • In general every node reference or user reference you have is going to slow something up
text wrangler settings for feed import

text wrangler settings for feed import

Feed mappings

Feed mappings - remember to have a unique id in there

  • organic groups access permissions settings Permissions settings

Modules tested: although a lot of modules were tested not all really made the cut. Some because they didn’t really seem useful in our case. Others (organic subgroups) because I really couldn’t get a response on IRC or the forums about how to ingest them en masse – if anyone has done this please feel free to chime in) organic groups access permissions settings

  • User Import – it only allows you to map your users to a single group.  Thankfully feeds tamper allowed us to map multiple groups per user and group post
  • User Import for Organic Groups – these two seemed promising, however UI4OG only allows the users to be mapped to one group… no good for our use case
  • OG Subgroups – ok – wanted to see this in action, never really got it working at least not through the import interface- might make a good use case for using the migration modules
  • Node Access by User Reference - I really like a lot of Node one’s ideas, and Johan Falk in particular comes up with some very clever ways of re-arranging drupal mods – so I thought I might give this intuitive technique a go – the caveats mentioned in his post indeed became insurmountable – with the need to have 16 user references in each group post my virtual machine came grinding to a halt.
Mar 13 2012
Mar 13

Note to all:  this module is majorly messed up – am leaving this warning here until http://drupal.org/node/1494820 is resolved – briefly the template files get deleted and the output becomes munged after ~1,000 pdfs are generated.   Also while some of my early tests were cranking ~100-200 pdfs per minute we’re seeing results now in the 3-5 per minute making this module unusable for large scale projects. here’s a patched version for D6views_pdf-patched

Views PDF allows you to output the results of a view onto a PDF. You can even upload an existing PDF to use a background template – pretty cool.   For the Audio Visually inclined here’s your 3 minutes of fun. http://www.youtube.com/watch?v=PszjYSq7xQQ

Use Case: Generate 40,000 PDF’s with a user’s name on them and some other predefined fields and make these files accessible to the user for download. 

Problem: creating the PDF’s on the fly is slow – so we need to have them all pre-generated

Solution: Used Cottser‘s writeup here http://drupal.org/node/1415380#comment-5701968 and modified it to be a rule set instead of a rule – with argument type node. Under that added one rule that ended up looking like this

Rule set for saving PDF's to server

Rule set for saving PDF's to server

As you can see the rule requires a pdf view – so hopefully you’ve already got one of them here are some shots of mine

PDF View

PDF View

and here are

views pdf argument settings

views pdf argument settings

the argument settings.  Now earlier we mentioned that the pdf needs to be accessible to users, so back over in our rule set we take an action – we load a referenced user (the user is referenced in the node itself through a user reference cck field) so our final rule set ends up looking like this

Final look of Rule Set

Final look of Rule Set

Ok – almost finished.  Now that we have a rule set we need to add this to a views bulk operation view so that we can “do the deed.”

I like Improved Admin because it gives you a nice starting point for working with Views Bulk Operations.. use whatever brings you the greatest joy.

PDF Save Rule Set in Views Bulk Operations

PDF Save Rule Set in Views Bulk Operations

Once your Rule Set is added to your VBO you may use it with any set of nodes you like.  On our VMWare machine we were churning ~200 pdfs per minute, not too shabby.

Mar 12 2012
Mar 12

A few weeks ago after looking at the taxonomy views integrator a reader posted about how helpful sub path alias is combined with url alter and of course pathauto.   Full Disclosure: tested path alias extended, it seems more robust, but must have missed something as it didn’t flow right off the shelf…

Use Case:  when a user logs in I want them to go to a URL based on their user ID and immediately begin editing the URL.  Pathauto will give you token replacements to do stuff like survey/[user:uid] however when you go to edit the node it typically reverts back to node/81948794387/edit making it difficult to reference.  You could use something like drupal_get_normal_path($path); to do this, but that's not going to make it pretty on the url line, and it's just kinda messy.

A rules based page redirect to an edit page - no node lookups needed

For those interested in a video it's here - no reason to get too excited though - it really does just work - tested against 40,000 nodes and they're all happy, you should be too... http://www.youtube.com/watch?v=t6Touamrvk0

Other niceties – your user/username/edit pages are now working, your mother sent you cookies and it’s Monday morning.  Get some.

Mar 06 2012
Mar 06

Last Thursday we had the opportunity to meet up wth Bryan Ollendyke aka btopro to discuss his flagship product ELMS, as well as numerous other modules – Accessible Content for making more standards compliant sites, CDN for speeding up sites, Organic Groups for working with students and classes, Spaces, database tuning, and many more.  You’ll want to skip to ~minute 8 or 9 where we worked out our technical difficulties.  Ask any questions in the blog and I’ll do my best to help answer.  Specifically settings for CDN are covered as well as use cases and other general high level approaches to development.   Note that link goes to a JNLP blackboard elluminate session – you can exand the size of the window pretty easily in there

https://sas.elluminate.com/p.jnlp?psid=2012-03-01.1249.M.31E08D9EFCC408A0F784A02BEE522E.vcr&sid=2008268

apologies for the

 

Feb 24 2012
Feb 24

Create a rule set and add an argument to receive from your view

There are numerous ways to clean up old posts. Node Expire + Rules is one way, however it requires the user to specify an expiration date, another module, and in that sense is neither intuitive nor efficient. Using Rules and Views together via rules + views integration there’s a great way use the data that has already been entered.

For the video folks here’s your 2 minute rundown of what is up:

1) Create the rule set to handle the data. Add a content argument – you’ll be passing the node ID’s over to Rules for the actions to take place

2) Inside the rule set add a rule – no conditions are needed, just add the action to unpublish the nodes

Here's what your final rule should look like

3) The final rule should look similar to the image at right

4) Once you’ve got your rule set up it’s time to create the view that will send information over to the rule.  Assuming you have rules + views integration and Views Periodic Execution installed you’ll now be able to execute your views on a cron tab

5) In views you’ll need to set the periodic execution phase, the rule set, and of course set up your filters as per usual and MOST IMPORTANTLY include the NID (so that rules knows which nodes to act on)

Select your rule set and pass the node id for your argument

6) The Views Periodic Execution mod by Stephen Jones aka darthsteven

Set the periodic execution phase

7) and of course you need to choose the rule set unto which the little nids may argue and achieve action.  Once you pick your rule set the available arguments’ll appear – any fields you have elected to have appear in your view are available to activate the rule.

Create a rules executor view and send it to your rule set
Feb 16 2012
Feb 16

Autocomplete for apachesolr views

For the folks who need a working copy of apachesolr autocomplete for use with apachesolr views here’s a repo that’ll help https://github.com/alibama/apachesolr-autocomplete-drupal – bear in mind that it’s just the latest version with patches #13 & 14 listed in the autocomplete issue queue applied.  Just figure it’ll save someone a minute of testing against the latest version of solr views…   It’s also attached in a zip at the end of this post.

Also in today’s two minute vid:  exposed form filters in a block = a great way to handle site search.  The exposed filters become available as a separate block that then points to the page.  We then take the newly created block over to our sitewide context and have a search box on every page that connects to the apachesolr search view….

Exposed form in block

Sitewide Contexts put blocks on every page...

 

 

 

 

 

Apachsolr Views Autocomplete Module

Feb 13 2012
Feb 13

Goal: Improve User Interface for our 10,000+ list of electronic resources.

Solution: When working with long lists  a good UI makes all the difference. In our electronic resources catalog the Views Autocomplete Filter module allows patrons to filter through thousands of titles in a few clicks. Views Autocomplete Filter works in much the same way as Better Exposed Filters (and I wish there were some way to have both filters in the same view – if anyone reads this and has a thought on that it’d be greatly appreciated…). For the videophiles here’s the two minute review

Views Autocomplete Filter

 

 

Oddities: The only problem was we got a stinking HTTP 0 error if the patron tried to apply the exposed filter before the site came up with a suggestion.  http://drupal.org/node/627834#comment-2398782 is a pretty straightforward workaround to log errors to a log instead of to the user’s screen…we don’t really care, in our case final fix looks like this

 

commented line 284 of webroot/misc/autocomplete.js
error: function (xmlhttp) {
//alert(Drupal.ahahError(xmlhttp, db.uri));
}

and with that we achieved greater happiness, and all was better in the realm.

For Drupal 7 Autocomplete Deluxe looks pretty nice as well…

Feb 08 2012
Feb 08

Background: By default the taxonomy_term view is available to generate views of the terms in given taxonomies. This view may be extended just like any other view to provide a lot more information, however with this customization you may find yourself wanting a different view for different taxonomies.  In our case we have a taxonomy of electronic journals and resources that needs to look vastly different from the historical collections where pictures and such are available.

TVI let's you pick your taxonomy term view from the taxonomy page

 

Our solution: Taxonomy Views Integrator allows you to choose which view to associate with which taxonomy through a very handy and intuitive drop down menu.  Since there are already too many redirects and such on our site in my opinion this is the way to go.  We cloned our default taxonomy term view and added some new filters… voila!  Then just go to /admin/content/taxonomy and in each vocabulary you may choose which view to use… taxonomy and views… integrated.. better than chocolate caramel lobster salad…

For the videophiles here’s your two minute walkthrough…

NB: There are several tools out there to accomplish this task:

Views Term Path Override: overrides the term path – more URL’s getting flung about, however it’s certainly viable

Taxonomy Redirect: Likewise, probably works, but just doesn’t seem quite as elegant or obvious – not certain which of our admins would remember to

probably a few other ways of doing this… thanks to deeporange1 and awebb for this handy mod

Feb 02 2012
Feb 02

Rules are great for workflows. We have about 30 rules in place on our intranet to help almost every part of our daily workflow, and as with most offices communication between we mere mortals and our fearless leaders is critical. With the help of realname and realname user rereference we create a convenient user interface for data entry,

Realname User Reference Widget

After that we work with Rules and Tokens to create a more automated workflow.  For the Video types there’s a brief ~3 minute video.

The important thing to remember when working with user references in rules is that you must load the user reference BEFORE those that user and the associated tokens become available.  Give your user reference a handy name to create your unique tokens and you’re ok.  Once you have loaded the referenced user into your rule, the tokens are available to use – any information stored in the referenced user’s profile is there too. Also used in this tutorial though not mentioned explicitly is html mail for sending prettier emails through rules.

This is how our rule looked at the end

Debugging: If you find yourself in trouble remember that in the settings page you may turn on the rules debugger (which, depending on the number of rules may churn out a rather lengthy list… ). In the settings there’s also an option to turn off token warnings.  This may tell you whether or not you’ve done your job with the use of tokens.

Debugging Rules - tokens have options too

Jan 25 2012
Jan 25

It’s been a while since we looked at Apachesolr Drupal integration.  In large part that is because it “just works.”

It's solr, in a view, with exposed filters, facets, and it brews tea!

With the recent release of new code on Apachesolr Views (Big ups to dstuart, Ravi.J and ygerasimov for the recent contributions… everything seems to be aces) it’s time to revisit the subject.

If you have struggled with theming the search-result.tpl.php file and really don’t want to learn any more about getting great faceted search results you are totlally in luck!  Note to all: we’re using views 3.x-dev, apachesolr 3.x-dev, and apachesolr_views 3.x-dev.

For those of you who are video inclined here’s a ~4 minute screencast

For the rest of you Robert Douglass called it over two years ago in his “views 3 + apachesolr + acquia drupal = the future of search” post and for the most part that’s the deal – if you want to see more screen shots go there.

We’re also using ApacheSolr Custom Fields and the Batch Indexing module (thanks anarchivist)  (as mentioned previously).  Note that at this time the custom field module requires this fix to run… but still a handy module.

Learn to not code with the help of nice mods!

Custom Fields is well worth the minor effort in that it is another piece of the no-coding puzzle.  We also enjoyed having views php (a bit of coding is ok – we used it to set up displays per content type in the view)

Also using better exposed filters again to make the UI for the exposed filter better… gotta love naming conventions!

In any case the working view took about 10-15 minutes to produce, with ~5 minutes spent making tea.

Attached below is our working stack in a zip file

if anyone wants to download the entire package that we’re using go ahead, there are a few known issues including taxonomy facets that still need to be patched in this release, however for many use cases it is good to go
 Solr Stack – Views + Apachesolr + Apachesolr Views + Batch Reindex + Custom Fields

Jan 25 2012
Jan 25

A glossary index is a helpful tool for our patrons to find the journals that they are looking for – building your first glossary can be a struggle so here’s a 2 minute video to walk you through the basics

Working in the arguments region in views

Once we had the block built we attached it to our view of titles using contexts.  Another way that would have been acceptable would have been Views Attach.  I wanted to use the attached views, however I wasn’t entirely certain about all possible use cases, so we just went with  a block and joined everything up using contexts.

A path, node type, and taxonomy based context

And yes, we could have added “views” conditions as well, although it is already pretty much overkilled…  in any case it’s another beautiful day with contexts & views

Jan 24 2012
Jan 24

Exposing filters in a view is a great way to add interactivity to lists. Out of the box Drupal Views lets you use CCK select lists as an end user visible filter.  The downside is that the select list is a clunky user interface.  To select multiple options you have to hold down the control button while mousing around – not so bad with a short list, but rapidly unmanageable with a longer list.

To solve this user experience conundrum mikeker provided the new and improved exposed filters… aptly called “better exposed filters“  – one thing I like about drupal is that the naming conventions tend to be fairly obvious.

Here’s a brief ~2 minute walkthrough of setting it up

Before Better Exposed Filters

After Better Exposed Filters

Note: you do of course have to expose the filter in views before being able to use the “better” exposed filter…

The tools are available in a new block within your view

Initially after turning the module on I expected to see the new options available from within the filter section of the view, however the module creates a new menu region within views… afterwards style the output as you see fit with css – such that happiness may reign.  any questions or comments welcome

Jan 23 2012
Jan 23

Wow, well after about an hour of debugging we found that vocabularies that support free tagging doesn’t work. The issue queue + patch for Drupal 6 is here http://drupal.org/node/748012 – (the issue queue is for D7, however the patch at the end is D6) In our use case we went the simple route, we changed the taxonomy to be a single option…

In any case – we tested multi-select and that does work in drupal context-6.3.x-dev…  Context Variable might be a workaround as well…

Jan 23 2012
Jan 23

Do you have heathen nodes?  Convert them!  Today we bring to you the gospel of Views Bulk Operations and Node Convert, assisted by Improved Admin Listing, and of course Views

For the videophiles here’s a youtube for the proess

  1. Download and install the mods
  2. Design your conversion template – each field and taxonomy must be either mapped, appended to the body of the new node, or dropped
  3. Edit the “Improved Listing” view
  4. Click on the gear Under  “Style” next to “Views Bulk Operations”
  5. Add the new template that you just created
  6. Now go to admin/content/node/improved (the nice view created by Improved Admin and select the nodes you want to convert
  7. Click through to watch the heathen nodes line up into a happy batch API queue… no Spanish Inquisition here… it’s all happy nodes & clean data!

 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web