My favorites | Sign in
Project Logo
                
Search
for
Updated Sep 17, 2008 by thirstyferret
AboutTheCode  
Overview of the code

Introduction

This document outlines how the Huddle Desktop application's code is structured. All code in source control is commented at quite a detailed level, so any further information should be sought there.

All images are stored in the /imgs subfolder or in subfolders of that that relate to their use

The Application Window

The window itself is formed of a single HTML file. As Adobe AIR runs an instance of the Webkit HTML renderer in the window, this single HTML page runs all the formatting for the application, deals with shadows, window chrome, buttons and events etc.

HTML / XML

Huddle.html

This is the main application window. Its main responsibility is dealing with the layout of the window, but its other roles include bringing together all the style sheets and javascript files, instanciating and initialising the objects and kick-starting the javascript.

Huddle-app.xml

This is the "application descriptor" XML file that AIR uses to compile and run the application. It specifies the initial details of the window and other operating system parameters.

CSS

These can be found in the /styles subfolder.

content.css

This file handles the styling for all the various content pages; sections include:

default.css

Handles basic styling of generic page elements, such as the body tags, links, generic classes used throughout the design (e.g. center and hidden) and the loading icon

window.css

Handles styling of window elements; backgrounds, chrome buttons (e.g. close, minimise, resize, move), the header and footer etc.

Javascript

All Javascripts can be found in the /scripts subdirectory

AIRAliases.js

This is an Adobe-provided file so that you can use shorthand for referencing AIR related elements, such as air.nativeWindow instead of the really long reference you'd need normally :)

breadcrumbs.js

This file contains the object for manipulating, displaying and adding to the breadcrumb links when you are navigating through file systems.

download.js

This file includes a class called DownloadManager which handles the queueing, downloading and display of files. It can handle downloading a folder, file or multiple files in an array. It queues them and downloads them to a user-selected directory, restoring their original file names.

This file is reasonably complex, as two asynchronous AJAX calls are made to obtain the correct data - one to get the details of the file being downloaded (for filename and other data) and the call to get the data itself.

dragndrop.js

This file handles (unsurprisingly) the drag and drop functionality as well as handling the queueing and uploading of files to be added to the Huddle site.

The drag and drop object provides two end points, drag.set() and drag.remove() to easily add and remove drag and drop event listeners to elements on the page.

The upload manager handles the queueing, uploading and status reporting of files in progress.

dropdown.js

This file contains the dropdown object, to create, add elements to, display and re-render the dropdown list containing workspaces on the main page.

huddle.js

In this file is the Huddle class, used to store user's login data (which is required for each API call) and information about the state and size of the main application.

jquery.js

This is the compressed jQuery framework - http://jquery.com

jquery-ui.js

This is part of the jQuery UI effects library for some of the fancy animations.

json.js

This is a container for all of the asynchronous requests to the huddle API, with the exception of file upload and download processing. It is intended as a simple wrapper to make modification of calls and function easy.

layouts.js

This file provides wrappers for several functions contained in utils-<>.js files. It allows all functions related to certain types of page to be contained in their own pseudo-classes for easy reference and to make the code a bit more understandable.

msg.js

This file contains a class to handle all the display of messages and interaction with the user. It handles when multiple messages need to be displayed, message locking (such as during file uploads / downloads - you don't want the upload statistics to be removed when you move your mouse over the close button, for example) and methods required for that behaviour.

page.js

This script contains methods relating to the loading and displaying of content on the page. It contains the method that is called on load which initialises almost all of the application (Page.load() method). It contains methods for dealing with the movement and resizing of the window, as well as the loading icon. Principally, it contains the methods that control the unloading and loading of new content into the page (Page.displayPage() and Page.switchContent())

select.js

This class handles the ability for a user to shift-click on multiple files to download them. It handles the array of currently selected files, toggling a file from this list (if it's not there it adds it, if it's there it removes it); it also handles the formatting of the selected / deselected objects. Importantly it also handles queueing the selected files for download when one of them is dragged out of the window.

systray.js

This file contains the method for initialising, displaying and capturing events on the system tray / dock icon.

utilities.js

This file contains some generic functions (such as isArray() and functions for the formatting of object titles) as well two classes that handle the display of tables of objects.

The Cell class contains variables and methods for constructing, rendering and adding event listeners to individual files / folders / workspaces.

The Table class constructs the table as a whole, generating cells from a downloaded array, rendering and adding event listeners to it.

utils-file-folder.js

This file contains functions related to downloading, processing and displaying the data relating to files and folders. They are mostly given nicer wrappers in the layouts.js file, it is not recommended to access them outside that structure.

utils-login.js

This file contains functions for displaying and processing the login page; it is also wrapped in layouts.js and should be accessed there.

utils-workspace.js

Here are functions related to getting and displaying workspace and dashboard data, again wrapped through layouts.js.

whatsnew.js

This file contains code for getting the What's New feed for the Huddle dashboard and workspaces. It is currently not implemented but a demonstration is there and commented out for reference.


Sign in to add a comment
Hosted by Google Code