Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / AlbumWin.html
diff --git a/docs/source/AlbumWin.html b/docs/source/AlbumWin.html
new file mode 100644 (file)
index 0000000..e0a7a5b
--- /dev/null
@@ -0,0 +1,69 @@
+<html>\r
+<head>\r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js">Imgorg.AlbumWin = Ext.extend(Ext.Window, {
+    title: 'Choose Album',
+    layout: 'fit',
+    closeAction: 'hide',
+    width: 300,
+    modal: true,
+    
+    initComponent: function() {
+        Ext.apply(this, {
+            items: [{
+                autoHeight: true,
+                xtype: 'form',
+                id: 'album-select',
+                bodyStyle: 'padding:15px',
+                labelWidth: 50,
+                items: [{
+                    anchor: '95%',
+                    fieldLabel: 'Album',
+                    xtype: 'img-albumcombo',
+                    name: 'album',
+                    allowBlank: false
+                }]
+            }],
+            buttons: [{
+                text: 'Add to Album',
+                handler: this.addToAlbum,
+                scope: this
+            },{
+                text: 'Cancel',
+                handler: function() {
+                    this.hide();
+                },
+                scope: this
+            }]
+        });
+        Imgorg.AlbumWin.superclass.initComponent.call(this);
+    },
+    
+    addToAlbum: function() {
+        var af = this.getComponent('album-select').getForm();
+        if (af.isValid()) {
+            if (this.selectedRecords) {
+                var imageIds = [];
+                for (var i = 0; i < this.selectedRecords.length; i++) {
+                    var r = this.selectedRecords[i];
+                    imageIds.push(r.data.dbid || r.data.id);
+                }
+                var fld = af.findField('album');
+                var album = fld.getValue();
+                
+                Imgorg.ss.Images.addToAlbum({
+                    images: imageIds,
+                    album: album
+                });
+            }
+            this.hide();
+        }
+    }
+});
+</pre>    \r
+</body>\r
+</html>
\ No newline at end of file