We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15688
    • 12 Posts
    Hello, I am trying to setup a snippit to be added on all my pages which will add a link directly to the manager edit page.

    Heres what I have so far:

    <?php
    // First see if we pass authorization

    if(! isset($_SESSION[’mgrValidated’]) || !$_SESSION[’mgrValidated’])
    return "";

    // Build link

    $str_link = ’<a href="/manager">Manager</a>’;

    $str_link = $str_link . ’ <a href="/manager/index.php?a=27id=’ . $modx->documentIdentifier . ’">(edit)</a>’;

    $str_link = $str_link . ’&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;’;

    return $str_link;
    ?>


    Unfortunatly the link to the edit page isn’t right... i’m not sure how i can get it to go directly to edit rather than just to the manager front page.
      • 15688
      • 12 Posts
      Ok after I looked into this more I found that the manager page link actually calls a javascript function. Here is the code from manager page (view document data area that has the "edit" button:

      <div class="subTitle">
      <span class="right">View document data</span>

      <table cellpadding="0" cellspacing="0" class="actionButtons">
      <td id="Button1"><a href="#" onclick="editdocument();"><img src="media/style/MODxLight/images/icons/save.gif" align="absmiddle"> Edit</a></td>
      <td id="Button2"><a href="#" onclick="movedocument();"><img src="media/style/MODxLight//images/icons/cancel.gif" align="absmiddle"> Move</a></td>
      <td id="Button4"><a href="#" onclick="duplicatedocument();"><img src="media/style/MODxLight/images/icons/copy.gif" align="absmiddle"> Duplicate</a></td>
      <td id="Button3"><a href="#" onclick="deletedocument();"><img src="media/style/MODxLight/images/icons/delete.gif" align="absmiddle"> Delete</a></td>
      </table>
      </div>



      Note quite sure where editdocument() is located but I am guessing I can extract the info I need from that javascript function if I can find it.

      Alternatively is there a way to invoke that functioncall remotely and open the right edit page?
        • 4310
        • 2,310 Posts
        Are you trying to access Manager editing tools/features from from outside the Manager?
        Have you seen the FDM (Front end Document Manager) snippet?
          • 15688
          • 12 Posts
          Just took a look at it but it looks like it pops up its own editor... again, all i want is a url to point the browser to that will open the manager in edit mode to the current document.
            • 4310
            • 2,310 Posts
            Ah, I understand now.
            I’ve not seen anything like that before.
            Maybe someone else has tried it before and will post.
              • 15688
              • 12 Posts
              Silly me, I didn’t catch that.

              This is working great!

              One question though. When it opens the manager via that link its missing the header and side bar. Is there anyway to open the page up with the proper frames?

              BTW here is the snippet if anyone is interested. I call it from a page_tail chuck but be sure to call it with [!ManagerLink!] so that it doesn’t get cached

              <?php
              	// See if we pass authorization
              	if( isset($_SESSION['mgrValidated']) && $_SESSION['mgrValidated']) 
              	{
              		// Build link
              		$str_link = '<a href="/manager">Manager</a>';
              		$str_link = $str_link . ' <a href="/manager/index.php?a=27&id=' . $modx->documentIdentifier . '">(edit)</a>';
              		return $str_link;
              	}
              ?>