commit 2f5cd9008ee878a9172c25db23ac24541480edc4
parent ef0b7bfd0fcd4f027f073543648a470a5c68ac29
Author: Felicitus <felicitus@felicitus.org>
Date: Tue, 27 Aug 2013 17:29:30 +0200
Merge branch 'master' of github.com:partkeepr/PartKeepr
Diffstat:
3 files changed, 136 insertions(+), 91 deletions(-)
diff --git a/src/frontend/js/Components/Grid/GridMenuPlugin.js b/src/frontend/js/Components/Grid/GridMenuPlugin.js
@@ -23,18 +23,23 @@ Ext.define("PartKeepr.GridMenuPlugin", {
text: i18n("Export"),
icon: 'resources/fugue-icons/icons/application-export.png',
menu: [{
+ icon: 'resources/mimetypes/csv.png',
+ text: 'Export as semicolon-delimited CSV (.csv)',
+ handler: this.exportSSV,
+ scope: this
+ },{
icon: 'resources/mimetypes/csv.png',
- text: 'Export as CSV (.csv)',
+ text: i18n('Export as comma-delimited CSV (.csv)'),
handler: this.exportCSV,
scope: this
- },{
+ },,{
icon: 'resources/fugue-icons/icons/blue-document-excel.png',
- text: 'Export as Excel XML (.xlsx)',
+ text: i18n('Export as Excel XML (.xlsx)'),
handler: this.exportXLSX,
scope: this
},{
icon: 'resources/icons/mediawiki_icon.png',
- text: 'Export as MediaWiki table (.txt)',
+ text: i18n('Export as MediaWiki table (.txt)'),
handler: this.exportWiki,
scope: this
}]
@@ -60,8 +65,20 @@ Ext.define("PartKeepr.GridMenuPlugin", {
* Exports the grid to CSV
*/
exportCSV: function () {
- this.doExport(Ext.ux.exporter.Exporter.exportAny(this.grid, "csv", {}), this.getExportFilename() + ".csv");
+ var csvFormatter = Ext.ux.exporter.Exporter.getFormatterByName("csv");
+ csvFormatter.separator = ",";
+
+ this.doExport(Ext.ux.exporter.Exporter.exportAny(this.grid, csvFormatter, {}), this.getExportFilename() + ".csv");
},
+ /**
+ * Exports the grid to SSV (semicolon separated file)
+ */
+ exportSSV: function () {
+ var csvFormatter = Ext.ux.exporter.Exporter.getFormatterByName("csv");
+ csvFormatter.separator = ";";
+
+ this.doExport(Ext.ux.exporter.Exporter.exportAny(this.grid, "csv", {}), this.getExportFilename() + ".csv");
+ },
/**
* Exports the grid to MediaWiki format
*/
diff --git a/src/frontend/js/Components/Part/PartDisplay.js b/src/frontend/js/Components/Part/PartDisplay.js
@@ -67,8 +67,16 @@ Ext.define('PartKeepr.PartDisplay', {
'<td class="e">'+i18n("Used in projects")+':</td>',
'<td class="e">{[ (values.projects == "") ? "'+i18n("none")+'" : values.projects ]}</td>',
'</tr>',
+ '<tr>',
+ '<td class="o">'+i18n("Attachments")+':</td>',
+ '<td class="o">' +
+ '<tpl for="values.processedAttachments">' +
+ '<p><a href="{link}" target="_blank">{data.originalFilename}</a></p>' +
+ '</tpl>' +
+ '</td>' +
+ '</tr>',
'</table>');
-
+
/**
* Create the "add stock" button
*/
@@ -138,10 +146,18 @@ Ext.define('PartKeepr.PartDisplay', {
values[i] = r.data[i];
}
}
-
+
+ values.processedAttachments = this.record.attachments().data;
+
+ for (var i=0;i<values.processedAttachments.getCount();i++) {
+ var data = values.processedAttachments.getAt(i);
+
+ data.link = "file.php?type=PartAttachment&id="+data.internalId;
+ }
+
this.tpl.overwrite(this.infoContainer.getEl(), values);
this.imageDisplay.setStore(this.record.attachments());
-
+
this.doLayout();
// Scroll the container to top in case the user scrolled the part, then switched to another part
this.getTargetEl().scrollTo("top", 0);
diff --git a/src/frontend/js/Components/StorageLocation/StorageLocationEditor.js b/src/frontend/js/Components/StorageLocation/StorageLocationEditor.js
@@ -1,85 +1,97 @@
Ext.define('PartKeepr.StorageLocationEditor', {
- extend: 'PartKeepr.Editor',
- alias: 'widget.StorageLocationEditor',
- saveText: i18n("Save Storage Location"),
-
- layout: 'column',
-
- initComponent: function () {
- var config = {};
-
- Ext.Object.merge(config, {
- autoLoad: false,
- model: "PartKeepr.Part",
- autoSync: false, // Do not change. If true, new (empty) records would be immediately commited to the database.
- remoteFilter: true,
- remoteSort: true,
- proxy: PartKeepr.getRESTProxy("Part"),
- pageSize: 15});
-
- this.store = Ext.create('Ext.data.Store', config);
-
- this.gridPanel = Ext.create("PartKeepr.BaseGrid", {
- store: this.store,
- columnLines: true,
- columns: [
- {
- header: i18n("Name"),
- dataIndex: 'name',
- flex: 1,
- minWidth: 200,
- renderer: Ext.util.Format.htmlEncode
- },{
- header: i18n("Qty"),
- width: 50,
- dataIndex: 'stockLevel'
- }
- ]
- });
-
- var container = Ext.create("Ext.form.FieldContainer", {
- fieldLabel: i18n("Contained Parts"),
- labelWidth: 110,
- layout: 'fit',
- height: 246,
- items: this.gridPanel
- });
-
-
-
- this.items = [{
- columnWidth: 1,
- minWidth: 500,
- layout: 'anchor',
- xtype: 'container',
- margin: '0 5 0 0',
- items: [{
- xtype: 'textfield',
- name: 'name',
- anchor: '100%',
- labelWidth: 110,
- fieldLabel: i18n("Storage Location")
- },
- container
- ]},
- {
- width: 370,
- height: 250,
- xtype: 'remoteimagefield',
- name: 'image_id',
- imageType: 'storagelocation',
- imageWidth: 256,
- imageHeight: 256,
- labelWidth: 110,
- fieldLabel: i18n("Image")
- }];
-
- this.on("startEdit", this.onStartEdit, this);
- this.callParent();
- },
- onStartEdit: function () {
- this.store.getProxy().extraParams.storageLocation = this.record.get("id");
- this.store.load();
- }
-
+ extend: 'PartKeepr.Editor',
+ alias: 'widget.StorageLocationEditor',
+ saveText: i18n("Save Storage Location"),
+
+ layout: 'column',
+
+ initComponent: function () {
+ var config = {};
+
+ Ext.Object.merge(config, {
+ autoLoad: false,
+ model: "PartKeepr.Part",
+ autoSync: false, // Do not change. If true, new (empty) records would be immediately commited to the database.
+ remoteFilter: true,
+ remoteSort: true,
+ proxy: PartKeepr.getRESTProxy("Part"),
+ pageSize: 15
+ });
+
+ this.store = Ext.create('Ext.data.Store', config);
+
+ this.bottomToolbar = Ext.create("Ext.toolbar.Paging", {
+ store: this.store,
+ enableOverflow: true,
+ dock: 'bottom',
+ displayInfo: false
+ });
+
+ this.gridPanel = Ext.create("PartKeepr.BaseGrid", {
+ store: this.store,
+ columnLines: true,
+ dockedItems: [ this.bottomToolbar ],
+ columns: [
+ {
+ header: i18n("Name"),
+ dataIndex: 'name',
+ flex: 1,
+ minWidth: 200,
+ renderer: Ext.util.Format.htmlEncode
+ },
+ {
+ header: i18n("Qty"),
+ width: 50,
+ dataIndex: 'stockLevel'
+ }
+ ]
+ });
+
+ var container = Ext.create("Ext.form.FieldContainer", {
+ fieldLabel: i18n("Contained Parts"),
+ labelWidth: 110,
+ layout: 'fit',
+ height: 246,
+ items: this.gridPanel
+ });
+
+
+ this.items = [
+ {
+ columnWidth: 1,
+ minWidth: 500,
+ layout: 'anchor',
+ xtype: 'container',
+ margin: '0 5 0 0',
+ items: [
+ {
+ xtype: 'textfield',
+ name: 'name',
+ anchor: '100%',
+ labelWidth: 110,
+ fieldLabel: i18n("Storage Location")
+ },
+ container
+ ]
+ },{
+ width: 370,
+ height: 250,
+ xtype: 'remoteimagefield',
+ name: 'image_id',
+ imageType: 'storagelocation',
+ imageWidth: 256,
+ imageHeight: 256,
+ labelWidth: 110,
+ fieldLabel: i18n("Image")
+ }
+ ];
+
+ this.on("startEdit", this.onStartEdit, this);
+ this.callParent();
+ },
+ onStartEdit: function () {
+ this.store.getProxy().extraParams.storageLocation = this.record.get("id");
+ this.store.load();
+ }
+
});
\ No newline at end of file