phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc class.xslttemplates.inc.php class....


From: Sigurd Nes
Subject: [Phpgroupware-cvs] phpgwapi/inc class.xslttemplates.inc.php class....
Date: Mon, 28 Aug 2006 13:39:18 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Changes by:     Sigurd Nes <sigurdne>   06/08/28 13:39:18

Modified files:
        inc            : class.xslttemplates.inc.php 
                         class.browser.inc.php 

Log message:
        Enables wml-output for wml-capable browsers

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.xslttemplates.inc.php?cvsroot=phpgwapi&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.browser.inc.php?cvsroot=phpgwapi&r1=1.19&r2=1.20

Patches:
Index: class.xslttemplates.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.xslttemplates.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- class.xslttemplates.inc.php 6 Aug 2006 04:51:26 -0000       1.28
+++ class.xslttemplates.inc.php 28 Aug 2006 13:39:18 -0000      1.29
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/lpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage gui
-       * @version $Id: class.xslttemplates.inc.php,v 1.28 2006/08/06 04:51:26 
skwashd Exp $
+       * @version $Id: class.xslttemplates.inc.php,v 1.29 2006/08/28 13:39:18 
sigurdne Exp $
        */
 
        if( (floor(phpversion()) == 4 && !extension_loaded('xslt') )
@@ -195,7 +195,13 @@
                        return $this->xmlvars;
                }
 
-               function xsl_parse()
+               /**
+               * Parse the xsl-stylesheets
+               *
+               * @param boolean $wml_out set to true for wml-enabled browsers
+               */
+
+               function xsl_parse($wml_out = false)
                {
                        if( is_array($this->xslfiles) && count($this->xslfiles) 
> 0)
                        {
@@ -205,9 +211,18 @@
                                $this->xsldata .= '<!ENTITY nbsp 
"&#160;">'."\n";
                                $this->xsldata .= ']>'."\n";
                                $this->xsldata .= '<xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">'."\n";
+
+                               if(!$wml_out)
+                               {       
                                $this->xsldata .= '<xsl:output method="html" 
version="1.0" encoding="utf-8" indent="yes" omit-xml-declaration="yes" 
standalone="yes" media-type="application/xml+xhtml"/>'."\n";
                                //FIXME Remove the line above and uncomment the 
one below once the main templates are converted or else it fscks validation
                                //$this->xsldata .= '<xsl:output method="html" 
version="1.0" encoding="utf-8" indent="yes" omit-xml-declaration="yes" 
doctype-public="-//W3C/DTD XHTML 1.0 Transitional//EN" 
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; 
standalone="yes" media-type="application/xml+xhtml"/>'."\n";
+                               }
+                               else
+                               {
+                                       $this->xsldata .= '<xsl:output method = 
"xml" encoding="utf-8"  doctype-public="-//WAPFORUM//DTD WML 1.3//EN" 
doctype-system="http://www.wapforum.org/DTD/wml13.dtd"; />'."\n";                
          
+
+                               }
                                $this->xsldata .= '<xsl:template 
match="/">'."\n";
                                $this->xsldata .= "\t".'<xsl:apply-templates 
select="PHPGW"/>'."\n";
                                $this->xsldata .= '</xsl:template>'."\n";
@@ -261,11 +276,18 @@
                function parse($parsexsl = True, $parsexml = True)
                {
                        $output_header = 
!(isset($GLOBALS['phpgw_info']['flags']['noframework']) && 
$GLOBALS['phpgw_info']['flags']['noframework']);
+                       
+                       // Determine whether the browser is wml-capable or not
+                       $wml_out = execMethod('phpgwapi.browser.is_mobile');
+                       
+                       if(!$wml_out)
+                       {
                        $GLOBALS['phpgw']->common->phpgw_header($output_header);
+                       }
 
                        if($parsexsl)
                        {
-                               $this->xsl_parse();
+                               $this->xsl_parse($wml_out);
                        }
                        if($parsexml)
                        {

Index: class.browser.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.browser.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- class.browser.inc.php       30 Dec 2004 06:47:30 -0000      1.19
+++ class.browser.inc.php       28 Aug 2006 13:39:18 -0000      1.20
@@ -7,7 +7,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage network
-       * @version $Id: class.browser.inc.php,v 1.19 2004/12/30 06:47:30 
skwashd Exp $
+       * @version $Id: class.browser.inc.php,v 1.20 2006/08/28 13:39:18 
sigurdne Exp $
        * @internal Majority of code borrowed from Sourceforge 2.5
        */
 
@@ -289,5 +289,21 @@
                                }
                        }
                }
+               
+               /**
+               * Determine whether the browser is wml-capable or not
+               * @return bool is wml-capable
+               */
+               function is_mobile()
+               {
+                       if (stripos ( $_SERVER['HTTP_ACCEPT'], 
'text/vnd.wap.wml' ))
+                       {
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
        }
 ?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]