Closed Bug 511699 Opened 16 years ago Closed 16 years ago

p12n: Make SHOWFOR configurable (for Firefox vs Fennec)

Categories

(support.mozilla.org :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: paulc, Assigned: jsocol)

References

()

Details

(Whiteboard: sumo_only showfor)

Attachments

(1 file, 1 obsolete file)

For productization, we need showfor to be configurable so we can ship it for two different products, e.g. Firefox and Fennec
James said he'll investigate the config file approach.
Assignee: nobody → jsocol
Is there a list of what Fennec will need here? Obviously Mac vs Linux vs Windows is no longer applicable. What about versions?
I'm guessing no. You think it would be possible to place the versions somewhere in the DOM when SHOWFOR is used? That way, we could have a file that lists versions somehow. I'm not sure how Fennec versions and platforms can be detected yet. We'll need to talk to the team to figure that out.
Attached patch php patch, v1 (obsolete) — Splinter Review
This patch moves the configuration (for the PHP part only) into a config file in scripts/showfor/config.php and comes with a config.php.dist (which is just the Firefox settings). This is a bit long, so let me explain... Because of the way Tiki includes wikiplugin files, the config array is in the global scope. (I'm sorry. Another option was to wrap it in a global function that returns the array, but I thought this was easier to work with.) The config array is extract()ed in the wikiplugin_showfor() function. This is less than ideal, but since the function constructs so many variable variables, it was the safest way to avoid identifier collisions. The other options were essentially equivalent to extract() anyway. I added a new "os_aliases" array, and stripped out a few switch statements relating to the OS types, and replaced them with calls to wikiplugin_showfor_find_alias(). Another switch got replaced with the "os_spans" config array, which defines the sets of classes and their complements when SHOWFOR tries to hide content via the {DIV()} plugin. I wasn't really sure how to handle browser/OS detection, so I left it as is. Modifications to the JavaScript can address those as needed. I didn't touch the inner loops. I modified the wikiplugin_showfor_find_alias() function so it doesn't require the real name to be both the array key, and listed as an alias, and added some documentation to it. (Probably too much, but I was being generous to future generations.) I did NOT move the $types array into the configuration, because several of the inner loops seemed to depend on the specific values of "browser" and "os". I added a blank line or two to make things easier to read, and a bunch of comments in the config.php.dist file explaining it. And finally, stripped off the closing ?> "just because".
Attachment #396801 - Flags: review?(paul.craciunoiu)
Comment on attachment 396801 [details] [diff] [review] php patch, v1 Testing on a couple articles works fine for me. Functionality's there for OSes and versions, 2.0 is still hidden. As a minor nitpick, the patch uses tabs for indentation, and since laura so mentioned we shouldn't, it'd be nice to change those.
Attachment #396801 - Flags: review?(paul.craciunoiu)
Attachment #396801 - Flags: review?(laura)
Attachment #396801 - Flags: review+
Attached patch patch, v1.0.1Splinter Review
Indenting in config.php.dist is now all with spaces. Tabs used in wikiplugin_showfor.php were already there.
Attachment #396844 - Flags: review?(paul.craciunoiu)
Comment on attachment 396844 [details] [diff] [review] patch, v1.0.1 The same articles load fine :)
Attachment #396844 - Flags: review?(paul.craciunoiu)
Attachment #396844 - Flags: review?(laura)
Attachment #396844 - Flags: review+
Attachment #396801 - Attachment is obsolete: true
Attachment #396801 - Flags: review?(laura)
Attachment #396844 - Flags: review?(laura) → review+
Pav, can you give any insight into the onload behavior for Fennec? For example, on SUMO, we check to see if the user is running Firefox, and if so, try to start with the content for the current version and OS. If not, we fall back to the default browser.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
We don't yet have Fennec in the list of supported user-agents for SUMO, right? i.e., this isn't yet testable? My user-agent is Mozilla/5.0 (Windows; U; WindowsCE 5.2; en-US; rv:1.9.3a1pre) Gecko/20090828 Fennec/1.0a3 (for when you want to test).
Yay, feeling good about this; tested: * Firefox 2.0.0.20 - Windows XP * Firefox 3.0.13 - Windows Vista, Ubuntu * Firefox 3.5.2 - Vista, Ubuntu, Mac OS X * IE 6 - XP * IE 7 - Vista * IE 8 - Vista * Opera 9.62 - Windows 7 * Safari 4.0.3 - Mac OS X * Google Chrome 2.0.172.43 - Windows Vista Verified FIXED -- feel free to double-check my work, someone!
Status: RESOLVED → VERIFIED
scripts/showfor/config.php.dist is already set up for SUMO, it just needs to be copied to scripts/showfor/config.php
Whiteboard: sumo_only showfor
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: