Add Advanced Settings (iPhone/iPod and Domain checking)

der - June 8, 2008 - 15:51
Project:Mobile Theme
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active (needs more info)
Description

I have been working with Joe Hewitt's iui library and I've uncovered several bugs which I've submitted back to the iui project. The project doesn't seem to be getting a lot of attention from the maintainers so I have no idea when/if they may incorporate my patches but in any event I have a revised version of the iui libraries with the fixes.

Here are the two bugs.

multiple submit buttons dont work
radio buttons get submitted incorrectly

Also, I have a theme loader module that can be used to determine when to load the iui theme. It's useful if one has a need for using both the iphone theme and a normal theme on the same site. It can be configured to look for specific user agents and/or specific subdomains.

here's a screenshot

If you're interested, I could contribute my loader module and my patched iui library to this project. If, by chance, you're looking for a co-maintainer I might be able to help out there too.

#1

Rob Loach - June 9, 2008 - 16:06
Version:6.x-1.0» 6.x-1.x-dev
Status:active» active (needs more info)

Great work on the bugs! I always love to give back to projects I use, and love to see others do the same.

I've been using a small little module I put together called Mobile Theme, which just checks if the user's browser is a mobile theme. Extending that use case for the iPhone/iPod would be neat as iUI wouldn't work on some mobile devices (ones that arn't iPhones/iPods). If you have any other ideas, feel free to let me know.

#2

der - June 10, 2008 - 02:08

The only issue I see with using the Browscap module (as used in the Mobile Theme module) to determine when to use the iui theme is that not all mobile devices will work well with iui. As a matter of fact only webkit based iui devices would theoretically work and for all practical purposes really only an iPhone and iPod will work well enough to make it useful. My theme loader module specifically looks for the iPhone and iPod user agents so the theme would only be exposed on those devices. All other devices get the default theme for the site. Since both your Mobile Theme module and my iphone loader module are both pretty small and kinda serve the same purpose maybe they could just be combined into one module. The code in my init function looks like this:

function iphone_loader_init() {
  global $custom_theme;
  if (isset($_SERVER['HTTP_HOST'])) {
      if (variable_get('ihone_loader_check_agent_iphone', 1) && stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
      $custom_theme = 'iphone';
    }
    if (variable_get('ihone_loader_check_agent_ipod', 1) && stristr($_SERVER['HTTP_USER_AGENT'], 'iPod')) {
      $custom_theme = 'iphone';
    }
    if (variable_get('ihone_loader_check_agent_safari', 0) && stristr($_SERVER['HTTP_USER_AGENT'], 'Safari')) {
      $custom_theme = 'iphone';
    }
    if (variable_get('ihone_loader_check_subdomain', 0) && substr($_SERVER['SERVER_NAME'],0,7) == variable_get('iphone_loader_subdomain_string', 'iphone') . '.') {
      $custom_theme = 'iphone';
    }
  }
}

We could easily incorporate your init code with mine and have one module that allows the user to configure it to load a mobile theme in three different ways. 1) if browscap says it's a mobile device or... 2) if user agent is iPhone/iPod or....3) being accesses from a specific subdomain (i.e. mobile.mysite.com)

#3

Rob Loach - June 10, 2008 - 14:05

I just gave you CVS access on the iUI theme, as well as mobile_theme.

I was thinking we somehow added the iPhone/webkit use case to mobile theme somehow. Although iUI wouldn't work on Mobile Theme, we add an addition setting to it in the Mobile Theme fieldset in admin/build/theme/settings. Not too sure how the user interface would work yet though.....

I also just added this ability to the Switchtheme module. The patch is right here. Not too sure what the best solution is yet....

#4

der - June 10, 2008 - 16:00

My thoughts were a settings page that looks like this.

#5

Rob Loach - June 10, 2008 - 18:01

Brilliant! One problem, what happens when the user is on a mobile device that doesn't support web kit? Should there be multiple mobile themes that could be selected? Hmmm..... A small cell phone couldn't render Garland, or iUI, but it could render Mobile. But at the same time, you want phones that do support iUI to render using iUI.

#6

der - June 10, 2008 - 22:29

So the use cases are:

1) enable one mobile theme for all mobile devices

2) enable one mobile theme for webkit based devices (iPhone/iPod Touch) and enable a different mobile theme for all other mobile devices

I also like the option of forcing a theme based on subdomain so that would be the third use case. So how about an admin settings page like this.

#7

Rob Loach - June 11, 2008 - 14:44

It would be nice to have the default mobile theme in there.....
http://www.flickr.com/photos/robloach/2570707622/sizes/o/

Would that work? I'd be glad to add it in like that.

#8

Rob Loach - June 11, 2008 - 14:47
Title:bugs in iui core and need for a loader module» Add Advanced Settings (iPhone/iPod and Domain checking)
Project:iUI» Mobile Theme
Version:6.x-1.x-dev» 6.x-1.x-dev
Component:Miscellaneous» Code

#9

der - June 11, 2008 - 18:03

That works for me. The only other suggestion I would have would be to change the label and/or the description of the default theme dropdown so that people understand that it's the default.

#10

jruz - August 17, 2008 - 23:29

im looking forward for the changes you are talking about.

hope you release them soon

thanks for your work!!!

 
 

Drupal is a registered trademark of Dries Buytaert.