Some thoughts on a Right-Click Action Menu

LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Thu, 2005-08-11 07:47

Hi All,

I'm dreaming to get the Item Actions popping up in my theme on right clicking i.e. an image (or right clicking the page). I've made some thoughts based on Pedro's PGtheme - I have some ideas - only the final (most important) link is missing and I'm stuck here...

My Idea is to add a some code to the theme.js, replacing the pop-up message which is called in PGtheme by right clicking the page

var posX, posY="";
    
function rightcl(e) {  
  if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
    posX: window.event.x;
    posY: window.event.y;
    ----> popup the actionbar
    return false;
  }
  else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
    posX: window.event.x;
    posY: window.event.y;
    ----> popup the actionbar
    return false;
  }
  return true;
}

you see - here is where I'm stuck - how to tell the page to open the actionbar.tpl from Java at the mouse coordinates I've rightclicked - which should contain something like

<div id="actions" style="position: absolute; left: posX; top: posY;  
z-index: 10; visibility: hidden;">
<div id="actionsIn" style="position: relative; left: 0px; top: 0px;  
z-index: 10;" class="gcBackground1 gcBorder2">
      {g->theme include="actionbar.tpl"}
</div>

In addition a new template, actionbar.tpl

<tr><td>
<div id="gsSidebar" class="gcBackground1 gcBorder1">
  {* Show only the action block *}
  {$theme.params.sidebarBlocks item=2}
    {g->block type=$block.0 params=$block.1 class="gbBlock"}
</div>
</td></tr></table>

(I assumed the action block on the second position of the normal sidebar)

Any idea to bring me to a solution? Is this possible at all?

 
pgilbert

Joined: 2005-03-28
Posts: 157
Posted: Thu, 2005-08-11 13:45

LFrank,

Try this, at Theme.js cut this out:

 
function right(e) {
    if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
alert(msgmouse);
      return false;
    }
    else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
alert(msgmouse);
      return false;
    }
    return true;
  }


  document.onmousedown=right;
  if (document.layers) window.captureEvents(Event.MOUSEDOWN);
  window.onmousedown=right;

and put this at the end of the file:

function right(e) {
    if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
a=ShowLayer('actions','visible');
      return false;
    }
    else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
a=ShowLayer('actions','visible');
      return false;
    }
    return true;
  }


  document.onmousedown=right;
  if (document.layers) window.captureEvents(Event.MOUSEDOWN);
  window.onmousedown=right;

Is that wath you want?

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Thu, 2005-08-11 20:44

Yep, nearly ... I try some finetuning on mouseposition and seperate meue :)
Many Thanks, Pedro !!