Click here to Skip to main content
Click here to Skip to main content

Droptiles - Metro style Live Tiles powered Web Dashboard

By , 18 Jul 2012
 

Introduction

Droptiles is a Windows 8 Start like Metro style Web 2.0 Dashboard. It builds the experience using Tiles . Tiles are mini apps that can fetch data from external sources. Clicking on a tile launches the full app. Apps can be from any existing website to customized website specifically built to fit the Dashboard experience. Droptiles is built almost entirely of HTML, Javascript and CSS and thus highly portable to any platform. The sample project is built using ASP.NET to show some server side integration, like Signup, Login and getting dynamic data from server. But with very little change you can port it to PHP, Ruby, JSP or any other platform. Droptiles is the sequel of my Dropthings, which is the first Open Source Web 2.0 Dashboard. 

See it live!, go to Droptiles.com

Get the code from: 

https://github.com/oazabir/Droptiles

Features   

  • Metro style user interface. CSS framework to build metro style websites, inspired by metroui.org.ua. 
  • Drag & Drop tiles to personalize the experience.
  • Client side object model and data binding for easy MVVM implementation.
  • Server side platform neutral implementation. Can be ported to PHP, JSP easily.
  • Live tiles. Tiles are mini-apps, loading data from variety of sources.

It even has its own App Store! 

How can you use Droptiles 

  • Enterprise Dashboard  aggregating data from various systems and offering a launch pad for intranet/internet applications. 
  • Web 2.0 Portal offering portlets in the form of tiles. Aggregating data from various services and as a launch pad for different services.
  • Touch enabled Kiosk front-end. Great for Hotels, Restaurants, Banks front-desk self service. 
  • Content aggregator for News and Research purpose.

Main parts

There are three main parts in Droptiles:

  • Dashboard
  • App Store
  • Login, Signup, Settings.

Dashboard is the home page, that shows the tiles.

App Store shows a collection of apps available for users to add on the Dashboard.

Login, Signup, Settings areas are built using ASP.NET and uses ASP.NET Membership provider.

The Dashboard

Dashboard comprises of Sections. Each section contains a collection of tiles. Each box you see is a Tile. Tiles are mini apps. A tile can be of the following type:

  • Simple html pages 
  • A dynamic Javascript mini-App  
  • Dynamic page 

Coding a Tile 

Let's look at the Flickr tile. First of all, all the tiles appearance are defined in the Tiles.js file, which contains the meta data for all the tiles. For example, the Flickr tile metadata is defined as following:

    flickr: function (uniqueId) {
        return {
            uniqueId: uniqueId,
            name: "flickr",
            iconSrc: "img/Flickr alt 1.png",
            label: "Flickr",
            size: "tile-double tile-double-vertical",
            color: "bg-color-darken",
            appUrl: "http://www.flickr.com/",
            cssSrc: ["tiles/flickr/flickr.css"],
            scriptSrc: ["tiles/flickr/flickr.js"],
            initFunc: "flickr_load"
        };
    }

The icon is the default icon shown on the tile while the javascript, css, html are loaded. The horizontal and vertical size of the tile is defined in the size attribute. Then when clicked, what URL to host in the full screen view is defined in appUrl. The additional CSS, Javascripts to load are defined in cssSrc and scriptSrc. Finally the initFunc tells what function to invoke once the javascripts are loaded.

The metadata defines how the tile is displayed on the Dashboard. The behavior to load data from Flickr comes from the Flickr.js file, defined as follows:

    function flickr_load(tile, div) {
 
        var url = "http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=json&tags=nature&jsoncallback=?";    
 
        $.getJSON(url, function (data) {        
            var ctr = 0;
            $.each(data.items.reverse(), function (i, item) {
                if (item.tags.length < 150) {
                    var sourceSquare = item.media.m;
                    var sourceOrig = (item.media.m).replace("_m.jpg", ".jpg");
 
                    var htmlString = '<div class="flickr_item"> <a target="_blank" href="' + sourceOrig +
                        '" class="link" title="' + item.title + '">';
                    htmlString += '<img title="' + item.title +
                        '" src="' + sourceSquare + '" ';
                    htmlString += 'alt="' + item.title +
                        '" />';
                    htmlString += '</a><div class="flickr_title">' + item.title + '</div>' +
                        '</div>';
 
                    tile.slides.push(htmlString);
 
                    ctr = ctr + 1;
                }
            });
 
            tile.counter(ctr);
        });
 
    }

That's it.

Tiles can be Dynamic aspx pages loaded directly inside the tile box. For example:

The way Dashboard works is:

  • First get the list of Sections and the tiles in each section.
  • Create Tile boxes as per the definition stored in Tiles.js file. 
  • For each Tile, see if the Tile has any external Javascript, CSS and html files to load. If yes, then load them.
  • Execute the function defined in the initFunc. Pass the tile object, the Tile div reference and the initParams to it. 

Default tiles to show on Dashboard 

The default tiles shown on Dashboard are defined in the same Tiles.js file as following:
    window.DefaultTiles = [
        {
            name :"Section1",
            tiles: [
               { id: "flickr1", name:"flickr" },
               { id: "amazon1", name:"amazon" },
               { id: "news1", name: "news" },
               { id: "weather1", name: "weather" },
               { id: "calendar1", name: "calendar" },
               { id: "feature1", name: "feature" },
               { id: "facebook1", name: "facebook" }
            ]
        },
        {
            name: "Section2",
            tiles: [
               { id: "wikipedia1", name: "wikipedia" },           
               { id: "email1", name: "email" },
               { id: "maps1", name: "maps" },
               { id: "angrybirds1", name: "angrybirds" },
               { id: "cuttherope1", name: "cutTheRope" },
               { id: "dynamicTile1", name: "dynamicTile" },
               { id: "buy1", name: "buy" }]
        },
        {
            name: "Section3", tiles: [
               { id: "youtube1", name: "youtube" },
               { id: "ie1", name: "ie" },
 
            ]
        }
    ];

Tiles are shown in the exact order they are fined. The name has to be the same name used to define the Tile metadata.

HTML markup for tiles

There are various parts of a tile:

The following HTML defines the tile design:

    <div class="metro-sections" data-bind="foreach: sections">
        <div class="metro-section" data-bind="attr: {id : uniqueId}, foreach: sortedTiles">
            <div data-bind="attr: { id: uniqueId, 'class': tileClasses }">
                <!-- ko if: tileImage -->
                <div class="tile-image">
                    <img data-bind="attr: { src: tileImage }" src="img/Internet%20Explorer.png" />
                </div>
                <!-- /ko -->
                <!-- ko if: iconSrc -->
                <!-- ko if: slides().length == 0 -->
                <div data-bind="attr: { 'class': iconClasses }">
                    <img data-bind="attr: { src: iconSrc }" src="img/Internet%20Explorer.png" />
                </div>
                <!-- /ko -->
                <!-- /ko -->
                <div data-bind="foreach: slides">
                    <div class="tile-content-main">
                        <div data-bind="html: $data">
                        </div>
                    </div>
                </div>
                <!-- ko if: label -->
                <span class="tile-label" data-bind="html: label">Label</span>
                <!-- /ko -->
                <!-- ko if: counter -->
                <span class="tile-counter" data-bind="html: counter">10</span>
                <!-- /ko -->
                <!-- ko if: subContent -->
                <div data-bind="attr: { 'class': subContentClasses }, html: subContent">
                    subContent
                </div>
                <!-- /ko -->
            </div>
        </div>
    </div>

The markup is full of KnockoutJS markups which is used to bind the Tile object model to the html markup.

Dashboard Execution 

Here's a sequence diagram that shows how the Dashboard loads:

The code in Dashboard.js is very straightforward and it does all the magic!

    var viewModel = new DashboardModel("Start", [], window.currentUser, ui, TileBuilders);
 
    $(document).ready(function () {
 
        // Hide the body area until it is fully loaded in order to prevent flickrs
        $('#content').css('visibility', 'visible');
 
        // Initiate KnockoutJS binding which creates all the tiles and binds the whole
        // UI to viewModel.
        ko.applyBindings(viewModel);
 
        // See if user has a previous session where page setup was stored
        var cookie = readCookie("p");
        if (cookie != null && cookie.length > 0) {
            try {
                viewModel.loadSectionsFromString(cookie);
            } catch (e) {
                // Failed to load saved tiles. Load the default tiles.
                viewModel.loadSectionsFromString(DefaultTiles);
            }
        }
        else {
            // No cookie, load default tiles. Defined in Tiles.js
            viewModel.loadSectionsFromString(DefaultTiles);
        }

First it tries to read the section and tiles setup from the cookie, if it is saved. If not found in cookie, it loads the default definition. Then the framework in TheCore.js kicks in and takes care of creating the tiles and injecting the dynamic behavior inside the tiles.

The code is heavily documented, so you can read the details from there.

App Store 

 

The App Store experience is built the same way as the Dashboard. The App Store shows how reusable the Droptiles framework is. It uses the same TheCore.js to provide the experience. The only difference is instead of Tiles.js which defines the tile metadata and the default tiles, it has its own AppStoreTiles.js that defines the Tile metadata and the default tiles to show on the App Store.

That's all that differs. 

Here's the code in AppStore.js:

    var viewModel = new DashboardModel("App Store", [], window.currentUser, ui, 
        TileBuilders);
 
    $(document).ready(function () {
 
        // Hide the body area until it is fully loaded in order to prevent flickrs
        $('#content').css('visibility', 'visible');
 
        // Initiate KnockoutJS binding which creates all the tiles and binds the whole
        // UI to viewModel.
        ko.applyBindings(viewModel);
 
        viewModel.switchTheme('theme-white');
        viewModel.loadSectionsFromString(window.AppStoreTiles);

That's it. The loadSectionsFromString function takes care of creating the AppStore Tiles. It takes the section and tile configuration in a string serialized format, like this:

    Section1~flickr1,flickr.news1,news|Section2~angrybirds1,angrybirds

This is how it is stored in the cookie as well so that next time you visit the Dashboard, it shows you how you have left it.  

Conclusion

Droptiles is an open source project to show how Windows 8 Start experience can be built using just HTML, Javascript and CSS. It can be adopted to build various web applications, especially touch enabled applications. The modern Metro look & feel makes it very attractive to use as a self-service portal experience or as a content aggregator.  

  

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Omar Al Zabir
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom
Member

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionChanges to phpmemberMember 1005114514 May '13 - 2:50 
What are the necessary changes to Droptile normal function in php? I am not a connoisseur of php applications and liked much of his work, I'd love to use it on a personal project, but only install on my hosting php. Can anyone help me on how to make these changes from ASP to PHP?
 
Quais são as alterações necessárias para Droptiles funcionar normal em php? Não sou um bom conhecedor de aplicações php e gostei muito do seu trabalho, gostaria muito de usa-lo em um projeto pessoal, mas minha hospedagem só instala em php. Alguém pode me ajudar em como fazer estas alterações de ASP para PHP?
GeneralMy vote of 5membercsharpbd5 Apr '13 - 9:23 
Nice!!!
Thanks 4 share.
QuestionJs error happend after tiles are being deleted from Dashboardmemberlazyspider11 Mar '13 - 21:19 
Hello Omar,
Thanks for creating such a good project.
 
I found something wrong after delete tiles from Dashboard, the message shows obviously that is a Js error.
 
like : Unable to get property 'xxx' of undefined or null reference
 
First i thought it was my problem with my local settings, and then I tried to re-operate at www.droptiles.com , the result is same.
 
please let me know if you will able to support your app in future.
 
Btw: It passed in Chrome but failed in IE9 & 10.
QuestionI do not understand how to link a tilememberRyan199314 Feb '13 - 3:12 
Hello Omar,
 
First I would like to thank you for your Metro design.
There is just 1 problem.
 
After trying several things, I have no idea how to link a tile from the Tiles.js to the html code.
Could you give/send me an example so I could try it myself?
 
I appreciate everything so far!
 
Greetz,
 
Ryan de Vries
QuestionTile section expand/grow horizontallymembermanoj.more6 Jan '13 - 20:42 
Hi Omar,
thanks for answering previous questions.
 
Is it possible to grow the section div horizontally rather than vertically?
 
Currently when we add new tiles to div, and number of tiles increases section div expands/grows vertically. can we change this behavior so that section will grow horizontally?
 
thanks
NewsDrupal Theme Conversion SandboxmemberCharlie Love4 Jan '13 - 9:35 
I've converted DropTiles to a Drupal theme which is in Sandbox at the moment at Drupal.com http://drupal.org/sandbox/charlie_love/1880114[^] I'm looking for developers to work on the project with me and I'm happy to add people to the sandbox.
Charlie Love
http://charlielove.org
http://www.glew.org.uk

QuestionUppercase and lowercase broken links.memberMember 971671928 Dec '12 - 17:12 
I just found this today and I love this idea. I downloaded the zip and I uploaded the code to my web server. It wasnt running correctly. I opened up the code and ran through it briefly. I stopped looking after after these 2 instances...
 
Demo.html:
<link rel="stylesheet" type="text/css" href="css/droptiles.css?v=14">
File is named Droptiles.css
 
Default.aspx:
<script type="text/javascript" src="tiles/tiles.js?v=14"></script>
Location is Tiles/Tiles.js
 
I am pretty amatuer at this, so these errors could just be me. Please tell me what I am doing wrong.
AnswerRe: Uppercase and lowercase broken links.memberOmar Al Zabir3 Jan '13 - 22:50 
Windows and IIS are case insensitive, so the case won't cause any issue.
(regards) => "Omar AL Zabir"
+ "C#, ASP.NET MVP"
+ "http://omaralzabir.com";

QuestionObjects are not being added to Dashboard from App StorememberGreg Frazier17 Dec '12 - 14:03 
Hello Omar,
 
I trust you are well. Please let me know if you no longer wish to support your app and will not be able to answer these open questions.
 
I am unable to add apps from the app store to the Dashboard. Is it possible to schedule a remote session where you can take a look at the code in action?
 
I am running your app on a Windows 7 laptop.
 
I do have plans for it if I can ensure that the major features work properly.
 
Feel free to call me directly at 313.931.0522. I am in the USA, eastern standard time zone.
 
Thank you.
AnswerRe: Objects are not being added to Dashboard from App StorememberOmar Al Zabir19 Dec '12 - 23:12 
Are you able to reproduce the problem on the droptiles.com website?
 
If the bug isn't there, then there's a local issue with your laptop setup, which I am afraid I cannot support.
(regards) => "Omar AL Zabir"
+ "C#, ASP.NET MVP"
+ "http://omaralzabir.com";

GeneralRe: Objects are not being added to Dashboard from App StorememberGreg Frazier20 Dec '12 - 3:13 
Hello Omar,
 
The problem also occurs on your website, droptiles.com, as well.
 
When I select the object 'Amazon.com' in the Apps store to be added to the dashboard, nothing gets added.
 
Am I overlooking something?
 
Thank you.
GeneralRe: Objects are not being added to Dashboard from App StorememberOmar Al Zabir20 Dec '12 - 5:52 
Hi Greg, I was able to reproduce the bug. Thanks for reporting. Looks like there's some dead code left which I need to remove. I will get that cleaned.
(regards) => "Omar AL Zabir"
+ "C#, ASP.NET MVP"
+ "http://omaralzabir.com";

QuestionError : Object doesn't support property or method 'attach'"membermanoj.more13 Dec '12 - 0:30 
hi Omar,
its an Excellent application. I love it.
i am studying your droptiles application. I have come across an error in the file "TheCore.js" in addTile function.
 
Error Description is - "Microsoft JScript runtime error: Object doesn't support property or method 'attach'"
 
this error come when we add tile from appstore to dashboard.
Thanks!
AnswerRe: Error : Object doesn't support property or method 'attach'"memberOmar Al Zabir3 Jan '13 - 22:51 
There's some dead code. I will get that cleaned. Thanks for reporting.
(regards) => "Omar AL Zabir"
+ "C#, ASP.NET MVP"
+ "http://omaralzabir.com";

Questionjscript Runtime Errors EncounteredmemberGreg Frazier11 Dec '12 - 7:14 
Hello Omar,
 
First of all, let me say that I really like your app. I plan to use it commercially so I need to know how to pay you.
 
I am not that experienced with java or jscripts. For example, I am encountering this jscript error when clicking on the weather tile:
 
"Microsoft jscript runtime error. Unspecified error."
 
Any assistance is appreciated.
 
Thank you.
Greg Frazier, CPA

AnswerRe: jscript Runtime Errors EncounteredmemberGreg Frazier11 Dec '12 - 7:24 
More info:
 
This error occurs in the script names barlesque.js.
 
Thank you.
GeneralRe: jscript Runtime Errors EncounteredmemberGreg Frazier17 Dec '12 - 13:54 
Hello Omar,
 
I think I have resolved this error.
 
Thank you.
QuestionHow to add a view in Razor as a tile?memberFenRunner30 Oct '12 - 11:59 
Hi
 
I really like your project. I am considering to buy it in the near future. However I am developing a website in Razor MVC4 where I use dynamic views everywhere. How can I plugin any of such views as tile? I see that you are using Asp.net in earlier versions. Are there any ways of pointing a tile to a view located in a different directory - not just inside of a Tiles folder?
 
Thanks
Leslaw Pawlaczyk
QuestionHow to create Adding SubMenu item?memberghousebasha22 Oct '12 - 3:51 
Hi Omar Al Zabir your blog is awesome now here i need to create some task plz help now we have to do drag and drop things like let me explain you we have empty place right now iam droping somemenu now it is placed at droped place now i need to drop one more menu it should place like sub menu for before menu how could we do this could u plz help me to do this task thanks in advance
Questionphp ConversionmemberCharlie Love17 Oct '12 - 6:35 
Would love to team up with others to convert Omar's excellent project to php and then a Drupal module and theme.
 
Anyone else up for it?
 
Great work Omar
AnswerRe: php ConversionmemberCharlie Love3 Jan '13 - 22:45 
I've completed.a port to PHP for use as a Drupal theme.
 
In testing (and these all replicated on DropTiles.com):
 
Mac OS X 10.8: Safari, doesn't update the add cookie when apps selected from the AppStore.
IPad iOS 6 Safari: no drag icons, no AppStore (similar bug as above I think)
IE9 Windows 8 Same issue with the adding apps.
Mac OS X 10.8 Chrome and in Firefox: logged in wont remember layout of tiles. Logged out user, partially remembers layout. Also when dragging tiles also creates duplicate tiles on dashboard.
 
I"ll have another go at documenting these properly and then attempt to debug them all.
 
Thanks for a DropTiles, it's fab and I'll push any solutions to bugs to you.
 
Charlie
GeneralRe: php ConversionmemberOmar Al Zabir3 Jan '13 - 22:52 
Thanks for reporting the bugs. I don't have those specific combinations of hardware, so I would appreciate it very much if you can share the solutions.
(regards) => "Omar AL Zabir"
+ "C#, ASP.NET MVP"
+ "http://omaralzabir.com";

QuestionHTML5 featuresmemberroyjavelosa12 Oct '12 - 17:39 
Id like to create an HTML5 web apps/site which could be consumed on Desktop, tablet and Mobile devices. I want it to be flexible in such a way that I could use PHP or Java with it. After intensive googling I found your Droptiles. Since I was also thinking of incorporating the Windows Live Tiles look and functionality in my mobile web site, I thought that this would be a good choice.
My question is what are the HTML5 features which are supported by Droptiles? I need to know this before commiting to this framework. So far I have not read of any html5 feature.
 
By the way the html5 features that I consider as deal breakers are
 
- offline storage
- support for viewport meta tag ( or anything that would allow it to scale depending on the device used)
- html5 input types (email,phone number, calendar etc)
 
Im really interested in using your framework and purchase a license but I first need to know if this framework will cater my present requirements. I hope you reply as soon as possible Smile | :) thanks.
Overall amazing framework!
AnswerRe: HTML5 featuresmemberOmar Al Zabir13 Oct '12 - 0:54 
Hi,
Droptiles does not have any feature now that requires HTML 5. So, it is not using HTML 5 yet.
 
If you want to use HTML 5 features, you can easily add them. There's nothing in droptiles that will prevent that. It has been designed to have negligible footprint on the server side and 98% on client side html, js. So, you can easily make Single page Applications out of it, utilizing the html 5 features.
(regards) => "Omar AL Zabir"
+ "C#, ASP.NET MVP"
+ "http://omaralzabir.com";

GeneralRe: HTML5 featuresmemberroyjavelosa14 Oct '12 - 3:35 
Thanks for the quick reply sir!
One more thing, when will the android support update be coming? I watched your screencast and you said that presently it does not support Android devices/browser. I also tested viewing your droptiles example on a Note 10.1 tablet with a chrome browser and the example seems to be buggy. When you said that it does not support android did you mean that droptiles framework does not support android? or did you mean that only the example does not support android?
Could I easily fix the rendering issue on android devices using viewport tags and progressive enhancement techniques?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 18 Jul 2012
Article Copyright 2012 by Omar Al Zabir
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid