LA Drupal meetup (Feb. 23rd, 7:30PM) - Drupal 7 Alpha-2 discussion + Enhanced Inline Image Handling in Drupal 6 presentation

Events happening in the community are now at Drupal community events on www.drupal.org.
Chris Charlton's picture
Start: 
2010-02-23 19:30 - 21:30 America/Los_Angeles
Event type: 
User group meeting

LA Drupal is one of the world's largest and most active Drupal user groups who meets monthly. Top talent, excellent discussions, and great community members share their Drupal knowledge of all levels - from newbies to elite.

When? Tuesday, Feb. 23rd, 2010 (from 7:30pm - 9:30pm)
Where? Causecast.org offices - 1558 10th St. (Unit D), Santa Monica, CA 90401 (entrance is on Colorado; park on the street).

Free Beer & Pizza provided by our host: www.causecast.org

Raffle prizes: every attendee has a chance to win! Prizes include books, and monthly passes to Lynda.com where you can watch titles like "Drupal: Creating and Editing Custom Themes" by Chris Charlton.

TOPICS

  • Drupal 7 Updates What's new with Drupal 7. What was just released in the Alpha-2 preview that came out this recently. Plus Q&A. If you are planning a new web site or application for 2010, you will want to hear what Drupal 7 brings.

  • Awesome, Rich Inline Images in Drupal 6. Presentation on image handling in Drupal 6 and how inline images have vastly improved since Fall, 2009. Building a site with the wrong rich-text and image editors isn't a good idea -- especially when the site is handed off to a client. Christefano from Exaltation of Larks will show how to combine half a dozen modules (half of which you probably use already) to implement a gorgeous, intuitive image handling solution for newbies, site editors and experienced admins alike. (NOTE: Drupal 6 is still a perfect choice to build web sites with for the next 18+ months.)

  • Recap the wonderful volunteer work this past weekend at SCALE 8x. LA Drupal members volunteered to staff the Drupal booth at the Southern California Linux Expo (SCALE) for the third year in a row. This year Drupal was the only CMS (content management system) at the expo, beating out all the other options both open-source and commercially supported.

  • Getting ready for DrupalCon San Francisco (April 2010). Are you going? Did you vote on your favorite session proposals? If you don't have a ride there yet, there is a Drupal party bus that is driving up from San Diego, through Los Angeles, up to San Francisco.

Main Presentation Area
Main presentation area holds up to 80 people and is geared towards general interest topics, especially geared towards people who are new to Drupal or the Topic(s) being presented. It is also a forum for sharing, asking questions.

Lightning Talks - come prepared to talk for 5 min. about something you'd like to share with the Drupal group. Finished a new Drupal site? Find a cool new module? Keep it succinct - you get stopped at five minutes - but we'll be nice about it.

Q & A followed by Job Announcements.

And...
In addition to our presentation(s) of the night we have open-mic opportunities for those who have general Drupal questions or need help during our wonderful meeting segment, "Ask the LA Drupal Community." Need to just ask another human a Drupal question? Then this is that chance.

We have raffle prizes for attendees, and as always, the end of the meeting is our networking session with the fun and knowledgeable LA Drupal crowd.

Those wishing to make announcements for Drupal jobs/work, please come early and speak to the organizers and we can provide time for you to speak to the audience.

Tags for the night:
Post photos on Flickr.com with the tag "ladrupal" and "drupal".

More upcoming L.A. Drupal events & training: http://groups.drupal.org/node/3002/events

Get a Drupal job or post your own: http://groups.drupal.org/node/3002/jobs

Members can vote on our polls: http://groups.drupal.org/node/3002/polls

Chat with other LA Drupal members online now: http://ladrupal.org/chat

Join in on LA Drupal discussions: http://groups.drupal.org/node/3002/recent

Whats an LA Drupal meetup like? Fun & Interesting!

LA Drupal meetups are free and open to anyone interested in Drupal from beginner to guru, but you have to bring a fun attitude and be willing to share or learn.

We have areas for networking, general topics, and more advanced learning and sharing. Presentations and a big breakout session at the end to chat and network.

We like to highlight and encourage folks with cool local projects to present at upcoming meetings. In the past year we've had presenters from Warner Brothers Records; hosting over a hundred artist sites on Drupal, StandUp2Cancer.org - over a million hits in one day during the airing of the show, and local shops such as www.ThisByThem.com, www.ActiveLamp.com, www.openChimp.com, www.chillco.com, www.exaltations.net, www.WorkHabit.com, www.AchieveInternet.com, and others. Topics have included How to build your first Drupal Module, Using Views 1 & Views 2, Panels module, Drush module, Theming, and Scaling Drupal & Cloud computing just to name a handful.

Have a topic you'd like to see? Add it here: http://groups.drupal.org/node/9220

Comments

Here are the modules used

christefano's picture

Here are the modules used during the presentation on inline images:

The editors used:

If you plan to use TinyMCE, neither WYSIWIG API 2.0 nor 2.x-dev support it right now. You can use TwoD's patch or choose a different editor until WYSIWYG API is updated.

Recommended extras:

Pathologic prevents broken links when using the Insert module (which uses absolute paths) in case a Drupal site is moved from one domain to another. This can happen when moving a site from dev to staging or live to dev.

Better Formats improves Drupal's input formats by, for example, setting default formats for specific roles and content types.

I recently discovered why the

christefano's picture

I recently discovered why the Pathologic module wasn't working during the presentation. It wasn't configured properly per the module's instructions in the Drupal.org handbook!

"If the site is using a WYSIWYG content editor such as FCKeditor, TinyMCE, etc and Pathologic doesn’t seem to be doing anything, it may be due to the fact that such editors often try to output paths which begin with a slash character. Such paths are usually ignored by Pathologic, because Pathologic considers such paths to be absolute. However, you can trick Pathologic into working with such paths by using the “Additional paths to be considered local” field. If the Drupal installation is at the root level of a web site (such as http://example.com/), simply enter a single slash into the “Additional paths” field. If it's in a subdirectory (such as http://example.com/foo/drupal/), enter the full subdirectory path, with slashes at both the beginning and end (so /foo/drupal/ in this case)."

Notes on Custom exposed View filter forms

littleviking001's picture

I couldn't bring myself to do a proper write-up, but I did heavily comment my example code. I think it's just as good (even if it is a massive read). Feel free to contact me with any questions, anyway.

<?php

/**
* @file
* Notes on building custom exposed Views filter forms
*
* This file should hopefully serve as a walkthrough for submitting data to
* exposed Views filters using custom forms. The main reason one would want to
* do this is that exposed Views filters can give us ugly, ugly URL queries.
* For one, every form element of an exposed filter form gets put into the URL
* whether the user fills it in or not. For larger forms (like faceted
* searches), this can give absolutely unacceptable queries.
*
* You should be able to read through from top to bottom and get a handle on
* what the code is doing. A decent understanding of Drupal and PHP code is
* assumed, but it's really only a few hooks. Anyone who has built a Drupal
* module should be able to use this right away.
*/


/**
* Form builder
*
* Custom exposed filter form for Drupal User Group view search
*/
function user_group_search_form() {
  /**
   * This is the custom exposed filter form. This form will take the place of
   * the default exposed form, so any data you want to filter on should be
   * present here.
   */
  $form['postal_code'] = array(
    '#type' => 'textfield',
    '#title' => t('Postal Code'),
    '#default_value' => (string) $_GET['postal_code'],
  );
  $form['search'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
  );
  return $form;
}

/**
* Form submit
*/
function user_group_search_form_submit(&$form, &$form_state) {
  /**
   * In the submit handler, we're forming a GET query and sending the user
   * back to the same page with that query set. (For techies out there, the
   * reason we don't just set the form action to 'get' is that that passes
   * through values like form-build-id which make our URL queries ugly again.)
   *
   * As an example, an array set up like:
   *   $query['postal_code']   = '90006';
   *   $query['date']          = 'Mar-3-2010';
   *   $query['time']['start'] = '8pm';
   *   $query['time']['end']   = '10pm';
   *
   * Will yield a search URL like:
   * http://example.com/my_view_search?postal_code=90006&date=Mar-3-2010
   *   &time[start]=8pm&time[end]=10pm
   */

  // Set up the query
  $query['postal_code'] = $form_state['values']['postal_code'];

  // Remove empty values (if there are any)
  $query = array_filter($query);

  // Send user back to the current page, but now with the URL query set
  $form_state['redirect'] = array($_GET['q'], $query);
}

/**
* Implementation of hook_block().
*/
function filterform_block($op = 'list', $delta = 0, $edit = array()) {
  /**
   * Just adding the custom form to a block so we have a way to embed it on
   * the page.
   */
  switch ($op) {
    case 'list':
      $blocks['user_group_search_form']['info'] = t('Drupal User Group Search Form');
      return $blocks;

    case 'view':
      if ($delta == 'user_groupg_search_form') {
        $block['subject'] = t('Drupal User Group Search');
        $block['content'] = drupal_get_form('user_group_search_form');
      }
      return $block;
  }   
}

/**
* Implementation of Views' hook_views_pre_build().
*
* Quick explanation: As the view is processing and getting ready to display
* to the user, this hook occurs just before Views processes the arguments,
* filters and everything else into a SQL query. So any alterations to filters,
* arguments, relationships, sorts and so on should happen here.
*/
function filterform_views_pre_build(&$view) {
  /**
   * Read the current URL query, parse it into a specially formatted $filters
   * array, and pass that into the View object. This lets us use our own format
   * for exposed filters instead of being stuck with the default (ugly) URL
   * queries.
   */

  if ($view->name == 'user_group_search') {

    /**
     * The $filters array needs to match the URL query that would normally be
     * made by Views' exposed filters, so do one search with the normal exposed
     * filter and note down the URL query string.
     *
     * In my case (with just a Location proximity), the URL looked like:
     *   http://ladrupal/default?distance[postal_code]=
     *     &distance[search_distance]=20&distance[search_units]=mile
     * Or
     *   http://ladrupal/default?
     *      distance[postal_code]=90006
     *    & distance[search_distance]=20
     *    & distance[search_units]=mile
     *
     * So the PHP array equivalent would be:
     *  $filters['distance']['postal_code'] = '90006';
     *  $filters['distance']['search_distance'] = '20';
     *  $filters['distance']['search_units'] = 'mile';
     */
    $filters = array();

    if (isset($_GET['postal_code'])) {
      // postal_code is the only dynamic value (as we set up in our custom
      // filter form), so that one will pull from $_GET while the others are
      // static pre-set values.
      $filters['distance']['postal_code'] = (string) $_GET['postal_code'];
      $filters['distance']['search_distance'] = '20';
      $filters['distance']['search_units'] = 'mile';
    }

    // When the filters array is finished, we pass it into the View object
    // with set_exposed_input().
    $view->set_exposed_input($filters);
   
    // And now we're done! With any luck, we should be able to submit our
    // custom form and have it affect the View.
  }
}

Another thing

littleviking001's picture

Another thing - You can hide the default exposed filters by going to your View's settings and setting "Exposed form in block" to Yes. That option makes a block on the block admin page with the view's exposed form, usually so you can put it wherever you want on the page, but it you just leave the block disabled then the exposed input works and you don't have to deal with the extra form.