Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

ICN show/hide Check-out and Check-in

550000NPG8 gravatar image
Question by RAVI_PATNALA  (36) | Jun 05 at 03:53 AM icnicn_filenet

Hi,

I would like to show/hide the OOTB actions checkout/check-in which are available on Document Context Menu Actions. For the custom actions we will specify the file which does the hide/show functionality in the getActionModelClass() of action class. But for OOTB actions how do we do that? PFA the screenshot of the actions what I want to show/hide.

[1]: /answers/storage/temp/28262-checkoutcheck-in.jpg

checkoutcheck-in.jpg (36.8 kB)

People who like this

  0
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

1 reply

  • Sort: 
50QM60YQ17 gravatar image

Answer by jase_kross (196) | Jun 13 at 09:19 AM

You could replace the isVisible function in ecm.model.Action via ICN plugin. In doing so you would really want to augment the existing code with some additional logic that hides/shows the checkin/checkout actions. Your replacement function then would be a mix of your custom logic and the ootb function code. Keep in mind that when it comes time to upgrade ICN you'll want to revisit your replacement function for differences that the upgrade may introduce to the ootb function. If there are differences you should work to understand them and refactor your code to account for them.

The code below provides an example of a replacement function for ecm.model.Action.isVisible in ICN 3.0.5. As you'll notice I've commented the beginning and ending of the custom section. From your other thread on the role check you'd also need to incorporate logic into this section to evaluate whether the user is role or otherwise and return true/false.

 // For ICN 3.0.5
 ecm.model.Action.prototype.isVisible = function(repository, items, repositoryTypes, teamspace) {
     
     // begin custom
     var canPerform = true;
     switch (this.id) {
                 case "CheckOut": canPerform = false;
                 case "CheckOutDownload": canPerform = false;
                 case "CheckOutLabelWithDownload": canPerform = false;
                 case "CheckOutNoDownload": canPerform = false;
                 case "CheckIn": canPerform = false;
                 case "Unlock": canPerform = false;
     }
     
     if (!canPerform){
         return false;
     }
     // end custom
     
     if (this.repositoryTypes == null || this.repositoryTypes == "") {
         return this._isVisibleForItems(repository, items);
     } else if (repositoryTypes && repositoryTypes.length > 0) {
         return this._isVisibleToAnyOfRepositoryTypes(repositoryTypes);
     } else if (repository) {
         var serverTypes = this.repositoryTypes.split(',');
         for (i in serverTypes) {
             if (serverTypes[i] == repository.type) {
                 return this._isVisibleForItems(repository, items, teamspace);
             }
         }
         return false;
     } else {
         return false;
     }
 };
Comment

People who like this

  0   Show 3   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
550000NPG8 gravatar image RAVI_PATNALA (36)   Jun 13 at 10:59 AM 0
Share

Hi Jase,

Thanks for your time and reply. I have already implemented similar to this in global plugin. But I didn't use the OOTB function code in my overriden function isVisible. May I know why do we need OOTB function code here? This also avoids to write separate js file to show/hide for each custom action. Below is my code. Please check.

aspect.after(ecm.model.Action.prototype, "isVisible", function() {

    var actionVisible = true;
    if(ReturnedRestrictedActionsAndFeatures!=undefined){
        if(ReturnedRestrictedActionsAndFeatures.length>0){
            var SplitStringRestrictedActionsAndFeatures = ReturnedRestrictedActionsAndFeatures.split("!");
            if(SplitStringRestrictedActionsAndFeatures[0]!=='NoValue'){
                var SplitStringRestrictedActions = SplitStringRestrictedActionsAndFeatures[0].split(";");
                for (var i in SplitStringRestrictedActions) {

                    if(SplitStringRestrictedActions[i]===this.id){
                        actionVisible=false;
                    }
                }
            }
        }
    }else{
           actionVisible = true;
    }
    if(actionVisible===false){

        return false;
    }else{
        return true;
    }
 });

Note: I see a minor risk here. That is, it will show the actions which are hidden by the system internally. I hope there are no such. But it will hide the actions what ever I configured :-).

50QM60YQ17 gravatar image jase_kross (196) RAVI_PATNALA (36)   Jun 13 at 02:30 PM 0
Share

What I suggested with replacing the function wasn't to actually modify the OOTB ecm.model.Action.js file. Instead it was to provide a replacement for the function through your plugin files, which can be done by including the replacement function in your main plugin js file. Replacement in this fashion is one approach that could be taken. Now knowing that you took the aspect.after approach that should be fine also.

As to your code, do you see errors in the browser console or debugging facilities when it executes? What is not working about it? Do the menu actions not show at all or do they all show? Are you receiving an undefined error because of ReturnedRestrictedActionsAndFeatures? Is ReturnedRestrictedActionsAndFeatures stored in a different container object and not the global namespace? Are you using the correct ids for the default checkin/checkout actions?

Ids for the checkin/checkout actions: CheckOut CheckOutDownload CheckOutLabelWithDownload CheckOutNoDownload CheckIn Unlock

These are a few things I would suggest to check out.

550000NPG8 gravatar image RAVI_PATNALA (36) jase_kross (196)   Jul 05 at 04:00 AM 0
Share

Hi Jase,

I didn't get any errors in the browser console or any where. The menu actions hide/show working as expected. The code I posted above is working perfectly.

Regards, Ravi

Follow this question

192 people are following this question.

Answers

Answers & comments

Related questions

ICN Document Actions hide and show 2 Answers

download file showing up as .bin extension 1 Answer

ICN Add Document using Entry Template show/hide 1 Answer

Filenet and ICN JDBC validation 2 Answers

Keep Criteria Open when there is error 2 Answers

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges