Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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);

});
}
});
}
);
32 changes: 32 additions & 0 deletions cap-notebook/demoapp/app/admin-books/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
Expand All @@ -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
Expand Down
207 changes: 157 additions & 50 deletions cap-notebook/demoapp/app/common.cds
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cap-notebook/demoapp/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</script>

<script id="sap-ushell-bootstrap" src="https://sapui5.hana.ondemand.com/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
<script id="sap-ui-bootstrap" src="https://sapui5.hana.ondemand.com/1.133.0/resources/sap-ui-core.js"
<script id="sap-ui-bootstrap" src="https://sapui5.hana.ondemand.com/1.138.1/resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
Expand Down
Loading
Loading