<?php
defined('ROOT_DIR') or die(__FILE__.' requires egConfig.inc.php');

include_once(ROOT_DIR.'egWindow.class.php');

class egEdit extends egWindow {

	var $name;
	var $hide;
	var $readonly;

	function egEdit($id, $value, $posX=0, $posY=0, $width=0, $height=18, $name="", $hide=false) {
	  if($height == null) {
	    $height = 18;
	  }
	  $this->name = $name;
	  $this->hide = $hide;
		parent::egWindow($id, $value, $posX, $posY, $width, $height);
	}

	function getClassName() {
		return "egEdit";
	}

	function getHTML($container = null) {
		$html = "var edit_{$this->id} = new egEdit('{$this->id}', '{$this->title}', '{$this->posX}', '{$this->posY}', '{$this->width}', '{$this->height}', '{$container}', '{$this->name}', '{$this->hide}');";
		if($this->readonly) {
			$html .= "edit_{$this->id}.setReadonly();";		
		}
		$html .= "egObjectsArray['edit_{$this->id}'] = edit_{$this->id};";

		return $html;
	}

	/**
   *
   * @static
	 */
	function getScriptsFiles() {
    $scriptsArray = array();
    $scriptsArray[ALL] = "egEdit_default.js";
    return $scriptsArray;
	}

	/**
   *
   * @static
   */
	function getStylesFiles() {
    $stylesArray = array();
    $stylesArray[ALL] = "egEdit_default.css";

    $stylesArray[INTERNET_EXPLORER] = array();

    $stylesArray[INTERNET_EXPLORER][ALL] = "egEdit_ie60.css";

    $stylesArray[INTERNET_EXPLORER]['6'] = array();
    $stylesArray[INTERNET_EXPLORER]['6'][ALL] = "egEdit_ie60.css";

    $stylesArray[INTERNET_EXPLORER]['7'] = array();
    $stylesArray[INTERNET_EXPLORER]['7'][ALL] = "egEdit_ie60.css";


    $stylesArray[FIREFOX] = array();

    $stylesArray[FIREFOX][ALL] = "egEdit_ff15.css";

    $stylesArray[FIREFOX]['1'] = array();
    $stylesArray[FIREFOX]['1'][ALL] = "egEdit_ff15.css";
    $stylesArray[FIREFOX]['1']['5'] = "egEdit_ff15.css";

    $stylesArray[FIREFOX]['2'] = array();
    $stylesArray[FIREFOX]['2'][ALL] = "egEdit_ff15.css";


    return $stylesArray;
  }
}
?>