3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
8 * Sample Image Organizer utilizing Ext.Direct
9 * Tagging/Organizing into galleries
13 Ext.ns('Imgorg','Imgorg.App');
14 Imgorg.App = function() {
16 SWFUpload.onload = function() {
18 flash_url: "SWFUpload/Flash/swfupload.swf",
19 upload_url: "php/router.php",
20 file_size_limit: "100 MB",
22 file_types_description: "Image Files",
23 file_upload_limit: 100,
24 file_queue_limit: 100,
26 button_placeholder_id: "btnUploadHolder",
27 button_cursor: SWFUpload.CURSOR.HAND,
28 button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
29 file_queued_handler: function(file) {
30 Ext.ux.SwfuMgr.fireEvent('filequeued', this, file);
32 upload_start_handler: function(file) {
33 Ext.ux.SwfuMgr.fireEvent('uploadstart', this, file);
35 upload_progress_handler: function(file, complete, total) {
36 Ext.ux.SwfuMgr.fireEvent('uploadprogress', this, file, complete, total);
38 upload_error_handler: function(file, error, message) {
39 Ext.ux.SwfuMgr.fireEvent('uploaderror', this, file, error, message);
41 upload_success_handler: function(file, data, response) {
42 Ext.ux.SwfuMgr.fireEvent('uploadsuccess', this, file, data);
44 minimum_flash_version: "9.0.28",
46 extAction: 'Images', // The class to use
48 extMethod: 'upload' // The method to execute
49 //needs extTID – Transaction ID to associate with this request.
52 swfu = new SWFUpload(settings);
54 var view, thumbPanel, uploadPanel, tabPanel;
59 Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
61 Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif';
62 Ext.Direct.addProvider(Imgorg.REMOTING_API);
64 Ext.ux.SwfuMgr.on('filequeued', this.onFileQueued, this);
69 xtype: 'img-albumtree',
85 Ext.getCmp('album-tree').addAlbum();
96 click: this.onAlbumClick,
105 enableTabScroll: true,
106 items: this.getTabs()
110 tabPanel = Ext.getCmp('img-tabpanel');
111 thumbPanel = tabPanel.getComponent('images-view');
112 Imgorg.TagWin = new Imgorg.TagWindow();
115 getTabs: function() {
117 xtype: 'img-albumspanel',
120 openalbum: this.onOpenAlbum,
124 xtype: 'img-thumbpanel',
126 },this.getImageThumbConfig())];
131 contentEl: 'SWFUpload_Console',
134 Ext.fly('SWFUpload_Console').applyStyles({height: '100%', width: '100%'});
142 getImageThumbConfig: function() {
146 dblclick: function(view, idx, node, e) {
147 var p = this.openImage(view.getStore().getAt(idx));
150 viewitem: function(view, node) {
151 var recs = view.getSelectedRecords();
152 for (var i = 0; i < recs.length; i++) {
153 this.openImage(recs[i]);
162 openImage: function(rec) {
163 return tabPanel.add({
165 title: Ext.util.Format.ellipsis(rec.data.filename,15),
171 onOpenAlbum: function(ap, album, name) {
172 var tab = tabPanel.add(Ext.apply({
173 xtype: 'img-thumbpanel',
175 title: 'Album: '+name
176 },this.getImageThumbConfig()));
184 onAlbumClick: function(node, e) {
185 this.onOpenAlbum(null, node.attributes.id, node.attributes.text);
188 onFileQueued: function(swfu, file) {
190 uploadPanel = Ext.getCmp('img-tabpanel').add({
191 title: 'Upload Queue',
192 xtype: 'img-uploadqueue',
196 uploadPanel.addFile(swfu, file);
208 Ext.onReady(Imgorg.App.init,Imgorg.App);
210 Ext.override(Ext.CompositeElementLite,{
211 removeElement : function(keys, removeDom){
212 var me = this, els = this.elements, el;
213 Ext.each(keys, function(val){
214 if (el = (els[val] || els[val = me.indexOf(val)])) {
216 el.dom ? el.remove() : Ext.removeNode(el);