Download & Extend

'Mobile Tools' build mode set when not mobile

Project:Mobile Tools
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:twom
Status:active

Issue Summary

I'm using mobile tools simply to switch themes for mobile devices (no redirection, everything for redirection is disabled).

When viewing a node from a desktop browser (ie. non-mobile device), the build mode is being set as "Mobile Tools", not "full node". This is a huge problem when trying to do things based on build mode, such as when using Views with Views Attach.

Is this a bug or is there a way to change this behavior? Marking 'critical' since, if it's a bug, it's interfering with normal Drupal behavior.

Comments

#1

By the way, as a broader example (so people don't focus on my use of Views Attach) this also causes CCK field formatting to stop working.

So, for example, lets say I have an imagefield and I choose an imagecache size in the field's display settings under full node...that won't take effect because mobile tools isn't allowing the build mode to be 'full node'...

Unless I'm missing something (which I may be) this breaks lots of major stuff...anyone else?

#2

Assigned to:Anonymous» twom

Hi,

Two things that should happen here:

1) Apparently mobile tools is thinking that your desktop site is a mobile site. Can you tell about your configuration of the Mobile Tools module (maybe attach a screen shot of your config. page... you can anonymize your domain names if you want).

2) Secondly I will make the option to have a mobile_tools build mode configurable

The build mode code has been contributed in the issue, so I will do some extra tests myself to see how well it works.

#3

I committed a configuration option to enable/disable the build modes.

If you can tell about your configuration, we can also look for the problem with the mobile site detection.

#4

Status:active» needs work

#5

Twom, thanks for looking into this. Two screenshots attached here (one has removed the domain name).

Note that, as I said before, I'm simply using mobile tools to switch a theme, not doing any kind of redirection.

Thoughts?

AttachmentSize
Settings Screen 73.15 KB
Theme Settings Screen 59.81 KB

#6

By the way, the addition of the setting to enable/disable build modes is a great addition.

#7

Status:needs work» needs review

@Rob_Feature: do you still experience problems with the dev version? Or is everything ok now?

#8

Everything seems to be OK now. CCK displays work as expected now.

The display modes are still available in my views (which was the only place I could see them in the UI before) but that could be left over from the old version (would upgrading to the new version remove these or are they in the db somewhere?)

#9

I tried the both of 6.x-2.1 and 6.x-2.x-dev. But I still cannnot fix this problem.
#8 says everything seems OK. I appreciate to know how you could fixed it.

#10

If I remember, I had to actually uninstall the module and reinstall it for the change to take place. Give that a try.

#11

Rob_Feature, thanks for your reply. I tried to uninstall and reinstall 6.x-2.x-dev, but the problem was not fixed unfortunately.

My case is:

I have a content type with imagefield of "medium" which is scaled to the width of 360px.

I set to switch to iWebkit theme by Theme Setting of Mobile Tools for iPhone users, it works perfect except imagefield. My "medium" image is automatically squeezed to fit the iPhone screen only for the width.

Then I activated Mobile Tool Build Mode installing Display Suite module, and I set the imagefiled of Mobile Theme to "small" which is horizontally scaled to the width of 240px. Now iPhone shows the image at 240px, but PC also shows 240px even with the setting of "Basic" at "medium".

My other settings ares:
Mobile URL and Desktop URL are the same in General configuration.
Redirection options are not used.
Switch theme for mobile device is activated with Mobile Theme "iWebkit".
Enabled filter for iPhone device group with Mobile Theme "iWebkit".
Device detection tool is Mobile Tools.

Are there any wrong setting?

For the views pages, it is easy to set different imagecache setting by making new views pages for iPhone, but for the node pages, I cannot find any other solution than this build mode.

#12

Status:needs review» fixed

Ok, I found the problem. It was a small bug in checking if the current site that was served was the mobile site.

I committed the code to dev.

#13

I could temporarily solve the problem by overriding node.tpl.php for my content type, by replacing $content with every field components including image path of imagecache for mobile theme. But it is not very smart.

I look forward the fixed scripts.

#14

The new dev version with the fix can be downloaded now!

#15

Thanks a lot, twom.

With the latest dev of Jan 23, the imagefield could be successfully switched to by theme.

However, with the latest dev, the block display seems to have a problem.
The blocks specially for mobile theme will not come out, though those are displayed with 6.x-2.1.
I appreciate your review.

#16

Status:fixed» postponed (maintainer needs more info)

Can you double check that you have enabled the Mobile Tools block in your mobile theme too?

Thx!

#17

It is not the block for message option, but blocks by core system. The blocks displayed by 6.x-2.1 will not appear by dev.

#18

Hi,
I'm using the last dev code and in my case the issue about build mode is still there.
After some research it's look like it's because I use the same url for desktop and mobile. This is maybe a bad approach but this is a choice regarding the capabilities of my hosting provider !
So, in the function _mobile_tools_site_detection() in file mobile_tools.module after some test, you finally compare both mobile and desktop url, which are the same in my case, and return 'mobile' any time !

However, the theme switching works fine. Cannot we use the same algorithm to define the correct display mode ?

#19

Status:postponed (maintainer needs more info)» needs review

I have lost track about this issue, but in meantime the _mobile_tools_site_detection() has changed. In case you have you "redirection" option set to false, and your theme switching based on device, the function will look at the visiting device to determine what the site type is.

Is the dev version working now?

#20

Version:6.x-1.14» 6.x-2.2

Hi Tom,
Sorry, it's not perfectly working. So my config:
- Same desktop and mobile URL
- Automatic redirection of the mobile user set to false
- Mobile Tools display mode set to true

After enabling display mode, the mobile content is display as expected, but afterward when checking from a desktop, the mobile display mode is used !
Fortunately, the theme switching is still working fine. Always the right theme is displayed.

I'm using the last stable version 6.x-2.2.

As I will be able to have two different urls in my next production environment, this issue won't block me anymore.

BTW, great webcast yesterday, thanks.

#21

Thanks for watching the webinar :) It was fun to do.

In meantime I found (another) bug that caused your error. So it should be working now. But if you already switch to the different url method, you probably don't need it.

I'll keep it open for review for now.

#22

Version:6.x-2.2» 6.x-2.x-dev

After testing the latest 6.x-2.x-dev version it seems that you fixed the issue. Works now fine with the same url.

One more details, I tested mobile version with a firefox extension, an iPhone, an Android and an iPad 2.
Only the iPad2 wasn't recognize as a mobile device. Didn't have tested with the first iPad.

Anyway, thanks for the great work.
-Damien

#23

Status:needs review» closed (fixed)

Hi,

Thanks for reporting back!

The ipad behavior is by design... I had to make a choice in the module :)

However, I can always recommend to make your own device detection plugin:
http://mobiledrupal.com/content/create-your-own-device-detection-algorit...

#24

Status:closed (fixed)» active

Hi, I am still having the exact same issue. June 24 2011 Dev.

Mobile URL and Desktop URL are the same in General configuration..
Device detection tool is Mobile Tools.

If build mode mobile is enabled from mobile tools, it always shows (even on the desktop).

#25

I'm bitten by this bug as well. On hook_nodeapi, $node->build_mode is always 'mobile'. I tried to test this and alter only the mobile version, but since the test will always think it's a mobile site, I resorted to testing mobile_tools_site_type().

nobody click here