diff --git a/cap-notebook/demoapp/app/admin-books/webapp/controller/custom.controller.js b/cap-notebook/demoapp/app/admin-books/webapp/controller/custom.controller.js
new file mode 100644
index 00000000..a7fd5a2a
--- /dev/null
+++ b/cap-notebook/demoapp/app/admin-books/webapp/controller/custom.controller.js
@@ -0,0 +1,33 @@
+sap.ui.define(
+ [
+ "sap/ui/core/mvc/ControllerExtension",
+ "sap/m/library"
+ ],
+ function (ControllerExtension,library) {
+ "use strict";
+
+ return ControllerExtension.extend("books.controller.custom", {
+ onRowPress: function(oContext) {
+ this.base.editFlow
+ .invokeAction("AdminService.openAttachment", {
+ contexts: oContext.getParameter("bindingContext")
+ })
+ .then(function (res) {
+ let odataurl = "";
+ if(res.getObject().value == "None") {
+ const lastSlashIndex = res.oModel.getServiceUrl().lastIndexOf('/');
+ let str = res.oModel.getServiceUrl();
+ if (lastSlashIndex !== -1) {
+ str = str.substring(0, lastSlashIndex) + str.substring(lastSlashIndex + 1);
+ }
+ odataurl = str+res.oBinding.oContext.sPath+"/content";
+ } else {
+ odataurl = res.getObject().value;
+ }
+ library.URLHelper.redirect(odataurl, true);
+
+ });
+ }
+ });
+ }
+);
\ No newline at end of file
diff --git a/cap-notebook/demoapp/app/admin-books/webapp/manifest.json b/cap-notebook/demoapp/app/admin-books/webapp/manifest.json
index fadc830a..3d92bc9b 100644
--- a/cap-notebook/demoapp/app/admin-books/webapp/manifest.json
+++ b/cap-notebook/demoapp/app/admin-books/webapp/manifest.json
@@ -117,6 +117,29 @@
"route": "AuthorsDetails"
}
}
+ },
+ "controlConfiguration": {
+ "attachments/@com.sap.vocabularies.UI.v1.LineItem": {
+ "tableSettings": {
+ "type": "ResponsiveTable",
+ "selectionMode": "Auto",
+ "rowPress": ".extension.books.controller.custom.onRowPress"
+ }
+ },
+ "references/@com.sap.vocabularies.UI.v1.LineItem": {
+ "tableSettings": {
+ "type": "ResponsiveTable",
+ "selectionMode": "Auto",
+ "rowPress": ".extension.books.controller.custom.onRowPress"
+ }
+ },
+ "footnotes/@com.sap.vocabularies.UI.v1.LineItem": {
+ "tableSettings": {
+ "type": "ResponsiveTable",
+ "selectionMode": "Auto",
+ "rowPress": ".extension.books.controller.custom.onRowPress"
+ }
+ }
}
}
}
@@ -133,6 +156,15 @@
}
}
},
+ "extends": {
+ "extensions": {
+ "sap.ui.controllerExtensions": {
+ "sap.fe.templates.ObjectPage.ObjectPageController#books::BooksDetailsList": {
+ "controllerName": "books.controller.custom"
+ }
+ }
+ }
+ },
"contentDensities": {
"compact": true,
"cozy": true
diff --git a/cap-notebook/demoapp/app/common.cds b/cap-notebook/demoapp/app/common.cds
index c9120dfe..51544538 100644
--- a/cap-notebook/demoapp/app/common.cds
+++ b/cap-notebook/demoapp/app/common.cds
@@ -59,22 +59,58 @@ annotate my.Books with @(UI : {HeaderInfo : {
annotate my.Books.attachments with @UI: {
HeaderInfo: {
- $Type : 'UI.HeaderInfoType',
- TypeName : '{i18n>Attachment}',
- TypeNamePlural: '{i18n>Attachments}',
+ $Type : 'UI.HeaderInfoType',
+ TypeName : '{i18n>Attachment}',
+ TypeNamePlural: '{i18n>Attachments}',
},
LineItem : [
- {Value: fileName, @HTML5.CssDefaults: {width: '20%'}},
- {Value: content, @HTML5.CssDefaults: {width: '20%'}},
+ {Value: type, @HTML5.CssDefaults: {width: '10%'}},
+ {Value: fileName, @HTML5.CssDefaults: {width: '25%'}},
+ {Value: content, @HTML5.CssDefaults: {width: '0%'}},
{Value: createdAt, @HTML5.CssDefaults: {width: '20%'}},
{Value: createdBy, @HTML5.CssDefaults: {width: '20%'}},
- {Value: note, @HTML5.CssDefaults: {width: '20%'}},
+ {Value: note, @HTML5.CssDefaults: {width: '25%'}},
{
$Type : 'UI.DataFieldForAction',
Label : 'Copy Attachments',
Action: 'AdminService.copyAttachments',
+ },
+ {
+ $Type : 'UI.DataFieldForActionGroup',
+ ID : 'TableActionGroup',
+ Label : 'Create',
+ ![@UI.Hidden]: {$edmJson: {$Eq: [ {$Path: 'IsActiveEntity'}, true ]}},
+ Actions: [
+ {
+ $Type : 'UI.DataFieldForAction',
+ Label : 'Link',
+ Action: 'AdminService.createLink'
+ }
+ ]
+ },
+ {
+ @UI.Hidden: {$edmJson: {
+ $If: [
+ { $Eq: [ { $Path: 'IsActiveEntity' }, true ] },
+ true,
+ {
+ $If: [
+ { $Ne: [ { $Path: 'mimeType' }, 'application/internet-shortcut' ] },
+ true,
+ false
+ ]
+ }
+ ]
+ }
+ },
+ $Type : 'UI.DataFieldForAction',
+ Label : 'Edit Link',
+ Action: 'AdminService.editLink',
+ Inline: true,
+ IconUrl: 'sap-icon://edit',
+ @HTML5.CssDefaults: {width: '4%'}
}
- ]
+ ],
}
{
note @(title: '{i18n>Note}');
@@ -96,65 +132,136 @@ annotate Attachments with @Common: {SideEffects #ContentChanged: {
}}{};
annotate my.Books.references with @UI: {
- HeaderInfo: {
- $Type : 'UI.HeaderInfoType',
- TypeName : '{i18n>Attachment}',
- TypeNamePlural: '{i18n>Attachments}',
+ HeaderInfo: {
+ $Type : 'UI.HeaderInfoType',
+ TypeName : '{i18n>Attachment}',
+ TypeNamePlural: '{i18n>Attachments}',
+ },
+ LineItem : [
+ {Value: type, @HTML5.CssDefaults: {width: '10%'}},
+ {Value: fileName, @HTML5.CssDefaults: {width: '25%'}},
+ {Value: content, @HTML5.CssDefaults: {width: '0%'}},
+ {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}},
+ {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}},
+ {Value: note, @HTML5.CssDefaults: {width: '25%'}},
+ {
+ $Type : 'UI.DataFieldForAction',
+ Label : 'Copy Attachments',
+ Action: 'AdminService.copyAttachments',
},
- LineItem : [
- {Value: fileName, @HTML5.CssDefaults: {width: '20%'}},
- {Value: content, @HTML5.CssDefaults: {width: '20%'}},
- {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}},
- {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}},
- {Value: note, @HTML5.CssDefaults: {width: '20%'}},
-
+ {
+ $Type : 'UI.DataFieldForActionGroup',
+ ID : 'TableActionGroup',
+ Label : 'Create',
+ ![@UI.Hidden]: {$edmJson: {$Eq: [ {$Path: 'IsActiveEntity'}, true ]}},
+ Actions: [
{
$Type : 'UI.DataFieldForAction',
- Label : 'Copy Attachments',
- Action: 'AdminService.copyAttachments',
+ Label : 'Link',
+ Action: 'AdminService.createLink'
}
- ]
-} {
- note @(title: '{i18n>Note}');
- fileName @(title: '{i18n>Filename}');
- modifiedAt @(odata.etag: null);
- content
- @Core.ContentDisposition: { Filename: fileName }
- @(title: '{i18n>Attachment}');
- folderId @UI.Hidden;
- repositoryId @UI.Hidden ;
- objectId @UI.Hidden ;
- mimeType @UI.Hidden;
- status @UI.Hidden;
+ ]
+ },
+ {
+ @UI.Hidden: {$edmJson: {
+ $If: [
+ { $Eq: [ { $Path: 'IsActiveEntity' }, true ] },
+ true,
+ {
+ $If: [
+ { $Ne: [ { $Path: 'mimeType' }, 'application/internet-shortcut' ] },
+ true,
+ false
+ ]
+ }
+ ]
+ }
+ },
+ $Type : 'UI.DataFieldForAction',
+ Label : 'Edit Link',
+ Action: 'AdminService.editLink',
+ Inline: true,
+ IconUrl: 'sap-icon://edit',
+ @HTML5.CssDefaults: {width: '4%'}
+ }
+ ],
+}
+{
+ note @(title: '{i18n>Note}');
+ fileName @(title: '{i18n>Filename}');
+ modifiedAt @(odata.etag: null);
+ content
+ @Core.ContentDisposition: { Filename: fileName }
+ @(title: '{i18n>Attachment}');
+ folderId @UI.Hidden;
+ repositoryId @UI.Hidden ;
+ objectId @UI.Hidden ;
+ mimeType @UI.Hidden;
+ status @UI.Hidden;
}
annotate my.Books.footnotes with @UI: {
- HeaderInfo: {
- $Type : 'UI.HeaderInfoType',
- TypeName : '{i18n>Attachment}',
- TypeNamePlural: '{i18n>Attachments}',
+ HeaderInfo: {
+ $Type : 'UI.HeaderInfoType',
+ TypeName : '{i18n>Attachment}',
+ TypeNamePlural: '{i18n>Attachments}',
+ },
+ LineItem : [
+ {Value: type, @HTML5.CssDefaults: {width: '10%'}},
+ {Value: fileName, @HTML5.CssDefaults: {width: '25%'}},
+ {Value: content, @HTML5.CssDefaults: {width: '0%'}},
+ {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}},
+ {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}},
+ {Value: note, @HTML5.CssDefaults: {width: '25%'}},
+ {
+ $Type : 'UI.DataFieldForAction',
+ Label : 'Copy Attachments',
+ Action: 'AdminService.copyAttachments',
},
- LineItem : [
- {Value: fileName, @HTML5.CssDefaults: {width: '20%'}},
- {Value: content, @HTML5.CssDefaults: {width: '20%'}},
- {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}},
- {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}},
- {Value: note, @HTML5.CssDefaults: {width: '20%'}},
-
+ {
+ $Type : 'UI.DataFieldForActionGroup',
+ ID : 'TableActionGroup',
+ Label : 'Create',
+ ![@UI.Hidden]: {$edmJson: {$Eq: [ {$Path: 'IsActiveEntity'}, true ]}},
+ Actions: [
{
$Type : 'UI.DataFieldForAction',
- Label : 'Copy Attachments',
- Action: 'AdminService.copyAttachments',
+ Label : 'Link',
+ Action: 'AdminService.createLink'
}
- ]
+ ]
+ },
+ {
+ @UI.Hidden: {$edmJson: {
+ $If: [
+ { $Eq: [ { $Path: 'IsActiveEntity' }, true ] },
+ true,
+ {
+ $If: [
+ { $Ne: [ { $Path: 'mimeType' }, 'application/internet-shortcut' ] },
+ true,
+ false
+ ]
+ }
+ ]
+ }
+ },
+ $Type : 'UI.DataFieldForAction',
+ Label : 'Edit Link',
+ Action: 'AdminService.editLink',
+ Inline: true,
+ IconUrl: 'sap-icon://edit',
+ @HTML5.CssDefaults: {width: '4%'}
+ }
+ ],
} {
note @(title: '{i18n>Note}');
fileName @(title: '{i18n>Filename}');
modifiedAt @(odata.etag: null);
content
- @Core.ContentDisposition: { Filename: fileName }
- @(title: '{i18n>Attachment}');
- folderId @UI.Hidden;
+ @Core.ContentDisposition: { Filename: fileName }
+ @(title: '{i18n>Attachment}');
+ folderId @UI.Hidden;
repositoryId @UI.Hidden ;
objectId @UI.Hidden ;
mimeType @UI.Hidden;
diff --git a/cap-notebook/demoapp/app/index.html b/cap-notebook/demoapp/app/index.html
index f4721ad9..ab8ffe43 100644
--- a/cap-notebook/demoapp/app/index.html
+++ b/cap-notebook/demoapp/app/index.html
@@ -15,7 +15,7 @@
-