| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615 |
- var GAL = function(config) {
- config = config || {};
- GAL.superclass.constructor.call(this,config);
- };
- Ext.extend(GAL,Ext.Component,{
- page:{},window:{},grid:{},tree:{},panel:{},combo:{},config: {},view: {}
- });
- Ext.reg('gallery',GAL);
- GAL = new GAL();
- GAL.window.CreateAlbum = function(config) {
- config = config || {};
- this.ident = config.ident || 'gcalb'+Ext.id();
- Ext.applyIf(config,{
- title: _('gallery.album_create')
- ,id: this.ident
- // ,height: 150
- ,width: 600
- ,url: GAL.config.connector_url
- ,action: 'mgr/album/create'
- ,fields: [{
- xtype: 'hidden'
- ,name: 'parent'
- },{
- layout: 'column'
- ,border: false
- ,defaults: {
- layout: 'form'
- ,labelAlign: 'top'
- ,anchor: '100%'
- ,border: false
- ,labelSeparator: ''
- }
- ,items: [{
- columnWidth: .5
- ,items: [{
- xtype: config.record['parent'] == 0 ? 'hidden' : 'statictextfield'
- ,fieldLabel: _('gallery.parent')
- ,name: 'parent_name'
- ,id: this.ident+'-parent-name'
- ,anchor: '100%'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('name')
- ,name: 'name'
- ,id: this.ident+'-name'
- ,anchor: '100%'
- },{
- xtype: 'textarea'
- ,fieldLabel: _('description')
- ,name: 'description'
- ,id: this.ident+'-description'
- ,anchor: '100%'
- }]
- },{
- columnWidth: .5
- ,items: [{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.year')
- ,name: 'year'
- ,anchor: '100%'
- ,allowBlank: true
- },{
- xtype: 'checkbox'
- ,boxLabel: _('gallery.active')
- ,description: MODx.expandHelp ? '' : _('gallery.active_desc')
- ,name: 'active'
- ,id: this.ident+'-active'
- ,hideLabel: true
- ,checked: true
- ,inputValue: 1
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-active'
- ,text: _('gallery.active_desc')
- ,cls: 'desc-under'
- },{
- xtype: 'checkbox'
- ,boxLabel: _('gallery.prominent')
- ,description: MODx.expandHelp ? '' : _('gallery.prominent_desc')
- ,name: 'prominent'
- ,id: this.ident+'-prominent'
- ,hideLabel: true
- ,checked: true
- ,inputValue: 1
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-prominent'
- ,text: _('gallery.prominent_desc')
- ,cls: 'desc-under'
- }]
- }]
- }]
- });
- GAL.window.CreateAlbum.superclass.constructor.call(this,config);
- };
- Ext.extend(GAL.window.CreateAlbum,MODx.Window);
- Ext.reg('gal-window-album-create',GAL.window.CreateAlbum);
- GAL.window.UpdateItem = function(config) {
- config = config || {};
- this.ident = config.ident || 'gupdit'+Ext.id();
- Ext.applyIf(config,{
- title: _('gallery.item_update')
- ,id: this.ident
- ,closeAction: 'close'
- // ,height: 150
- // ,width: '55%'
- ,width: 600
- ,url: GAL.config.connector_url
- ,action: 'mgr/item/update'
- ,fileUpload: true
- ,fields: [{
- layout: 'column'
- ,border: false
- ,defaults: {
- layout: 'form'
- ,labelAlign: 'top'
- ,anchor: '100%'
- ,border: false
- ,labelSeparator: ''
- }
- ,items: [{
- columnWidth: .5
- ,items: [{
- xtype: 'textfield'
- ,fieldLabel: _('name')
- ,name: 'name'
- ,id: this.ident+'-name'
- ,anchor: '100%'
- },{
- xtype: 'textarea'
- ,fieldLabel: _('description')
- ,name: 'description'
- ,id: this.ident+'-description'
- ,anchor: '100%'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.item_url')
- ,description: MODx.expandHelp ? '' : _('gallery.item_url_desc')
- ,name: 'url'
- ,id: this.ident+'-item-url'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-item-url'
- ,text: _('gallery.item_url_desc')
- ,cls: 'desc-under'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.tags')
- ,description: MODx.expandHelp ? '' : _('gallery.comma_separated_list')
- ,name: 'tags'
- ,id: this.ident+'-tags'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-tags'
- ,text: _('gallery.comma_separated_list')
- ,cls: 'desc-under'
- }]
- },{
- columnWidth: .5
- ,items: [{
- xtype: 'hidden'
- ,name: 'thumbnail'
- },{
- xtype: 'hidden'
- ,name: 'image'
- },{
- html: ''
- ,id: this.ident+'-preview'
- },{
- xtype: 'statictextfield'
- ,name: 'id'
- ,fieldLabel: _('id')
- ,submitValue: true
- ,anchor: '100%'
- },{
- xtype: 'checkbox'
- ,boxLabel: _('gallery.active')
- ,description: MODx.expandHelp ? '' : _('gallery.item_active_desc')
- ,name: 'active'
- ,id: this.ident+'-active'
- ,hideLabel: true
- ,checked: true
- ,inputValue: 1
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-active'
- ,text: _('gallery.item_active_desc')
- ,cls: 'desc-under'
- }]
- }]
- }]
- });
- GAL.window.UpdateItem.superclass.constructor.call(this,config);
- this.on('activate',function(w,e) {
- if (typeof Tiny != 'undefined') { MODx.loadRTE(this.ident + '-description'); }
- var d = this.fp.getForm().getValues();
- if (d && d.image) {
- var p = Ext.getCmp(this.ident+'-preview');
- var u = d.image+'&h=200&w=200&zc=1&q=100&f=png';
- p.update('<div class="gal-item-update-preview"><img src="'+u+'" alt="" onclick="Ext.getCmp(\'gal-album-items-view\').showScreenshot(\''+d.id+'\'); return false;" /></div>');
- }
- },this);
- };
- Ext.extend(GAL.window.UpdateItem,MODx.Window);
- Ext.reg('gal-window-item-update',GAL.window.UpdateItem);
- GAL.window.UploadItem = function(config) {
- config = config || {};
- this.ident = config.ident || 'gupit'+Ext.id();
- Ext.applyIf(config,{
- title: _('gallery.item_upload')
- ,id: this.ident
- // ,height: 150
- // ,width: '55%'
- ,width: 600
- // ,minWidth: 650
- ,url: GAL.config.connector_url
- ,action: 'mgr/item/upload'
- ,fileUpload: true
- ,fields: [{
- xtype: 'hidden'
- ,name: 'album'
- },{
- layout: 'column'
- ,border: false
- ,defaults: {
- layout: 'form'
- ,labelAlign: 'top'
- ,anchor: '100%'
- ,border: false
- ,cls: (MODx.config.connector_url) ? '' : 'main-wrapper' // check for 2.3
- ,labelSeparator: ''
- }
- ,items: [{
- columnWidth: .5
- ,items: [{
- xtype: 'textfield'
- ,fieldLabel: _('name')
- ,name: 'name'
- ,id: this.ident+'-name'
- ,anchor: '100%'
- },{
- xtype: 'textarea'
- ,fieldLabel: _('description')
- ,name: 'description'
- ,id: this.ident+'-description'
- ,anchor: '100%'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.item_url')
- ,description: _('gallery.item_url_desc')
- ,name: 'url'
- ,id: this.ident+'-item-url'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-item-url'
- ,text: _('gallery.item_url_desc')
- ,cls: 'desc-under'
- }]
- },{
- columnWidth: .5
- ,items: [{
- xtype: (MODx.config.connector_url) ? 'fileuploadfield' : 'textfield' // check for 2.3
- ,inputType: (MODx.config.connector_url) ? 'text' : 'file' // check for 2.3
- ,fieldLabel: _('gallery.file')
- ,description: MODx.expandHelp ? '' : _('gallery.item_upload_file_desc')
- ,name: 'file'
- ,id: this.ident+'-file'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-file'
- ,text: _('gallery.item_upload_file_desc')
- ,cls: 'desc-under'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.tags')
- ,description: MODx.expandHelp ? '' : _('gallery.comma_separated_list')
- ,name: 'tags'
- ,id: this.ident+'-tags'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-tags'
- ,text: _('gallery.comma_separated_list')
- ,cls: 'desc-under'
- },{
- xtype: 'checkbox'
- ,boxLabel: _('gallery.active')
- ,name: 'active'
- ,description: ''
- ,id: this.ident+'-active'
- ,hideLabel: true
- ,checked: true
- ,inputValue: 1
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-active'
- ,text: _('gallery.item_active_desc')
- ,cls: 'desc-under'
- }]
- }]
- }]
- });
- GAL.window.UploadItem.superclass.constructor.call(this,config);
- this.on('activate',function() {
- if (typeof Tiny != 'undefined') { MODx.loadRTE(this.ident + '-description'); }
- });
- };
- Ext.extend(GAL.window.UploadItem,MODx.Window);
- Ext.reg('gal-window-item-upload',GAL.window.UploadItem);
- GAL.window.UploadCover = function(config) {
- config = config || {};
- this.ident = config.ident || 'gupit'+Ext.id();
- Ext.applyIf(config,{
- title: _('gallery.cover_upload')
- ,id: this.ident
- // ,height: 150
- ,height: 300 // account for the preview thumbnail that is rendered after the window is opened
- // ,width: 350
- // ,minWidth: 350
- ,saveBtnText:_('gallery.upload_cover')
- ,url: GAL.config.connector_url
- ,action: 'mgr/album/uploadcover'
- ,fileUpload: true
- ,fields: [{
- xtype: 'hidden'
- ,name: 'albumid'
- },{
- layout: 'column'
- ,border: false
- ,defaults: {
- layout: 'form'
- ,labelAlign: 'top'
- ,border: false
- ,cls: (MODx.config.connector_url) ? '' : 'main-wrapper' // check for 2.3
- ,labelSeparator: ''
- }
- ,items: [{
- columnWidth: 1
- ,items: [{
- xtype:'hidden'
- ,name:'id'
- },{
- xtype: (MODx.config.connector_url) ? 'fileuploadfield' : 'textfield' // check for 2.3
- ,inputType: (MODx.config.connector_url) ? 'text' : 'file' // check for 2.3
- ,fieldLabel: _('gallery.file')
- ,description: MODx.expandHelp ? '' : _('gallery.item_upload_file_desc')
- ,name: 'file'
- ,id: this.ident+'-file'
- ,anchor: '100%'
- },{
- xtype:'panel'
- ,fieldLabel: _('gallery.current_cover')
- ,html: ''
- ,id: this.ident+'-preview'
- }]
- }]
- }]
- });
- GAL.window.UploadCover.superclass.constructor.call(this,config);
- };
- Ext.extend(GAL.window.UploadCover,MODx.Window);
- Ext.reg('gal-window-cover-update',GAL.window.UploadCover);
- GAL.window.UploadMultiItems = function(config) {
- config = config || {};
- this.ident = config.ident || 'gupmuit'+Ext.id();
- Ext.applyIf(config,{
- title: _('gallery.multi_item_upload')
- ,id: this.ident
- ,height: 350
- // ,width: 475
- ,fields: [{
- xtype: 'hidden'
- ,name: 'album'
- },{
- layout: 'column'
- ,border: false
- ,defaults: {
- layout: 'form'
- ,labelAlign: 'top'
- ,anchor: '100%'
- ,border: false
- ,labelSeparator: ''
- }
- ,items: [{
- columnWidth: .5
- ,items: [{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.tags')
- ,description: MODx.expandHelp ? '' : _('gallery.comma_separated_list')
- ,name: 'tags'
- ,id: this.ident+'-tags'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-tags'
- ,text: _('gallery.comma_separated_list')
- ,cls: 'desc-under'
- }]
- },{
- columnWidth: .5
- ,items: [{
- xtype: 'checkbox'
- ,boxLabel: _('gallery.active')
- ,hideLabel: true
- ,name: 'active'
- ,description: ''
- ,id: this.ident+'-active'
- ,checked: true
- ,inputValue: 1
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-active'
- ,text: _('gallery.item_active_desc')
- ,cls: 'desc-under'
- }]
- }]
- },{
- html: '<div id="file-upload" />'+_('gallery.loading_ellipsis')+'</div>'
- ,id: 'file-upload-field'
- ,xtype: 'panel'
- }]
- ,buttons: [{
- text: _('done')
- ,scope: this
- ,handler: function() { this.hide(); }
- }]
- ,keys: [] // Prevent enter triggering the window submit
- });
- GAL.window.UploadMultiItems.superclass.constructor.call(this,config);
- this.on('show',this.setup,this)
- };
- Ext.extend(GAL.window.UploadMultiItems,MODx.Window,{
- setup: function() {
- if (typeof GAL.uploader == 'undefined') {
- GAL.uploader = new qq.FileUploader({
- element: document.getElementById('file-upload')
- ,action: GAL.config.connector_url
- ,params: {
- action: 'mgr/item/ajaxupload'
- ,album: this.config.album
- ,HTTP_MODAUTH: MODx.siteId
- }
- ,onComplete: function() {
- GAL.uploader.win.fireEvent('success');
- }
- ,onSubmit: function() {
- var f = GAL.uploader.win.fp.getForm();
- var data = {
- active: f.findField('active').getValue() ? 1 : 0
- ,tags: f.findField('tags').getValue()
- };
- var p = this.params;
- Ext.apply(p,data);
- GAL.uploader.setParams(p);
- }
- });
- GAL.uploader.win = this;
- }
- }
- });
- Ext.reg('gal-window-multi-item-upload',GAL.window.UploadMultiItems);
- GAL.window.BatchUpload = function(config) {
- config = config || {};
- this.ident = config.ident || 'gupbu'+Ext.id();
- Ext.applyIf(config,{
- title: _('gallery.batch_upload')
- ,id: this.ident
- // ,height: 150
- // ,width: 600
- ,url: GAL.config.connector_url
- ,action: 'mgr/item/batchupload'
- ,fileUpload: true
- ,fields: [{
- xtype: 'hidden'
- ,name: 'album'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.directory')
- ,description: MODx.expandHelp ? '' : _('gallery.batch_upload_intro')
- ,name: 'directory'
- ,id: this.ident+'-directory'
- ,anchor: '100%'
- ,value: MODx.config['gallery.default_batch_upload_path'] || '{assets_path}images/'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-directory'
- ,text: _('gallery.batch_upload_intro')
- ,cls: 'desc-under'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.tags')
- ,description: MODx.expandHelp ? '' : _('gallery.batch_upload_tags')
- ,name: 'tags'
- ,id: this.ident+'-tags'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-tags'
- ,text: _('gallery.batch_upload_tags')
- ,cls: 'desc-under'
- },{
- xtype: 'checkbox'
- ,boxLabel: _('gallery.active')
- ,description: MODx.expandHelp ? '' : _('gallery.item_active_desc')
- ,name: 'active'
- ,id: this.ident+'-active'
- ,hideLabel: true
- ,checked: true
- ,inputValue: 1
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-active'
- ,text: _('gallery.item_active_desc')
- ,cls: 'desc-under'
- }]
- });
- GAL.window.BatchUpload.superclass.constructor.call(this,config);
- };
- Ext.extend(GAL.window.BatchUpload,MODx.Window);
- Ext.reg('gal-window-batch-upload',GAL.window.BatchUpload);
- GAL.window.ZipUpload = function(config) {
- config = config || {};
- this.ident = config.ident || 'gupbu'+Ext.id();
- Ext.applyIf(config,{
- title: _('gallery.zip_upload')
- ,id: this.ident
- // ,height: 150
- // ,width: 600
- ,url: GAL.config.connector_url
- ,action: 'mgr/item/zipupload'
- ,fileUpload: true
- ,fields: [{
- xtype: 'hidden'
- ,name: 'album'
- },{
- xtype: (MODx.config.connector_url) ? 'fileuploadfield' : 'textfield' // check for 2.3
- ,inputType: (MODx.config.connector_url) ? 'text' : 'file' // check for 2.3
- ,fieldLabel: _('gallery.zip_file')
- ,description: MODx.expandHelp ? '' : _('gallery.zip_upload_intro')
- ,name: 'zip'
- ,id: this.ident+'-zip'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-zip'
- ,text: _('gallery.zip_upload_intro')
- ,cls: 'desc-under'
- },{
- xtype: 'textfield'
- ,fieldLabel: _('gallery.tags')
- ,description: MODx.expandHelp ? '' : _('gallery.batch_upload_tags')
- ,name: 'tags'
- ,id: this.ident+'-tags'
- ,anchor: '100%'
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-tags'
- ,text: _('gallery.batch_upload_tags')
- ,cls: 'desc-under'
- },{
- xtype: 'checkbox'
- ,boxLabel: _('gallery.active')
- ,description: MODx.expandHelp ? '' : _('gallery.item_active_desc')
- ,name: 'active'
- ,id: this.ident+'-active'
- ,hideLabel: true
- ,checked: true
- ,inputValue: 1
- },{
- xtype: MODx.expandHelp ? 'label' : 'hidden'
- ,forId: this.ident+'-active'
- ,text: _('gallery.item_active_desc')
- ,cls: 'desc-under'
- }]
- });
- GAL.window.ZipUpload.superclass.constructor.call(this,config);
- };
- Ext.extend(GAL.window.ZipUpload,MODx.Window);
- Ext.reg('gal-window-zip-upload',GAL.window.ZipUpload);
|