[Phpcms-plugins-cvs] admin4phpCMS/modules/editor class.module_zip_editor.php,NONE,1.1 class.module_t
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-08-25 21:17:25
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2565/modules/editor Modified Files: class.module_text_editor.php class.module_xml_editor.php class.module_editor.php class.module_phpcms_editor.php class.module_image_editor.php Added Files: class.module_zip_editor.php Log Message: step 1 is taken Index: class.module_xml_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor/class.module_xml_editor.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- class.module_xml_editor.php 24 Jul 2004 08:50:34 -0000 1.2 +++ class.module_xml_editor.php 25 Aug 2004 21:16:43 -0000 1.3 @@ -28,6 +28,9 @@ /* * $Log$ +* Revision 1.3 2004/08/25 21:16:43 mjahn +* step 1 is taken +* * Revision 1.2 2004/07/24 08:50:34 mjahn * updated editor-module * @@ -40,7 +43,7 @@ /** * include PEAR:XML_Tree for parsing of XML-files **/ -include_once ('XML/Tree.php'); +include_once (PATH_TO_PEAR.'XML/Tree.php'); /** * XML editor class @@ -73,14 +76,14 @@ $filename = $actiondata ['filename']; if (!isset($filename)) { - $actiondata = array ('errortext'=>'Datei '.$filename.' konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Datei '.$filename.' konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } if (!file_exists ($filename)) { - $actiondata = array ('errortext'=>'Layoutdatei '.$filename.' konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Layoutdatei '.$filename.' konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } @@ -94,8 +97,8 @@ $fh = @fopen ($filename, 'wb'); if ($fh === false) { fclose ($fh); - $actiondata = array ('errortext'=>'Konnte nicht in die Zieldatei '.$this->filename.' schreiben! (fehlende Schreibrechte)'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Konnte nicht in die Zieldatei '.$this->filename.' schreiben! (fehlende Schreibrechte)'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } fwrite ($fh, $this->_file->get ()); @@ -111,8 +114,8 @@ $i = 0; foreach ($data as $line) { - $actiondata = array ('_id'=>'line'.$i, '_root'=>$actiondata ['_root'], '_type'=>'empty', 'class'=>'', 'id'=>'', 'content'=>htmlentities ($line).'<br />'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>'line'.$i, '_root'=>$actiondata ['_root'], '_type'=>'empty', 'class'=>'', 'id'=>'', 'content'=>htmlentities ($line).'<br />'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $i++; } } @@ -126,20 +129,20 @@ $this->filename = $actiondata ['_filename']; // set container for fileviewer - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'columns', '_type'=>'column_block', 'extra'=>'id="spalten"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$actiondata ['_root'], '_id'=>'columns', '_type'=>'column_block', 'extra'=>'id="spalten"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set container for XML-Tree - $actiondata = array ('_root'=>'columns', '_id'=>'tree-column', '_type'=>'column'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'columns', '_id'=>'tree-column', '_type'=>'column'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set list-container for XML-Tree - $actiondata = array ('_root'=>'tree-column', '_id'=>'file-edit-tree', '_type'=>'ulist'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'tree-column', '_id'=>'file-edit-tree', '_type'=>'ulist'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set container for input-fields - $actiondata = array ('_root'=>'columns', '_id'=>'edit-column', '_type'=>'column'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'columns', '_id'=>'edit-column', '_type'=>'column'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $XML =& new XML_Tree ($this->filename); $this->_file =& $XML->getTreeFromFile (); @@ -147,8 +150,8 @@ $this->displayNode ($this->_file, 'file-edit-tree', 'file-edit-tree-0', 'edit-column'); - $actiondata = array ('_id'=>'file-edit-form-submit', '_root'=>'file-edit-form', '_type'=>'form_button', 'text'=>'Absenden', 'name'=>'xml-save-file', 'value'=>'save'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>'file-edit-form-submit', '_root'=>'file-edit-form', '_type'=>'form_button', 'text'=>'Absenden', 'name'=>'xml-save-file', 'value'=>'save'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } @@ -162,43 +165,38 @@ **/ function displayNode (&$node, $root, $node_id, $input_id) { if (isset ($node->name) && $node->name != '') { - $actiondata = array ('_id'=>$node_id, '_root'=>$root, '_type'=>'list_entry'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - - $actiondata = array ('_id'=>$node_id.'-script', '_root'=>$root, '_type'=>'script', 'content'=>'registerTab (\''.$node_id.'\')'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>$node_id, '_root'=>$root, '_type'=>'list_entry'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_id'=>$node_id.'-link', '_root'=>$node_id, '_type'=>'link', 'content'=>$node->name, 'href'=>'#'.$node_id, 'extra'=>'onclick="displayTab (\''.$node_id.'\' )" onkeypress="displayTab (\''.$node_id.'\')"'); - if (isset ($node->attributes['name'])) { - $actiondata ['title'] = $node->attributes['name']; - } - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>$node_id.'-script', '_root'=>$root, '_type'=>'script', 'content'=>'registerTab (\''.$node_id.'\')'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); + $actiondata1 $actiondata = array ('_id'=>$node_id.'-name', '_root'=>$node_id.'-link', '_type'=>'empty', 'content'=>$node->name); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_id'=>$node_id.'-block', '_root'=>$input_id, '_type'=>'block', 'extra'=>'id="'.$node_id.'"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>$node_id.'-block', '_root'=>$input_id, '_type'=>'block', 'extra'=>'id="'.$node_id.'"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_id'=>$node_id.'-set', '_root'=>$node_id.'-block', '_type'=>'form_fieldset','title'=>$node->name); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>$node_id.'-set', '_root'=>$node_id.'-block', '_type'=>'form_fieldset','title'=>$node->name); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); foreach ($node->attributes as $name=>$value) { - $actiondata = array ('_id'=>$node_id.'-'.$name, '_root'=>$node_id.'-set', '_type'=>'form_input_text', 'extra'=>'id="xml-'.$node_id.'-attr-'.$name.'" ', 'name'=>'xml-'.$node_id.'-attr-'.$name, 'value'=>htmlentities ($value), 'label'=>$name); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>$node_id.'-'.$name, '_root'=>$node_id.'-set', '_type'=>'form_input_text', 'extra'=>'id="xml-'.$node_id.'-attr-'.$name.'" ', 'name'=>'xml-'.$node_id.'-attr-'.$name, 'value'=>htmlentities ($value), 'label'=>$name); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } - $actiondata = array ('_id'=>$node_id.'-content', '_root'=>$node_id.'-set', '_type'=>'form_textarea', 'name'=>'xml-'.$node_id.'-content', 'extra'=>'id="xml-'.$node_id.'-content" ', 'value'=>htmlentities ($node->content), 'label'=>'content'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>$node_id.'-content', '_root'=>$node_id.'-set', '_type'=>'form_textarea', 'name'=>'xml-'.$node_id.'-content', 'extra'=>'id="xml-'.$node_id.'-content" ', 'value'=>htmlentities ($node->content), 'label'=>'content'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } if (isset ($node->children) && is_array ($node->children) && count ($node->children) > 0) { - $actiondata = array ('_id'=>$node_id.'-sub', '_root'=>$node_id, '_type'=>'ulist'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>$node_id.'-sub', '_root'=>$node_id, '_type'=>'ulist'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $num = count ($node->children); Index: class.module_image_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor/class.module_image_editor.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.module_image_editor.php 24 Jul 2004 08:50:34 -0000 1.1 +++ class.module_image_editor.php 25 Aug 2004 21:16:43 -0000 1.2 @@ -28,8 +28,8 @@ /* * $Log$ -* Revision 1.1 2004/07/24 08:50:34 mjahn -* updated editor-module +* Revision 1.2 2004/08/25 21:16:43 mjahn +* step 1 is taken * * Revision 1.1 2004/06/18 15:17:00 mjahn * module filemanager and editor included @@ -161,18 +161,18 @@ $webname = $actiondata ['_webname']; $root = $actiondata ['_root']; $size = getimagesize ($filename); - $actiondata = array ('_root'=>$root, '_id'=>'view-image-block', '_type'=>'empty'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$root, '_id'=>'view-image-block', '_type'=>'empty'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set image-viewer - $actiondata = array ('_root'=>'view-image-block', '_id'=>'view-image', '_type'=>'image', 'src'=>$webname, + $actiondata1 = array ('_root'=>'view-image-block', '_id'=>'view-image', '_type'=>'image', 'src'=>$webname, 'width'=>$size[0], 'height'=>$size[1], 'alt'=>'', 'title'=>''); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set image-data $content = 'Dateigröße: '.file_util::filesize ($filename).'<br />'. 'Breite: '.$size[0].'px<br />'. 'Höhe: '.$size[1].'px<br />'; - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'fileinfo', '_type'=>'block', 'id'=>'', 'class'=>'', 'content'=>$content); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$actiondata ['_root'], '_id'=>'fileinfo', '_type'=>'block', 'id'=>'', 'class'=>'', 'content'=>$content); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } function editFile (&$actiondata) { Index: class.module_text_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor/class.module_text_editor.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.module_text_editor.php 18 Jun 2004 15:17:00 -0000 1.1 +++ class.module_text_editor.php 25 Aug 2004 21:16:43 -0000 1.2 @@ -28,6 +28,9 @@ /* * $Log$ +* Revision 1.2 2004/08/25 21:16:43 mjahn +* step 1 is taken +* * Revision 1.1 2004/06/18 15:17:00 mjahn * module filemanager and editor included * @@ -35,11 +38,6 @@ /** -* include PEAR:XML_Tree for parsing of XML-files -**/ -include_once ('XML/Tree.php'); - -/** * Text editor class * * This class provides an interface for editing Text-files. @@ -65,14 +63,14 @@ **/ function openfile ($filename) { if (!isset($filename)) { - $actiondata = array ('errortext'=>'Datei '.$filename.' konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Datei '.$filename.' konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } if (!file_exists ($filename)) { - $actiondata = array ('errortext'=>'Layoutdatei '.$filename.' konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Layoutdatei '.$filename.' konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } @@ -90,8 +88,8 @@ **/ function savefile ($filename = '') { if (!isset ($this->_file)) { - $actiondata = array ('errortext'=>'Keine XML-Daten zum Speichern vorhanden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Keine XML-Daten zum Speichern vorhanden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } @@ -101,8 +99,8 @@ $fh = @fopen ($filename, 'wb'); if ($fh === false) { fclose ($fh); - $actiondata = array ('errortext'=>'Konnte nicht in die Zieldatei '.$this->filename.' schreiben! (fehlende Schreibrechte)'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Konnte nicht in die Zieldatei '.$this->filename.' schreiben! (fehlende Schreibrechte)'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } fwrite ($fh, $this->_file->get ()); @@ -112,12 +110,17 @@ function viewFile (&$actiondata) { $this->filename = $actiondata ['_filename']; - $data = file ($this->filename); - $i = 0; - + if (strrchr ($this->filename, '.') == '.gz') { + $data = file ($this->filename); + } else { + $data = file ($this->filename); + } + + reset ($data); + $i = 1; foreach ($data as $line) { - $actiondata = array ('_id'=>'line'.$i, '_root'=>$actiondata ['_root'], '_type'=>'empty', 'content'=>htmlentities ($line)); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>'view-line-'.$i, '_root'=>$actiondata ['_root'], '_type'=>'ed_viewer_text_line', 'content'=>htmlentities ($line), 'line'=>$i); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $i++; } } @@ -125,10 +128,16 @@ function editFile (&$actiondata) { $this->filename = $actiondata ['_filename']; - $data = file ($this->filename); + if (strrchr ($this->filename, '.') == '.gz') { + $data = file ($this->filename); + } else { + $data = file ($this->filename); + } + + $data = join ('', $data); - $actiondata = array ('_id'=>'edit-file', '_root'=>$actiondata ['_root'], '_type'=>'form_textarea', 'value'=>join ('', $data)); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>'edit-file', '_root'=>$actiondata ['_root'], '_type'=>'ed_editor_text', 'content'=>htmlentities ($data)); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } } ?> \ No newline at end of file Index: class.module_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor/class.module_editor.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- class.module_editor.php 24 Jul 2004 08:50:34 -0000 1.2 +++ class.module_editor.php 25 Aug 2004 21:16:43 -0000 1.3 @@ -30,6 +30,9 @@ /* * $Log$ +* Revision 1.3 2004/08/25 21:16:43 mjahn +* step 1 is taken +* * Revision 1.2 2004/07/24 08:50:34 mjahn * updated editor-module * @@ -43,6 +46,7 @@ * @package admin4phpCMS * @subpackage module_editor * @uses file_editor +* @todo internal clipboard over all editors **/ class module_editor extends module { @@ -56,9 +60,12 @@ $this->_registerAction ('doParseParam', 'parseParam'); $this->_registerAction ('doProcess', 'process'); $this->docroot = realpath ($_SERVER['DOCUMENT_ROOT']); - $actiondata = array ('module'=>'editor'); - $this->_callEvent ('CONFIG_GET', $actiondata); - $this->CONF =& $actiondata ['config']; + $actiondata1 = array ('module'=>'editor'); + $this->_callEvent ('CONFIG_GET', $actiondata1); + $this->CONF =& $actiondata1 ['config']; + + $actiondata1 = array ('filename'=>dirname (__FILE__).'/layout.xml'); + $this->_callEvent ('LAYOUT_ADD_TEMPLATE', $actiondata1); } /** @@ -73,12 +80,18 @@ $this->viewfile = ''; $this->editfile = ''; $this->action = ''; + $this->basedir = ''; // get the action if (isset ($actiondata['request']['action'])) { $this->action = $actiondata['request']['action']; } + // get the basedir + if (isset ($actiondata['request']['basedir'])) { + $this->basedir = $actiondata['request']['basedir']; + } + // get the filename of the file to view if ($this->action == 'viewfile' && isset ($actiondata['request']['file'])) { $this->filename = realpath ($this->docroot.'/'.$actiondata['request']['file']); @@ -92,8 +105,8 @@ if (isset ($this->filename) && strpos ($this->filename, $this->docroot) === false) { $this->filename = ''; $this->action = ''; - $actiondata = array ('errortext'=>'Die Datei befindet sich außerhalb des erlaubten Bereiches!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Die Datei befindet sich außerhalb des erlaubten Bereiches!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); } } @@ -101,9 +114,9 @@ * @param array $actiondata **/ function process (&$actiondata) { - $actiondata = array(); - $this->_callEvent ('USER_GET_STATUS', $actiondata); - $this->_USER = $actiondata; + $actiondata1 = array(); + $this->_callEvent ('USER_GET_STATUS', $actiondata1); + $this->_USER = $actiondata1; if (!$this->_USER['isLoggedIn']) { return true; @@ -115,15 +128,15 @@ // check if the file exists if (!file_exists ($this->filename)) { - $actiondata = array ('errortext'=>'Die Datei '.$this->filename.' existiert nicht!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Die Datei '.$this->filename.' existiert nicht!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return true; } // check if the file is readable if (!is_readable ($this->filename)) { - $actiondata = array ('errortext'=>'Die Datei '.$filename.' kann nicht geöffnet werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Die Datei '.$this->filename.' kann nicht geöffnet werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return true; } @@ -131,7 +144,7 @@ $this->webname = str_replace ($this->docroot, '', $this->filename); // extract the extension from filename - $this->ext = strtolower (substr ($this->filename, strrpos ($this->filename, '.')+1)); + $this->ext = strtolower (substr (strrchr ('.', $this->filename), 1)); // load correct editor-module into framework switch ($this->ext) { // imagetypes @@ -149,16 +162,20 @@ case 'htm': $this->filetype = 'phpcms'; break; + + case 'zip': + $this->filetype = 'zip'; + break; default: $this->filetype = 'text'; break; } - $actiondata = array ('filename'=>dirname(__FILE__).'/class.module_'.$this->filetype.'_editor.php', 'class'=>'module_'.$this->filetype.'_editor'); - $this->_callEvent ('LOAD_MODULE', $actiondata); + $actiondata1 = array ('filename'=>dirname(__FILE__).'/class.module_'.$this->filetype.'_editor.php', 'class'=>'module_'.$this->filetype.'_editor'); + $this->_callEvent ('LOAD_MODULE', $actiondata1); - $actiondata = array ('filename'=>$this->filename); - $this->_callEvent ('EDITOR_SAVE_FILE', $actiondata); + $actiondata1 = array ('filename'=>$this->filename); + $this->_callEvent ('EDITOR_SAVE_FILE', $actiondata1); switch ($this->action) { case 'viewfile': @@ -176,28 +193,21 @@ function getViewContent (&$actiondata) { - $actiondata = array ('_id'=>'headline1', '_root'=>$actiondata['_root'], '_type'=>'headline', 'content'=>$this->webname); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - // set container for fileviewer - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'fileviewer', '_type'=>'block', 'extra'=>'id="fileviewer"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$actiondata ['_root'], '_id'=>'fileviewer', '_type'=>'ed_viewer', 'extra'=>'id="fileviewer"', 'filename'=>$this->webname, 'basedir'=>$this->basedir); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_root'=>'fileviewer', '_filename'=>$this->filename, '_webname'=>$this->webname); - $this->_callEvent ('DISPLAY_VIEWER', $actiondata); + $actiondata1 = array ('_root'=>'fileviewer', '_filename'=>$this->filename, '_webname'=>$this->webname); + $this->_callEvent ('DISPLAY_VIEWER', $actiondata1); } function getEditContent (&$actiondata) { - $actiondata = array ('_id'=>'headline1', '_root'=>$actiondata['_root'], '_type'=>'headline', 'content'=>$this->webname); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>'file-editor', '_root'=>$actiondata['_root'], '_type'=>'ed_editor', 'filename'=>$this->webname, 'basedir'=>$this->basedir); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - // set formular for fileviewer - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'file-edit-form', '_type'=>'form', 'action'=>'', 'method'=>'post'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - - $actiondata = array ('_root'=>'file-edit-form', '_filename'=>$this->filename, '_webname'=>$this->webname); - $this->_callEvent ('DISPLAY_EDITOR', $actiondata); + $actiondata1 = array ('_root'=>'file-editor', '_filename'=>$this->filename, '_webname'=>$this->webname); + $this->_callEvent ('DISPLAY_EDITOR', $actiondata1); } } Index: class.module_phpcms_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor/class.module_phpcms_editor.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.module_phpcms_editor.php 24 Jul 2004 08:50:34 -0000 1.1 +++ class.module_phpcms_editor.php 25 Aug 2004 21:16:43 -0000 1.2 @@ -28,8 +28,8 @@ /* * $Log$ -* Revision 1.1 2004/07/24 08:50:34 mjahn -* updated editor-module +* Revision 1.2 2004/08/25 21:16:43 mjahn +* step 1 is taken * * */ @@ -74,12 +74,13 @@ $EDITOR->configfile = 'editor.conf.xml'; // connect the user-permission-control to the editor-object - $this->_callEvent ('USER_GET_STATUS', $actiondata); - $this->EDITOR->USER = $actiondata; + $actiondata1 = array (); + $this->_callEvent ('USER_GET_STATUS', $actiondata1); + $this->EDITOR->USER = $actiondata1; // call display-method of editor object - $actiondata = array ('_id'=>'edit-file', '_root'=>$actiondata ['_root'], '_type'=>'empty', 'content'=>$EDITOR->start ()); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_id'=>'edit-file', '_root'=>$actiondata ['_root'], '_type'=>'empty', 'content'=>$EDITOR->start ()); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } } --- NEW FILE: class.module_zip_editor.php --- <?php /** * Editor for Text-files * * <b>License</b> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @author Martin Jahn <mj...@us...> * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @copyright Copyright (c) 2004, Martin Jahn * @version $Id: class.module_text_editor.php,v 1.1 2004/06/18 15:17:00 mjahn Exp $ * @package admin4phpCMS * @subpackage module_editor **/ /* * $Log: class.module_text_editor.php,v $ * Revision 1.1 2004/06/18 15:17:00 mjahn * module filemanager and editor included * */ /** * Text editor class * * This class provides an interface for editing Text-files. * * @package admin4phpCMS * @subpackage module_editor * @inheriteddoc **/ class module_zip_editor extends module { function init () { $this->_registerEvent ('DISPLAY_VIEWER', 'doDisplayViewer'); $this->_registerAction ('doDisplayViewer', 'viewFile'); $this->_registerEvent ('DISPLAY_EDITOR', 'doDisplayEditor'); $this->_registerAction ('doDisplayEditor', 'editFile'); } /** * Open a XML-file * * @param string $filename Contains the path of the XML-file to edit * @return boolean true if XML-file was opened successful **/ function openfile ($filename) { if (!isset($filename)) { $actiondata1 = array ('errortext'=>'Datei '.$filename.' konnte nicht geladen werden!'); $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } if (!file_exists ($filename)) { $actiondata1 = array ('errortext'=>'Layoutdatei '.$filename.' konnte nicht geladen werden!'); $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } $this->filename = $filename; $XML =& new XML_Tree ($this->filename); $this->_file =& $XML->getTreeFromFile (); return true; } /** * save the data from the formular into the XML-file * * @param string $filename Contains the path where to save the XML-file * @return boolean true if file was saved successful **/ function savefile ($filename = '') { if (!isset ($this->_file)) { $actiondata1 = array ('errortext'=>'Keine XML-Daten zum Speichern vorhanden!'); $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } if ($filename != '' && file_exists ($filename) && is_writeable ($filename)) { $this->filename = $filename; } $fh = @fopen ($filename, 'wb'); if ($fh === false) { fclose ($fh); $actiondata1 = array ('errortext'=>'Konnte nicht in die Zieldatei '.$this->filename.' schreiben! (fehlende Schreibrechte)'); $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } fwrite ($fh, $this->_file->get ()); fclose ($fh); } function viewFile (&$actiondata) { $this->filename = $actiondata ['_filename']; if (strrchr ($this->filename, '.') == '.gz') { $data = file ($this->filename); } else { $data = file ($this->filename); } reset ($data); $i = 1; foreach ($data as $line) { $actiondata1 = array ('_id'=>'view-line-'.$i, '_root'=>$actiondata ['_root'], '_type'=>'ed_viewer_text_line', 'content'=>htmlentities ($line), 'line'=>$i); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $i++; } } function editFile (&$actiondata) { $this->filename = $actiondata ['_filename']; if (strrchr ($this->filename, '.') == '.gz') { $data = file ($this->filename); } else { $data = file ($this->filename); } $data = join ('', $data); $actiondata1 = array ('_id'=>'edit-file', '_root'=>$actiondata ['_root'], '_type'=>'ed_editor_text', 'content'=>htmlentities ($data)); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } } ?> |