AlbumWin.js
上传用户:shuoshiled
上传日期:2018-01-28
资源大小:10124k
文件大小:2k
源码类别:

中间件编程

开发平台:

JavaScript

  1. /*!
  2.  * Ext JS Library 3.0.0
  3.  * Copyright(c) 2006-2009 Ext JS, LLC
  4.  * licensing@extjs.com
  5.  * http://www.extjs.com/license
  6.  */
  7. Imgorg.AlbumWin = Ext.extend(Ext.Window, {
  8.     title: 'Choose Album',
  9.     layout: 'fit',
  10.     closeAction: 'hide',
  11.     width: 300,
  12.     modal: true,
  13.     
  14.     initComponent: function() {
  15.         Ext.apply(this, {
  16.             items: [{
  17.                 autoHeight: true,
  18.                 xtype: 'form',
  19.                 id: 'album-select',
  20.                 bodyStyle: 'padding:15px',
  21.                 labelWidth: 50,
  22.                 items: [{
  23.                     anchor: '95%',
  24.                     fieldLabel: 'Album',
  25.                     xtype: 'img-albumcombo',
  26.                     name: 'album',
  27.                     allowBlank: false
  28.                 }]
  29.             }],
  30.             buttons: [{
  31.                 text: 'Add to Album',
  32.                 handler: this.addToAlbum,
  33.                 scope: this
  34.             },{
  35.                 text: 'Cancel',
  36.                 handler: function() {
  37.                     this.hide();
  38.                 },
  39.                 scope: this
  40.             }]
  41.         });
  42.         Imgorg.AlbumWin.superclass.initComponent.call(this);
  43.     },
  44.     
  45.     addToAlbum: function() {
  46.         var af = this.getComponent('album-select').getForm();
  47.         if (af.isValid()) {
  48.             if (this.selectedRecords) {
  49.                 var imageIds = [];
  50.                 for (var i = 0; i < this.selectedRecords.length; i++) {
  51.                     var r = this.selectedRecords[i];
  52.                     imageIds.push(r.data.dbid || r.data.id);
  53.                 }
  54.                 var fld = af.findField('album');
  55.                 var album = fld.getValue();
  56.                 
  57.                 Imgorg.ss.Images.addToAlbum({
  58.                     images: imageIds,
  59.                     album: album
  60.                 });
  61.             }
  62.             this.hide();
  63.         }
  64.     }
  65. });