diff --git a/application/Espo/Modules/Crm/Resources/layouts/Case/detailPortal.json b/application/Espo/Modules/Crm/Resources/layouts/Case/detailPortal.json new file mode 100644 index 0000000000..369c9893ab --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Case/detailPortal.json @@ -0,0 +1,12 @@ +[ + { + "label":"Overview", + "rows": [ + [{"name":"name"}, {"name":"number"}], + [{"name":"status"}, {"name":"priority"}], + [{"name":"type"}, false], + [{"name":"description", "fullWidth": true}], + [{"name":"attachments", "fullWidth": true}] + ] + } +] diff --git a/application/Espo/Modules/Crm/Resources/layouts/Case/detailSmallPortal.json b/application/Espo/Modules/Crm/Resources/layouts/Case/detailSmallPortal.json new file mode 100644 index 0000000000..835a3d3653 --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Case/detailSmallPortal.json @@ -0,0 +1,12 @@ +[ + { + "label":"", + "rows":[ + [{"name":"name", "fullWidth": true}], + [{"name":"status"}, {"name":"priority"}], + [{"name":"type"}, {"name":"number"}], + [{"name":"description", "fullWidth": true}], + [{"name":"attachments", "fullWidth": true}] + ] + } +] \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/layouts/Case/listPortal.json b/application/Espo/Modules/Crm/Resources/layouts/Case/listPortal.json new file mode 100644 index 0000000000..99963c176a --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/Case/listPortal.json @@ -0,0 +1,6 @@ +[ + {"name":"name", "link": true}, + {"name":"number", "widthPx": 100}, + {"name":"status", "width": 17}, + {"name":"priority", "width": 17} +] \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/layouts/Case/listSmall.json b/application/Espo/Modules/Crm/Resources/layouts/Case/listSmall.json index c85c67ce15..630c81384f 100644 --- a/application/Espo/Modules/Crm/Resources/layouts/Case/listSmall.json +++ b/application/Espo/Modules/Crm/Resources/layouts/Case/listSmall.json @@ -1,6 +1,6 @@ [ - {"name":"name","width":35,"link":true}, - {"name":"number","width":18}, - {"name":"status"}, - {"name":"priority"} + {"name":"name", "link": true}, + {"name":"number", "width": 18}, + {"name":"status", "width": 19}, + {"name":"priority", "width": 19} ] \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/detailPortal.json b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/detailPortal.json new file mode 100644 index 0000000000..6d89c1da10 --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/detailPortal.json @@ -0,0 +1,9 @@ +[ + { + "label": "", + "rows": [ + [{"name":"body", "fullWidth": true, "noLabel": true}], + [{"name":"attachments", "fullWidth": true, "noLabel": true}] + ] + } +] diff --git a/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/detailSmallPortal.json b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/detailSmallPortal.json new file mode 100644 index 0000000000..6d89c1da10 --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/detailSmallPortal.json @@ -0,0 +1,9 @@ +[ + { + "label": "", + "rows": [ + [{"name":"body", "fullWidth": true, "noLabel": true}], + [{"name":"attachments", "fullWidth": true, "noLabel": true}] + ] + } +] diff --git a/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/list.json b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/list.json index 6510cfa48f..96f8d27578 100644 --- a/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/list.json +++ b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/list.json @@ -1,5 +1,5 @@ [ - {"name":"name", "width": 50, "link": true}, - {"name":"status"}, - {"name":"createdAt"} + {"name":"name", "link": true}, + {"name":"status", "width": 20}, + {"name":"createdAt", "width": 20} ] diff --git a/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/listPortal.json b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/listPortal.json new file mode 100644 index 0000000000..2ae42ee989 --- /dev/null +++ b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/listPortal.json @@ -0,0 +1,3 @@ +[ + {"name":"name", "link": true} +] diff --git a/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/listSmall.json b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/listSmall.json index 97ec2d41f8..7d8d313c9e 100644 --- a/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/listSmall.json +++ b/application/Espo/Modules/Crm/Resources/layouts/KnowledgeBaseArticle/listSmall.json @@ -1,5 +1,5 @@ [ - {"name":"name", "width": 40, "link": true}, - {"name":"status"}, - {"name":"createdAt"} + {"name":"name", "link": true}, + {"name":"status", "width": 22}, + {"name":"createdAt", "width": 22} ] \ No newline at end of file diff --git a/application/Espo/Modules/Crm/Resources/metadata/app/aclPortal.json b/application/Espo/Modules/Crm/Resources/metadata/app/aclPortal.json index 0a0369c0cf..1fc5daea56 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/app/aclPortal.json +++ b/application/Espo/Modules/Crm/Resources/metadata/app/aclPortal.json @@ -12,7 +12,8 @@ "KnowledgeBaseArticle": { "portals": false, "order": false, - "status": false + "status": false, + "assignedUser": false }, "Case": { "status": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json index 13c1b77504..7c92fea3ce 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json @@ -65,5 +65,16 @@ "selectDefaultFilters": { "filter": "open" }, - "allowInternalNotes": true + "allowInternalNotes": true, + "additionalLayouts": { + "detailPortal": { + "type": "detail" + }, + "detailSmallPortal": { + "type": "detail" + }, + "listPortal": { + "type": "list" + } + } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/KnowledgeBaseArticle.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/KnowledgeBaseArticle.json index c8de7e7592..f476fa599d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/KnowledgeBaseArticle.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/KnowledgeBaseArticle.json @@ -33,5 +33,16 @@ } ] } + }, + "additionalLayouts": { + "detailPortal": { + "type": "detail" + }, + "detailSmallPortal": { + "type": "detail" + }, + "listPortal": { + "type": "list" + } } } diff --git a/application/Espo/Resources/i18n/en_US/Admin.json b/application/Espo/Resources/i18n/en_US/Admin.json index 848d7579bd..3fd6494766 100644 --- a/application/Espo/Resources/i18n/en_US/Admin.json +++ b/application/Espo/Resources/i18n/en_US/Admin.json @@ -63,6 +63,10 @@ "detail": "Detail", "listSmall": "List (Small)", "detailSmall": "Detail (Small)", + "detailPortal": "Detail (Portal)", + "detailSmallPortal": "Detail (Small, Portal)", + "listSmallPortal": "List (Small, Portal)", + "listPortal": "List (Portal)", "filters": "Search Filters", "massUpdate": "Mass Update", "relationships": "Relationship Panels", diff --git a/client/src/models/user.js b/client/src/models/user.js index fa316dc279..f3a148b4eb 100644 --- a/client/src/models/user.js +++ b/client/src/models/user.js @@ -29,12 +29,14 @@ Espo.define('models/user', 'model', function (Dep) { return Dep.extend({ - name: "User", + name: 'User', isAdmin: function () { return this.get('isAdmin'); + }, + + isPortal: function () { + return this.get('isPortalUser'); } - }); - }); diff --git a/client/src/views/record/detail.js b/client/src/views/record/detail.js index ec41795cf8..005eb1ecae 100644 --- a/client/src/views/record/detail.js +++ b/client/src/views/record/detail.js @@ -120,6 +120,8 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'], printPdfAction: false, + portalLayoutDisabled: false, + events: { 'click .button-container .action': function (e) { var $target = $(e.currentTarget); @@ -641,6 +643,12 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'], } } + if (this.getUser().isPortal() && !this.portalLayoutDisabled) { + if (this.getMetadata().get(['clientDefs', this.scope, 'additionalLayouts', this.layoutName + 'Portal'])) { + this.layoutName += 'Portal'; + } + } + this.on('remove', function () { if (this.isChanged) { this.model.set(this.attributes); @@ -688,6 +696,7 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'], this.inlineEditDisabled = this.options.inlineEditDisabled || this.inlineEditDisabled; this.navigateButtonsDisabled = this.options.navigateButtonsDisabled || this.navigateButtonsDisabled; + this.portalLayoutDisabled = this.options.portalLayoutDisabled || this.portalLayoutDisabled; this.setupActionItems(); this.setupBeforeFinal(); diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js index 8e196b4b24..46ad31ed92 100644 --- a/client/src/views/record/list.js +++ b/client/src/views/record/list.js @@ -71,6 +71,8 @@ Espo.define('views/record/list', 'view', function (Dep) { massActionsDisabled: false, + portalLayoutDisabled: false, + events: { 'click a.link': function (e) { e.stopPropagation(); @@ -267,6 +269,7 @@ Espo.define('views/record/list', 'view', function (Dep) { this.showMore = _.isUndefined(this.options.showMore) ? this.showMore : this.options.showMore; this.massActionsDisabled = this.options.massActionsDisabled || this.massActionsDisabled; + this.portalLayoutDisabled = this.options.portalLayoutDisabled || this.portalLayoutDisabled; if (this.massActionsDisabled && !this.selectable) { this.checkboxes = false; @@ -776,6 +779,12 @@ Espo.define('views/record/list', 'view', function (Dep) { this.checkboxes = false; } + if (this.getUser().isPortal() && !this.portalLayoutDisabled) { + if (this.getMetadata().get(['clientDefs', this.scope, 'additionalLayouts', this.layoutName + 'Portal'])) { + this.layoutName += 'Portal'; + } + } + this.listenTo(this.collection, 'sync', function (c, r, options) { if (this.hasView('modal') && this.getView('modal').isRendered()) return; if (this.noRebuild) {