1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
   | <?php
include_once("fckeditor/fckeditor.php") ;
 
/**
 * This code is part of the FileManager software (www.gerd-tentler.de/tools/filemanager), copyright by
 * Gerd Tentler. Obtain permission before selling this code or hosting it on a commercial website or
 * redistributing it over the Internet or in any other medium. In all cases copyright must remain intact.
 */
 
include_once('Tools.php');
 
/**
 * This class creates a text editor.
 *
 * @package FileManager
 * @subpackage class
 * @author Gerd Tentler
 */
class Editorhtml {
 
/* PRIVATE PROPERTIES ************************************************************************** */
 
	/**
	 * holds FileManager object
	 *
	 * @var FileManager
	 */
	var $FileManager;
 
/* PUBLIC METHODS ****************************************************************************** */
 
	/**
	 * constructor
	 *
	 * @param FileManager $FileManager
	 * @return Editor
	 */
	function Editorhtml(&$FileManager) {
		$this->FileManager =& $FileManager;
	}
 
	/**
	 * view text editor
	 *
	 * @param Entry $Entry		file entry object
	 */
	function view(&$Entry) {
		$this->viewHeader($Entry);
		$this->viewContent($Entry);
		$this->viewFooter();
	}
 
/* PRIVATE METHODS ***************************************************************************** */
 
	/**
	 * view header
	 *
	 * @param Entry $Entry		file entry object
	 */
	function viewHeader(&$Entry) {
		global $msg;
 
		$webPath = $this->FileManager->fmWebPath;
		$url = $webPath . '/action.php?fmContainer=' . $this->FileManager->container;
 
		print "<form name=\"frmEdit\" class=\"fmForm\" action=\"javascript:fmCall('$url', 'frmEdit')\" method=\"post\">\n";
    	print "<input type=\"hidden\" name=\"fmMode\" value=\"edit\">\n";
    	print "<input type=\"hidden\" name=\"fmObject\" value=\"$Entry->id\">\n";
		print "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\">\n";
		print "<tr>\n";
		print "<td class=\"fmTH1\" align=\"left\">" . $msg['cmdEdithtml'] . ": $Entry->name</td>\n";
		print "<td class=\"fmTH1\" align=\"right\" nowrap=\"nowrap\">\n";
		Tools::printIcon("$webPath/icons/list.gif", 14, 14, "fmCall('$url')", $msg['cmdViewList'], 'cursor:pointer');
		Tools::printIcon("$webPath/icons/reset.gif", 14, 14, "document.frmEdit.reset()", $msg['cmdReset'], 'cursor:pointer');
		Tools::printIcon("$webPath/icons/save.gif", 14, 14, "fmCallOK('{$msg['msgSaveFile']}', '', 'frmEdit')", $msg['cmdSave'], 'cursor:pointer');
		print "</td>\n";
		print "</tr>\n";
		print "<tr>\n";
		print "<td class=\"fmTH2\" colspan=\"2\" align=\"center\">\n";
	}
 
	/**
	 * view footer
	 */
	function viewFooter() {
		print "</td>\n";
		print "</tr>\n";
		print "</table>\n";
		print "</form>\n";
	}
 
	/**
	 * view file content
	 *
	 * @param Entry $Entry		file entry object
	 */
	function viewContent(&$Entry) {
		$file = $Entry->getFile();
		$content = Tools::readLocalFile($file);
		$width = $this->FileManager->fmWidth - 14;
		$height = $this->FileManager->maskHeight;
 
		$oFCKeditor = new FCKeditor('fmText') ;
		$oFCKeditor->BasePath = 'fckeditor/' ;
		$oFCKeditor->Value = $content ;
		$oFCKeditor->Create() ;
 
	/**	print "<textarea name=\"fmText\" style=\"width:{$width}px; height:{$height}px\" ";
		print "wrap=\"off\" class=\"fmField\">" . htmlspecialchars($content) . "</textarea>\n"; */
	}
}
 
?> | 
Partager