http://www.mediawiki.org/wiki/Special:Code/MediaWiki/93524

Revision: 93524
Author:   hartman
Date:     2011-07-30 14:27:42 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
* Fix content-type response header for wml
* Fix content-type in wml <head>
* Fix an issue where the card index for wml was not wrapped in <p>
* Make some notes about things we should and could do in the future.

Modified Paths:
--------------
    trunk/extensions/MobileFrontend/DeviceDetection.php
    trunk/extensions/MobileFrontend/MobileFrontend.php
    trunk/extensions/MobileFrontend/views/layout/application.wml.php

Modified: trunk/extensions/MobileFrontend/DeviceDetection.php
===================================================================
--- trunk/extensions/MobileFrontend/DeviceDetection.php 2011-07-30 13:55:27 UTC 
(rev 93523)
+++ trunk/extensions/MobileFrontend/DeviceDetection.php 2011-07-30 14:27:42 UTC 
(rev 93524)
@@ -364,6 +364,7 @@
                
                if ( $formatName === '' ) {
                        if ( strpos( $acceptHeader, 
'application/vnd.wap.xhtml+xml' ) !== false ) {
+                               // Should be wap2 or in WURFL xhtmlmp
                                $formatName = 'html';
                        } elseif ( strpos( $acceptHeader, 'vnd.wap.wml' ) !== 
false ) {
                                $formatName = 'wml';
@@ -373,4 +374,4 @@
                }
                return $formatName;
        }
-}
\ No newline at end of file
+}

Modified: trunk/extensions/MobileFrontend/MobileFrontend.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFrontend.php  2011-07-30 13:55:27 UTC 
(rev 93523)
+++ trunk/extensions/MobileFrontend/MobileFrontend.php  2011-07-30 14:27:42 UTC 
(rev 93524)
@@ -218,6 +218,29 @@
                //      ob_start( array( $this, 'DOMParse' ) );
                // }
 
+               // WURFL documentation: 
http://wurfl.sourceforge.net/help_doc.php
+               // Determine the kind of markup
+               if( is_array($props) && $props['preferred_markup'] ) {
+                       wfDebug( __METHOD__ . ": preferred markup for this 
device: " . $props['preferred_markup'] );
+                       // xhtml/html: html_web_3_2, html_web_4_0
+                       // xthml basic/xhtmlmp (wap 2.0): html_wi_w3_xhtmlbasic 
html_wi_oma_xhtmlmp_1_0
+                       // chtml (imode): html_wi_imode_*
+                       // wml (wap 1): wml_1_1, wml_1_2, wml_1_3
+               }
+               // WML options that might influence our 'style' of output
+               // $props['access_key_support'] (for creating easy keypad 
navigation)
+               // $props['softkey_support'] ( for creating your own menu)
+
+               // WAP2/XHTML MP
+               // xhtmlmp_preferred_mime_type ( the mime type with which you 
should serve your xhtml to this device
+
+               // HTML
+               // $props['pointing_method'] == touchscreen
+               // ajax_support_javascript
+               // html_preferred_dtd
+
+               // Determine  
+
                if (self::$useFormat === 'mobile' ||
                        self::$useFormat === 'mobile-wap' ) {
                                $this->disableCaching();
@@ -340,7 +363,7 @@
                $card .= "<card id='{$idx}' 
title='{$title}'><p>{$segments[$requestedSegment]}</p>";
                $idx = $requestedSegment + 1;
                $segmentsCount = count($segments);
-               $card .= $idx . "/" . $segmentsCount;
+               $card .= "<p>" . $idx . "/" . $segmentsCount . "</p>";
 
                $useFormatParam = ( isset( self::$useFormat ) ) ? '&' . 
'useFormat=' . self::$useFormat : '';
 
@@ -489,7 +512,18 @@
                        && empty( self::$search ) ) {
                        $contentHtml =  $this->javascriptize( $contentHtml );
                } elseif ( $this->contentFormat == 'WML' ) {
-                       $contentHtml = $this->javascriptize( $contentHtml );
+                       header( 'Content-Type: text/vnd.wap.wml' );
+
+                       // TODO: Content transformations required
+                       // WML Validator:
+                       // http://validator.w3.org
+                       // 
+                       // div -> p
+                       // no style, no class, no h1-h6, sup, sub, ol, ul, li 
etc.
+                       // table requires "columns" property
+                       // lang and dir officially unsupported (but often work 
on rtl phones)
+
+                       // Content wrapping
                        $contentHtml = $this->createWMLCard( $contentHtml, 
$title );
                        require( 'views/layout/application.wml.php' );
                }

Modified: trunk/extensions/MobileFrontend/views/layout/application.wml.php
===================================================================
--- trunk/extensions/MobileFrontend/views/layout/application.wml.php    
2011-07-30 13:55:27 UTC (rev 93523)
+++ trunk/extensions/MobileFrontend/views/layout/application.wml.php    
2011-07-30 14:27:42 UTC (rev 93524)
@@ -7,7 +7,6 @@
                <title>{$title}</title> 
            <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
            <meta name="character-set=utf-8" content="charset"/>
-               <meta http-equiv="Content-Type" content="text/html; 
charset=UTF-8" />
            <meta forua="true" http-equiv="Cache-Control" content="max-age=0"/>
          </head>
        {$contentHtml}


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to