We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Does anyone know where the actions on the links in the context menu for the tree menu are defined (which php page). For example, from frames/3c.php:
    constructLink(1, "context_view", $_lang["view_document"], 1);
    constructLink(2, "save", $_lang["edit_document"], $modx->hasPermission('edit_document'));
    constructLink(5, "cancel", $_lang["move_document"], $modx->hasPermission('edit_document'));

    1 is the action for viewing the doc, 2 for saving and 5 for cancel.

    Thanks!
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 13577
      • 302 Posts
      Hmm... If I’m understanding you correctly...

      The actions are all listed in manager/index.php - but the action numbers there are NOT the same (how convenient) as those in the tree. An example:

      constructLink(1, "context_view", $_lang["view_document"], 1);


      The number "1" (first one) there points to the action number in the menuHandler() function located in manager/frames/3.php. By looking at the case for "1" there we see the url:

      case 1 :
        top.main.document.location.href="index.php?a=3&id=" + itemToChange;
        break


      From this we look at the querystring and see that the a=3. So now we can look at the manager/index.php file and see:

      /********************************************************************/
      /* document data													*/
      /********************************************************************/
      	case "3" :
      		// get the page to show document's data
      		include_once "header.inc.php";
      		include_once "actions/static/document_data.static.action.php";
      		include_once "footer.inc.php";		
      	break;


      From there, you’d go to those included files to see what was actually being done... did I miss the question entirely?
        Standard Disclaimer
        I could be totally wrong.
      • Yeah... confusing the heck out of me! I think this is headed down the right path.

        So based on that, how would we trigger a duplicate document then (what would the tree menu action need to be)?
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • Aha!

          The tricky bit was that it was storing the location in the frame 3 way down low at the bottom where I wasn’t expecting to find it!

          Thank you. smiley
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 13577
            • 302 Posts
            Well... gee.

            The manager action (in manager/index.php) is 94. So we’d have to work the scenario backwards. So we need 94 to get to manager/index.php. that means we need a new case in menuHandler. There seem to be 10 cases 1-11 (excluding 7 for some reason). So we can take the next case number (12) or reuse 7. I’ll say next number.

            So in that case we’ll need to actually do the thing (in manager/frames/3.php):

            case 12 : // duplicate doc
              top.main.document.location.href="index.php?a=94&pid=" + itemToChange;
              break;


            Then we’ll need a dingle in the context menu to trigger that case:

            <?php echo constructLink(12, "duplicateImage", str_replace(" ", " ", $_lang["duplicate"]), $modx->hasPermission('new_document')); ?>


            Note- I don’t know if "duplicateImage" exists. Probably not. But the image name should go there. Also I left the permission attached to "new_document" because it seemed appropriate since I didn’t see a "duplicate" permission anywhere.

            So maybe I should actually "try" this theory...

              Standard Disclaimer
              I could be totally wrong.
              • 13577
              • 302 Posts
              Quote from: rthrash at Dec 02, 2005, 04:25 PM

              Aha!

              The tricky bit was that it was storing the location in the frame 3 way down low at the bottom where I wasn’t expecting to find it!

              So you got it working then? I can go back to doing other things or I should I test this?
                Standard Disclaimer
                I could be totally wrong.
              • And now it’s done...

                Duplicate document added to context menu (#5 on the bugtracker) and will be in 0.9.1

                And I did use #7 ... wonder what that used to be? lol
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 13577
                  • 302 Posts
                  Quote from: rthrash at Dec 02, 2005, 05:02 PM
                  ...And I did use #7 ... wonder what that used to be? lol

                  Maybe that was the trunk monkey function.
                    Standard Disclaimer
                    I could be totally wrong.
                    • 32963
                    • 1,732 Posts
                    Would suggest using Jardec’s solution. It’s best to use existing actions.
                      xWisdom
                      www.xwisdomhtml.com
                      The fear of the Lord is the beginning of wisdom:
                      MODx Co-Founder - Create and do more with less.
                    • Quote from: jaredc at Dec 02, 2005, 05:13 PM

                      Quote from: rthrash at Dec 02, 2005, 05:02 PM
                      ...And I did use #7 ... wonder what that used to be? lol

                      Maybe that was the trunk monkey function.

                      Hmmm... sounds entertaining but the server seems to be down ATM. smiley

                      LOL ... back up and you know, I think you’re right!

                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me