Default action on document link

Options

Hi

In Smart View when you click on document name it does the download action. 

Is it possible to write oscript patch/override to change this to open Overview page (Smart View). 

Or is this decided outside oscript (i.e. in smart view sdk)?

Thanks

Uldis

Comments

  • Hi Uldis – this is configurable; in admin pages look for Configure Document Functions.

  • Thanks for your answer, but the configuration you are reffering to is just for Classic View

  • Hi Uldis,

    I don't recall any configuration for the "promoted action", if I may copy some ClassicUI terminology.

    Your best bet would like be to make your own alterations: https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=67953154&objAction=browse

    If I recall, the override kit should have a dummy theme (sans minification), that you can look at for getting started. If you have a fellow developer who is great with nodeJS and related techs, you ought to have them take a look. Compared to the traditional way of customization, it's a bit more convoluted.

    If you're asking this on behalf of a customer, you could also log a Feature Request with support.

    Thanks,

    Nizar

  • Thanks for your answer. So you are saying that the only way is through smart view sdk? Nothing you can override on oscript level?

    Quoted Nizar Ghazal on 11/27/2018 08:29 AM:

    Hi Uldis,

    I don't recall any configuration for the "promoted action", if I may copy some ClassicUI terminology.

    Your best bet would like be to make your own alterations: https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=67953154&objAction=browse

    If I recall, the override kit should have a dummy theme (sans minification), that you can look at for getting started. If you have a fellow developer who is great with nodeJS and related techs, you ought to have them take a look. Compared to the traditional way of customization, it's a bit more convoluted.

    If you're asking this on behalf of a customer, you could also log a Feature Request with support.

    Thanks,

    Nizar

  • If you want to open the Document Overview by the click on the document name, you will need to use the SDK to write a Smart UI extenstion. There is no administration page for this configuration today.

    How the Default Action for Documents Work

    Clicking on a document (on a link with the document name, for example) executes the "Open" command in Smart UI. This command is configured as the "default action" for the document object type. This command is pluggable; the following four plugins are deplyed with the CS core installation:

    1. Brava Viewer
    2. Content Suite Viewer
    3. Browser Window
    4. Download

    These plugins are "asked" to deal with the document and the most fitting one will perform the opening action.

    How to Customize the Default Document Opening

    There is no administration page to enable/disable the Open command plugins directly. Brava and CSV have their own configuration pages to enable/disable them for particular users and/or MIME types. Opening content in the browser window can be suppressed (and thus Donwload forced) by setting FetchMimeTypes in opentext.ini.

    If the above configuration is not enough, you can write a Smart UI extension using the SDK. There are two extension points in this scenario:

    1. Default action assignment
    2. Open plugin selection

    The default action is the "click action". It is supposed to point to the most usual command. If you add your rule for the subtype 144 and optionally for other properties like specificn MIME types, you can execute your own command, where you can do whatever you need.

    Open plugins allow custom handling for some documents, while letting the other functionality and other plugins still work. If you add a new plugin to be evaluated as the first one, you can handle selected documents as you need and let the others processed by other plugins.

    How to Open the Document Overview

    You can reuse the OpenSpecificNodePerspectiveCommand (csui/utils/commands/open.specific.node.perspective). If you write a new command you inherit it from it OpenSpecificNodePerspectiveCommand. If you write other code, like a new open command plugin, you can execute that command. Or you can just navigate to "/app/nodes/:id" in the current or in a new window.

  • Thanks, Ferdinand. Very good input as always. 

    Although I'm not sure I understand which of those 2 options is the best for me. 

    We just need all documents to open in Overview page (Smart View Overview) when they are clicked (from Folder view, from Favorites widget, from Recently Accessed)

    Quoted Ferdinand Prantl on 11/27/2018 09:40 AM:

    If you want to open the Document Overview by the click on the document name, you will need to use the SDK to write a Smart UI extenstion. There is no administration page for this configuration today.

    How the Default Action for Documents Work

    Clicking on a document (on a link with the document name, for example) executes the "Open" command in Smart UI. This command is configured as the "default action" for the document object type. This command is pluggable; the following four plugins are deplyed with the CS core installation:

    1. Brava Viewer
    2. Content Suite Viewer
    3. Browser Window
    4. Download

    These plugins are "asked" to deal with the document and the most fitting one will perform the opening action.

    How to Customize the Default Document Opening

    There is no administration page to enable/disable the Open command plugins directly. Brava and CSV have their own configuration pages to enable/disable them for particular users and/or MIME types. Opening content in the browser window can be suppressed (and thus Donwload forced) by setting FetchMimeTypes in opentext.ini.

    If the above configuration is not enough, you can write a Smart UI extension using the SDK. There are two extension points in this scenario:

    1. Default action assignment
    2. Open plugin selection

    The default action is the "click action". It is supposed to point to the most usual command. If you add your rule for the subtype 144 and optionally for other properties like specificn MIME types, you can execute your own command, where you can do whatever you need.

    Open plugins allow custom handling for some documents, while letting the other functionality and other plugins still work. If you add a new plugin to be evaluated as the first one, you can handle selected documents as you need and let the others processed by other plugins.

    How to Open the Document Overview

    You can reuse the OpenSpecificNodePerspectiveCommand (csui/utils/commands/open.specific.node.perspective). If you write a new command you inherit it from it OpenSpecificNodePerspectiveCommand. If you write other code, like a new open command plugin, you can execute that command. Or you can just navigate to "/app/nodes/:id" in the current or in a new window.

  • Both default action and open plugins are global concepts. They apply to all links in NodesTable, Favourites, Recently Accessed or other widgets. (As kong as the developer implements the links correctly by using the default action behaviour.)

    If you want to try the easiest way at first, go for overriding the default action for documents. If you don't use Brava or CS Viewer, it will work well.

    I didn't find any SDK example for overriding the default action. Let's try to sketch the solution here for a fictitious "myext" extension.

    1. Implement the command opening the Document Overview perspective. Reuse the perspective-opening command, give it your unique signature and implement command enabling for documents only; non need to check for permissions, because you cannot have the default click-action for an object, which you cannot see :-)

    src/commands/open.document.overview.js

      define([    'csui/lib/underscore', 'csui/utils/commands/open.node.perspective',    'csui/utils/commandhelper'  ], function (_, OpenNodePerspectiveCommand, CommandHelper) {    var OpenDocumentOverviewCommand = OpenNodePerspectiveCommand.extend({      defaults: {        signature: 'myext-open-document-overview'      },      enabled: function (status) {        var node = CommandHelper.getJustOneNode(status);        return node && _.contains([ 144, 749 ], node.get('type'));      }    });    return OpenDocumentOverviewCommand;  });

    2. Add the rule to identify the nodes, for which you want to execute the new command as a default action. The rule with the subtype only without additional MIME types will match all documents.

    src/utils/defaultactionitems.js

      define(function () {    return [      {        equals: { type: [ 144, 749 ] }, // Match all documents and e-mails.        signature: 'myext-open-document-overview', // Signature of the                                                   // command to execute.        sequence: 5 // Default rule in csui/utils/impl/core.defaultactionitems                    // uses the sequence 10. We need to put our rule before it                    // by using a lower sequence number.      }    ];  });

    3. Declare the command and default action rules modules public, so that they can be required by other modules from your module.

    src/bundles/myext-all.js

      "myext/commands/open.document.overview",  "myext/utils/defaultactionitems",

    4. Register the command and default action rules modules to their extension points, so that Smart View will load them automatically:

    src/myext-extensions.json

      "csui/utils/commands": {    "extensions": {      "myext": [        "myext/commands/open.document.overview"      ]    }  },  "csui/utils/defaultactionitems": {    "extensions": {      "myext": [        "myext/utils/defaultactionitems"      ]    }  },
  • Yes, Smart UI can be extended using its SDK only by JavaScript. OScript can be used to extend the REST API.


    From: eLink Entry: Content Server Development Forum <development@elinkkc.opentext.com>
    Sent: 27 November 2018 14:32:13
    To: eLink Recipient
    Subject: Default action on document link
     
    Default action on document link  Posted by uldis@contesto.no (Šilovs, Uldis) On 11/27/2018 08:29 AM
     
    Thanks for your answer. So you are saying that the only way is through smart view sdk? Nothing you can override on oscript level?Quoted Nizar Ghazal on 11/27/2018 08:29 AM:

    Hi Uldis,

    I don't recall any configuration for the "promoted action", if I may copy some ClassicUI terminology.

    Your best bet would like be to make your own alterations: https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=67953154&objAction=browse

    If I recall, the override kit should have a dummy theme (sans minification), that you can look at for getting started. If you have a fellow developer who is great with nodeJS and related techs, you ought to have them take a look. Compared to the traditional way of customization, it's a bit more convoluted.

    If you're asking this on behalf of a customer, you could also log a Feature Request with support.

    Thanks,

    Nizar


    [To post a comment, use the normal reply function]
    Topic: Default action on document link
    Forum: Content Server Development Forum
    Content Server: My Support
  • Wow, thanks! Will try .. :)

  • Uldis
    edited March 4, 2020 #11
    Options

    Hi. Not sure if you will get this answer, but I've tried implementing a default click as you suggested. In general it seems to be working.
    My default click takes the user to OverView page (in Smart View). There was one minor issue. In the OvervView page there is also a button Open, when user clicks on it then it will also try to open itself (Overview page). I tried to skip the default click override when current page is Overview page.

    I did that in "my-ext/utils/commands/defaultactionitems" like this using jquery class selector. I don't feel good about this approach, I hope someone can suggest a better way to check what's the current page (view) or what is it is now.

    define(['csui/lib/jquery','my-ext/utils/commands/defaultactionitems'],function($,dc) {
    'use strict';
    /* Check if not in Overview page, if so then skip the override */
    var NotOverViewPage = ($("div.cs-document-overview-wrapper").length > 0)? false : true;
    return [{
    "signature": "my-ext-open-document-overview",
    "sequence": 9,
    decides: function (node) {
    return NotOverViewPage && node.get('type') === 144;
    }
    }];
    });