7 Replies Latest reply: Jun 19, 2014 10:45 AM by Wilfred Shelly RSS

    New Menu bar in contributor interface

    Wilfred Shelly

      Hi , I am trying to add a new menu bar in contributor interface . I was able to add a custom menu in the menu bar , but i was unable to create an action for it in the global html file . Can anyone suggest or have a solution for this .

        • 1. Re: New Menu bar in contributor interface
          S2154

          Add label and action for your newly added menu

          • 2. Re: New Menu bar in contributor interface
            Sarath.Dontireddy

            Hi, Are you trying to create a custom action or trying to use system pre-configured actions like edit/inspect/copy/delete etc...

             

            Below are some of the samples...You can refer to  Admin guide "Customizing the Menu Bar" for more information.

             

            Example with  finishassignment preconfigure action added to the Menu bar

            config.menubar = {

            "default": [

                 {

                      |

                      |

                 },

              {

              "id": "Workflow",

              "label": fw.util.getString("dvin/Common/Workflow"),

              "children": [

              {label: fw.util.getString('UI/UC1/Layout/FinishAssignments'), action: 'finishassignment'}

              ]

              }

             

            Similarly if you want to add custom action

            {

            "label": "Hello World",

            "action": function () {

            alert("Hello from the top menubar!");

            }

            And you want to define functions separately you could try this one as well

             

            //Define the function hello with prefix myActions

            config.myActions = {

            hello: function (args) {

            var doc = SitesApp.getActiveDocument(),

            asset = doc.get('asset'),

            view = SitesApp.getActiveView();

            view.info('Hello World!! The asset is a ' + asset.type + ' with id:+ asset.id);

            }

            };

             

            //Define the menu bar  with actoion

            {

            "label": "Hello World",

            "action": config.myActions.hello

            }

            • 3. Re: New Menu bar in contributor interface
              Wilfred Shelly

              HI Sarath , thanks for your reply . The scenario is , Create a new menu bar and after clicking the menu/menu options available through the drop down , i need to call a CS Element which will get displayed below in the content pane . Below is the sample code which i had already written .

               

               

              config.menubar =

              {

                "id": "compareassets",

                "label": 'Options',

                "children": [

                {'label': 'Compare Assets', cache:true ,action:'assetcompare', deferred: 'UI/Actions/Asset/Approve/AssetComparison'}

                ]

               

                }

               

              Options is the menubar and CompareAssets is the child . On clicking CompareAssets i need to call my CSElement which will be displyed below in the content pane

              • 4. Re: New Menu bar in contributor interface
                BishnuSatpathy

                Hi Wilfred

                 

                For your query of executing a CSElement on click of a drop down menu option of a menubar, we had similar requirements. Below are my suggestion, may help.

                 

                We created a basic asset and associated a template to it.

                Then the way you have mentioned the above code, you can proceed with that except under the children section you can load the asset and assign it for the value of label.

                Now whatever code you want to execute on click of the drop down, can keep the logic in that template which will get executed.

                 

                Regards

                Bishnu

                • 5. Re: New Menu bar in contributor interface
                  S2154

                  I don't think you can configure CSElement directly . You need to it indirectly like below,

                   

                  1. Create any basic/flex asset (e.g)Article and associate this asset with template which you would like to invoke

                  2. Update menubar cofiig like below,

                   

                  config.menubar =

                  {

                    "id": "compareassets",

                    "label": 'Options',

                    "children": [

                    {'label': 'Compare Assets', cache:true ,action: function () { fw.ui.GridFormatter.open(<name of the asset>, 'asset', 'Article:', <assetId> ) } , deferred: 'UI/Actions/Asset/Approve/AssetComparison'}

                    ]

                   

                    }

                  Hope it helps you

                  • 6. Re: New Menu bar in contributor interface
                    Sarath.Dontireddy

                    Hi Wilfred Shelly,

                     

                    My two cents of thoughts, You can try something on the below lines ,  though i haven't executed the code.

                     

                     

                    //Define the menu bar  with actoion

                    {

                    "label": "Hello World",

                    "action": config.myActions.menuOpenElement

                    }

                     

                     

                    //Define a view : This  is important , You can observe the URL pointing to the pageName

                    config.views['openElementView'] = {

                                          viewClass: 'fw.ui.view.SimpleView',

                                          viewParams: {

                                                           url: '/cs/ContentServer?pageName=XXXXXXXXXXXX' //

                     

                                          }

                                };



                    //Define your custom action

                    config.myActions = {

                                        menuOpenElement: function () {

                                              var views = SitesApp.getViews();

                                             var view;

                                             dojo.forEach(views, function (v) {

                                                        if (v.viewType === 'openElementView') {

                                                                 view = v;

                                                        }

                                             });

                                             // view already opened - just focus it

                                            if (view) {

                                                        view.focus();

                                            } else {

                                                       // create view

                                                      view = fw.ui.ViewFactory.buildView('openElementView');

                                                      view.set('title', 'Open Element View');

                                                      view.show();

                                           }

                                        }

                    };

                     

                    Regards,

                    Sarath

                    • 7. Re: New Menu bar in contributor interface
                      Wilfred Shelly

                      Hi Sarath ,

                       

                      Thanks for your reply . I was able to navigate to the custom element by below approach . But i have one problem , the menu drop down (child menus) is getting loaded only after any asset is rendered in the content pane . Is there some way to load the child menus at the start itself . I am able to see the Options menu , but the child menus are not getting displayed .

                       

                      //addition in config.menubar

                      {

                        "id": "utility",

                        "label": 'Options',

                        "children": [

                        {'label': 'Bulk Import', cache:false ,action:'importutility'}

                        ]

                       

                      }

                       

                      //addtion in config views

                      "import":{

                        'viewClass': 'fw.ui.view.SimpleView',

                        'viewParams': {

                        element: 'UI/Layout/CenterPane/Form/ImportForm'

                        }

                        },

                       

                      //addtion in config.controllers

                       

                      "importutility": {

                        "next-view": "import",

                        "model-update-required": false

                        },