ASNMTAP

 view release on metacpan or  search on metacpan

applications/htmlroot/snmptraps/include/classes/class.frontend.php  view on Meta::CPAN

	// ======================== Contructor and functions for the main of the frontend =======================
	
	/**
	* Constructor for the main
	*
	* @author Michael Luebben <michael_luebben@web.de>
	*/
	function constructorMain() {
	   global $languageXML, $traps, $MAIN;
	   // Check database connacetion and read traps from database
	   $traps = common::readTraps();
	   $this->site[] = '<FORM NAME="form1" ACTION="./index.php" METHOD="POST">';
	   $this->site[] = '<TABLE WIDTH="100%" BORDER="0">';
	   $this->site[] = '   <TR>';

  	   /**
	   * @author Alex Peeters [alex.peeters@citap.be]
       */
       if ($MAIN->checkAction() == "1") {
	     $this->site[] = '      <TH CLASS="status" WIDTH="30">'.$languageXML['LANG']['MAIN']['TRAPTABLEHEADER']['OPTION'].'</TH>';
       }

       $this->site[] = '      <TH CLASS="status">'.$languageXML['LANG']['MAIN']['TRAPTABLEHEADER']['HOST'].'</TH>';
       $this->site[] = '      <TH CLASS="status" WIDTH="30">'.$languageXML['LANG']['MAIN']['TRAPTABLEHEADER']['TRAPOID'].'</TH>';
       $this->site[] = '      <TH CLASS="status">'.$languageXML['LANG']['MAIN']['TRAPTABLEHEADER']['TRAPTIME'].'</TH>';
       common::showTrapFields("field",NULL,NULL,NULL);
       $this->site[] = '      <TH CLASS="status">'.$languageXML['LANG']['MAIN']['TRAPTABLEHEADER']['MESSAGE'].'</TH>';
	   $this->site[] = '   </TR>';
	   common::createTrapPage($traps);
	   $this->site[] = '</TABLE>';
	}
	
	/**
	* Create a Java Infobox
	*
	* @author Michael Luebben <michael_luebben@web.de>
	*/ 
	function javaInfoBox($formatline) {
	   $infoBox = 'onmouseover="return overlib(\'';
	   $infoBox .= $formatline;
	   $infoBox .= '\', CAPTION, \'Trap-Message\', VAUTO);" onmouseout="return nd();" ';
	   return($infoBox);
	}
	
    /**
	* Show traps
	*
	* @author Michael Luebben <michael_luebben@web.de>
	*/ 
	function showTrap($trap,$rowColor,$styleLine) {
	   global $configINI, $languageXML, $MAIN;
       $this->site[] = '   <TR>';

  	   /**
	   * @author Alex Peeters [alex.peeters@citap.be]
       */
       if ($MAIN->checkAction() == "1") {
   	      // Checkbox
	      $this->site[] = '      <TD CLASS="'.$rowColor.'"><INPUT TYPE="checkbox" NAME="trapIDs[]" VALUE="'.$trap['id'].'" '.$_GET['sel'].'>';
	      // Mark a trap
	      $this->site[] = '         <A HREF="./index.php?action=mark&amp;trapID='.$trap['id'].'&amp;severity='.$_REQUEST['severity'].'&amp;category='.rawurlencode($_REQUEST['category']).'&amp;hostname='.$_REQUEST['hostname'].'&amp;trapOID='.$_REQUEST['t...
	      // Delete a trap
	      $this->site[] = '         <A HREF="./index.php?action=delete&amp;trapID='.$trap['id'].'&amp;severity='.$_REQUEST['severity'].'&amp;category='.rawurlencode($_REQUEST['category']).'&amp;hostname='.$_REQUEST['hostname'].'&amp;trapOID='.$_REQUEST[...
	      $this->site[] = '      </TD>';
       }

	   // Select host
	   $this->site[] = '      <TD CLASS="'.$rowColor.'"><P '.$styleLine.'><A HREF="./index.php?severity='.$_REQUEST['severity'].'&amp;category='.rawurlencode($_REQUEST['category']).'&amp;hostname='.$trap['hostname'].'&amp;FQDN=T">'.$trap['hostname'].'</...
	   // Select trapOID
	   $this->site[] = '      <TD CLASS="'.$rowColor.'"><P '.$styleLine.'><A HREF="./index.php?severity='.$_REQUEST['severity'].'&amp;category='.rawurlencode($_REQUEST['category']).'&amp;hostname='.$trap['hostname'].'&amp;trapOID='.$trap['trapoid'].'&am...
	   $this->site[] = '      <TD CLASS="'.$rowColor.'"><P '.$styleLine.'>'.$trap['traptime'].'</P></TD>';
	   common::showTrapFields("entry",$trap,$rowColor,$styleLine);
	   $this->site[] = '      <TD CLASS="'.$rowColor.'"><P '.$styleLine.' '.$this->javaInfoBox($trap['orgFormatline']).'CLASS="formatline">'.htmlentities($trap['formatline']).'</P></TD>';
	   $this->site[] = '   </TR>';
	}
	
	// ======================= Contructor and functions for the footer of the frontend ====================== 
	
	/**
	* Constructor for the main
	*
	* @author Michael Luebben <michael_luebben@web.de>
	*/
	//FIXME !!!
	function constructorFooter() {
	   global $configINI, $languageXML, $MAIN;
	   $this->site[] = '<TABLE WIDTH="100%" BORDER="0">';
	   $this->site[] = '   <TR>';
	   $this->site[] = '      <TD CLASS="linkBox">';

  	   /**
	   * @author Alex Peeters [alex.peeters@citap.be]
       */
       if ($MAIN->checkAction() == "1") {
	      $this->site[] = '         <IMG SRC="'.$configINI['global']['images'].$configINI['global']['iconStyle'].'/arrow.png" ALT="" BORDER="0">';
  	      $this->site[] = '         <INPUT TYPE="checkbox" NAME="checkbox" VALUE="checkbox" onClick="checkAll(\'yes\'); return true;">(Mark all)';
  	      $this->site[] = '         <INPUT TYPE="image" SRC="'.$configINI['global']['images'].$configINI['global']['iconStyle'].'/mark.png" NAME="markTraps[0]" TITLE="'.$languageXML['LANG']['MAIN']['TRAPTABLEENTRY']['OPTIONREAD'].'">';
	      $this->site[] = '         <INPUT TYPE="image" SRC="'.$configINI['global']['images'].$configINI['global']['iconStyle'].'/delete.png" NAME="deleteTraps[0]" TITLE="'.$languageXML['LANG']['MAIN']['TRAPTABLEENTRY']['OPTIONDELETE'].'">';
	   }

	   $this->site[] = '         <INPUT TYPE="hidden" NAME="oldestfirst" VALUE="'.$_REQUEST['oldestfirst'].'">';
       $this->site[] = '         <INPUT TYPE="hidden" NAME="severity" VALUE="'.$_REQUEST['severity'].'">';
	   $this->site[] = '         <INPUT TYPE="hidden" NAME="category" VALUE="'.$_REQUEST['category'].'">';
	   $this->site[] = '         <INPUT TYPE="hidden" NAME="hostname" VALUE="'.$_REQUEST['hostname'].'">';
	   $this->site[] = '         <INPUT TYPE="hidden" NAME="trapOID" VALUE="'.$_REQUEST['trapOID'].'">';
	   $this->site[] = '         <INPUT TYPE="hidden" NAME="FQDN" VALUE="'.$_REQUEST['FQDN'].'">';
	   $this->site[] = '      </TD>';	   
	   $this->site[] = '   </TR>';
	   $this->site[] = '</TABLE>';
	   $this->site[] = '</FORM>';
	}
	
}
?>



( run in 1.387 second using v1.01-cache-2.11-cpan-df04353d9ac )