r36293 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36292‎ | r36293 | r36294 >
Date:18:12, 14 June 2008
Author:nhuffschmid
Status:old
Tags:
Comment:
updated hawhaw.inc
simulator-less design now better matches hawhaw api and license
fixed nbsp-bug
Modified paths:
  • /trunk/wap/hawhaw/hawhaw.inc (modified) (history)
  • /trunk/wap/hawiki/hawiki.inc (modified) (history)
  • /trunk/wap/hawiki/hawiki_cfg.inc (modified) (history)
  • /trunk/wap/hawpedia.php (modified) (history)
  • /trunk/wap/transcode.php (modified) (history)

Diff [purge]

Index: trunk/wap/hawhaw/hawhaw.inc
@@ -3,7 +3,7 @@
44 // HAWHAW: HTML and WML hybrid adapted webserver
55 // PHP class library
66 // Copyright (C) 2008 Norbert Huffschmid
7 -// Last modified: 14. May 2008
 7+// Last modified: 14. June 2008
88 //
99 // This library is free software; you can redistribute it and/or modify it under the
1010 // terms of the GNU Library General Public License as published by the Free Software
@@ -21,13 +21,10 @@
2222 // For further information about this library and its license terms please visit:
2323 // http://www.hawhaw.de/
2424 //
25 -// changes against V5.18:
26 -// improved browser detection for:
27 -// - PalmOS
28 -// - Minimo
29 -// - PIE
30 -// - Blackberry
31 -// - Nintendo DS
 25+// changes against V5.19:
 26+// - added support of Amazon Kindle device
 27+// - disabling of simulator supported
 28+// - improved detection of desktop browsers
3229
3330 ###################################
3431 # BEGIN OF CONFIGURATION PART #
@@ -48,7 +45,7 @@
4946 ###################################
5047
5148 // miscellaneous constants
52 -define("HAW_HAW_VERSION", "HAWHAW V5.19B");
 49+define("HAW_HAW_VERSION", "HAWHAW V5.20B");
5350 define("HAW_COPYRIGHT", "(C) Norbert Huffschmid");
5451 if (defined("HAW_TERA_WURFL_PATH"))
5552 define("HAW_VERSION", HAW_HAW_VERSION . "/Tera-WURFL");
@@ -97,7 +94,8 @@
9895 define("HAW_RAW", 16);
9996 define("HAW_RULE", 17);
10097 define("HAW_VOICERECORDER", 18);
101 -define("HAW_USERDEFINED", 19);
 98+define("HAW_USERDEFINED", 19); // synonym for HAW_PLUGIN (deprecated)
 99+define("HAW_PLUGIN", 19);
102100
103101 // constants for page setup
104102 define("HAW_ALIGN_LEFT", 1);
@@ -162,6 +160,12 @@
163161 define("HAW_DISP_VLINKCOLOR", "#006633"); // lighter green
164162 define("HAW_DISP_FACE", "Arial,Times");
165163
 164+// constants for simulator handling
 165+define("HAW_SIM_NONE", 0); // no simulator at all
 166+define("HAW_SIM_CLASSIC", 1); // classic hawhaw simulator style
 167+define("HAW_SIM_SKIN", 2); // skin-based (phone-) simulator
 168+
 169+
166170 function HAW_specchar($input, $deck)
167171 {
168172 // convert special characters
@@ -559,18 +563,21 @@
560564 var $number_of_top_banners = 0;
561565 var $bottom_banners;
562566 var $number_of_bottom_banners = 0;
563 - var $display_banners = true;
 567+ var $display_banners = false;
 568+ var $link_brackets = true;
564569 var $waphome;
565570 var $hdmlcardset;
566571
567572 // browser dependent properties
568 - var $pureHTML = false; // Big-screen-HTML-code ("simulator", causes trouble with unrecognized devices)
 573+ var $desktopBrowser = false; // non-mobile browser
 574+ var $pureHTML; // deprecated synonym for $desktopBrowser (keep for compatibilty reasons)
569575 var $PDAstyle = false; // PDA browsers needs special HTML code
570576 var $iModestyle = false; // cHTML too
571577 var $upbrowser = false; // UP browser
572578 var $owgui_1_3 = false; // Openwave GUI Extensions for WML 1.3
573579 var $MMLstyle = false; // Mobile Markup Language
574580 var $lynx = false; // Lynx text browser
 581+ var $iPhoneAlike = false; // iPhone, iPod Touch etc.
575582 var $xhtml = false; // XHTML MP (mobile profile)
576583 var $gif_enabled = false; // browser can not deal with GIF images
577584 var $submitViaLink = false; // use link instead of <do>
@@ -582,8 +589,8 @@
583590 var $hawoutput = ""; // no forced output
584591
585592 // device simulator properies
586 - var $use_simulator = false; // decide whether default simulator device is to be used
587 - var $skin = ""; // contains css url, where skinning is defined
 593+ var $use_simulator = HAW_SIM_CLASSIC; // decide whether default simulator device is to be used
 594+ var $skin = ""; // contains css url, where skinning is defined
588595
589596 // character set properties
590597 var $charset = "iso-8859-1"; // default charset
@@ -786,6 +793,16 @@
787794 }
788795 }
789796
 797+ $this->pureHTML = &$this->desktopBrowser; // synonyms for non-mobile browsers
 798+
 799+ if (strstr(strtolower($HTTP_USER_AGENT), "lynx"))
 800+ $this->lynx = true;
 801+
 802+ if (strstr($HTTP_USER_AGENT, "(iPhone") ||
 803+ strstr($HTTP_USER_AGENT, "(iPod") ||
 804+ strstr($HTTP_USER_AGENT, "(Aspen Simulator"))
 805+ $this->iPhoneAlike = true;
 806+
790807 if (defined("HAW_TERA_WURFL_PATH") && !$forced_output)
791808 {
792809 $this->determine_capabilities_terawurfl();
@@ -936,17 +953,17 @@
937954
938955
939956 /**
940 - Adds some user-defined HAWHAW object to HAW_deck.<br>
941 - @param udef Some user-defined object.
 957+ Adds some HAWHAW plugin to HAW_deck.<br>
 958+ @param plugin Some user-defined plugin object.
942959
943960 <pre>
944 - A user-defined HAWHAW class definition should look like this:
 961+ A HAWHAW plugin class definition should look like this:
945962
946 - class HAW_foo // some class name of your choice
 963+ class HAW_plugin_foo // some class name of your choice
947964 {
948965 var $bar; // some class variable declarations of your choice
949966
950 - function HAW_foo(...)
 967+ function HAW_plugin_foo(...)
951968 {
952969 # some constructor code (if required)
953970 }
@@ -959,7 +976,7 @@
960977 # this member function is called by HAWHAW and MUST NOT be changed!
961978 function get_elementtype()
962979 {
963 - return HAW_USERDEFINED;
 980+ return HAW_PLUGIN;
964981 }
965982
966983 function create($deck)
@@ -972,28 +989,37 @@
973990
974991 Usage: ...
975992 require_once("hawhaw.inc);
976 - require_once("HAW_foo.php");
 993+ require_once("HAW_plugin_foo.php");
977994 ...
978 - $myText = new HAW_text("Classic text");
979 - $myDeck->add_text($myText);
980 - $myClass = new HAW_foo("Cool output");
 995+ $myClass = new HAW_plugin_foo("Cool output");
981996 $myClass->set_coolstuff($ringtone, $sms, $userlocation);
982 - $myDeck->add_userdefined($myClass);
 997+ $myDeck->add_plugin($myClass);
983998 ...
984999 </pre>
9851000 */
986 - function add_userdefined($udef)
 1001+ function add_plugin($plugin)
9871002 {
988 - if (!is_object($udef))
989 - die("invalid argument in add_userdefined()");
 1003+ if (!is_object($plugin))
 1004+ die("invalid argument in add_plugin()");
9901005
991 - $this->element[$this->number_of_elements] = $udef;
 1006+ $this->element[$this->number_of_elements] = $plugin;
9921007
9931008 $this->number_of_elements++;
9941009 }
9951010
9961011
9971012 /**
 1013+ Adds some user-defined HAWHAW object to HAW_deck.<br>
 1014+ @param udef Some user-defined object.
 1015+ @deprecated use HAW_deck::add_plugin() instead
 1016+ */
 1017+ function add_userdefined($udef)
 1018+ {
 1019+ $this->add_plugin($udef);
 1020+ }
 1021+
 1022+
 1023+ /**
9981024 Adds a HAW_banner object to HAW_deck. <br>
9991025 Note: Has no effect on WML/handheld pages.
10001026 @param banner Some HAW_banner object.
@@ -1403,20 +1429,39 @@
14041430
14051431
14061432 /**
1407 - Activates the device simulator on bigscreen browsers. <br>
1408 - Note: If no skin is specified, the HAWHAW default skin is used.
 1433+ Activates or deactivated the device simulator on bigscreen browsers. <br>
 1434+ Note: If no sim parameter is provided, the HAWHAW default skin is used.
14091435 HAWHAW output can be displayed in any kind of user-defined skin.
14101436 See <a href="http://skin.hawhaw.de/skin.css" target="_blank">
14111437 CSS file</a> of the HAWHAW default skin for more info.
1412 - @param skin URL of CSS file, where skin is defined (optional)
 1438+ @param sim HAW_SIM_NONE | HAW_SIM_CLASSIC | URL of CSS file, where skin is defined (optional)
14131439 */
1414 - function use_simulator($skin="http://skin.hawhaw.de/skin.css")
 1440+ function use_simulator($sim="http://skin.hawhaw.de/skin.css")
14151441 {
1416 - $this->use_simulator = true;
1417 - $this->skin = $skin;
 1442+ if ($sim === HAW_SIM_NONE)
 1443+ $this->use_simulator = HAW_SIM_NONE;
 1444+ else if ($sim === HAW_SIM_CLASSIC)
 1445+ $this->use_simulator = HAW_SIM_CLASSIC;
 1446+ else if (is_string($sim))
 1447+ {
 1448+ $this->use_simulator = HAW_SIM_SKIN;
 1449+ $this->skin = $sim;
 1450+ }
 1451+ else
 1452+ die("invalid argument in use_simulator()");
14181453 }
 1454+
14191455
 1456+ /**
 1457+ Defines whether links are shown within square brackets or not.
 1458+ @param flag true (default) | false
 1459+ */
 1460+ function use_link_brackets($flag)
 1461+ {
 1462+ $this->link_brackets = $flag;
 1463+ }
14201464
 1465+
14211466 /**
14221467 Sets deck-related text to be spoken by voice browsers. <br>
14231468 @param text Some introducing text that will be spoken before any other dialog or
@@ -1757,9 +1802,9 @@
17581803 $bodystyle = "text-align: center; ";
17591804 $css_style = "";
17601805
1761 - if ($this->pureHTML || $this->PDAstyle || $this->xhtml)
 1806+ if ($this->desktopBrowser || $this->PDAstyle || $this->xhtml)
17621807 {
1763 - if ($this->pureHTML)
 1808+ if ($this->desktopBrowser)
17641809 {
17651810 // big-screen browser
17661811
@@ -1849,7 +1894,7 @@
18501895
18511896 printf("<title>%s</title>\n", HAW_specchar($this->title, $this));
18521897
1853 - if ($this->pureHTML && $this->use_simulator && $this->css_enabled)
 1898+ if ($this->desktopBrowser && ($this->use_simulator == HAW_SIM_SKIN) && $this->css_enabled)
18541899 // use HAWHAW default- or user-defined skin
18551900 printf("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" $endtag\n", $this->skin);
18561901
@@ -1880,18 +1925,18 @@
18811926 }
18821927 }
18831928
1884 - if ($this->pureHTML)
 1929+ if ($this->desktopBrowser)
18851930 {
1886 - if ($this->css_enabled && $this->use_simulator)
 1931+ if ($this->css_enabled && ($this->use_simulator == HAW_SIM_SKIN))
18871932 {
1888 - // use simulator design
 1933+ // use skin design
18891934 echo "<div id=\"skin\">\n";
18901935 echo "<div id=\"display\">\n";
18911936 }
1892 - else
 1937+ else if ($this->use_simulator == HAW_SIM_CLASSIC)
18931938 {
18941939 // use classic HAWHAW design
1895 - printf("<div style=\"background-color: %s; background-image: url(%s); border: %dpx solid #aaa; padding: 8px; width: %s; height: %s; margin: 0px auto; overflow: auto;\">\n",
 1940+ printf("<div id=\"classic\" style=\"background-color: %s; background-image: url(%s); border: %dpx solid #aaa; padding: 8px; width: %s; height: %s; margin: 0px auto; overflow: auto;\">\n",
18961941 $this->disp_bgcolor, $this->disp_background, $this->border, $this->width, $this->height);
18971942 }
18981943 }
@@ -2134,9 +2179,9 @@
21352180 if ($this->ml == HAW_HTML)
21362181 {
21372182 if ($this->css_enabled)
2138 - printf("<div style=\"%s\">\n", $divstyle);
 2183+ printf("<div id=\"canvas\" style=\"%s\">\n", $divstyle);
21392184 else
2140 - printf("<div align=\"%s\">\n", $this->alignment);
 2185+ printf("<div id=\"canvas\" align=\"%s\">\n", $this->alignment);
21412186 }
21422187 elseif ($this->ml == HAW_WML)
21432188 printf("<p align=\"%s\">\n", $this->alignment);
@@ -2155,7 +2200,7 @@
21562201 case HAW_PHONE:
21572202 case HAW_LINKSET:
21582203 case HAW_RAW:
2159 - case HAW_USERDEFINED:
 2204+ case HAW_PLUGIN:
21602205 case HAW_RULE:
21612206 case HAW_VOICERECORDER:
21622207 {
@@ -2189,17 +2234,22 @@
21902235 if (!$this->css_enabled && $this->fontstyle_attrbs)
21912236 echo "</font>\n";
21922237
2193 - if ($this->pureHTML)
 2238+ if ($this->desktopBrowser)
21942239 {
2195 - if ($this->css_enabled && $this->use_simulator)
2196 - // terminate display div
 2240+ if ($this->css_enabled && ($this->use_simulator == HAW_SIM_SKIN))
 2241+ {
 2242+ // terminate display divs
21972243 echo "</div>\n";
 2244+ echo "</div>\n";
 2245+ }
 2246+
 2247+ if ($this->use_simulator == HAW_SIM_CLASSIC)
 2248+ echo "</div>\n"; // terminate classic div
21982249
2199 - echo "</div>\n"; // terminate skin/classic div
2200 -
22012250 if (!$this->lynx)
22022251 {
2203 - $default_text = "Powered by HAWHAW (C)";
 2252+ $signature = "";
 2253+ $default_text = "Powered by HAWHAW (C)";
22042254 if ($haw_license_holder && $haw_signature)
22052255 {
22062256 if ($haw_signature == 1)
@@ -2215,7 +2265,13 @@
22162266 $signature = sprintf("<a href=\"http://info.hawhaw.de/index.htm?host=%s\" target=\"_blank\"><small>%s</small></a>\n",
22172267 $this->waphome, $default_text);
22182268
2219 - echo $signature;
 2269+ if ($signature && ($this->use_simulator == HAW_SIM_NONE))
 2270+ {
 2271+ echo "<hr width=\"150px\"/>\n"; // seperate content from signature
 2272+ printf("<span style=\"font-size:8pt;\">%s</span>\n", $signature);
 2273+ }
 2274+ else
 2275+ echo $signature;
22202276 }
22212277 }
22222278
@@ -2369,8 +2425,6 @@
23702426 // let's be dotmobi compliant ...
23712427 $this->ml = HAW_HTML;
23722428 $this->xhtml = true;
2373 - $this->pureHTML = false;
2374 - $this->display_banners = false;
23752429 $this->gif_enabled = true;
23762430 $this->css_enabled = true;
23772431 }
@@ -2379,22 +2433,32 @@
23802434 }
23812435 }
23822436
 2437+ // guess some non-mobile browsers
 2438+ if (strstr($HTTP_USER_AGENT, "MSIE") || // can be WIN CE!
 2439+ strstr($HTTP_USER_AGENT, "Firefox") ||
 2440+ strstr($HTTP_USER_AGENT, "Macintosh") || // Safari desktop browser
 2441+ strstr($HTTP_USER_AGENT, "Iceweasel") ||
 2442+ strstr($HTTP_USER_AGENT, "Konqueror") ||
 2443+ strstr($HTTP_USER_AGENT, "Opera")) // can be Opera Mini!
 2444+ {
 2445+ $this->desktopBrowser = true;
 2446+ $this->display_banners = true;
 2447+ }
 2448+
23832449 if (strstr($acc_low, "vnd.wap.xhtml") ||
23842450 strstr($ua_low, "opera mini") ||
23852451 strstr($ua_low, "google wireless transcoder") ||
23862452 (strstr($ua_low, "symbianos") && strstr($acc_low, "xhtml+xml")) ||
2387 - strstr($HTTP_USER_AGENT, "(iPhone") ||
2388 - strstr($HTTP_USER_AGENT, "(iPod") ||
2389 - strstr($HTTP_USER_AGENT, "(Aspen Simulator") ||
 2453+ ($this->iPhoneAlike == true) ||
23902454 strstr($HTTP_USER_AGENT, "(Linux; U; Android") ||
23912455 strstr($HTTP_USER_AGENT, "Kindle/"))
23922456 {
23932457 // XHTML device detected
23942458 $this->xhtml = true;
2395 - $this->pureHTML = false;
2396 - $this->display_banners = false;
23972459 $this->gif_enabled = true;
23982460 $this->css_enabled = true;
 2461+ $this->desktopBrowser = false;
 2462+ $this->display_banners = false;
23992463 }
24002464 elseif ( strstr($ua_low, "avantgo") ||
24012465 strstr($ua_low, "reqwirelessweb") ||
@@ -2413,7 +2477,7 @@
24142478 {
24152479 // PDA browser detected (or poor old Netscape 4.7x which messes with CSS)
24162480 $this->PDAstyle = true;
2417 - $this->pureHTML = false;
 2481+ $this->desktopBrowser = false;
24182482 $this->display_banners = false;
24192483 }
24202484 elseif (strstr($ua_low, "docomo") ||
@@ -2422,23 +2486,21 @@
24232487 {
24242488 // i-mode browser detected
24252489 $this->iModestyle = true;
2426 - $this->pureHTML = false;
 2490+ $this->desktopBrowser = false;
24272491 $this->display_banners = false;
24282492 }
24292493 elseif (strstr($ua_low, "j-"))
24302494 {
24312495 // MML browser detected
24322496 $this->MMLstyle = true;
2433 - $this->pureHTML = false;
 2497+ $this->desktopBrowser = false;
24342498 $this->display_banners = false;
24352499 }
2436 - elseif (strstr($ua_low, "lynx"))
 2500+ elseif ($this->lynx == true)
24372501 {
2438 - // text browser detected
2439 - $this->lynx = true;
 2502+ // lynx text browser
24402503 $this->css_enabled = true; // enabled in the meaning of silently discarding it ...
2441 - $this->pureHTML = true;
2442 - $this->display_banners = false;
 2504+ $this->desktopBrowser = true;
24432505 $this->xhtmlmp_preferred_mime_type = "text/html";
24442506 }
24452507
@@ -2461,9 +2523,7 @@
24622524 $this->submitViaLink = true; // with some WAP devices it's quite difficult to submit WML forms
24632525
24642526 // set alternative mime-type for some XHTML Mobile Profile devices
2465 - if (strstr($HTTP_USER_AGENT, "(iPhone") ||
2466 - strstr($HTTP_USER_AGENT, "(iPod") ||
2467 - strstr($HTTP_USER_AGENT, "(Aspen Simulator"))
 2527+ if ($this->iPhoneAlike == true)
24682528 $this->xhtmlmp_preferred_mime_type = "text/html";
24692529 }
24702530
@@ -2486,7 +2546,7 @@
24872547 {
24882548 // wireless device
24892549
2490 - $this->pureHTML = false;
 2550+ $this->desktopBrowser = false;
24912551 $this->display_banners = false;
24922552
24932553 if ($cap['markup']['xhtml_support_level'] >= 1)
@@ -2549,7 +2609,7 @@
25502610 else
25512611 {
25522612 // Tera-WURFL was not able to identify device
2553 - $this->pureHTML = false;
 2613+ $this->desktopBrowser = false;
25542614 $this->display_banners = false;
25552615 $this->ml = HAW_HTML;
25562616 $this->xhtml = true;
@@ -2802,22 +2862,33 @@
28032863
28042864
28052865 /**
2806 - Adds some user-defined HAWHAW object to HAW_form
2807 - @param udef Some user-defined object.
2808 - @see HAW_deck::add_userdefined()
 2866+ Adds some HAWHAW plugin object to HAW_form
 2867+ @param plugin Some user-defined plugin object.
 2868+ @see HAW_deck::add_plugin()
28092869 */
2810 - function add_userdefined($udef)
 2870+ function add_plugin($plugin)
28112871 {
2812 - if (!is_object($udef))
2813 - die("invalid argument in add_userdefined()");
 2872+ if (!is_object($plugin))
 2873+ die("invalid argument in add_plugin()");
28142874
2815 - $this->element[$this->number_of_elements] = $udef;
 2875+ $this->element[$this->number_of_elements] = $plugin;
28162876
28172877 $this->number_of_elements++;
28182878 }
28192879
28202880
28212881 /**
 2882+ Adds some user-defined HAWHAW object to HAW_form
 2883+ @param udef Some user-defined object.
 2884+ @deprecated use HAW_form::add_plugin() instead
 2885+ */
 2886+ function add_userdefined($udef)
 2887+ {
 2888+ $this->add_plugin($udef);
 2889+ }
 2890+
 2891+
 2892+ /**
28222893 Adds a HAW_rule object to HAW_form.
28232894 @param rule Some HAW_rule object.
28242895 @see HAW_rule
@@ -2940,7 +3011,7 @@
29413012 printf("<form action=\"%s\"%s>\n", $this->url, $method);
29423013
29433014 if ($deck->xhtml)
2944 - echo "<div>\n"; // needed for validation
 3015+ echo "<div id=\"hawform\">\n"; // needed for validation
29453016 }
29463017 // not necessary in WML, HDML and VoiceXML!
29473018
@@ -2976,7 +3047,7 @@
29773048 case HAW_HIDDEN:
29783049 case HAW_RAW:
29793050 case HAW_RULE:
2980 - case HAW_USERDEFINED:
 3051+ case HAW_PLUGIN:
29813052 {
29823053 $form_element->create($deck);
29833054 break;
@@ -3148,7 +3219,8 @@
31493220 {
31503221 // HDML
31513222
3152 - $deck->hdmlcardset->add_display_content("<" . $deck->alignment . ">\n");
 3223+ if ($deck->alignment != "left")
 3224+ $deck->hdmlcardset->add_display_content("<" . $deck->alignment . ">\n");
31533225
31543226 // print text
31553227 if ($this->text)
@@ -3183,14 +3255,15 @@
31843256 $this->boxcolor = "#000000"; // default: on black background
31853257
31863258 if ($deck->css_enabled)
3187 - printf("<div style=\"background-color:%s; margin:0px;\">\n", $this->boxcolor);
 3259+ printf("<div id=\"hawtextbox\" style=\"background-color:%s; margin:0px;\">\n",
 3260+ $this->boxcolor);
31883261 else
31893262 {
31903263 printf("<table border=\"0\" bgcolor=\"%s\" width=\"100%%\"><tr><td><font%s>\n",
31913264 $this->boxcolor, $deck->fontstyle_attrbs);
31923265
31933266 // align text in (table-)box
3194 - printf("<div align=\"%s\">\n", $deck->alignment);
 3267+ printf("<div id=\"hawtextbox\" align=\"%s\">\n", $deck->alignment);
31953268 }
31963269
31973270 // decrement line breaks because div/table already causes 1 br
@@ -3480,7 +3553,8 @@
34813554 {
34823555 // HDML
34833556
3484 - $deck->hdmlcardset->add_display_content("<" . $deck->alignment . ">\n");
 3557+ if ($deck->alignment != "left")
 3558+ $deck->hdmlcardset->add_display_content("<" . $deck->alignment . ">\n");
34853559
34863560 if ($this->localsrc)
34873561 $icon = sprintf(" icon=\"%s\"", $this->localsrc);
@@ -3527,9 +3601,14 @@
35283602 else
35293603 {
35303604 // use HTML bitmap
 3605+
 3606+ if ($deck->css_enabled)
 3607+ $style = " style=\"vertical-align:middle; border-style:none\"";
 3608+ else
 3609+ $style = " align=\"middle\" border=\"0\"";
35313610
3532 - printf("<img src=\"%s\" alt=\"%s\"%s />\n",
3533 - $this->src_html, HAW_specchar($this->alt, $deck), $size);
 3611+ printf("<img src=\"%s\" alt=\"%s\"%s%s />",
 3612+ $this->src_html, HAW_specchar($this->alt, $deck), $size, $style);
35343613 }
35353614
35363615 // evaluate HTML break instruction
@@ -4175,7 +4254,7 @@
41764255 }
41774256
41784257 // create HTML input
4179 - if ($deck->xhtml || $deck->pureHTML)
 4258+ if ($deck->xhtml || $deck->desktopBrowser)
41804259 {
41814260 printf("<label for=\"%s\">%s</label>\n",
41824261 $this->name, HAW_specchar($this->label, $deck));
@@ -4208,7 +4287,8 @@
42094288 if ($this->type == HAW_INPUT_PASSWORD)
42104289 $options .= " NOECHO=\"true\"";
42114290
4212 - $display_content = "<" . $deck->alignment . ">\n";
 4291+ if ($deck->alignment != "left")
 4292+ $display_content = "<" . $deck->alignment . ">\n";
42134293
42144294 $display_content .= HAW_specchar($this->label, $deck);
42154295 $display_content .= "\n";
@@ -4410,7 +4490,8 @@
44114491
44124492 $options = " key=\"$this->name\"";
44134493
4414 - $display_content = "<" . $deck->alignment . ">\n";
 4494+ if ($deck->alignment != "left")
 4495+ $display_content = "<" . $deck->alignment . ">\n";
44154496
44164497 $display_content .= HAW_specchar($this->label, $deck);
44174498 $display_content .= "\n";
@@ -4470,7 +4551,7 @@
44714552 {
44724553 $this->name = $name;
44734554 $this->type = $type;
4474 - $this->value = false;
 4555+ $this->value = "";
44754556 $this->number_of_options = 0;
44764557 $this->voice_text = HAW_VOICE_ENUMERATE;
44774558 $this->voice_audio_src = "";
@@ -4494,7 +4575,8 @@
44954576
44964577 $this->options[$this->number_of_options]["label"] = $label;
44974578 $this->options[$this->number_of_options]["value"] = $value;
4498 -
 4579+ $this->options[$this->number_of_options]["is_selected"] = $is_selected;
 4580+
44994581 if ((strlen($this->value) == 0) || ($is_selected == HAW_SELECTED))
45004582 $this->value = $value;
45014583
@@ -4590,7 +4672,7 @@
45914673 {
45924674 // create HTML select
45934675
4594 - if ($deck->xhtml || $deck->pureHTML)
 4676+ if ($deck->xhtml || $deck->desktopBrowser)
45954677 {
45964678 // dummy label for select element (needed for Bobby approval)
45974679 // object to be enhanced in future versions ...
@@ -4602,7 +4684,7 @@
46034685
46044686 for ($i=0; $i < $this->number_of_options; $i++)
46054687 {
4606 - if ($this->options[$i]["value"] == $this->value)
 4688+ if ($this->options[$i]["is_selected"] == HAW_SELECTED)
46074689 $state = " selected=\"selected\"";
46084690 else
46094691 $state = "";
@@ -4765,7 +4847,8 @@
47664848
47674849 $this->buttons[$this->number_of_buttons]["label"] = $label;
47684850 $this->buttons[$this->number_of_buttons]["value"] = $value;
4769 -
 4851+ $this->buttons[$this->number_of_buttons]["is_checked"] = $is_checked;
 4852+
47704853 if ((strlen($this->value) == 0) || ($is_checked == HAW_CHECKED))
47714854 $this->value = $value;
47724855
@@ -4863,12 +4946,12 @@
48644947
48654948 while (list($key, $val) = each($this->buttons))
48664949 {
4867 - if ($val["value"] == $this->value)
 4950+ if ($val["is_checked"] == HAW_CHECKED)
48684951 $state = "checked=\"checked\"";
48694952 else
48704953 $state = "";
48714954
4872 - if ($deck->xhtml || $deck->pureHTML)
 4955+ if ($deck->xhtml || $deck->desktopBrowser)
48734956 {
48744957 printf("<input type=\"radio\" name=\"%s\" id=\"%s\" %s value=\"%s\" />",
48754958 $this->name, $this->name . $key, $state, $val["value"]);
@@ -5120,7 +5203,7 @@
51215204
51225205 $state = ($this->is_checked() ? "checked=\"checked\"" : "");
51235206
5124 - if ($deck->xhtml || $deck->pureHTML)
 5207+ if ($deck->xhtml || $deck->desktopBrowser)
51255208 {
51265209 printf("<input type=\"checkbox\" name=\"%s\" id=\"%s\" %s value=\"%s\" />",
51275210 $this->name, $this->name, $state, $this->value);
@@ -5467,6 +5550,7 @@
54685551 var $title;
54695552 var $accesskey; // "1", "2", ... "0", "*", "#"
54705553 var $css_class;
 5554+ var $image;
54715555 var $br;
54725556 var $voice_text;
54735557 var $voice_audio_src;
@@ -5490,6 +5574,7 @@
54915575 $this->accesskey = HAW_NO_ACCESSKEY; // no accesskey assigned
54925576 // can be assigned later e.g. from HAW_linkset object if required
54935577 $this->css_class = "";
 5578+ $this->image = false;
54945579 $this->br = 1; // default: 1 line break after text
54955580 $this->voice_text = $label;
54965581 $this->voice_audio_src = "";
@@ -5498,6 +5583,16 @@
54995584 }
55005585
55015586 /**
 5587+ Adds an image that is to be displayed on the left side of the link.
 5588+ @param image HAW_image object that contains the image/icon
 5589+ @see HAW_image
 5590+ */
 5591+ function add_image($image)
 5592+ {
 5593+ $this->image = $image;
 5594+ }
 5595+
 5596+ /**
55025597 Sets a css class for this object in a (X)HTML page.
55035598 @param css_class CSS class to be defined in the deck's central CSS file
55045599 */
@@ -5619,7 +5714,7 @@
56205715
56215716 $title_option = "";
56225717
5623 - if ($this->title && ($deck->xhtml || $deck->lynx || $deck->pureHTML))
 5718+ if ($this->title && ($deck->xhtml || $deck->lynx || $deck->desktopBrowser))
56245719 $title_option = sprintf(" title=\"%s\"", HAW_specchar($this->title, $deck));
56255720
56265721 $accesskey_option = "";
@@ -5641,10 +5736,23 @@
56425737 printf("<span class=\"%s\">\n", $this->css_class);
56435738 }
56445739
5645 - printf("[<a href=\"%s\"%s%s>%s</a>]%s\n",
5646 - HAW_specchar($this->url, $deck), $title_option, $accesskey_option,
5647 - HAW_specchar($this->label, $deck), $br);
 5740+ if ($deck->link_brackets == true)
 5741+ echo "[";
 5742+
 5743+ printf("<a href=\"%s\"%s%s>",
 5744+ HAW_specchar($this->url, $deck), $title_option, $accesskey_option);
56485745
 5746+ if (is_object($this->image))
 5747+ // image available for this link, let it create itself
 5748+ $this->image->create($deck);
 5749+
 5750+ printf("%s</a>", HAW_specchar($this->label, $deck));
 5751+
 5752+ if ($deck->link_brackets == true)
 5753+ echo "]";
 5754+
 5755+ printf("%s\n", $br);
 5756+
56495757 if ($deck->css_enabled && $this->css_class)
56505758 {
56515759 echo "</span>\n";
@@ -5666,9 +5774,13 @@
56675775 for ($i=0; $i < $this->br; $i++)
56685776 $br .= "<br/>";
56695777
5670 - printf("<a%s href=\"%s\">%s</a>%s\n",
5671 - $title_option, HAW_specchar($this->url, $deck),
5672 - HAW_specchar($this->label, $deck), $br);
 5778+ printf("<a%s href=\"%s\">", $title_option, HAW_specchar($this->url, $deck));
 5779+
 5780+ if (is_object($this->image))
 5781+ // image available for this link, let it create itself
 5782+ $this->image->create($deck);
 5783+
 5784+ printf("%s</a>%s\n", HAW_specchar($this->label, $deck), $br);
56735785 }
56745786
56755787 elseif ($deck->ml == HAW_HDML)
@@ -5690,6 +5802,10 @@
56915803 $br = "";
56925804 for ($i=0; $i < $this->br; $i++)
56935805 $br .= "<br>";
 5806+
 5807+ if (is_object($this->image) && (strlen($this->label) == 0))
 5808+ // workaround for (non-displayable) images and non-existing labels
 5809+ $this->label = $this->image->alt;
56945810
56955811 $content = sprintf("<a task=\"go\" dest=\"%s\"%s%s>%s</a>%s\n",
56965812 HAW_specchar($this->url, $deck),
@@ -5782,6 +5898,7 @@
57835899 var $isPOTS; // Plain Old Telephony System
57845900 var $title;
57855901 var $accesskey; // "1", "2", ... "0", "*", "#"
 5902+ var $image;
57865903 var $br;
57875904 var $voice_text;
57885905 var $voice_audio_src;
@@ -5812,6 +5929,7 @@
58135930
58145931 $this->title = $title;
58155932 $this->accesskey = HAW_NO_ACCESSKEY;
 5933+ $this->image = false;
58165934 $this->br = 1; // default: 1 line break
58175935 $this->voice_text = $destination;
58185936 $this->voice_audio_src = "";
@@ -5820,6 +5938,16 @@
58215939 }
58225940
58235941 /**
 5942+ Adds an image that is to be displayed on the left side of the phone link.
 5943+ @param image HAW_image object that contains the image/icon
 5944+ @see HAW_image
 5945+ */
 5946+ function add_image($image)
 5947+ {
 5948+ $this->image = $image;
 5949+ }
 5950+
 5951+ /**
58245952 Sets the number of line breaks (CRLF) after phone link. (default: 1)
58255953 @param br Some number of line breaks.
58265954 */
@@ -5908,13 +6036,13 @@
59096037 else
59106038 $dest = $this->destination;
59116039 }
5912 - elseif ($deck->MMLstyle) {
 6040+ elseif ($deck->MMLstyle || $deck->iPhoneAlike) {
59136041 if ($this->isPOTS)
59146042 $dest = "tel:" . $this->destination;
59156043 else
59166044 $dest = $this->destination;
59176045 }
5918 - elseif ($deck->pureHTML) {
 6046+ elseif ($deck->desktopBrowser) {
59196047 if ($this->isPOTS)
59206048 $dest = "callto:" . $this->destination;
59216049 else
@@ -5929,8 +6057,22 @@
59306058 $dest = $this->destination;
59316059 }
59326060
5933 - printf("[<a href=\"%s\"%s>%s</a>]%s\n",
5934 - $dest, $title_option, HAW_specchar($this->label, $deck), $br);
 6061+ if ($deck->link_brackets == true)
 6062+ echo "[";
 6063+
 6064+ printf("<a href=\"%s\"%s>", $dest, $title_option);
 6065+
 6066+ if (is_object($this->image))
 6067+ // image available for this link, let it create itself
 6068+ $this->image->create($deck);
 6069+
 6070+ printf("%s</a>", HAW_specchar($this->label, $deck));
 6071+
 6072+ if ($deck->link_brackets == true)
 6073+ echo "]";
 6074+
 6075+ printf("%s\n", $br);
 6076+
59356077 }
59366078 elseif ($deck->ml == HAW_WML)
59376079 {
@@ -5951,8 +6093,13 @@
59526094 else
59536095 $dest = $this->destination;
59546096
5955 - printf("<a href=\"%s\"%s>%s</a>%s\n", $dest, $title_option,
5956 - HAW_specchar($this->label, $deck), $br);
 6097+ printf("<a href=\"%s\"%s>", $dest, $title_option);
 6098+
 6099+ if (is_object($this->image))
 6100+ // image available for this link, let it create itself
 6101+ $this->image->create($deck);
 6102+
 6103+ printf("%s</a>%s\n", HAW_specchar($this->label, $deck), $br);
59576104 }
59586105 elseif ($deck->ml == HAW_HDML)
59596106 {
@@ -6179,7 +6326,7 @@
61806327 {
61816328 // create links inside a frame
61826329
6183 - echo "<div style=\"padding: 5px;\">\n";
 6330+ echo "<div id=\"hawlinkset\" style=\"padding: 5px;\">\n";
61846331
61856332 if ($deck->lynx)
61866333 {
@@ -6282,7 +6429,7 @@
62836430 $pageContent = new HAW_text("Here comes some content ...");
62846431 $myPage->add_text($pageContent);
62856432 $myHtmlCode = "<p>Here comes an adblock for html devices ...</p>";
6286 - $myAdBlock = new HAW_raw(HAW_HTML, $myHtmlCode);
 6433+ $myAdblock = new HAW_raw(HAW_HTML, $myHtmlCode);
62876434 $myPage->add_raw($myAdblock);
62886435 $myPage->create_page();
62896436 </pre>
@@ -6478,7 +6625,8 @@
64796626 // HDML devices doesn't understand <hr>
64806627 // ==> draw some number of hyphens to create a rule
64816628
6482 - $deck->hdmlcardset->add_display_content("<" . $deck->alignment . ">\n");
 6629+ if ($deck->alignment != "left")
 6630+ $deck->hdmlcardset->add_display_content("<" . $deck->alignment . ">\n");
64836631
64846632 $deck->hdmlcardset->add_display_content("----------\n<br>\n");
64856633 }
Index: trunk/wap/hawpedia.php
@@ -31,7 +31,7 @@
3232 $deck->set_width(HAWIKI_DISP_WIDTH);
3333 $deck->set_height(HAWIKI_DISP_HEIGHT);
3434 $deck->set_disp_bgcolor(HAWIKI_DISP_BGCOLOR);
35 -// $deck->use_simulator(HAWIKI_SKIN);
 35+ $deck->use_simulator(HAWIKI_SKIN);
3636 }
3737
3838 function hawpedia_error($error_msg)
Index: trunk/wap/transcode.php
@@ -55,6 +55,7 @@
5656 $wikitext = remove_controls($wikitext);
5757
5858 // replace html entities
 59+$wikitext = str_replace("&nbsp;", " ", $wikitext); // shows '?' on Safari/iPhone
5960 // throws warning PHP4: http://bugs.php.net/bug.php?id=25670
6061 $wikitext = @html_entity_decode($wikitext, ENT_QUOTES, 'UTF-8');
6162
Index: trunk/wap/hawiki/hawiki_cfg.inc
@@ -12,6 +12,6 @@
1313 define("HAWIKI_DATETIME_SHORT", "d/m/Y [H:i]"); // for modifications see PHP function date()
1414 define("HAWIKI_DATETIME_LONG", "l, F jS Y, g:i A");
1515 define("HAWIKI_EXTLINK_ICON", "images/external_link"); // must exist as .gif and .wbmp version
16 -define("HAWIKI_SKIN", "hawhaw/skin/hawpedia_phone/skin.css"); // comment out to disable skin
 16+define("HAWIKI_SKIN", HAW_SIM_NONE); // do NOT use any simulator
1717
1818 ?>
Index: trunk/wap/hawiki/hawiki.inc
@@ -140,8 +140,8 @@
141141 $this->deck->set_height(HAWIKI_DISP_HEIGHT);
142142 $this->deck->set_disp_bgcolor(HAWIKI_DISP_BGCOLOR);
143143
144 - //if (defined('HAWIKI_SKIN'))
145 - // $this->deck->use_simulator(HAWIKI_SKIN);
 144+ if (defined('HAWIKI_SKIN'))
 145+ $this->deck->use_simulator(HAWIKI_SKIN);
146146
147147 if (isset($lang) && (strlen($lang) == 2))
148148 {

Status & tagging log