Logo Search packages:      
Sourcecode: bamboo version File versions  Download package

leftnav.php

<script type="text/javascript">
function quickmenu(path) {
      <?php
      $clipboard = $ps->getPage("/.clipboard");
      if ($clipboard->childCount() == 0)
            echo "var clipboard = false;";
      else
            echo "var clipboard = true;";
      ?>

      var html;
      html = '<a href="' + path + '/?a=edit&ea=info&clip=cut&quick=1">Cut</a>';
      html += '<a href="' + path + '/?a=edit&ea=info&clip=copy&quick=1">Copy</a>';
      html += '<a href="' + path + '/?a=edit&ea=info&clip=delete&quick=1">Delete</a>';
      html += "<hr>";
      if (clipboard) {
            html += '<a href="' + path + '/?a=edit&ea=info&clip=paste&quick=1&where=before">Paste before</a>';
            html += '<a href="' + path + '/?a=edit&ea=info&clip=paste&quick=1&where=into">Paste into</a>';
            html += '<a href="' + path + '/?a=edit&ea=info&clip=paste&quick=1&where=after">Paste after</a>';
      }
      else {
            html+="<div>Paste before</div><div>Paste into</div><div>Paste after</div>";
      }
      html += "<hr>";
      html += '<a href="' + path + '/?a=edit&ea=info&clip=new&quick=1&where=before">New page before</a>';
      html += '<a href="' + path + '/?a=edit&ea=info&clip=new&quick=1&where=into">New page into</a>';
      html += '<a href="' + path + '/?a=edit&ea=info&clip=new&quick=1&where=after">New page after</a>';

      return html;
}

var delayhide;
function delayhidemenu(){
      clearTimeout(delayhide);
      delayhide=setTimeout("hidemenu()",800);
}
function cancelhidemenu() {
      clearTimeout(delayhide);
}
function hidemenu(){
      document.getElementById("dropmenu").style.visibility="hidden";
}

function dropdownmenu(obj, e, contents){
      cancelhidemenu();
      menu=document.getElementById("dropmenu");
      menu.innerHTML=contents;

      dim = getdim(obj);
      curx = dim.x + obj.offsetWidth + "px";
      cury = dim.y + "px";
      
      if (menu.style.visibility=="hidden") {
            menu.style.visibility = "visible";
      }
      else if (menu.style.top == cury) {
            menu.style.visibility="hidden";
      }
      menu.style.left = curx;
      menu.style.top  = cury;
}

function getdim(el){
      for (var lx=0,ly=0; el!=null; lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
      return {x:lx,y:ly}
}
</script>
<div id="dropmenu" style="visibility:hidden; position:absolute;" onMouseover="cancelhidemenu()" onMouseout="delayhidemenu()"></div>
<?php

$GLOBALS['linkaction'] = &$linkaction;
$ea = get('eaction',get('ea','edit'));
if ($ea == 'newedit')
      $linkaction = "?a=edit&ea=info";
elseif ($ea == 'saveedit')
      $linkaction = "?a=edit&ea=edit";
else
      $linkaction = "?a=edit&ea=$ea";
   
if (!isset($path)) 
      $path = $ps->getPathInfo($page);

$level = dohome();
if ($page->path == '' || $page->path{1} != ".") {
      echo "<div class=thinhr> </div>\n";
      dotree($level);
}
echo "<hr style='width:100%'/>\n";
doclipboard();
if (preg_match("'^/.clipboard'", $page->path)) {
      echo "<div class=thinhr> </div>\n";
      dotree(1);  
}
echo "<hr style='width:100%'/>\n";
dotrash();
if (preg_match("'^/.trash'", $page->path)) {
      echo "<div class=thinhr> </div>\n";
      dotree(1);
}
return;

function dohome() {
      global $page, $path, $linkaction;
      $branchdepth = 2; // how much of the tree to show     
      if (preg_match("'.*/$'",$page->path))
            $branchdepth--;
      $depth = count($path);
      
      echo("<div id=navroot>");
      $link = alink('/'. $linkaction ,"<u>H</u>ome","class='type-home browser' accesskey=h");
      if ($page->path=='') $link = "<strong>$link</strong>";
      echo "$link\n";   
      if ($depth > $branchdepth) {
            $startlevel = $depth-$branchdepth;
            $path = array_reverse($path);
            while(count($path) > $branchdepth) {
                  $pathpart = array_pop($path);
                  echo(alink($pathpart['path'] . '/' . $linkaction,$pathpart['title'],"class='type-dir browser'") . "\n");
            }
      }
      else {
            $startlevel = 0;
      }
      echo("</div>\n");
      return $startlevel;
}

function dotree($startlevel=0) {
      global $nav, $ps, $page, $path, $linkaction;
      $tree = $nav->getTree($page,$startlevel,true);
      #debug($page->path);
      foreach($tree as $entry) {
            echo (str_repeat('  ', $entry['level']+1));
            if (is_int($entry['level'])) {
                  $p = $ps->getPage($entry['path']);
                  if ($entry['dir'] == true)
                        $class = 'type-dir';
                  elseif ($entry['type'] == 'mod')
                        $class = 'type-mod';
                  else
                        $class = 'type-file';
      
                  $class .= " browser";
                  $link = alink($entry['path'] . '/' . $linkaction , $entry['title'], "class=\"$class\"");
                  if ($entry['selected']) $link = "<strong>$link</strong>";
                  $style = "margin-left: " . (($entry['level']*16)) . "px";

                  $menu = '<a class="quick" onClick="dropdownmenu(this, event, quickmenu(\'' . $entry['absolutepath'] . '\'))" onMouseout="delayhidemenu()" href="javascript:void(0)">&nbsp;&raquo;&nbsp;</a>';  
                  echo "<div style=\"$style\">$link$menu</div>\n";
            }
      }
      if (count($tree) == 0)
            echo "<div class='browser'>empty</div>";
}

function doclipboard() {
      global $page,$linkaction,$ps;

      if ($page->path=='/.clipboard') $selected = true;
      else $selected = false;

      $p = $ps->getPage("/.clipboard");

      echo("<div>");
      $link = alink('/.clipboard/'. $linkaction ,"C<u>l</u>ipboard","class='type-clip browser' accesskey='l'");
      if ($selected)
            $link = "<strong>$link</strong>";
      echo "$link</div>\n";   
}

function dotrash() {
      global $page, $path, $linkaction, $ps;

      if ($page->path=='/.trash') $selected = true;
      else $selected = false;

      $p = $ps->getPage("/.trash");
      echo("<div>");
      $link = alink('/.trash/'. $linkaction ,"<u>T</u>rash","class='type-trash browser' accesskey='t'");
      if ($selected)
            $link = "<strong>$link</strong>";
      echo "$link</div>\n";   
}


return;
?>

Generated by  Doxygen 1.6.0   Back to index