Development
Dive into DataView with Sencha Touch 2 Beta 2
Today we’re releasing Sencha Touch 2 beta 2, which contains around 100 enhancements, examples, and bug fixes based on your feedback from last week’s beta 1. We’ve been really energized by all your positive feedback on beta 1 and would like to reiterate our appreciation for the time and energy you put in to creating apps, reporting bugs and sharing your experiences with others.
Beta 2 should be a drop-in replacement for beta 1, and as before, we have prepared a full set of release notes. We hope you’ll continue to let us know what you think of the release in the comments, twitter and your own blogs.
Download Sencha Touch 2 Beta 2 View Release Notes
Great Progress on ICS IssuesLast week we asked for your help in raising awareness of a critical performance issue with Android 4/Ice Cream Sandwich. Thanks to your participation the bug report has been starred over 250 times and last week yielded a patch from the Android team that addresses the flashing that can happen before animations.
While that’s great news, it’s only half the story so we’d like to ask for your help one more time. While the flashing is gone, we feel that Android 4 is still not performing as well as it should when it comes to animations so if you’re in favor of better animation performance on Android 4, we’d like to ask you to take a moment to click the star on this bug report to let the Android team know how much this matters to everyone building HTML5 applications.
DataView ImprovementsDataView is a powerful Component that enables you to render an HTML template for each record in a Store. While that’s very useful, Sencha Touch 2 raises the bar by allowing you to render entire Components for each record. This enables a wealth of new UI options and we’d like to take the rest of this post to walk you through what’s improved.
Component DataViewThe Sencha Touch 2 DataView offers two ways to render items from a Store: element based and component based. In 1.x only the element-based approach was available, which made it difficult to do things like add a Button to each item in a List.
Turning your element-based DataView into a component-based one is straightforward. With a template based DataView, you normally specify a store and itemTpl configuration, but with a component based DataView, you do not need to specify an itemTpl. Instead, you set the useComponents configuration to true. This tells DataView that it will be rendering components.
Next we have to tell it which types of components it will be rendering. To do this, we set a defaultType for our DataView. This tells the DataView which type of Component to create for each record.
In the example below, we’re creating a fullscreen component-based DataView that uses the kittenslistitem type to create each item (we’ll create this kittenslistitem Component in a moment). We’re also passing in a Store full of kittens. DataView will render one kittenslistitem for each kitten:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; } Ext.create('Ext.DataView', { fullscreen: true, useComponents: true, defaultType: 'kittenslistitem', store: { fields: [ "name", "image", { name: "cuteness", type: 'int' } ], data: [ { name: 'Yawning kitten', image: 'data/images/kitten1.jpg', cuteness: 70 }, { name: 'Sitting kitten', image: 'data/images/kitten2.jpg', cuteness: 90 }, { name: 'Evil kitten', image: 'data/images/kitten3.jpg', cuteness: 70 }, { name: 'Ginger kitten', image: 'data/images/kitten4.jpg', cuteness: 80 }, { name: 'Kitten friends', image: 'data/images/kitten5.jpg', cuteness: 20 }, { name: 'Milk kitten', image: 'data/images/kitten6.jpg', cuteness: 50 } ] } }); Custom DataView ItemNow we have a component DataView and we’ve told it to use a component with an xtype of kittenslistitem. That hasn’t been defined yet; so let’s do that now.
It is important to note that this DataView item must extend Ext.dataview.component.DataItem. This is because this object includes important functionality to bind a specified record to the component.
Our custom DataView item will include three items:
- Ext.Img — displays an image of the kitten
- Ext.Component — displays the name of the kitten.
- Ext.slider.Slider — shows a slider component will the cuteness of the kitten.
Each of these components will be defined as a configuration in our KittenListItem class. Once the class is instantiated for each record, the configurations will be added into the item. This looks like the following:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; } Ext.define('KittensListItem', { extend: 'Ext.dataview.component.DataItem', xtype: 'kittenslistitem',</p> config: { image: true, name: { cls: 'x-name', flex: 1 }, slider: { flex: 2 }, layout: { type: 'hbox', align: 'center' } } });
Let’s start from the top:
- Define the KittensListItem which we will use in our component DataView
- Extend Ext.dataview.component.DataItem
- Inside the config object, add a new config called image and set it to true (this will be transformed into a Ext.Img component)
- Create another config called name. This is an object containing a cls and a flex property of 1 (this will be transformed into an Ext.Component component)
- Create another config called slider which has a default flex of 2 (this will be transformed into a Ext.slider.Slider)
- And finally give it a HBox layout and vertically align the items in the center.
For each new configuration we create, we need to create the appropriate apply and update methods so they get transformed into the correct component, and inserted into this item. Lets do this for the image configuration:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; } applyImage: function(config) { return Ext.factory(config, Ext.Img, this.getImage()); }, updateImage: function(newImage, oldImage) { if (newImage) { this.add(newImage); } if (oldImage) { this.remove(oldImage); } }First, we define the applyImage which is called when this component is initialized and each time the image configuration is changed. In the method, we use Ext.factory to transform the configuration into a Ext.Img component. We then define the updateImage method which is called after applyImage. This method gets called with two arguments: the new image, and the old image (if one existed before). In this method we simply check if newImage exists and add it to this component Data Item, and the same for the oldImage, except in this case we’re removing it.
We then repeat this process for the other two configurations: name and slider.
If you want to learn more about how the Class System works, there is a great guide written by Jacky Nguyen in the Sencha Touch 2 Documentation.
Mapping the Record to the DataItemNow we have the component data item created which will be used in our DataView. The three new configurations we created are automatically transformed into components and added into the item. The next step is configuring the map between the record and the item displayed in the list. Remember we have three fields we need to map:
- name -> html config of the name component
- image -> src config of the image component
- cuteness -> value config of the slider component
To do this, we use the dataMap configuration in our DataItem. This configuration allows us to map a setter of a configuration in our DataItem to a field in the record bound to our DataItem. Lets look at an example:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; } config: { … dataMap: { getImage: { setSrc: 'image' } } }Once this DataItem is added into DataView and the record is updated, this will essentially do this:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; } this.getImage().setSrc(record.get('image'));As you can see, it is using the getter for our new image config, then calling the src setter on the Ext.Img component with the image field of our record.
We now repeat this process for the name and cuteness fields, so the appropriate components are updated. And the final dataMap is:
/** * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) */ .javascript .imp {font-weight: bold; color: red;} .javascript .kw1 {color: #000066; font-weight: bold;} .javascript .kw2 {color: #003366; font-weight: bold;} .javascript .kw3 {color: #000066;} .javascript .co1 {color: #006600; font-style: italic;} .javascript .co2 {color: #009966; font-style: italic;} .javascript .coMULTI {color: #006600; font-style: italic;} .javascript .es0 {color: #000099; font-weight: bold;} .javascript .br0 {color: #009900;} .javascript .sy0 {color: #339933;} .javascript .st0 {color: #3366CC;} .javascript .nu0 {color: #CC0000;} .javascript .me1 {color: #660066;} .javascript span.xtra { display:block; } config: { … dataMap: { getImage: { setSrc: 'image' }, getName: { setHtml: 'name' }, getSlider: { setValue: 'cuteness' } } }Now that the DataItem is mapped to the record, we can load up our example in a browser. And when we add some CSS sparkle, the demo will look a little like this:
View the ultra-cute kittens DataView example ConclusionYou can view a live demo of this example on Sencha Labs and the full source code (with lots of comments!) over on GitHub.
The enhanced DataView in Sencha Touch 2 Beta 2 makes it easy to build complex data bound lists. If you have issues or find bugs with the beta, feel free to drop by our forums and let us know. We’re actively hunting down and fixing bugs, so let us know if there are things you’re expecting to work that just aren’t.
.right, .alignright { float: right; margin: 0 0 10px 10px; } .left, .alignleft { float: left; margin: 0 10px 10px 0; }Flex to Sencha: The Opportunity
In my professional career I have never witnessed a disruptive shift as large as the adoption of HTML5 as an application medium. Within this movement, Sencha is focused on building enterprise-grade frameworks, tools, and services to allow developers to deliver HTML5 applications on today’s mobile and desktop browser runtimes. Today Sencha is launching a fast-track program for Flex Developers looking to develop HTML5 applications.
Having worked on Flex at Adobe, I have a deep respect for Flex as a technology and ecosystem. Flex is great technology but the foundational dependency on Flash Player is forcing many projects to re-architect towards HTML5. Within this disruption, I believe there is a great opportunity for Flex developers to learn a new technology, leverage existing knowledge, and deliver great application experiences with Sencha. I also believe that Flex developers have the opportunity to define and lead the movement toward HTML5 applications as they bring years of experience building world class applications with components, classes, MVC, and a futuristic version of ECMAScript.
The developer paradigms of Sencha and Flex are very similar and developers who know Flex will learn Sencha frameworks quickly and find their existing knowledge of component development instantly valuable. While the syntax and architecture are different, I keep finding patterns and concepts that match Flex perfectly but are suited to the interpreted model of web development and deployment. Within Sencha frameworks, Flex developers will find a modern class system with package support, a rich set of UI components, model classes for loading data, declarative component instantiation (xtype), and MVC integrated into the framework.
Today Sencha is launching a fast-track program for Flex Developers looking to develop HTML5 applications. We begin with a Flex to Sencha Webinar on Tuesday, February 14, and will continue with a Flex to Sencha Road Show meeting with Flex user groups and Flex/Flash conferences throughout the year. We are also working on technology additions to Sencha frameworks including AMF and SOAP WebService support direct from JavaScript. For those that prefer visual tools, I also want to highlight the upcoming Sencha Designer 2 which helps you build both desktop and mobile applications visually.
Flex to Sencha Events:
I look forward to highlighting Sencha’s object-oriented and component based solution to building HTML5 applications to the Flex ecosystem. Having built many applications myself with Flex, I know that you can be successful building HTML5 applications with Sencha.
.right, .alignright { float: right; margin: 0 0 10px 10px; } .left, .alignleft { float: left; margin: 0 10px 10px 0; }First Look at Sencha Designer 2
Sencha Designer 2 beta is the latest version of our visual drag-and-drop tool for building JavaScript-based applications. Designer 2 supports both the Ext JS and Touch frameworks, so you can use the tool to build applications for either desktop or mobile operating systems. For a more in-depth look at Sencha Designer 2, please see our Introduction and Guided Tour included in the Designer documentation.
Building a Sencha Touch Mobile App using Sencha Designer 2This tutorial is delivered in both video and written form. You may find it easier to follow one or the other, or use both in unison. Continue on to the bottom of this post to see the full video walkthrough.
The application we’ll be building is called CityBars, a Sencha Touch app for mobile devices which makes use of the Yelp API to find nearby watering holes. I’ve tried to add some color to the video and to introduce you to Sencha Designer 2 in much the same way I’d help any developer new to Designer.
A Sencha Touch example app called CityBars, which uses the Yelp API to find nearby watering holes.
To follow along with the project you’ll need a copy of Sencha Designer 2 beta; and a Yelp developer API key. Note: Your API key will be capped at about 150 calls per day. If everything stops working this might be why.
You’ll also need to follow the step-by-step guide along with the CityBars project file. (The CityBars project is also available as Github repository, though this is simply the Sencha Touch mobile app, and not the Sencha Designer project.)
Watch the Video Building the CityBars Sencha Touch application with Sencha Designer 2 (1 hour and 1 minute)Watch this video on Vimeo.com
If you hit any road bumps, head over to the Sencha Designer 2 Help & Discussion forum to ask questions and get some assistance!
.right, .alignright { float: right; margin: 0 0 10px 10px; } .left, .alignleft { float: left; margin: 0 10px 10px 0; }Taxonomy Term Reference Filter by Views
Add a Filter by Views Setting for a Taxonomy Term Reference Field Instance.
Project Information
Maintenance status: Actively maintained
Development status: Under active development
Module categories: Fields, Taxonomy, Views
Last modified: February 6,...
Feeds URL Fetcher
A Feeds plugin that will fetch files from an any URL supported by PHP.
Project Information
Maintenance status: Actively maintained
Development status: Under active development
Module categories: Import/Export
Last modified: February 6, 2012
MO Auto-Add Terms
This module is used to automatically assign terms to a node. The module searches for the terms in the node and assigns them as it finds them.
For more information please check out the MO Auto add terms page.
We now offer this module here so maybe someone will come in and make it work with Drupal 7...
Demo
I...
dynatree
This module implements http://code.google.com/p/dynatree/ to create treemenus.
Dependencies
http://drupal.org/project/libraries
Install
Download the libraray into sites/all/libraries/dynatree. So the jquery.dynatree is reachable by sites/all/libraries/dynatree/src/jquery.dynatree.js
DOWNLOAD: http://code.google.com/p/dynatree/downloads/list
jstree...
Commerce Emporiki Bank
Adds a payment method to Drupal Commerce to accept credit card payments through the Emporiki Bank (Greek bank) API via XML (not redirection).
Provides options to select the live or the test Emporiki Bank environment.
Works with euros, dollars and pounds. If there is need for more currencies, please contact...
Media: Responsive
This module adds a responsive images view mode when inserting images using the Media module browser.
The view mode sets images to have a width of 100% and it will also use core image styles to shrink the image to the maximum width of your widest layout. Max-widths are set on images whose orignal source...
jQuery GPS
jQuery GPS provides a user interface for jQuery GPS Library.
You can easily enable and use it. It's working with the Google Maps API Key which you can get here.
Project Information
Maintenance status: Minimally maintained
Development status: Under active development
...
Cache Warmer
Introduction
cache_warmer is a drush command that hits a set of URIs of a drupal site based on the freshness of the content.
The main purpose is to offer a complete setup for running a mostly cached drupal site without having to deal with expiration logic and instead use microcaching.
Dealing with the...
TAC Redirect 403
TAC Redirect 403 extends the Taxonomy Access Control module by allowing you to specify a redirect URL for each taxonomy term. When a site visitor navigates to a content page that is restricted by a taxonomy access control rule, instead of Drupal's standard 403 (Access Denied) page being displayed, the...
ModuleField
Site builders
This module provides no direct functionality, so only download it if another module lists it as a dependency, or if you want to write your own module that uses its API.
Developers
Field UI and API are designed with the assumption that modules define field types, and administrators create...
Views URL alias
The 'Views URL alias' module allows Views be filtered by path aliases.
This module is useful if your website uses heirachical paths. It allows you to filter and sort a view by URL aliases. When combined with the Views bulk operation (VBO) module you can apply operations to a specific section of your...
Ubercart 3DSI EC-Linx Payment Gateway
This module provides Ubercart integration with the 3rd party payment gateway EC-Linx from 3DSI. A test environment setting is available during development.
Installation & Use:
Enable module in module list located at administer > build > modules.
Go to admin/store/settings/payment/edit/gateways...
TOC filter
Converts header tags into a linked table of contents.
This module is designed to be lightweight and accomplishs the very specific task of converting H2 (or H3) tags into an SEO friendly table of contents (TOC).
If you need a more complete heirarchical table on contents check out the Table of Contents...
Context: Spaces Features
This project created a condition for Context based on active Features in a given space. It sounds confusing but really it makes creating and managing Contexts a lot easier when you are creating distributions / platforms that have blocks that need positioned.
This also can help create a performance boost...
Area Print
Area Print is a simple module that let's you add print button or link that sends any given element(with id) to a printer.
All drupal-css is applied(though browsers tend to strip some off) and you can append your own on top of that.
In it's current form, the module provides only API-like functionality,...
Subscribe to feed
Summary
The 'Subscribe to Feed' allows users to subscribe to an RSS using an RSS/Podcast readers.
Drupal has several modules, including the Views module, that can generate RSS feeds. This modules allows users to subscribe to any feed using a selected RSS reader.
Supported RSS reader services include...
iTunes...
Node buttons edit
This is a simple little module that allows one to change the text on the 'Save', 'Preview' and 'Delete' buttons on a node form.
Configuration
You can edit the labels from the content type edit screen, in the 'Submission form settings' section.
About the Developers
This project is currently maintained...


