[Commits] r2499 - sandbox/cmoullet/ux/Mobile/app

commits at geoext.org commits at geoext.org
Sun Nov 28 05:59:40 CET 2010


Author: cmoullet
Date: 2010-11-28 05:59:40 +0100 (Sun, 28 Nov 2010)
New Revision: 2499

Modified:
   sandbox/cmoullet/ux/Mobile/app/index.html
   sandbox/cmoullet/ux/Mobile/app/init.js
Log:
Use the Mobile UX

Modified: sandbox/cmoullet/ux/Mobile/app/index.html
===================================================================
--- sandbox/cmoullet/ux/Mobile/app/index.html	2010-11-28 04:59:23 UTC (rev 2498)
+++ sandbox/cmoullet/ux/Mobile/app/index.html	2010-11-28 04:59:40 UTC (rev 2499)
@@ -5,6 +5,7 @@
     <title>Mobile Map Prototype</title>
     <link rel="stylesheet" href="../sencha-touch/resources/css/sencha-touch.css" type="text/css">
     <script type="text/javascript" src="../sencha-touch/sencha-touch.js"></script>
+    <script type="text/javascript" src="../ux/SwissSearchMobile/lib/GeoAdminMobile.ux/SwissSearchMobile.js"></script>
     <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
     <script type="text/javascript" src="init.js"></script>
 </head>

Modified: sandbox/cmoullet/ux/Mobile/app/init.js
===================================================================
--- sandbox/cmoullet/ux/Mobile/app/init.js	2010-11-28 04:59:23 UTC (rev 2498)
+++ sandbox/cmoullet/ux/Mobile/app/init.js	2010-11-28 04:59:40 UTC (rev 2499)
@@ -4,78 +4,9 @@
     phoneStartupScreen: 'phone_startup.png',
     glossOnIcon: false,
     onReady: function() {
-        var popup;
-        var searchField = Ext.create({
-            xtype : 'searchfield',
-            name  : 'swisssearch',
-            placeHolder: 'Search...',
-            listeners : {
-                keyup: function(field, e) {
-                    var key = e.browserEvent.keyCode;
-                    if (key === 13 || key === 10) {
-                        field.blur();
-                        Ext.util.JSONP.request({
-                            url: 'http://api.geo.admin.ch/swisssearch?lang=fr&query=lausanne&cb=Ext.util.JSONP.callback',
-                            callbackKey: 'cb',
-                            params: {
-                                lang: 'de',
-                                query: field.fieldEl.dom.value,
-                                cb: 'Ext.util.JSONP.callback'
-                            },
-                            callback: function(result) {
-                                Ext.regModel('swisssearch', {
-                                    fields: [
-                                        {
-                                            name: 'label',
-                                            type: 'string'
-                                        }
-                                    ]
-                                });
-                                if (result.results[0]) {
-                                    var store = new Ext.data.Store({
-                                        model: 'swisssearch',
-                                        data: result.results
-                                    });
 
-                                    var list = new Ext.List({
-                                        itemTpl : '{label}',
-                                        store: store,
-                                        listeners: {
-                                            selectionchange: function(selectionModel, records) {
-                                                alert('Not implemented: map recenter to: ' + records[0].data.bbox);
-                                                popup.hide();
-                                            }
-                                        }
-                                    });
-
-                                    if (popup) {
-                                        delete this.popup;
-                                    }
-                                    popup = new Ext.Panel({
-                                        floating: true,
-                                        modal: true,
-                                        centered: true,
-                                        width: 250,
-                                        height: 250,
-                                        scroll: 'both',
-                                        dockedItems: [
-                                            {
-                                                dock : 'top',
-                                                xtype: 'toolbar',
-                                                title: 'Search results'
-                                            }
-                                        ],
-                                        items: [
-                                            list
-                                        ]});
-                                    popup.show();
-                                }
-                            }
-                        });
-                    }
-                },
-                scope : this
-            }
+        var searchField = new GeoAdminMobile.ux.SwissSearchMobile({
+            map: null
         });
 
         var trackingButton = Ext.create({
@@ -118,7 +49,7 @@
                 iconMask: true
             },
             items : [
-                    layerManagerButton
+                layerManagerButton
             ]
         });
 



More information about the Commits mailing list