Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / AlbumWin.html
1 <html>\r
2 <head>\r
3   <title>The source code</title>\r
4     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
5     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
6 </head>\r
7 <body  onload="prettyPrint();">\r
8     <pre class="prettyprint lang-js">Imgorg.AlbumWin = Ext.extend(Ext.Window, {
9     title: 'Choose Album',
10     layout: 'fit',
11     closeAction: 'hide',
12     width: 300,
13     modal: true,
14     
15     initComponent: function() {
16         Ext.apply(this, {
17             items: [{
18                 autoHeight: true,
19                 xtype: 'form',
20                 id: 'album-select',
21                 bodyStyle: 'padding:15px',
22                 labelWidth: 50,
23                 items: [{
24                     anchor: '95%',
25                     fieldLabel: 'Album',
26                     xtype: 'img-albumcombo',
27                     name: 'album',
28                     allowBlank: false
29                 }]
30             }],
31             buttons: [{
32                 text: 'Add to Album',
33                 handler: this.addToAlbum,
34                 scope: this
35             },{
36                 text: 'Cancel',
37                 handler: function() {
38                     this.hide();
39                 },
40                 scope: this
41             }]
42         });
43         Imgorg.AlbumWin.superclass.initComponent.call(this);
44     },
45     
46     addToAlbum: function() {
47         var af = this.getComponent('album-select').getForm();
48         if (af.isValid()) {
49             if (this.selectedRecords) {
50                 var imageIds = [];
51                 for (var i = 0; i < this.selectedRecords.length; i++) {
52                     var r = this.selectedRecords[i];
53                     imageIds.push(r.data.dbid || r.data.id);
54                 }
55                 var fld = af.findField('album');
56                 var album = fld.getValue();
57                 
58                 Imgorg.ss.Images.addToAlbum({
59                     images: imageIds,
60                     album: album
61                 });
62             }
63             this.hide();
64         }
65     }
66 });
67 </pre>    \r
68 </body>\r
69 </html>