[Phpcms-plugins-cvs] admin4phpCMS/modules/editor class.module_phpcms_editor.php,NONE,1.1 editor.css,
Brought to you by:
mjahn
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24205/modules/editor Modified Files: class.module_xml_editor.php class.module_editor.php Added Files: class.module_phpcms_editor.php editor.css editor.js class.module_image_editor.php Log Message: updated editor-module Index: class.module_xml_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor/class.module_xml_editor.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.module_xml_editor.php 18 Jun 2004 15:17:00 -0000 1.1 +++ class.module_xml_editor.php 24 Jul 2004 08:50:34 -0000 1.2 @@ -28,6 +28,9 @@ /* * $Log$ +* Revision 1.2 2004/07/24 08:50:34 mjahn +* updated editor-module +* * Revision 1.1 2004/06/18 15:17:00 mjahn * module filemanager and editor included * @@ -123,26 +126,30 @@ $this->filename = $actiondata ['_filename']; // set container for fileviewer - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'columns', '_type'=>'column_block', 'id'=>'spalten', 'class'=>''); + $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'columns', '_type'=>'column_block', 'extra'=>'id="spalten"'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); // set container for XML-Tree - $actiondata = array ('_root'=>'columns', '_id'=>'file-edit-tree-column', '_type'=>'column', 'id'=>'', 'class'=>''); + $actiondata = array ('_root'=>'columns', '_id'=>'tree-column', '_type'=>'column'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); // set list-container for XML-Tree - $actiondata = array ('_root'=>'file-edit-tree-column', '_id'=>'file-edit-tree', '_type'=>'ulist', 'id'=>'', 'class'=>''); + $actiondata = array ('_root'=>'tree-column', '_id'=>'file-edit-tree', '_type'=>'ulist'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); // set container for input-fields - $actiondata = array ('_root'=>'columns', '_id'=>'file-edit-input', '_type'=>'column', 'id'=>'', 'class'=>''); + $actiondata = array ('_root'=>'columns', '_id'=>'edit-column', '_type'=>'column'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); $XML =& new XML_Tree ($this->filename); $this->_file =& $XML->getTreeFromFile (); //print_r ($this->_file); - $this->displayNode ($this->_file, 'file-edit-tree', 'file-edit-tree-0', 'file-edit-input'); + $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); + } /** @@ -155,31 +162,34 @@ **/ function displayNode (&$node, $root, $node_id, $input_id) { if (isset ($node->name) && $node->name != '') { - $actiondata = array ('_id'=>$node_id, '_root'=>$root, '_type'=>'list_entry', 'class'=>'', 'id'=>''); + $actiondata = array ('_id'=>$node_id, '_root'=>$root, '_type'=>'list_entry'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - $actiondata = array ('_id'=>$node_id.'-link', '_root'=>$node_id, '_type'=>'link', 'class'=>'', 'id'=>'', 'content'=>$node->name, 'href'=>'#'.$node_id); + $actiondata = array ('_id'=>$node_id.'-script', '_root'=>$root, '_type'=>'script', 'content'=>'registerTab (\''.$node_id.'\')'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + + $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); - $actiondata = array ('_id'=>$node_id.'-name', '_root'=>$node_id.'-link', '_type'=>'empty', 'class'=>'', 'id'=>'', 'content'=>$node->name); + $actiondata = array ('_id'=>$node_id.'-name', '_root'=>$node_id.'-link', '_type'=>'empty', 'content'=>$node->name); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - $actiondata = array ('_id'=>$node_id.'-block', '_root'=>$input_id, '_type'=>'block', 'class'=>'', 'id'=>$node_id); + $actiondata = array ('_id'=>$node_id.'-block', '_root'=>$input_id, '_type'=>'block', 'extra'=>'id="'.$node_id.'"'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - $actiondata = array ('_id'=>$node_id.'-set', '_root'=>$node_id.'-block', '_type'=>'form_fieldset', 'class'=>'', 'id'=>'', 'title'=>$node->name); + $actiondata = array ('_id'=>$node_id.'-set', '_root'=>$node_id.'-block', '_type'=>'form_fieldset','title'=>$node->name); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); foreach ($node->attributes as $name=>$value) { - $actiondata = array ('_id'=>$node_id.'-'.$name, '_root'=>$node_id.'-set', '_type'=>'form_input_text', 'extra'=>'id="'.$node_id.'-'.$name.'" ', 'name'=>$node_id.'-'.$name, 'value'=>htmlentities ($value), 'label'=>$name); + $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); } - $actiondata = array ('_id'=>$node_id.'-content', '_root'=>$node_id.'-set', '_type'=>'form_textarea', 'name'=>$node_id.'-content', 'extra'=>'id="'.$node_id.'-content" ', 'value'=>htmlentities ($node->content), 'label'=>'content'); + $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); @@ -187,7 +197,7 @@ if (isset ($node->children) && is_array ($node->children) && count ($node->children) > 0) { - $actiondata = array ('_id'=>$node_id.'-sub', '_root'=>$node_id, '_type'=>'ulist', 'class'=>'', 'id'=>''); + $actiondata = array ('_id'=>$node_id.'-sub', '_root'=>$node_id, '_type'=>'ulist'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); $num = count ($node->children); @@ -196,14 +206,6 @@ $this->displayNode ($node->children[$i], $node_id.'-sub', $node_id.'-'.$i, $input_id); } } - - - } } -/* -12 ma -12 deu -8 bio -*/ ?> \ No newline at end of file --- NEW FILE: editor.js --- /** * @package editor * @author Martin Jahn <mj...@us...> * @copyright (c) Copyright by Martin Jahn * @license GPL * @version $Id: editor.js,v 1.3 2004/07/02 17:41:24 mjahn Exp $ **/ /** * changed some things: * - body onload-eventhandler is no more needed * - comfortable choice of contentfield for image insertion **/ var imgtag_pre = '<img src="'; var imgtag_post = '" />'; // Author: James Craig // a few browser sniffs to account for known bugs var sUserAgent = navigator.userAgent.toLowerCase(); var isIE = document.all?true:false; var isOp = (sUserAgent.indexOf('opera')!=-1)?true:false; // make new popup window function pop(oAnchor,sProps,sWindow){ var sUrl = ''; // get URL from calling link oAnchor if(oAnchor.getAttribute) sUrl = oAnchor.getAttribute('href'); if(sUrl=='') sUrl = oAnchor.href; // if still no URL, return true and let the regular link take over if(sUrl=='') return true; // set window name ('_blank' for new window each time) var sWindowName = sWindow?sWindow:'reusedWindow'; // sets default properties if none are defined in the function call optional variable 'sProps' if(!sProps) sProps = 'width=640,height=480,scrollbars,resizable,toolbar,status,menubar,location'; // assign the popup to this variable so we can verify it exists if(sUrl) var oPopup = window.open(sUrl,sWindowName,sProps); // An Opera bug returns too early if you focus the window, so we don't focus it in that browser. // Only a noticable defect if a window is already open and hidden. if(oPopup && !isOp) oPopup.focus(); // If popup was created successfully, cancel link in calling window. // Acts as regular link in browser that has popup blocking enabled or JavaScript turned off. return (oPopup)?false:true; } // With onkeypress event, this verifies 'Enter' key // needed for popup function verifyKey(oElement,oEvent){ if(oEvent.keyCode==13 && oElement.onclick) oElement.onclick(); } // Moz only - wraps selected text with lft and rgt function wrapMoz(txtarea, lft, rgt) { var selLength = txtarea.textLength; var selStart = txtarea.selectionStart; var selEnd = txtarea.selectionEnd; if (selEnd==1 || selEnd==2) selEnd=selLength; var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd); var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + lft + s2 + rgt + s3; } // IE only - Insert text at caret position or at start of selected text function insertIE (txtarea, text) { if (txtarea.createTextRange && txtarea.caretPos) { var caretPos = txtarea.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text+caretPos.text + ' ' : text+caretPos.text; } else { txtarea.value = txtarea.value + text; } return; } // Switch function based on browser - Insert text at caret position or at start of selected text function insertTag(txtarea , lft) { if (document.all) { insertIE(txtarea, lft); } else if (document.getElementById) { wrapMoz(txtarea, unescape(lft), ''); } } function insertImg() { var index, link, desc, title, copy, lft, txtarea; if (document.getElementById('input-preview-select') == null) { return false; } if (document.getElementById ('input-preview-select').selectedIndex >= 0) { index = document.getElementById ('input-preview-select').selectedIndex; link = document.getElementById ('input-preview-select').options[index].value; if (link == null) { return false; } lft=imgtag_pre + link + imgtag_post; // get id of the selected contentfield where to insert the image-tag if (document.getElementsByName('input-preview-target') == null) { return false; } cs = document.getElementsByName('input-preview-target'); i=0; if (cs.length > 1) { while (true) { if (!cs[i]) { break; } if (cs[i].checked == false) { i++; continue; } break; } } insertTag(document.getElementById ('input-content-'+cs[i].value), lft); } return false; } // End Processing code. function selectImage() { var index; var link; if (document.getElementById ('input-preview-select').selectedIndex >= 0) { index = document.getElementById ('input-preview-select').selectedIndex; link = document.getElementById ('input-preview-select').options[index].value; link = document.getElementById ('input-preview-thumbpath').value + '/' + link; document.getElementById ('input-preview-image').src = link; title = document.getElementById ('input-preview-select').options[index].title; a1 = title.indexOf ('x'); a2 = title.indexOf ('='); a3 = title.indexOf ('('); a4 = title.indexOf (')'); width = title.substr (0, a1); height = title.substr (a1 + 1, a2 - a1 - 1); fsize = title.substr (a2 + 1, a3 - a2 - 1); ftime = title.substr (a3 + 1, a4 - a3 - 1); if (document.getElementById ('input-preview-info')) { document.getElementById ('input-preview-info').value = width + ' x ' + height + ' = ' + fsize + '(letzte Änderung am ' + ftime + ')'; } if (document.getElementById ('input-preview-size')) { document.getElementById ('input-preview-size').value = width+' x '+height; } if (document.getElementById ('input-preview-filesize')) { document.getElementById ('input-preview-filesize').value = fsize; } if (document.getElementById ('input-preview-filectime')) { document.getElementById ('input-preview-filectime').value = ftime; } } } var tabs = new Array (); /** * display a tab and hide all other tabs **/ function displayTab (id) { var i = 0; num = tabs.length; for (i = 0; i < num; i++) { if (tabs [i] != id) { hideTab (tabs [i]); /* alert ('hideTab (' + tabs [i] + ')');*/ continue; } showTab (tabs [i]); /* alert ('showTab (' + tabs [i] + ')');*/ } } /** * helper-function to hide a tab **/ function hideTab (id) { document.getElementById (id).style.display = 'none'; } /** * helper-function to display a tab **/ function showTab (id) { document.getElementById (id).style.display = 'block'; } /** * register a tabbox **/ function registerTab (id) { tabs.push (id); } window.onload = function onloadHide () { registerTab ('new'); registerTab ('open'); registerTab ('delete'); registerTab ('upload'); registerTab ('image'); displayTab ('xyz'); } --- NEW FILE: class.module_image_editor.php --- <?php /** * Editor for XML-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_xml_editor.php,v 1.1 2004/06/18 15:17:00 mjahn Exp $ * @package admin4phpCMS * @subpackage module_editor **/ /* * $Log: class.module_xml_editor.php,v $ * Revision 1.1 2004/06/18 15:17:00 mjahn * module filemanager and editor included * */ /** * Image editor class * * This class provides an interface for editing image-files. * * @package admin4phpCMS * @subpackage module_editor * @inheriteddoc **/ class module_image_editor extends module { function init () { $this->_registerEvent ('DISPLAY_VIEWER', 'doDisplayViewer'); $this->_registerAction ('doDisplayViewer', 'viewFile'); $this->_registerEvent ('DISPLAY_EDITOR', 'doDisplayEditor'); $this->_registerAction ('doDisplayEditor', 'editFile'); $this->_registerEvent ('EDITOR_SAVE_FILE', 'doEditorSaveFile'); $this->_registerAction ('doEditorSaveFile', 'saveFile'); } function histogram($image, $output, $rating = '0', $type_fill = 1) { //header ("Content-type: image/jpeg"); //print $image;die(); $this->image=$image; $this->type_fill=$type_fill; $this->input_format=$input_format; $this->output_format=$output_format; $this->rating=$rating; $this->outputHistogramm (); } function analize_to_array() { switch ($this->input_format) { case "jpeg": $im=imagecreatefromjpeg($this->image); break; case "png": $im=imagecreatefrompng($this->image); } $xx=imagesx($im); $yy=imagesy($im); $this->size=$xx*$yy; $this->index=0; for($i=0;$i<$xx;$i+=$this->rating) { for($j=0;$j<$yy;$j+=$this->rating) { $rgb = imagecolorat($im, $i, $j); $rrggbb=imagecolorsforindex ($im, $rgb); $this->r[$this->index] = $rrggbb['red']; $this->g[$this->index] = $rrggbb['green']; $this->b[$this->index] = $rrggbb['blue']; $this->index++; } } } function outputHistogramm() { $this->analize_to_array(); $coef=(int)($this->index/800); if($coef<1) { $coef=1; } $image = imagecreatetruecolor (800, 400); $background_color = imagecolorallocate ($image, 0, 0, 0); $axis_color=imagecolorallocate ($image, 255, 255, 255); $red=imagecolorallocate ($image, 255, 0, 0); $green=imagecolorallocate ($image, 0, 255, 0); $blue=imagecolorallocate ($image, 0, 0, 255); //---- imageline($image, 10, 0, 10, 400, $axis_color); imageline($image, 0, 100, 800, 100, $axis_color); imageline($image, 0, 200, 800, 200, $axis_color); imageline($image, 0, 300, 800, 300, $axis_color); $pos=0; for($i=0;$i<$this->index;$i+=$coef) { if($this->type_fill==0) { imagesetpixel($image, $pos+10, 100-($this->r[$i]/3), $red); imagesetpixel($image, $pos+10, 200-($this->g[$i]/3) , $green); imagesetpixel($image, $pos+10, 300-($this->b[$i]/3) , $green); } else if($this->type_fill==1) { imageline($image, $pos+10, 100, $pos+10, 100-($this->r[$i]/3), $red); imageline($image, $pos+10, 200, $pos+10, 200-($this->g[$i]/3), $green); imageline($image, $pos+10, 300, $pos+10, 300-($this->b[$i]/3), $blue); } $pos++; } //---- imagestring($image, 2, 30, 310, "Sample No. : 1 ----------------------------------------------------------------------------------------------> Sample No. : $this->index",$axis_color); imagestring($image, 3, 20, 340, "Image Histogram for Red, Green, Blue elements . ",$axis_color); imagestring($image, 2, 20, 360, "Image Name : test.jpg --- Number Of Pixels : $this->size --- Sampling Rate : 1 Sample for each $this->rating * $this->rating Pixels .",$axis_color); imagestring($image, 2, 20, 380, "For Scientific versions contact : za...@ya... -- Image Processing ",$axis_color); switch($this->output_format) { case "jpeg": imagejpeg($image); break; case "png": imagepng($image); } } function saveFile (&$actiondata) { } function viewFile (&$actiondata) { $filename = $actiondata ['_filename']; $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); // set image-viewer $actiondata = 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); // 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); } function editFile (&$actiondata) { } } --- NEW FILE: editor.css --- /** * @package editor * @author Martin Jahn <mj...@us...> * @copyright (c) Copyright by Martin Jahn * @license GPL * @version $Id: editor.css,v 1.9 2004/05/21 21:12:55 mjahn Exp $ **/ #editor fieldset { width: 90%; margin-bottom: 2em; padding: 1em; border: 2px ridge #060; display: block; } #editor legend { font-size: 140%; font-weight: bold; color: #060; background-color: transparent; } #editor form { margin: 0; } #editor h3 { margin: 25px 0 0 0; padding: 5px 10px; width: 98%; font-size: 120%; font-weight: normal; border-bottom: 2px solid #FFF; color: #060; background-color: #EEE; } #editor div.label { padding: 5px 10px; width: 98%; font-size: 90%; font-weight: bold; border-bottom: 2px solid #FFF; color: #060; background-color: #EEE; } #editor label { padding: 5px 10px; width: 98%; font-size: 90%; font-weight: bold; border-bottom: 2px solid #FFF; color: #060; background-color: #EEE; display: block; } #editor label span { padding-left: 10px; } #editor label span span { padding: 0; color: #000; } #editor a { color: #060; text-decoration: none; cursor: help; } #editor div.htmlarea, #editor input[type=text], #editor textarea { padding: 3px; width: 95%; border: 1px inset #060; background-color: #FAFAFA; display: block; } #editor input[type=text]:focus, #editor textarea:focus { border-color: #090; background-color: #FFF; } #editor select { position: relative; width: 95%; color: #000; border: 1px inset #060; background-color: #FAFAFA; display: block; } #editor select:focus { background-color: #FFF; } #editor input.editor-newfile { background: url(/img/editor/editor_new.png) no-repeat; background-position: 2px; } #editor input.editor-openfile { background: url(/img/editor/editor_edit.png) no-repeat; background-position: 2px; } #editor input.editor-savefile { background: url(/img/editor/editor_save.png) no-repeat; background-position: 2px; } #editor input.editor-delfile { background: url(/img/editor/editor_delete.png) no-repeat; background-position: 2px; } #editor input.editor-exit { background: url(/img/editor/editor_exit.png) no-repeat; background-position: 2px; } #editor input.editor-reset { background: url(/img/editor/editor_undo.png) no-repeat; background-position: 2px; } #editor input.editor-insertimage { background: url(/img/editor/editor_insertimage.png) no-repeat; background-position: 2px; } #editor input.editor-upload { background: url(/img/editor/editor_upload.png) no-repeat; background-position: 2px; } #editor input[type=submit], #editor input[type=reset], #editor input[type=button] { margin: 0 2px; padding: 2px 2px 2px 20px; border: 2px solid #F6F6F6; font-weight: normal; background-color: #EEE; } #editor input[type=submit]:hover, #editor input[type=reset]:hover, #editor input[type=button]:hover { border: 2px outset #EEE; background-color: #EFEFEF; } #editor input[type=submit]:active, #editor input[type=reset]:active, #editor input[type=button]:active { border: 2px inset #EEE; background-color: #EAEAEA; } #editor #preview { padding: 5px 10px; width: 98%; font-size: 90%; font-weight: bold; border-bottom: 2px solid #FFF; color: #060; background-color: #EEE; display: block; } #editor img.input-preview-image { padding: 1px; background: #EAEAEA; border: 1px inset #EEE; float:left; display:inline; } #editor label input.short { width: 18em; } Index: class.module_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/editor/class.module_editor.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.module_editor.php 18 Jun 2004 15:17:00 -0000 1.1 +++ class.module_editor.php 24 Jul 2004 08:50:34 -0000 1.2 @@ -30,12 +30,13 @@ /* * $Log$ +* Revision 1.2 2004/07/24 08:50:34 mjahn +* updated editor-module +* * Revision 1.1 2004/06/18 15:17:00 mjahn * module filemanager and editor included * */ -require('classes/CropImage.php'); - /** * Editor-class * @@ -145,6 +146,9 @@ case 'xml': $this->filetype = 'xml'; break; + case 'htm': + $this->filetype = 'phpcms'; + break; default: $this->filetype = 'text'; break; @@ -172,27 +176,27 @@ function getViewContent (&$actiondata) { - $actiondata = array ('_id'=>'headline1', '_root'=>$actiondata['_root'], '_type'=>'headline', 'content'=>$this->filename); + $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); - $actiondata = array ('_root'=>'fileviewer', '_filename'=>$this->filename); + $actiondata = array ('_root'=>'fileviewer', '_filename'=>$this->filename, '_webname'=>$this->webname); $this->_callEvent ('DISPLAY_VIEWER', $actiondata); } function getEditContent (&$actiondata) { - $actiondata = array ('_id'=>'headline1', '_root'=>$actiondata['_root'], '_type'=>'headline', 'content'=>$this->filename); + $actiondata = array ('_id'=>'headline1', '_root'=>$actiondata['_root'], '_type'=>'headline', 'content'=>$this->webname); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); // 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); + $actiondata = array ('_root'=>'file-edit-form', '_filename'=>$this->filename, '_webname'=>$this->webname); $this->_callEvent ('DISPLAY_EDITOR', $actiondata); } --- NEW FILE: class.module_phpcms_editor.php --- <?php /** * Editor for phpCMS-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$ * @package admin4phpCMS * @subpackage module_editor **/ /* * $Log$ * */ /** * phpCMS editor class * * This class provides an interface for editing phpCMS-files. * * @package admin4phpCMS * @subpackage module_editor * @inheriteddoc **/ class module_phpcms_editor extends module { function init () { $this->_registerEvent ('DISPLAY_VIEWER', 'doDisplayViewer'); $this->_registerAction ('doDisplayViewer', 'viewFile'); $this->_registerEvent ('DISPLAY_EDITOR', 'doDisplayEditor'); $this->_registerAction ('doDisplayEditor', 'editFile'); } function viewFile (&$actiondata) { } function editFile (&$actiondata) { global $GLOBALS; $GLOBALS['DEFAULTS']->PROJECTFILENAME = $_SERVER['DOCUMENT_ROOT'].'/cms/templates/home.ini'; // import online-editor class include_once (realpath (dirname(__FILE__).'/../../../onlineEditor4phpCMS/include/class.ext_editor.php')); if (isset ($_GET ['file'])) { $_GET ['editfile'] = $_GET ['file']; } // initialize editor $EDITOR = new cExtEditor(); // set path to the XML-style configfile $EDITOR->configfile = 'editor.conf.xml'; // connect the user-permission-control to the editor-object $this->_callEvent ('USER_GET_STATUS', $actiondata); $this->EDITOR->USER = $actiondata; // 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); } } ?> |