Closed demacus closed 8 years ago
I could not get it ported to the actual framework but here is pretty much the base of it, may you can insert it or at least give me a hint on how to declare the needed fields in symfony fw.
That's pretty easy, you create a public or private property in the model file, run php app/console doctrine:schema:update --force
then re-generate your environment and you have both a new database field as well as accessing the newly added property within ExtJS.
No feedback given for an extended period of time, closing. Feel free to re-open if required.
Hi there, since my Partkeepr install (as of 2013) is now somehow broken cause of an Doctrine error I did an update. I forgot I had a little hack on my install which was basically a part lookup on Farnell website with a simple parser which filled my part editor fields.
I could not get it ported to the actual framework but here is pretty much the base of it, may you can insert it or at least give me a hint on how to declare the needed fields in symfony fw.
`` /**
The PartEditor provides an editing form for a part. It contains multiple tabs, one for each nested record.
*/ Ext.define('PartKeepr.PartEditor', { extend: 'PartKeepr.Editor',
// Assigned model model: 'PartKeepr.Part',
// Layout stuff border: false, layout: 'fit', bodyStyle: 'background:#DBDBDB;',
/**
this.nameField = Ext.create("Ext.form.field.Text", { id: 'nameField', name: 'name', fieldLabel: i18n("Name"), allowBlank: false, labelWidth: 150 });
this.storageLocationComboBox = Ext.create("PartKeepr.StorageLocationComboBox", { fieldLabel: i18n("Storage Location"), name: 'storageLocation', id: 'storageLocationId', allowBlank: false, labelWidth: 150 });
this.storageLocationComboBox.store.on("load", function () { // Re-trigger validation because of asynchronous loading of the storage location field, // which would be marked invalid because validation happens immediately, but after loading // the storage locations, the field is valid, but not re-validated.
}, this);
this.footprintNone = Ext.create("Ext.form.field.Radio", { boxLabel: i18n("None"), name: 'footprint_mode', margin: { right: 5 }, value: "unset", listeners: { scope: this, change: function (field, newValue) { if (newValue === true) { this.footprintComboBox.clearValue(); } } } });
this.footprintSet = Ext.create("Ext.form.field.Radio", { name: 'footprint_mode', margin: { right: 5 }, value: "set" });
/*
// Defines the basic editor fields var basicEditorFields = [ this.nameField, { id: 'descField', xtype: 'textfield', fieldLabel: i18n("Description"), name: 'description' },{ layout: 'column', bodyStyle: 'background:#DBDBDB', border: false, items: [{ xtype: 'numberfield', fieldLabel: i18n('Minimum Stock'), allowDecimals: false, allowBlank: false, labelWidth: 150, name: 'minStockLevel', id: 'minStockLevelField', value: 0, columnWidth: 0.5, minValue: 0 },{ xtype: 'PartUnitComboBox', fieldLabel: i18n("Part Unit"), columnWidth: 0.5, margin: "0 0 0 5", name: 'partUnit', value: PartKeepr.getApplication().getDefaultPartUnit().get("id") }] },{ xtype: 'CategoryComboBox', fieldLabel: i18n("Category"), name: 'category' }, this.storageLocationComboBox, { xtype: 'fieldcontainer', layout: 'hbox', fieldLabel: i18n("Footprint"), defaults: { hideLabel: true }, items: [ this.footprintNone, this.footprintSet, this.footprintComboBox ] },{ xtype: 'textarea', fieldLabel: i18n("Comment"), id: 'commentField', name: 'comment', anchor: '100% ' }, { xtype: 'fieldcontainer', layout: 'hbox', fieldLabel: i18n("Status"), defaults: { hideLabel: true }, items: [{ xtype: 'textfield', fieldLabel: i18n("Status"), flex: 1, name: 'status' },{ xtype: 'checkbox', hideEmptyLabel: false, fieldLabel: '', margins: { left: 5 }, boxLabel: i18n("Needs Review"), name: 'needsReview' }] },{ xtype: 'textfield', fieldLabel: i18n("Condition"), name: 'partCondition' },{ xtype: 'fieldcontainer', layout: 'hbox', items : [{ xtype: 'textfield', labelWidth: 150, fieldLabel: i18n("Internal Part Number"), name: 'internalPartNumber', flex: 1 },{ xtype: 'displayfield', margins: { left: 5 }, fieldLabel: i18n("Internal ID"), name: 'id' }]
// Creates the distributor grid this.partDistributorGrid = Ext.create("PartKeepr.PartDistributorGrid", { title: i18n("Distributors"), iconCls: 'icon-lorry', layout: 'fit', deferredRender: false });
// Creates the manufacturer grid this.partManufacturerGrid = Ext.create("PartKeepr.PartManufacturerGrid", { title: i18n("Manufacturers"), iconCls: 'icon-building', layout: 'fit', deferredRender: false });
// Creates the parameter grid this.partParameterGrid = Ext.create("PartKeepr.PartParameterGrid", { title: i18n("Parameters"), id: 'partParameterGrid', iconCls: 'icon-table', layout: 'fit', deferredRender: false });
// Creates the attachment grid this.partAttachmentGrid = Ext.create("PartKeepr.PartAttachmentGrid", { title: i18n("Attachments"), iconCls: 'icon-attach', layout: 'fit', deferredRender: false });
// Adds stock level fields for new items if (this.partMode && this.partMode == "create") { this.initialStockLevel = Ext.create("Ext.form.field.Number", { fieldLabel: i18n("Initial Stock Level"), name: "initialStockLevel", id: 'initialStock', labelWidth: 150, columnWidth: 0.5 });
}
// Create a tab panel of all fields this.items = { xtype: 'tabpanel', border: false, plain: true, items: [{ iconCls: 'icon-brick', xtype: 'panel', border: false, autoScroll: false, layout: 'anchor', defaults: { anchor: '100%', labelWidth: 150 }, bodyStyle: 'background:#DBDBDB;padding: 10px;', title: i18n("Basic Data"), items: basicEditorFields }, this.partDistributorGrid, this.partManufacturerGrid, this.partParameterGrid, this.partAttachmentGrid ] };
this.on("startEdit", this.onEditStart, this, { delay: 200 }); this.on("itemSaved", this._onItemSaved, this);
this.addEvents("partSaved", "titleChange");
this.callParent();
this.on("itemSave", this.onItemSave, this);
}, onLookupClick: function () { var lookupSrc = "http://de.farnell.com/jsp/search/browse.jsp;?N=0&Ntk=gensearch&Ntt="+Ext.getCmp('lookupSku').getValue(); new Ext.Window({ title : i18n("Part Lookup"), width : 850, height: 700, maximizable: true, constrain: true, layout : 'fit', items : [{ xtype : "component", flex : 1, width: '100%', id : 'lookupWindow', autoEl : { tag : "iframe", id: 'lookupSkuSurfedUrl', src : lookupSrc, } }] }).show(); }, onParseClick: function () { var partkeeprUrl = "http://127.0.0.1/PartKeepr/frontend/rest.php"; / categoryName: "" categoryPath: "" footprint: 0 footprintName: "" needsReview: false storageLocation: 0 storageLocationName: "" /
var partBody = Ext.get('lookupWindow').dom.contentWindow.document.body; var pdContainer = partBody.getElementsBySelector('#pdContainer'); //console.log(pdContainer); var partBasicData = partBody.getElementsBySelector('dd'); //console.log(partBasicData);
}, lookupCategorys: function () { var categoryList = "http://de.farnell.com/"; new Ext.Window({ title : i18n("Category Lookup"), width : 640, height: 600, maximizable: true, constrain: true, layout : 'fit', items : [{ xtype : "component", flex : 1, width: '100%', id : 'catlookupWindow', autoEl : { tag : "iframe", src : categoryList, } }] }).show(); }, parseCategorys: function () { var catBody = Ext.get('catlookupWindow').dom.contentWindow.document.body; var catRaw = catBody.getElementsBySelector('.hasSubMenu'); var catId = 1; for ( var i=0; i<catRaw.length; i++) { var listRaw = catRaw[i].getElementsBySelector('li'); var tmpstr = catRaw[i].innerText; //console.log( tmpstr.substr(0,tmpstr.length-1) ); catId ++; var pId = catId; Ext.Ajax.request({ url: 'http://127.0.0.1/partkeepr/frontend/rest.php/PartCategory', method:'POST', params:{ id:catId, name:tmpstr.substr(0,tmpstr.length-1), text:"", description:"", parent:1, parentId:0, leaf:false, }, async: false, scope:this }); for ( var j=0; j<listRaw.length; j++) { tmpstr = listRaw[j].innerText; catId ++; Ext.Ajax.request({ url: 'http://127.0.0.1/partkeepr/frontend/rest.php/PartCategory', method:'POST', params:{ id:catId, name:tmpstr.substr(tmpstr.search("[a-zA-ZäöüÄÖÜ]"), tmpstr.search("[0-9]")-4-tmpstr.search("[a-zA-Z]äöüÄÖÜ") ), text:"", description:"", parent:pId, parentId:0, leaf:false, }, async: false, scope:this }); //console.log(tmpstr.substr( tmpstr.search("[a-zA-ZäöüÄÖÜ]"), tmpstr.search("[0-9]")-4-tmpstr.search("[a-zA-Z]äöüÄÖÜ") )); }; } },
/* lookupFootprints: function () { var mySrc = "http://www.ti.com/sc/docs/psheets/type/type.html"; new Ext.Window({ title : i18n("Footprint Lookup"), width : 640, height: 600, maximizable: true, constrain: true, layout : 'fit', items : [{ xtype : "component", flex : 1, width: '100%', id : 'fplookupWindow', autoEl : { tag : "iframe", src : mySrc, } }] }).show(); }, /* parseFootprints: function () { var partkeeprUrl = "http://127.0.0.1/PartKeepr/frontend/rest.php"; var src = "http://www.ti.com"; var fpTypeLinks = Ext.get('fplookupWindow').dom.contentWindow.document.getElementsByTagName('tbody')[1].getElementsByTagName('a'); console.log(fpTypeLinks); console.log(fpTypeLinks.length); //startID var fpid = 9; for (var i=0; i<fpTypeLinks.length; i++) { fpid ++; var pfpid = fpid; //make category request Ext.Ajax.request({ url: partkeeprUrl+"FootprintCategory?", method:'POST', params:{ id:0, name:"test", text:"", description:"test", parent:1, parentId:0, leaf:false }, async: false, scope:this });
// },
``
Thats my PartEditor.js, this worked pretty well for me since 2013... Best regards