I am trying to add a "mouseover" feature events: when you put the mouse over a day with some events, they got listes in a layer, when you remove the mouse, the layer disappears.

I managed to load the data in events.theme

function theme_event_calendar_month($op, $header, $rows) {
  $output = "\n";
  foreach($rows as $setmana) {
    array_shift($setmana); //borrem el primer element que la capçalera
    foreach($setmana as $dia) {
      if (strlen($dia['data'])>2) { //en cas que hi hagi dades
$data=explode("/",$dia['data']);

$llista=event_calendar_data($data[count($data)-5], $data[count($data)-4], $data[count($data)-3]);
        $output.="<div id=\"capa_".$dia['id']."\" style=\"position:absolute;width:100;height:100;top:100;left:200;background-color:red;visibility:hidden\">\n";
        foreach($llista as $node) $aaa++; //$output.="      ".$node->title."\n";
        $output.="</div>";

      }
    }
  }

  $output .= theme("table", $header, $rows);
  return '<div class="event-calendar"><div class="month-view">'. $output ."</div></div>\n";
}

but now I should change the $output .= theme("table", $header, $rows); so it add "onMouseOver" to every link. Where is the code of this function?

thanks

PS: I also add a couple of functions to event.js

Comments

enboig’s picture

I managed to add the "attributes" at

function theme_event_calendar_month($op, $header, $rows) {
  $output = "\n";
  foreach($rows as $clau_s => $setmana) {
    array_shift($setmana); //borrem el primer element que la capçalera
    foreach($setmana as $clau_d => $dia) {
      if (strlen($dia['data'])>2) { //en cas que hi hagi dades
        //?¿?¿ anem a buscar el llistat de coses per aquest dia
        $data=explode("/",$dia['data']);
        //$llista=event_calendar_data($year, $month, $day, $view = NULL, $types = NULL, $terms = NULL); ?¿?¿ per referència
        $llista=event_calendar_data($data[count($data)-5], $data[count($data)-4], $data[count($data)-3]);
        $output.="<div id=\"capa_".$dia['id']."\" style=\"position:absolute;width:100;height:100;top:100;left:200;background-color:red;visibility:hidden\">\n";
        foreach($llista as $node) $output.="      ".$node->title."\n";
        $output.="</div>\n";
        
        //posem l'atribut de mouseOver
        $rows[$clau_s][$clau_d]['onmouseover']='showDay(\'capa_'.$dia['id'].'\')';
        $rows[$clau_s][$clau_d]['onmouseout']='hiddenDay(\'capa_'.$dia['id'].'\')';
      }
    }
  }

  $output .= theme("table", $header, $rows);
  return '<div class="event-calendar"><div class="month-view">'. $output ."</div></div>\n";
}

my problem right now is that the attribute appears a:

...
 <td class="jun mon" id="jun4" onmouseover="showDay(&#039;capa_jun5&#039;)" onmouseout="hiddenDay(&#039;capa_jun5&#039;)"><a href="/meg/?q=event/2007/06/4/day">4</a></td>
...

the quote is translated to html and it shouldn't. How could I avoid this?

enboig’s picture

I changed the way of doing this. Right now using CSS I make hidden all the layers, and then moving the mouse over the day a javascript function should be called.

I have written the function (called mostra4()) with no parameters in event.js; but when I move the mouse over the day it says:
"mostra4 is not defined"

Is javascript loaded? do I have to activate it?

kkaefer’s picture

For adding effects and interactivity to Drupal web pages, the JavaScript library jQuery is used. Also read the article about unobtrusive JavaScript to learn a better and cleaner way to include JavaScript in your pages.

enboig’s picture

Status: Active » Closed (won't fix)

forget about it.