/* This file is part of Ext JS 4 Copyright (c) 2011 Sencha Inc Contact: http://www.sencha.com/contact Commercial Usage Licensees holding valid commercial licenses may use this file in accordance with the Commercial Software License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Sencha. If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. */ Ext.Loader.setConfig({enabled:true}); Ext.Loader.setPath('Ext.ux', '/lib/ext4/examples/ux/'); Ext.require([ 'Ext.form.*', 'Ext.grid.*', 'Ext.data.*', 'Ext.util.*', 'Ext.reg.*', 'Ext.ux.data.PagingMemoryProxy', 'Ext.toolbar.Paging', 'Ext.ux.SlidingPager', 'Ext.layout.container.Column', 'Ext.tab.Panel', 'Ext.view.View', 'Ext.ux.DataView.DragSelector', 'Ext.ux.DataView.LabelEditor' ]); /*! * Ext JS Library 3.3.1 * Copyright(c) 2006-2010 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ Ext.onReady(function(){ /*IMAGES*/ ImagesModel = Ext.define('ImagesModel', { extend: 'Ext.data.Model', fields: [ {name: 'id'}, {name: 'name'}, {name: 'filename'}, {name: 'url'}, {name: 'size', type: 'float'}, {name:'lastmod', type:'date', dateFormat:'timestamp'} ] }); var image_store = Ext.create('Ext.data.Store', { model: 'ImagesModel', proxy: { type: 'ajax', url: '/index/images/', reader: { type: 'json', root: 'images' } } }); Ext.regModel('Data1', { fields: [ {type: 'string', name: 'id'}, {type: 'string', name: 'name'} ] }); Ext.regModel('Data2', { fields: [ {type: 'string', name: 'id'}, {type: 'string', name: 'name'} ] }); Ext.regModel('Data3', { fields: [ {type: 'string', name: 'id'}, {type: 'string', name: 'name'} ] }); Ext.regModel('Data4', { fields: [ {type: 'string', name: 'id'}, {type: 'string', name: 'name'} ] }); Ext.regModel('Data5', { fields: [ {type: 'string', name: 'id'}, {type: 'string', name: 'name'}, {type: 'string', name: 'family'} ] }); var data1 = Ext.create('Ext.data.Store', { model: 'Data1', data: record_status }); var data_gp_country = Ext.create('Ext.data.Store', { model: 'Data2', data: country_of_origin }); var data4 = Ext.create('Ext.data.Store', { model: 'Data4', data: genus }); var data5 = Ext.create('Ext.data.JsonStore', { model: 'Data5', proxy: { type: 'ajax', url : '/query_ipni.php', reader: 'json', timeout: 5200000 } }); var data_tx_vardo_autorius_lo = Ext.create('Ext.data.JsonStore', { model: 'Data4', proxy: { type: 'ajax', url : '/query_ipni_author0.php', reader: 'json', timeout: 20000 } }); var data_tx_vidurus_taksono_epitetas_lo = Ext.create('Ext.data.JsonStore', { model: 'Data4', proxy: { type: 'ajax', url : '/query_ipni_species.php', reader: 'json', timeout: 22000 } }); var data_tx_vidurus_epiteto_vardo_aut_lo = Ext.create('Ext.data.JsonStore', { model: 'Data4', proxy: { type: 'ajax', url : '/query_ipni_author.php', reader: 'json', timeout: 22000 } }); var data_acc_salis = Ext.create('Ext.data.JsonStore', { model: 'Data4', proxy: { type: 'ajax', url : '/query_country.php', reader: 'json', timeout: 22000 } }); var data_tx_b2_hybrid_species = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_tx_b2_hybrid_species }); var data_gp_lytis = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_lytis }); var data_gp_gyvenimo_forma = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_gyvenimo_forma }); var data_gp_taksono_rangas_lt = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_taksono_rangas_lt }); var data_gp_apsauga_iucn = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_apsauga_iucn }); var data_gp_apsauga_lr = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_apsauga_lr }); var data_gp_pvz_statusas = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_pvz_statusas }); var data_gp_pvz_kilme = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_pvz_kilme }); var data_gp_padauginimo_budas = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_padauginimo_budas }); var data_gp_apibudinimo_lygis = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_apibudinimo_lygis }); var data_gp_metai = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_metai }); var data_gp_taksono_rangas = Ext.create('Ext.data.Store', { model: 'Data1', data: gp_taksono_rangas }); var data_pp_kolekcininkas = Ext.create('Ext.data.Store', { model: 'Data1', data: pp_kolekcininkas }); var data_pp_apibudintojas = Ext.create('Ext.data.Store', { model: 'Data1', data: pp_apibudintojas }); ComboCountry = Ext.extend(Ext.form.ComboBox, { initComponent:function() { Ext.apply(this, { store: data_gp_country, displayField:'name', valueField:'id', hiddenName : 'ORIGCTY', typeAhead: true, mode: 'local', forceSelection: true, triggerAction: 'all', emptyText:'', selectOnFocus:true }); ComboCountry.superclass.initComponent.apply(this, arguments); } }); Ext.QuickTips.init(); var bd = Ext.getBody(); /* * ================ Form 3 ======================= */ //bd.createChild({tag: 'h2', html: 'Form 3 - A little more complex'}); var top = Ext.create('Ext.form.Panel', { frame:true, title: 'Paieška', id: 'search-form', bodyStyle:'padding:10px 10px 0', border:false, width: 900, buttonAlign: 'left', collapsed: false, // initially collapse the group collapsible: false, fieldDefaults: { labelAlign: 'left', msgTarget: 'side' }, items: [ { xtype: 'container', anchor: '100%', layout:'column', items:[{ xtype: 'container', columnWidth:.50, layout: 'anchor', defaults:{ labelWidth :130 }, items: [{ xtype:'textfield', fieldLabel: 'Laisvo teksto paieška', name: 'free_text_search', anchor:'96%' }] },{ xtype: 'container', columnWidth:.50, layout: 'anchor', defaults:{ labelWidth :130 }, items: [{ xtype:'combobox', displayField: 'name', store: data4, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Gentis', anchor: '-150', labelWidth:130, id: 'gentis-searchbox', name: 'search_genus' }] }] } ], buttons: [{ text: 'Ieškoti' ,id:'address-search-button' ,handler: function () { //console.log(); Ext.getCmp("data-grid").store.proxy.extraParams=Ext.getCmp('search-form').getForm().getFieldValues(); //Ext.getCmp("data-grid").store.proxy.extraParams.foo2='b'; Ext.getCmp("data-grid").store.load(); //Ext.getCmp("data-grid").getStore().reload(); Ext.getCmp("data-grid").getView().refresh(); } },' ',{ text: 'Išvalyti' ,id:'address-cancel-button' ,handler: function () { Ext.getCmp("search-form").getForm().reset(); } }] }); top.render('app'); Ext.define('ImageModel', { extend: 'Ext.data.Model', fields: ['id', 'garden_code', 'record_status', 'tx_genus_gentis_lo', 'tx_rusies_epitetas_lo', 'tx_vidurus_taksono_rangas_lo','tx_vidurus_taksono_epitetas_lo','tx_veisle_cultivar_lo','tx_genus_gentis_lt','tx_rusies_epitetas_lt','tx_vidurus_taksono_rangas_lt','tx_vidurus_taksono_epitetas_lt','tx_veisle_cultivar_lt','tx_comment','tx_priklausomybe_klasei','tx_priklausomybe_seimai','gyvenimo_forma','lytis','iucn_apsaugos_kategorija','acc_number','acc_status','acc_donor','acc_kilme','acc_salis','acc_coordinates','kolekcininkas','padauginimo_budas','apibudinimo_lygis','apibudintojas','apibudinimo_data','apibudintojas_pastabos','bs_auginimo_vieta','pastabos_apie_bukle','informacija_apie_derejima','status' ,'tx_genus_gentis','tx_rusies_epitetas','tx_vidurus_taksono_rangas','tx_vidurus_taksono_epitetas','tx_veisle_cultivar','tx_vardo_autorius_lo','lr_apsaugos_kategorija','acc_vieta','g_comment','coords_lat','coords_long','coords_elev','coords_lat2','coords_long2','coords_elev2','tx_vidurus_epiteto_vardo_aut_lo','pvz_gavimo_data','tx_b2_hybrid_species','tx_b2_arealas'] }); Ext.define('HistoryModel', { extend: 'Ext.data.Model', fields: ['id','username','useragent','datetime','ip','action'] }); Ext.define('IndexPlantarumModel', { extend: 'Ext.data.Model', fields: ['id','acc_number','column2','column3'] }); // create the Data Store var store = Ext.create('Ext.data.JsonStore', { id: 'store', pageSize: 20, // allow the grid to interact with the paging scroller by buffering //buffered: true, model: 'IndexPlantarumModel', proxy: { type: 'ajax', url: '/indexplantarum/list', reader: { type: 'json', root: 'result' } } }); store.load(); var data_history = Ext.create('Ext.data.JsonStore', { model: 'HistoryModel', proxy: { type: 'ajax', url : '/index/history', reader: { type: 'json', root: 'result' } } }); //var sm = Ext.create('Ext.selection.CheckboxModel'); var grid = Ext.create('Ext.grid.Panel', { width: 900, height: 579, store: store, id:'data-grid', loadMask: true, remoteSort: true, viewConfig: { trackOver: true, emptyText: '
No records found.
', listeners: { itemdblclick: function(dataview, record, item, index, e) { //alert('itemdblclick'); //win_record_view(); win_record_view2(); }, itemclick: function(dataview, record, item, index, e) { // } } }, // grid columns columns:[{ id:'id' ,header:"id" ,sortable:false ,dataIndex:'id' ,hidden:true },{ xtype: 'rownumberer', width: 50, sortable: false },{ text: 'Pvz. nr.', width: 100, sortable: true, dataIndex: 'acc_number' },{ text: 'Augalo lotyniškas pavadinimas', width: 380, // flex:1, sortable: true, dataIndex: 'column2' },{ text: 'Pavyzdžio donoras ir gavimo data', width: 360, sortable: true, dataIndex: 'column3' }], stripeRows: true, tbar: [{ text:'Augalo paso duomenys' ,tooltip:'Peržiūrėti pasirinkto augalo paso duomenis' ,iconCls:'x-icon-public' ,handler:function() { win_view_public(); //if (Ext.getCmp('window-resources-form')) Ext.getCmp('window-resources-form').close(); //App.fn.win_resources_add(); } }], bbar: Ext.create('Ext.PagingToolbar', { store: store, displayInfo: true, displayMsg: 'Įrašų {0} - {1} iš {2}', emptyMsg: "Įrašų nerasta", beforePageText: 'Puslapis', afterPageText :'iš {0}', prevText:'Previous Page', nextText:'Next Page', refreshText:'Refresh', firstText:'First Page', lastText:'Last Page' }) }); //Įrašų {0} - {1} iš {2} //Displaying records {0} - {1} of {2} //No records to display //store.on('load', grid.getSelectionModel().restoreSelection, grid.getSelectionModel()); //win_record_view2 Ext.define('MyApp.MainForm', { extend: 'Ext.form.FormPanel', alias: 'widget.mainform', initComponent: function() { Ext.apply(this, { items: [{ xtype:'form', frame:false, border:false, bodyStyle: 'padding:2px; background-color:#DFE9F6', defaults: { anchor: '100%' }, items: [{ layout:'column', border:false, frame:false, bodyStyle: 'padding:5px; background-color:#DFE9F6', items:[{ columnWidth:.5, bodyStyle: 'background-color:#DFE9F6', border:false, layout: 'anchor', defaultType: 'textfield', items: [{ id:'id' ,name:'id' ,fieldLabel: 'ID' ,hidden:true },{ xtype:'textfield', allowBlank: false, fieldLabel: 'Pavyzdžio Nr.*', anchor: '-60', labelWidth:150, name: 'acc_number' }] },{ columnWidth:.5, border:false, layout: 'anchor', defaultType: 'textfield', bodyStyle: 'background-color:#DFE9F6', items: [] }] },{ xtype:'tabpanel', border:true, frame:false, plain:true, activeTab: 0, height:340, bodyStyle:'padding:8px; background-color:#DFE9F6', defaults:{bodyStyle:'padding:5px; background-color:#DFE9F6'}, items:[{ title:'Taksonomija', defaults: {width: 830}, defaultType: 'textfield', items: [{ xtype: 'container', anchor: '99%', layout:'column', items:[{ xtype: 'container', columnWidth:.475, layout: 'anchor', defaults: { labelWidth:170 }, items: [ { xtype: 'fieldset', title: 'LOTYNIŠKAI', bodyStyle:'margin-right:20px', autoHeight: true, collapsed: false, // initially collapse the group collapsible: false, items: [ { //IPNI [5] xtype:'combobox', allowBlank: false, fieldLabel: 'Gentis *', name: 'tx_genus_gentis_lo', anchor:'99%', displayField: 'name', queryMode: 'local', typeAhead: true, store: data4, id:'tx_genus_gentis_lo', labelWidth:170, listeners: { change: function(){ //console.log(Ext.getCmp('tx_genus_gentis_lo')); //Ext.getCmp('tx_rusies_epitetas_lo').store.load(); //console.log(Ext.getCmp('tx_rusies_epitetas_lo').store.getTotalCount()); Ext.getCmp('tx_rusies_epitetas_lo').store.removeAll(); } } },{ //IPNI [8] xtype:'combobox', allowBlank: true, fieldLabel: 'Rūšies epitet.', name: 'tx_rusies_epitetas_lo', id:'tx_rusies_epitetas_lo', anchor:'99%', displayField: 'name', queryMode: 'local', store: data5, labelWidth:170, listeners: { beforequery: function(){ //console.log(Ext.getCmp('tx_genus_gentis_lo')); this.store.proxy.extraParams = { genus: Ext.getCmp('tx_genus_gentis_lo').rawValue } Ext.getCmp('tx_rusies_epitetas_lo').store.load(); //if (Ext.getCmp('tx_rusies_epitetas_lo').store.totalCount==undefined) { // Ext.getCmp('tx_rusies_epitetas_lo').store.load(); //} }, change: function(a){ if (a.valueModels) { if (a.valueModels[0]) { Ext.getCmp('tx_priklausomybe_seimai').setValue(a.valueModels[0].raw.family); //console.log(a.valueModels[0].raw.tx_vardo_autorius_lo); //Ext.getCmp('tx_vardo_autorius_lo').setValue(a.valueModels[0].raw.tx_vardo_autorius_lo); } } } } },{ //IPNI [9] xtype:'combobox', allowBlank: true, fieldLabel: 'Vardo autorius', name: 'tx_vardo_autorius_lo', id:'tx_vardo_autorius_lo', labelWidth:170, anchor:'99%', displayField: 'name', queryMode: 'local', store: data_tx_vardo_autorius_lo, listeners: { beforequery: function(){ //console.log(Ext.getCmp('tx_genus_gentis_lo')); this.store.proxy.extraParams = { genus: Ext.getCmp('tx_genus_gentis_lo').rawValue, species: Ext.getCmp('tx_rusies_epitetas_lo').rawValue } //if (Ext.getCmp('tx_vardo_autorius_lo').store.totalCount==undefined) { Ext.getCmp('tx_vardo_autorius_lo').store.load(); //} }, change: function(a){ if (this.getValue() === null) { this.reset(); } } //change: function(a){ //if (a.valueModels) { //if (a.valueModels[0]) { //Ext.getCmp('tx_priklausomybe_seimai').setValue(a.valueModels[0].raw.family); //console.log(a.valueModels[0].raw.tx_vardo_autorius_lo); //Ext.getCmp('tx_vardo_autorius_lo').setValue(a.valueModels[0].raw.tx_vardo_autorius_lo); //} //} //} } },{ xtype:'combobox', displayField: 'name', allowBlank: true, store: data_gp_taksono_rangas, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Vidurūš. taksono rangas', name: 'tx_vidurus_taksono_rangas_lo', anchor:'99%', labelWidth:170, listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }, { //IPNI [5]+[8]=[10] xtype:'combobox', allowBlank: true, fieldLabel: 'Vidurūš. taksono epitetas', name: 'tx_vidurus_taksono_epitetas_lo', id:'tx_vidurus_taksono_epitetas_lo', anchor:'99%', displayField: 'name', queryMode: 'local', store: data_tx_vidurus_taksono_epitetas_lo, labelWidth:170, listeners: { beforequery: function(){ //console.log(Ext.getCmp('tx_genus_gentis_lo')); this.store.proxy.extraParams = { genus: Ext.getCmp('tx_genus_gentis_lo').rawValue, species: Ext.getCmp('tx_rusies_epitetas_lo').rawValue } //if (Ext.getCmp('tx_vidurus_taksono_epitetas_lo').store.totalCount==undefined) { Ext.getCmp('tx_vidurus_taksono_epitetas_lo').store.load(); //} }, change: function(a){ if (this.getValue() === null) { this.reset(); } } //change: function(a){ //if (a.valueModels) { //if (a.valueModels[0]) { //Ext.getCmp('tx_priklausomybe_seimai').setValue(a.valueModels[0].raw.family); //console.log(a.valueModels[0].raw.tx_vardo_autorius_lo); //Ext.getCmp('tx_vardo_autorius_lo').setValue(a.valueModels[0].raw.tx_vardo_autorius_lo); //} //} //} } }, { xtype:'combobox', allowBlank: true, fieldLabel: 'Vidurūš. epiteto vardo aut.', name: 'tx_vidurus_epiteto_vardo_aut_lo', id:'tx_vidurus_epiteto_vardo_aut_lo', anchor:'99%', displayField: 'name', queryMode: 'local', store: data_tx_vidurus_epiteto_vardo_aut_lo, labelWidth:170, listeners: { beforequery: function(){ //console.log(Ext.getCmp('tx_genus_gentis_lo')); this.store.proxy.extraParams = { genus: Ext.getCmp('tx_genus_gentis_lo').rawValue, species: Ext.getCmp('tx_rusies_epitetas_lo').rawValue, tx_vidurus_taksono_epitetas_lo: Ext.getCmp('tx_vidurus_taksono_epitetas_lo').rawValue } //if (Ext.getCmp('tx_vidurus_epiteto_vardo_aut_lo').store.totalCount==undefined) { Ext.getCmp('tx_vidurus_epiteto_vardo_aut_lo').store.load(); //} }, change: function(a){ if (this.getValue() === null) { this.reset(); } } } }, { xtype:'textfield', fieldLabel: 'Veislė', name: 'tx_veisle_cultivar_lo', anchor:'99%', labelWidth:170 } ] },{ xtype:'textfield', fieldLabel: 'Pastabos dėl taksonom. prikl.', name: 'tx_comment', anchor:'99%', labelWidth:170 },{ xtype:'textfield', fieldLabel: 'Priklausomybė klasei', anchor:'99%', name: 'tx_priklausomybe_klasei', labelWidth:170 },{ xtype:'textfield', fieldLabel: 'Priklausomybė šeimai', name: 'tx_priklausomybe_seimai', anchor:'99%', id:'tx_priklausomybe_seimai', labelWidth:170 } ] },{ xtype: 'container', columnWidth:.05, layout: 'anchor', defaults: { labelWidth:170 }, items: [{html: " ",border:false, bodyStyle:'padding:8px; background-color:#DFE9F6'}] },{ xtype: 'container', columnWidth:.475, layout: 'anchor', defaults: { labelWidth:170 }, items: [{ xtype: 'fieldset', title: 'LIETUVIŠKAI', autoHeight: true, collapsed: false, // initially collapse the group collapsible: false, items: [ { xtype:'textfield', fieldLabel: 'Rūšies epitet.', name: 'tx_rusies_epitetas_lt', anchor:'99%', labelWidth:160 },{ xtype:'textfield', fieldLabel: 'Gentis', name: 'tx_genus_gentis_lt', anchor:'99%', labelWidth:160 }, {xtype: 'displayfield', value: ' '} ,{ xtype:'combobox', allowBlank: true, displayField: 'name', store:data_gp_taksono_rangas_lt, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Vidurūš. taksono rangas', name: 'tx_vidurus_taksono_rangas_lt', anchor:'99%', labelWidth:160, listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } },{ xtype:'textfield', fieldLabel: 'Vidurūš. taksono epitetas', name: 'tx_vidurus_taksono_epitetas_lt', anchor:'99%', labelWidth:160 },{ xtype:'combobox', allowBlank: true, displayField: 'name', store:data_tx_b2_hybrid_species, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Hibridinė rušis', name: 'tx_b2_hybrid_species', anchor:'60%', labelWidth:160, listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } } ,{xtype: 'displayfield', value: ' '} ] },{ xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_apsauga_iucn, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'IUCN apsaugos kategorija', name: 'iucn_apsaugos_kategorija', anchor:'99%', labelWidth:170, listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } },{ xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_apsauga_lr, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'LR apsaugos kategorija', name: 'lr_apsaugos_kategorija', anchor:'99%', labelWidth:170, listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } },{ xtype:'textfield', fieldLabel: 'Arealas', name: 'tx_b2_arealas', anchor:'99%', id:'tx_b2_arealas', labelWidth:170 } ] }] }] },{ title:'Pavyzdys ir jo kultivavimas', defaults: {width: 250}, fieldDefaults: { labelAlign: 'top', labelwidth:180, msgTarget: 'side' }, defaults: { border: false, xtype: 'panel', flex: 1, layout: 'anchor', bodyStyle:'background-color:#DFE9F6' }, bodyStyle:'background-color:#DFE9F6; padding:8px; padding-right:0px; padding-top:3px;', layout: 'hbox', items: [{ width:250 ,items: [ { xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_pvz_statusas, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Pavyzdžio statusas', anchor: '-40', labelWidth:180, name: 'acc_status', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }, { xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_pvz_kilme, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Pavyzdžio kilmė', anchor: '-40', labelWidth:180, name: 'acc_kilme', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }, { xtype:'combobox', displayField: 'name', store:data_gp_country, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Šalis donoras', anchor: '-40', labelWidth:180, id:'acc_salis', name: 'acc_salis', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } },{ xtype:'combobox', fieldLabel: 'Pavyzdžio donoras', name: 'acc_donor', id:'acc_donor', displayField: 'name', queryMode: 'remote', typeAhead: true, store: data_acc_salis, anchor: '-40', labelWidth:180, listeners: { //paspaudus ishsaugoti ishnyksta nes force+ //arba neduoti ishseivinti jeigu ranka suvesta blogas laukas //change: function(a){ // if (this.getValue() === null) { // this.reset(); // } //console.log('reset'); //} beforequery: function(){ //console.log(Ext.getCmp('tx_genus_gentis_lo')); this.store.proxy.extraParams = { country: Ext.getCmp('acc_salis').rawValue } } ,afterquery: function(){ //console.log('afterquery'); } /*, change: function(a){ if (a.valueModels) { if (a.valueModels[0]) { Ext.getCmp('tx_priklausomybe_seimai').setValue(a.valueModels[0].raw.family); //console.log(a.valueModels[0].raw.tx_vardo_autorius_lo); //Ext.getCmp('tx_vardo_autorius_lo').setValue(a.valueModels[0].raw.tx_vardo_autorius_lo); } } } */ } }, { xtype:'textfield', fieldLabel: 'Geografinė vieta', anchor: '-40', labelWidth:180, name: 'acc_vieta' },{ xtype: 'fieldset', collapsible: false, bodyStyle:'background-color:#DFE9F6; border:0px !important;', id:'coords-fieldset', frame:false, border:false, defaults: { labelWidth:180, anchor: '100%', layout: { type: 'hbox', defaultMargins: {top: 0, right: 5, bottom: 0, left: 0} } }, items: [{ xtype: 'fieldcontainer', fieldLabel: 'Koordinatės', id:'coords-fieldset-container', combineErrors: true, msgTarget: 'under', defaults: { hideLabel: true }, items: [ {xtype: 'textfield', emptyText: 'Lat.', fieldLabel: '', name: 'coords_lat', width: 58, margins: '0 7 0 0'}, {xtype: 'textfield', emptyText: 'Long.', fieldLabel: '', name: 'coords_long', width: 58, margins: '0 7 0 0'}, {xtype: 'textfield', emptyText: 'Elev.', fieldLabel: '', name: 'coords_elev', width: 58, margins: '0 7 0 0'} ] }] },{ xtype:'textfield', fieldLabel: 'Pvz. gavimo data', name: 'pvz_gavimo_data', emptyText: '(yyyy.mm.dd)', anchor: '-40', labelWidth:180 }, { xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_padauginimo_budas, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Padauginimo/Kultivavimo forma', anchor: '-40', labelWidth:180, name: 'padauginimo_budas', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }] }, { width:250 ,items: [{ xtype:'combobox', allowBlank: true, displayField: 'name', store: data_pp_kolekcininkas, queryMode: 'local', typeAhead: true, fieldLabel: 'Kolekcininkas (kuratorius)', anchor: '-56', labelWidth:150, name: 'kolekcininkas', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } },{ xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_apibudinimo_lygis, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Apibūdinimo lygis', anchor: '-56', labelWidth:150, name: 'apibudinimo_lygis', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }, { xtype:'combobox', allowBlank: true, displayField: 'name', store: data_pp_apibudintojas, queryMode: 'local', typeAhead: true, fieldLabel: 'Apibūdintojas', anchor: '-56', labelWidth:150, name: 'apibudintojas', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }, { xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_metai, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Apibūdininimo data', anchor: '-56', labelWidth:150, name: 'apibudinimo_data', listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }, { xtype:'textfield', fieldLabel: 'Pastabos dėl apibūdinimo', anchor: '-56', labelWidth:150, name: 'apibudintojas_pastabos' }, { xtype:'textfield', fieldLabel: 'Pavyzdžio auginimo vieta', anchor: '-56', labelWidth:150, name: 'bs_auginimo_vieta' },{ xtype: 'fieldset', collapsible: false, bodyStyle:'background-color:#DFE9F6; border:0px !important;', id:'coords-fieldset2', frame:false, border:false, defaults: { labelWidth:150, anchor: '100%', layout: { type: 'hbox', defaultMargins: {top: 0, right: 5, bottom: 0, left: 0} } }, items: [{ xtype: 'fieldcontainer', fieldLabel: 'Pvz. auginimo koordinatės', id:'coords-fieldset-container2', combineErrors: true, msgTarget: 'under', defaults: { hideLabel: true }, items: [ {xtype: 'textfield', emptyText: 'Lat.', fieldLabel: '', name: 'coords_lat2', width: 58, margins: '0 7 0 0'}, {xtype: 'textfield', emptyText: 'Long.', fieldLabel: '', name: 'coords_long2', width: 58, margins: '0 7 0 0'}, {xtype: 'textfield', emptyText: 'Elev.', fieldLabel: '', name: 'coords_elev2', width: 58, margins: '0 7 0 0'} ] }] }, { xtype:'textfield', fieldLabel: 'Pavyzdžio būklė (metai)', anchor: '-56', labelWidth:150, tooltip:'test', name: 'pastabos_apie_bukle' }, { xtype:'textfield', fieldLabel: 'Informacija apie derėjimą', anchor: '-56', labelWidth:150, name: 'informacija_apie_derejima' },{ xtype:'combobox', allowBlank: true, displayField: 'name', store: data_gp_gyvenimo_forma, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Gyvenimo forma', name: 'gyvenimo_forma', anchor: '-56', labelWidth:150, listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } },{ xtype:'combobox', displayField: 'name', store: data_gp_lytis, queryMode: 'local', typeAhead: true, forceSelection: true, fieldLabel: 'Lytis', name: 'lytis', anchor: '-56', labelWidth:150, listeners: { change: function(a){ if (this.getValue() === null) { this.reset(); } } } }] }] },{ title: 'Komentarai', layout: 'fit', items: { xtype: 'htmleditor', name: 'g_comment', fieldLabel: 'Komentarai' } },{ title: 'Nuotraukos', layout: 'vbox', items: [{ layout: 'hbox', width : 830, height:40, frame:false, border:false, bodyStyle:'background-color:#DFE9F6; padding:5px;', items: [ { xtype: 'filefield', emptyText: '', fieldLabel: 'Nauja nuotrauka #1', name: 'photo-path1', width : 230, labelWidth:120 },{html:'', border:false, width:60},{ xtype: 'filefield', emptyText: '', fieldLabel: 'Nauja nuotrauka #2', name: 'photo-path2', width : 230, labelWidth:120 },{html:'', border:false, width:60},{ xtype: 'filefield', emptyText: '', fieldLabel: 'Nauja nuotrauka #3', name: 'photo-path3', width : 230, labelWidth:120 } ] }, Ext.create('Ext.Panel', { id: 'images-view', frame: false, collapsible: false, width: 820, border:false, bodyStyle:'background-color:#DFE9F6; padding:0px;', items: Ext.create('Ext.view.View', { store: image_store, tpl: [ '', '
', '
', '{shortName}x', '
', '
', '
' ], multiSelect: true, height: 210, trackOver: true, overItemCls: 'x-item-over', itemSelector: 'div.thumb-wrap', emptyText: 'No images to display', plugins: [ Ext.create('Ext.ux.DataView.DragSelector', {}), Ext.create('Ext.ux.DataView.LabelEditor', {dataIndex: 'name'}) ], prepareData: function(data) { Ext.apply(data, { shortName: Ext.util.Format.ellipsis(data.name, 15), sizeString: Ext.util.Format.fileSize(data.size), dateString: Ext.util.Format.date(data.lastmod, "m/d/Y g:i a") }); return data; }, listeners: { selectionchange: function(dv, nodes ){ var l = nodes.length, s = l !== 1 ? 's' : ''; //this.up('panel').setTitle('Simple DataView (' + l + ' item' + s + ' selected)'); }, itemdblclick: function(a,b,c) { //console.log(a,b,c); //console.log(b.data.url); window.open('http://bsodas.ateisiu.lt/images/'+b.data.filename,'Image','width=800,height=600') } } }) }) ] }] }] }] }); MyApp.MainForm.superclass.initComponent.apply(this, arguments); } }); win_view_public = function (z) { if (Ext.getCmp('window-services-form')) Ext.getCmp('window-services-form').close(); var rec = Ext.getCmp('data-grid').getSelectionModel().getSelection(); console.log(rec); //var win; window.open("/indexplantarum/view/id/"+rec[0].internalId); } win_record_view2 = function (z) { if (Ext.getCmp('window-services-form')) Ext.getCmp('window-services-form').close(); var rec = Ext.getCmp('data-grid').getSelectionModel().getSelection(); console.log(rec); //var win; window.open("/indexplantarum/view/id/"+rec[0].internalId); } win_label_public = function (z) { if (Ext.getCmp('window-services-form')) Ext.getCmp('window-services-form').close(); var rec = Ext.getCmp('data-grid').getSelectionModel().getSelection(); //console.log(rec); //var win; //window.open("/public/label/id/"+rec[0].internalId); } win_history_view = function (z) { if (Ext.getCmp('window-services-form')) Ext.getCmp('window-services-form').close(); var rec = Ext.getCmp('data-grid').getSelectionModel().getSelection(); var win; win = new Ext.Window({ id:'window-services-form' ,width:870 ,height:450 ,autoScroll:true ,plain:false ,border:false ,modal:true ,buttonAlign:'left' ,layout:'fit' ,title: 'Pakeitimų istorija' ,listeners:{show:function() { this.loadMask = new Ext.LoadMask(this.body, { msg:'Prašome palaukti...' }); }} ,items :[ new Ext.grid.GridPanel({ bodyStyle: 'padding:0px;' ,plain: true ,border: false ,split: false ,height: 390 ,id:'grid-history' ,store:data_history ,bbar: Ext.create('Ext.PagingToolbar', { store:data_history, displayInfo: true, displayMsg: 'Įrašų {0} - {1} iš {2}', emptyMsg: "Įrašų nerasta" }) ,columns:[{ id:'id' ,header:"id" ,sortable:false ,dataIndex:'id' ,hidden:true },{ header:"Veiksmas" ,sortable:true ,width: 100 ,dataIndex:'action' },{ header:"Vartotojas" ,sortable:true ,width: 100 ,dataIndex:'username' },{ header:"Data" ,sortable:true ,width: 120 ,dataIndex:'datetime' },{ header:"IP adresas" ,sortable:true ,width: 100 ,dataIndex:'ip' },{ header:"Naršyklė" ,sortable:true ,flex:1 ,dataIndex:'useragent' }] ,viewConfig:{forceFit:true} }) ] ,buttons: [/*{ text: 'Open - RIBESCO photo' ,handler:function() { window.open(Ext.getCmp('ribesco1').value); } },{ text: 'Open - RIBESCO evaluation data' ,handler:function() { //console.log(Ext.getCmp('landlords-photo-id')); window.open(Ext.getCmp('ribesco2').value); } },*/'                                                                                                                                                                                                                                                               ',{ text: 'Uždaryti' ,handler : function(){ win.close(); } }] }); win.on('show', function() { Ext.getCmp('grid-history').store.load({ id:rec[0].internalId }); }); win.show(); } win_record_view = function (z) { if (Ext.getCmp('window-services-form')) Ext.getCmp('window-services-form').close(); //console.log(Ext.getCmp('data-grid').getSelectionModel()); var rec = Ext.getCmp('data-grid').getSelectionModel().getSelection(); //console.log(rec); var win; win = new Ext.Window({ id:'window-services-form' ,width:870 ,height:450 ,autoScroll:true ,plain:false ,border:false ,modal:true ,buttonAlign:'left' ,layout:'fit' ,title: 'View record' ,listeners:{show:function() { this.loadMask = new Ext.LoadMask(this.body, { msg:'Loading, please wait...' }); }} ,items :[{ frame:false, border:false, bodyStyle: 'padding:2px; background-color:#DFE9F6', xtype:'mainform', id:'edit-main-form', width: 800 }] ,buttons: [/*{ text: 'Open - RIBESCO photo' ,handler:function() { window.open(Ext.getCmp('ribesco1').value); } },{ text: 'Open - RIBESCO evaluation data' ,handler:function() { //console.log(Ext.getCmp('landlords-photo-id')); window.open(Ext.getCmp('ribesco2').value); } },*/{ text: 'Išsaugoti' ,handler : function(){ Ext.getCmp('edit-main-form').submit({ url:'/index/save' ,waitMsg:'Saugojami duomenys...' ,modal:false ,success: function() { //console.log(Ext.getCmp("data-grid").store); Ext.getCmp("data-grid").store.load(); win.close(); //window.location.reload(); //Ext.Msg.show({title:'Pranešimas',msg:'Įrašas sėkmingai išsaugotas',modal:true,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK}); } ,failure: function(a,b) { if (b) { if (b.result) { if (b.result.errors) { if (b.result.errors.reason) reason=b.result.errors.reason; else reason='Klaida nenurodyta.'; } else reason='Klaida #3.' + b.result.error; } else reason='Klaida #2.'; } else reason='Klaida #1.'; Ext.Msg.show({title:'Klaida',msg:reason,modal:true,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK}); } }); } },'                                                                                                                                                                                                                                    ',{ text: 'Uždaryti' ,handler : function(){ win.close(); } }] }); win.on('show', function() { if (z!='add') { var rec = Ext.getCmp('data-grid').getSelectionModel().getSelection(); Ext.getCmp("edit-main-form").loadRecord(rec[0]); image_store.proxy.extraParams = { id: rec[0].internalId } image_store.load(); } }); win.show(); } win_record_view_new = function (new_id) { if (Ext.getCmp('window-services-form')) Ext.getCmp('window-services-form').close(); //console.log(Ext.getCmp('data-grid').getSelectionModel()); //var rec = Ext.getCmp('data-grid').getSelectionModel().getSelection(); //console.log(rec); var win; win = new Ext.Window({ id:'records-form-1' ,width:870 ,height:450 ,autoScroll:true ,plain:false ,border:false ,modal:true ,buttonAlign:'left' ,layout:'fit' ,title: 'View record' ,listeners:{show:function() { this.loadMask = new Ext.LoadMask(this.body, { msg:'Loading, please wait...' }); }} ,items :[{ frame:false, border:false, bodyStyle: 'padding:2px; background-color:#DFE9F6', xtype:'mainform', id:'copied-form' }] ,buttons: [/*{ text: 'Open - RIBESCO photo' ,handler:function() { window.open(Ext.getCmp('ribesco1').value); } },{ text: 'Open - RIBESCO evaluation data' ,handler:function() { //console.log(Ext.getCmp('landlords-photo-id')); window.open(Ext.getCmp('ribesco2').value); } },*/{ text: 'Išsaugoti' ,handler : function(){ Ext.getCmp('copied-form').submit({ url:'/index/save' ,waitMsg:'Saugojami duomenys...' ,modal:false ,success: function() { //console.log(Ext.getCmp("data-grid").store); Ext.getCmp("data-grid").store.load(); win.close(); //window.location.reload(); //Ext.Msg.show({title:'Pranešimas',msg:'Įrašas sėkmingai išsaugotas',modal:true,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK}); } ,failure: function(a,b) { if (b) { if (b.result) { if (b.result.errors) { if (b.result.errors.reason) reason=b.result.errors.reason; else reason='Klaida nenurodyta.'; } else reason='Klaida #3.'; } else reason='Klaida #2.'; } else reason='Klaida #1.'; Ext.Msg.show({title:'Klaida',msg:reason,modal:true,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK}); } }); } },'                                                                                                                                                                                                                                    ',{ text: 'Uždaryti' ,handler : function(){ win.close(); } }] }); win.on('show', function() { Ext.getCmp('copied-form').load({ url:'/index/view/id/'+new_id ,waitMsg:'Kraunama, prašome palaukti...' ,params:{cmd:'load'} }); }); win.show(); } grid.render('grid'); }); function delete_image (id) { Ext.Ajax.request({ waitMsg: 'Please Wait', url: '/index/deleteimage', params: {id: id}, success: function(response, opts){ var obj = Ext.decode(response.responseText); //console.log(obj); //win_record_view_new(obj.new_id); window.location.reload(); }, failure: function(response, opts){ //console.log('fail'); } }); //console.log(document.getElementById(id).parentNode); }