[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-developers] New feature - wml - class.xslttemplates.in
From: |
Sigurd Nes |
Subject: |
Re: [Phpgroupware-developers] New feature - wml - class.xslttemplates.inc.php |
Date: |
Sun, 27 Aug 2006 21:00:52 +0200 |
User-agent: |
Thunderbird 1.5.0.5 (X11/20060804) |
Dave Hall wrote:
> On Sun, 2006-08-27 at 14:28 +0200, Sigurd Nes wrote:
>> Dave Hall wrote:
>>> Hi Sigurd,
>>>
>>> On Sun, 2006-08-27 at 12:57 +0200, Sigurd Nes wrote:
>>>> How about having a detecting-function isMobileUser() - that detects
>>>> whether the output should be html or wml - changing the top element of
>>>> the stylesheet as something like this:
>>>>
>>> I would prefer bool browser::is_mobile(), that said it would not be 100%
>>> accurate. Close enough is good enough I suppose :)
>>>
>>> At the same time WML is more than a DTD. We would need to output the
>>> correct content type headers. And also we would need a WML template set.
>>> Given we are less than a week from a fetaure freeze for the API, I think
>>> we should look at implementing this in HEAD after the branch, instead of
>>> rushing it now.
>> My intention is not to implement the full framework at this stage - but
>> to enable certain pages within applications.
>> To accomplish this - it is enough to disable framework,header and footer
>> like this:
>>
>> $GLOBALS['phpgw_info']['flags'][noheader] = True;
>> $GLOBALS['phpgw_info']['flags'][nofooter] = True;
>> $GLOBALS['phpgw_info']['flags']['noframework'] = True;
>>
>> and to have an appropriate xslt-stylesheet for this page (function)
>> alone within the application in question.
>>
>> Any chance ?
>
> I will support it if:
>
> * is_mobile method is implemented in browser not the template class
> * is_mobile is an optional method parameter which defaults to false
> * we can work a clean and documented way to handle the template files
> * it all gets documented when it goes into cvs :)
>
> Maybe others disagree with me.
>
> Cheers
>
> Dave
>
Something like this? (attachment)
Regards
Sigurd
diff -aburN --exclude='CVS*' phpgwapi.org/inc/class.browser.inc.php
phpgwapi/inc/class.browser.inc.php
--- phpgwapi.org/inc/class.browser.inc.php 2006-08-27 20:53:30.000000000
+0200
+++ phpgwapi/inc/class.browser.inc.php 2006-08-27 19:46:02.000000000 +0200
@@ -27,6 +27,11 @@
var $data;
/**
+ * @var bool $is_mobile define whether the browser is
wml-capable or not
+ */
+ var $is_mobile = False;
+
+ /**
* Determine browser, version and platform
*/
function browser()
@@ -117,6 +122,12 @@
$this->br = '<br />';
$this->p = '<p>';
}
+
+ // Determine whether the browser is wml-capable or not
+ if (stripos ( $_SERVER['HTTP_ACCEPT'],
'text/vnd.wap.wml' ))
+ {
+ $this->is_mobile = true;
+ }
}
function return_array()
diff -aburN --exclude='CVS*' phpgwapi.org/inc/class.xslttemplates.inc.php
phpgwapi/inc/class.xslttemplates.inc.php
--- phpgwapi.org/inc/class.xslttemplates.inc.php 2006-08-27
20:53:30.000000000 +0200
+++ phpgwapi/inc/class.xslttemplates.inc.php 2006-08-27 20:27:17.000000000
+0200
@@ -205,9 +205,19 @@
$this->xsldata .= '<!ENTITY nbsp
" ">'."\n";
$this->xsldata .= ']>'."\n";
$this->xsldata .= '<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">'."\n";
+ $browser = CreateObject('phpgwapi.browser');
+ if(!$browser->is_mobile)
+ {
$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";