function jurnal() { var ds_stpublish = store_stpublish(); var file = ""; var kdjurnal = ""; p = new Ext.Panel({ border: true, frame: true, style: 'margin-left: 50px;margin-bottom: 30px', width: 120, height: 135, html: '
IMAGE
' }); //VARIABEL DATA STORE// var ds_ejurnal = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'e_library/c_jurnal/grid_list_jurnal', method: 'POST' }), root: 'data', totalProperty: 'results', id: 'photoid', remoteSort: true, autoLoad: true, waitMsg: 'Mengunduh..', baseParams: { }, fields: [{ name: "kdjurnal", mapping: "kdjurnal" }, { name: "idjnsjurnal", mapping: "idjnsjurnal" }, { name: "nmjnsjurnal", mapping: "nmjnsjurnal" }, { name: "judul", mapping: "judul" }, { name: "penulis", mapping: "penulis" }, { name: "warganegara", mapping: "warganegara" }, { name: "tglterbit", mapping: "tglterbit" }, { name: "deskripsi", mapping: "deskripsi" }, { name: "file", mapping: "file" }, { name: "idstpublish", mapping: "idstpublish" }, { name: "nmstpublish", mapping: "nmstpublish" }, { name: "userid", mapping: "userid" }, { name: "tgluserinput", mapping: "tgluserinput" }, { name: "download", mapping: "download" }, { name: "url", mapping: "url" }, { name: "tipe", mapping: "tipe" }, { name: "dilihat", mapping: "dilihat" }, { name: "issn", mapping: "issn" }, { name: "cover", mapping: "cover" }, { name: "kdfakultas", mapping: "kdfakultas" }, { name: "kdprodi", mapping: "kdprodi" }, { name: "nmfakultas", mapping: "nmfakultas" }, { name: "nmprodi", mapping: "nmprodi" }] }); //LISTENER STATUS PUBLISH var fnSelectStPublish = function(combo, record){ var idstpublish = record.data['idstpublish']; updateStPublish(idstpublish); }; //VARIABEL KOLOM// var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { sortable: true // columns are not sortable by default }, columns: [ new Ext.grid.RowNumberer(), { header: RH.h3('ISSN'), width: 50, dataIndex: 'issn', sortable: true }, { header: RH.h3('Jenis Jurnal'), width: 100, dataIndex: 'nmjnsjurnal', sortable: true }, { header: RH.h3('Judul'), width: 150, dataIndex: 'judul', sortable: true }, { header: RH.h3('Penulis'), width: 150, dataIndex: 'penulis', sortable: true }, { header: RH.h3('Tanggal Terbit'), width: 100, dataIndex: 'tglterbit', sortable: true }, { header: RH.h3('Status Publish'), width: 120, dataIndex: 'nmstpublish', sortable: true, editor: RH.getComboEditor('idstpublish', false, ds_stpublish, 'idstpublish', 'nmstpublish', fnSelectStPublish), }, { header: RH.h3('Dilihat'), width: 70, dataIndex: 'dilihat', align: 'right', sortable: true, renderer: function(value, p, r) {return r.data['dilihat'] + ' Kali'} }, { header: RH.h3('Download'), width: 75, dataIndex: 'download', align: 'right', sortable: true, renderer: function(value, p, r) {return r.data['download'] + ' Kali'} }] }); var vw = new Ext.grid.GridView({ emptyText: '< Jurnal Belum Dipilih >' }); var sm_nya = new Ext.grid.CheckboxSelectionModel({ singleSelect:true, listeners: { // rowselect: select_action, // rowdeselect: deselect_action } }); var cari_data = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 200 })]; var paging = new Ext.PagingToolbar({ pageSize: 15, store: ds_ejurnal, displayInfo: true, displayMsg: 'Data Jurnal Dari {0} - {1} of {2}', emptyMsg: 'Jurnal Belum Dipilih.' }); //VARIABEL GRID// var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_ejurnal, frame: true, //height: 500, autoScroll: true, autoHeight: true, autoWidth: true, //plugins: cari_data, id: 'grid_det_product', buttonAlign: 'left', defaults: { anchor: '-10' }, forceFit: true, tbar: [{ xtype: 'buttongroup', title: 'Pencarian', columns: 4, width: 1000, defaults: { scale: 'small' }, items: [ //SEARCH JENIS JURNAL// { xtype:'checkbox', boxLabel: '', name: 'cbjjurnal', id: 'cbjjurnal', listeners: { change: function () { if (Ext.getCmp('cbjjurnal').getValue()==false) { Ext.getCmp('idjjurnal').setValue(""); Ext.getCmp('jjurnal').setValue(""); } } } }, { text: 'Jenis Jurnal' }, { xtype: 'textfield', name: 'jjurnal', id: 'jjurnal', readOnly:true, width: 250 }, { xtype: 'button', iconCls: 'silk-find', id: 'btn_data_jjurnal', width: 5, handler: function() { find_x("Data Jenis Jurnal", 15); } }, { xtype: 'textfield', name: 'idjjurnal', id: 'idjjurnal', hidden:true, readOnly:true }, //SEARCH ISSN// { xtype:'checkbox', boxLabel: '', name: 'cbissn', id: 'cbissn', listeners: { change: function () { if (Ext.getCmp('cbissn').getValue()==false) { Ext.getCmp('issn').setValue(""); } } } }, { text: 'ISSN' },{ xtype: 'textfield', name: 'issn', id: 'issn', width: 250, validator: function() { ds_ejurnal.setBaseParam('cbjjurnal', Ext.getCmp('cbjjurnal').getValue()); ds_ejurnal.setBaseParam('cbissn', Ext.getCmp('cbissn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('idjjurnal', Ext.getCmp('idjjurnal').getValue()); ds_ejurnal.setBaseParam('issn', Ext.getCmp('issn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, //SEARCH JUDUL// { xtype:'checkbox', boxLabel: '', name: 'cbjudul', id: 'cbjudul', listeners: { change: function () { if (Ext.getCmp('cbjudul').getValue()==false) { Ext.getCmp('judul').setValue(""); } } } }, { text: 'Judul' },{ xtype: 'textfield', name: 'judul', id: 'judul', width: 250, validator: function() { ds_ejurnal.setBaseParam('cbjjurnal', Ext.getCmp('cbjjurnal').getValue()); ds_ejurnal.setBaseParam('cbissn', Ext.getCmp('cbissn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('idjjurnal', Ext.getCmp('idjjurnal').getValue()); ds_ejurnal.setBaseParam('issn', Ext.getCmp('issn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' }, //SEARCH PENGARANG// { xtype:'checkbox', boxLabel: '', name: 'cbpengarang', id: 'cbpengarang', listeners: { change: function () { if (Ext.getCmp('cbpengarang').getValue()==false) { Ext.getCmp('pengarang').setValue(""); } } } }, { text: 'Penulis' },{ xtype: 'textfield', name: 'pengarang', id: 'pengarang', width: 250, validator: function() { ds_ejurnal.setBaseParam('cbjjurnal', Ext.getCmp('cbjjurnal').getValue()); ds_ejurnal.setBaseParam('cbissn', Ext.getCmp('cbissn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('idjjurnal', Ext.getCmp('idjjurnal').getValue()); ds_ejurnal.setBaseParam('issn', Ext.getCmp('issn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' }, //BUTTON CARI// { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, { xtype: 'button', text: ' Cari ', iconCls: 'silk-zoom', id: 'btn_data', width: 5, style: 'margin-left: 76px', handler: function() { ds_ejurnal.setBaseParam('cbjjurnal', Ext.getCmp('cbjjurnal').getValue()); ds_ejurnal.setBaseParam('cbissn', Ext.getCmp('cbissn').getValue()); ds_ejurnal.setBaseParam('cbjudul', Ext.getCmp('cbjudul').getValue()); ds_ejurnal.setBaseParam('cbpengarang', Ext.getCmp('cbpengarang').getValue()); ds_ejurnal.setBaseParam('idjjurnal', Ext.getCmp('idjjurnal').getValue()); ds_ejurnal.setBaseParam('issn', Ext.getCmp('issn').getValue()); ds_ejurnal.setBaseParam('judul', Ext.getCmp('judul').getValue()); ds_ejurnal.setBaseParam('pengarang', Ext.getCmp('pengarang').getValue()); ds_ejurnal.load(); } }, { xtype: 'label', text: '' } ] }, { xtype: 'button', text: ' Add ', iconCls: 'silk-add', id: 'btn_add', width: 5, style: 'margin-bottom: 100px', handler:function() { fnAddJurnal(); } }, { text: 'Edit', id: 'btn_edit', iconCls: 'silk-edit', style: 'margin-bottom: 100px', handler:function(){ if(sm_nya.getCount() > 0){ var module_id = sm_nya.getSelected().data['kdjurnal']; f_jurnal_form(module_id,ds_ejurnal); Ext.getCmp('kdprodi').enable(); } } }, { text: 'Delete', id: 'btn_delete', iconCls: 'silk-delete', style: 'margin-bottom: 100px', handler:function(){ if(sm_nya.getCount() > 0){ var delete_id = sm_nya.getSelected().data['kdjurnal']; Ext.MessageBox.show({ title: "Konfirmasi", msg: "Anda Yakin Untuk menghapus Data ini?", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { Ext.Ajax.request({ url: BASE_URL + 'e_library/c_jurnal/delete', method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Hapus Data Berhasil"); ds_ejurnal.load(); }, failure:function(result){ Ext.MessageBox.alert("Informasi", "Hapus Data Gagal"); }, params: { hapus_id: delete_id } }); } } }); } } } ], sm: sm_nya, vw: vw, cm: cm, bbar: paging, clicksToEdit: 1, listeners: { rowclick: function rowClick(grid, rowIdx) { var rec = ds_ejurnal.getAt(rowIdx); RH.setCompValue('frm.kdjurnal', rec.data['kdjurnal']); RH.setCompValue('frm.issn', rec.data['issn']); RH.setCompValue('frm.kdjnsjurnal', rec.data['nmjnsjurnal']); RH.setCompValue('frm.judul', rec.data['judul']); RH.setCompValue('frm.penulis', rec.data['penulis']); RH.setCompValue('frm.warganegara', rec.data['warganegara']); RH.setCompValue('frm.tglterbit', rec.data['tglterbit']); RH.setCompValue('frm.fakultas', rec.data['nmfakultas']); RH.setCompValue('frm.prodi', rec.data['nmprodi']); RH.setCompValue('frm.deskripsi', rec.data['deskripsi']); isi_gambar_jurnal(rec.data['cover']); Ext.getCmp('bdown').enable(); file = rec.data["file"]; kdjurnal = rec.data["kdjurnal"]; } } }); //DISPLAY FORM PANEL// var DispPanel = new Ext.form.FormPanel({ id: 'fp.mhsFDisp', fileUpload: true, border: false, autoScroll:true, bodyStyle: 'padding:5px 5px 0', frame: true, labelAlign: 'top', layout: 'anchor', forceFit:true, items: [ { layout: 'form', defaultType: 'textfield', defaults: { readOnly: true }, items: [ p , { id: 'frm.kdjurnal', fieldLabel: 'Kode' ,width: 225, height:24, hidden: true} , { id: 'frm.issn', fieldLabel: 'ISSN' ,width: 225, height:24} , { id: 'frm.kdjnsjurnal', fieldLabel: 'Jenis Jurnal' ,width: 225, height:24} , { id: 'frm.judul', fieldLabel: 'Judul' ,width: 225, height:50, xtype: 'textarea'} , { id: 'frm.penulis', fieldLabel: 'Penulis' ,width: 225, height:24} , { id: 'frm.warganegara', fieldLabel: 'Warga Negara' ,width: 225, height:24} , { id: 'frm.tglterbit', fieldLabel: 'Tanggal Terbit' ,width: 225, height:24} , { id: 'frm.fakultas', fieldLabel: 'Fakultas' ,width: 225, height:24} , { id: 'frm.prodi', fieldLabel: 'Prodi' ,width: 225, height:24} , { id: 'frm.deskripsi', fieldLabel: 'Deskripsi' ,width: 225, height:500, xtype: 'textarea'} , { xtype: 'button', id: 'bdown', text: 'Download', disabled: true, width: 75, handler: function() { window.open('/resources/jurnal/' + file, '_blank'); Ext.Ajax.request({ url: BASE_URL + 'e_library/c_jurnal/update_download', method: 'POST', params: { kdjurnal:kdjurnal, pengguna:USERNAME }, success: function(response) { ds_ejurnal.reload(); } }); } } ] }] }); //FUNCTION// //add// function fnAddJurnal(){ f_jurnal_form('',ds_ejurnal); } /**FUNCTIONS UPDATE GRID KELAS*/ function updateStPublish(idstpublish){ Ext.Ajax.request({ url: BASE_URL + 'e_library/c_jurnal/update_stpublish', params: { kdjurnal : RH.getCompValue('frm.kdjurnal'), idstpublish : idstpublish, }, success: function() { Ext.Msg.alert("Info", "Ubah Berhasil"); ds_ejurnal.reload(); }, failure: function() { Ext.Msg.alert("Info", "Ubah Data Gagal"); } }); } //=================================================== AWAL// var jurnalPanel = new Ext.Panel({ layout: 'border', defaults: { collapsible: true, split: true }, items: [{ collapsible: false, title: "E-Jurnal", region: 'center', id: 'images-view', items: [grid_nya], }, { region: 'east', xtype: 'panel', title: 'Detail Jurnal', border: true, layout:'fit', width:270, collapsible: true, collapseMode: 'header', titleCollapse: true, titleAlign: 'center', items: [DispPanel], collapsed: false }], listeners: { 'afterrender': function() { } } }); get_content(jurnalPanel); }