Hello,

i would like to make following proposal to the conditional objects in templates:
Its rather flexible and supports normal variables and Session-vars.....

in the template file:

<roundcube:button command="print" imageSel="/images/buttons/print_sel.png" imageAct="/images/buttons/print_act.png" imagePas="/images/buttons/print_pas.png" width="32" height="32" title="printmessage" condition="session:username:test"/>
</div>

in main.inc:

function rcube_xml_command($command, $str_attrib, $add_attrib=array())
  {
  global $IMAP, $CONFIG, $OUTPUT;
 
  $command = strtolower($command);
  $attrib = parse_attrib_string($str_attrib) + $add_attrib;
 

   //check if tag is conditional
   if($attrib['condition']) {
   $condition=explode(':',$attrib['condition']);
  
   $logmesg="condition:".$condition[0].'='.print_array($condition);
//console($logmesg);
    if(strpos($condition[2],',')) $condition_array=explode(',',$condition[2]);
    else $condition_array=array(0=>$condition[2]);
          
  switch ($condition[0]) {
  case 'session':
  // if sesion var is not set -> switch off command
       if(!in_array($_SESSION[$condition[1]],$condition_array)) $command='none';

  break;

 
  default:
  if(!$condition[0]==$condition[1])) $command='none';
// condition is not handled -> switch off command
  break;
  }
  }

Regards!