5 Replies Latest reply on May 27, 2013 5:03 PM by Sham HC

    Customizing items on right click of a page in siteadmin

    Aryan12345

      Hi,

       

      We have a requirement where we want to show users a "prompt" when user right clicks on a page and selects any of the items. Please see the attached snapshot on what i am talking about.

       

      I want something similar to what is prompted when someone clicks on delete and i want it on click of the activate button. Basically i want to ask the user - "are you sure you want to activate".

       

      has anyone done this before. Can you please advice how this can be achieved?

       

      Cheers!

       

       

      Snapshot.png

       

      activaate.png

        • 1. Re: Customizing items on right click of a page in siteadmin
          Sham HC Level 7

          Hi Aryan,

           

            *  Write javascript method which pops for the dialog.

            *  Overlay /libs/wcm/core/content/siteadmin/actions/activate

            *  In the overlayed  activatenow node for conditions property call your script.

           

          Thanks,

          Sham

          @adobe_sham

          http://aemfaq.blogspot.com/

          • 2. Re: Customizing items on right click of a page in siteadmin
            Aryan12345 Level 1

            Thanks a lot Sham.

             

            One question.... When you say overlay do you mean override the foundation component?

             

            Second question, do i override by copying the component to my project in the apps folder? If I do that will it work? Also where do i copy it in the /apps/<myproject> folder? For example if i want to modify page properties for a template, i will copy the foundation dialog in to my template folder. In a similar way, where do i copy this foundation component?

             

            Cheers!

            • 3. Re: Customizing items on right click of a page in siteadmin
              KaushikNitin

              Hi Sham ,

               

              I tried this , i put a alert in the fucntion and called the script in conditions at

              •      /libs/wcm/core/content/siteadmin/actions/activate/menu/activateNow

              I got multiple alert messages at load of siteadmin , on page click and Activate link in the right click menu got disabled .

               

              Please suggest somethig.

              • 4. Re: Customizing items on right click of a page in siteadmin
                KaushikNitin Level 1

                I modified the CQ.wcm.SiteAdmin.activatePage function and added

                 

                for (var i = 0; i < selections.length; i++) {

                         CQ.Ext.Msg.show({

                         "title":"Title",

                        "msg":"R You Sure ?",

                        "buttons":CQ.Ext.Msg.YESNO,

                        "icon":CQ.Ext.MessageBox.QUESTION,

                            [1]      "fn":function(btnId) {

                                 if (btnId == "yes") {

                                     [2]           paths.push(selections[i].id);

                          });

                   }

                I want to add only those pages on which "yes" is clicked .But doing this i am not able to access the paths & selections [2]  varibales inside the function [1] .

                 

                Please suggest something on this OR any alternative way to achieve this.

                • 5. Re: Customizing items on right click of a page in siteadmin
                  Sham HC Level 7

                  Why do you need paths & selections just use CQ.wcm.SiteAdmin.activatePage.call(this);

                   

                  Attach below a method just call this at /apps/wcm/core/content/siteadmin/actions/activate

                   

                  CQ.wcm.SiteAdmin.iActPage = function() {

                      var selections = this.getSelectedPages();

                   

                      var msg = (selections.length > 1) ?

                                CQ.I18n.getMessage("You are going to activate the following pages: ") :

                                CQ.I18n.getMessage("You are going to activate the following page: ");

                      msg += "<br/><br/>";

                      var max = 7;

                      for (var i=0; i<selections.length; i++) {

                          if (i == max) {

                              msg += CQ.I18n.getMessage("(and {0} more...)", [selections.length-i], "pages to activate") + "<br/>";

                              break;

                          }

                          var page = CQ.shared.XSS.getXSSRecordPropertyValue(selections[i], "title");

                          if (!page) {

                              page = selections[i].get("label");

                          }

                          msg += page + "<br/>";

                      }

                      msg += "<br/>" + CQ.I18n.getMessage("Are you sure?");

                   

                      var title = (selections.length > 1) ?

                              CQ.I18n.getMessage("Activate Pages")

                              : CQ.I18n.getMessage("Activate Page");

                   

                      CQ.Ext.Msg.show({

                          "title":title,

                          "msg":msg,

                          "buttons":CQ.Ext.Msg.YESNO,

                          "icon":CQ.Ext.MessageBox.QUESTION,

                          "fn":function(btnId) {

                              if (btnId == "yes") {

                                  CQ.wcm.SiteAdmin.activatePage.call(this);

                              }

                          },

                          "scope":this

                      });

                  };

                   

                  Thanks,

                  Sham