issue 2662 editor

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12243 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-11-16 09:03:29 +00:00
parent e101348f59
commit 3480da757a
12 changed files with 2252 additions and 2055 deletions

View file

@ -1,104 +1,115 @@
<?php
/**
* @class emoticon
* @author NHN (developers@xpressengine.com)
* @brief Emoticons image connected components
**/
/**
* @class emoticon
* @author NHN (developers@xpressengine.com)
* @brief Emoticons image connected components
*/
class emoticon extends EditorHandler
{
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
var $emoticon_path = '';
class emoticon extends EditorHandler {
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
var $emoticon_path = '';
/**
* @brief editor_sequence and components out of the path
*/
function emoticon($editor_sequence, $component_path)
{
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
$this->emoticon_path = sprintf('%s%s/images',preg_replace('/^\.\//i','',$this->component_path),'tpl','images');
}
/**
* @brief editor_sequence and components out of the path
**/
function emoticon($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
$this->emoticon_path = sprintf('%s%s/images',preg_replace('/^\.\//i','',$this->component_path),'tpl','images');
}
/**
* @brief Returns a list of emoticons file
*/
function getEmoticonList()
{
$emoticon = Context::get('emoticon');
if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new Object(-1,'msg_invalid_request');
/**
* @brief Returns a list of emoticons file
**/
function getEmoticonList() {
$emoticon = Context::get('emoticon');
if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new Object(-1,'msg_invalid_request');
$list = $this->getEmoticons($emoticon);
$list = $this->getEmoticons($emoticon);
$this->add('emoticons', implode("\n",$list));
}
$this->add('emoticons', implode("\n",$list));
}
/**
* @brief Likely to be recursively emoticons will search all the files to a subdirectory. 8000 gaekkajineun ran tests whether the stack and raise beef pro-overs and Unsure. (06/09/2007, Benny)
*/
function getEmoticons($path)
{
$emoticon_path = sprintf("%s/%s", $this->emoticon_path, $path);
$output = array();
/**
* @brief Likely to be recursively emoticons will search all the files to a subdirectory. 8000 gaekkajineun ran tests whether the stack and raise beef pro-overs and Unsure. (06/09/2007, Benny)
**/
function getEmoticons($path) {
$emoticon_path = sprintf("%s/%s", $this->emoticon_path, $path);
$output = array();
$oDir = dir($emoticon_path);
while($file = $oDir->read())
{
if(substr($file,0,1)=='.') continue;
if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file));
}
$oDir->close();
if(count($output)) asort($output);
return $output;
}
$oDir = dir($emoticon_path);
while($file = $oDir->read()) {
if(substr($file,0,1)=='.') continue;
if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file));
}
$oDir->close();
if(count($output)) asort($output);
return $output;
}
/**
* @brief popup window to display in popup window request is to add content
*/
function getPopupContent()
{
// Bringing a list of emoticons directory
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
$emoticon_list = array();
if($emoticon_dirs)
{
foreach($emoticon_dirs as $emoticon)
{
if(preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) $emoticon_list[] = $emoticon;
}
}
Context::set('emoticon_list', $emoticon_list);
// The first emoticon image files in the directory Wanted
$emoticons = $this->getEmoticons($emoticon_list[0]);
Context::set('emoticons', $emoticons);
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
/**
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// Bringing a list of emoticons directory
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
$emoticon_list = array();
if($emoticon_dirs) {
foreach($emoticon_dirs as $emoticon) {
if(preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) $emoticon_list[] = $emoticon;
}
}
Context::set('emoticon_list', $emoticon_list);
// The first emoticon image files in the directory Wanted
$emoticons = $this->getEmoticons($emoticon_list[0]);
Context::set('emoticons', $emoticons);
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief Emoticon of the path were added to solve the problem. (06/09/2007 Benny)
*/
function transHTML($xml_obj)
{
$src = $xml_obj->attrs->src;
$alt = $xml_obj->attrs->alt;
/**
* @brief Emoticon of the path were added to solve the problem. (06/09/2007 Benny)
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->src;
$alt = $xml_obj->attrs->alt;
if(!$alt)
{
$tmp_arr = explode('/',$src);
$alt = array_pop($tmp_arr);
}
if(!$alt) {
$tmp_arr = explode('/',$src);
$alt = array_pop($tmp_arr);
}
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
if(!$alt) $alt = $src;
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
if(!$alt) $alt = $src;
$attr_output = array();
$attr_output = array("src=\"".$src."\"");
$attr_output = array();
$attr_output = array("src=\"".$src."\"");
if($alt)
{
$attr_output[] = "alt=\"".$alt."\"";
}
if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\"";
if($alt) {
$attr_output[] = "alt=\"".$alt."\"";
}
if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\"";
$code = sprintf("<img %s style=\"border:0px\" />", implode(" ",$attr_output));
$code = sprintf("<img %s style=\"border:0px\" />", implode(" ",$attr_output));
return $code;
}
}
?>
return $code;
}
}
/* End of file emoticon.class.php */
/* Location: ./modules/editor/components/emoticon/emoticon.class.php */

View file

@ -1,78 +1,83 @@
<?php
/**
* @class image_gallery
* @author NHN (developers@xpressengine.com)
* @brief Making images uploaded to the image gallery
**/
/**
* @class image_gallery
* @author NHN (developers@xpressengine.com)
* @brief Making images uploaded to the image gallery
*/
class image_gallery extends EditorHandler
{
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
class image_gallery extends EditorHandler {
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence and components out of the path
*/
function image_gallery($editor_sequence, $component_path)
{
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief editor_sequence and components out of the path
**/
function image_gallery($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief popup window to display in popup window request is to add content
*/
function getPopupContent()
{
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
/**
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
Context::set("tpl_path", $tpl_path);
Context::set("tpl_path", $tpl_path);
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
*/
function transHTML($xml_obj)
{
$gallery_info->srl = rand(111111,999999);
$gallery_info->border_thickness = $xml_obj->attrs->border_thickness;
$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
$gallery_info->border_color = $xml_obj->attrs->border_color;
$gallery_info->bg_color = $xml_obj->attrs->bg_color;
$gallery_info->gallery_align = $xml_obj->attrs->gallery_align;
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$gallery_info->srl = rand(111111,999999);
$gallery_info->border_thickness = $xml_obj->attrs->border_thickness;
$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
$gallery_info->border_color = $xml_obj->attrs->border_color;
$gallery_info->bg_color = $xml_obj->attrs->bg_color;
$gallery_info->gallery_align = $xml_obj->attrs->gallery_align;
$images_list = $xml_obj->attrs->images_list;
$images_list = preg_replace('/\.(gif|jpg|jpeg|png) /i',".\\1\n",$images_list);
$gallery_info->images_list = explode("\n",trim($images_list));
// If you set the output to output the XML code generated a list of the image
if(Context::getResponseMethod() == 'XMLRPC')
{
$output = '';
for($i=0;$i<count($gallery_info->images_list);$i++)
{
$output .= sprintf('<img src="%s" alt="" /><br />', $gallery_info->images_list[$i]);
}
return $output;
}
// HTML gallery output, the output settings via the template for the conversion to generate the html code should
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
$gallery_info->width = trim($matches[3][0]);
if(!$gallery_info->width) $gallery_info->width = 400;
$images_list = $xml_obj->attrs->images_list;
$images_list = preg_replace('/\.(gif|jpg|jpeg|png) /i',".\\1\n",$images_list);
$gallery_info->images_list = explode("\n",trim($images_list));
// If you set the output to output the XML code generated a list of the image
if(Context::getResponseMethod() == 'XMLRPC') {
$output = '';
for($i=0;$i<count($gallery_info->images_list);$i++) {
$output .= sprintf('<img src="%s" alt="" /><br />', $gallery_info->images_list[$i]);
}
return $output;
}
// HTML gallery output, the output settings via the template for the conversion to generate the html code should
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
$gallery_info->width = trim($matches[3][0]);
if(!$gallery_info->width) $gallery_info->width = 400;
Context::set('gallery_info', $gallery_info);
Context::set('gallery_info', $gallery_info);
$tpl_path = $this->component_path.'tpl';
Context::set("tpl_path", $tpl_path);
$tpl_path = $this->component_path.'tpl';
Context::set("tpl_path", $tpl_path);
if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html';
else $tpl_file = 'slide_gallery.html';
if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html';
else $tpl_file = 'slide_gallery.html';
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
}
?>
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
}
/* End of file image_gallery.class.php */
/* Location: ./modules/editor/components/image_gallery/image_gallery.class.php */

View file

@ -1,103 +1,111 @@
<?php
/**
* @class image_link
* @author NHN (developers@xpressengine.com)
* @brief Add an image, or to modify the properties of components
**/
/**
* @class image_link
* @author NHN (developers@xpressengine.com)
* @brief Add an image, or to modify the properties of components
*/
class image_link extends EditorHandler
{
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
class image_link extends EditorHandler {
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence and components out of the path
*/
function image_link($editor_sequence, $component_path)
{
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief editor_sequence and components out of the path
**/
function image_link($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief popup window to display in popup window request is to add content
*/
function getPopupContent()
{
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
/**
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
Context::set("tpl_path", $tpl_path);
Context::set("tpl_path", $tpl_path);
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
*/
function transHTML($xml_obj)
{
$src = $xml_obj->attrs->src;
$width = $xml_obj->attrs->width;
$height = $xml_obj->attrs->height;
$align = $xml_obj->attrs->align;
$alt = $xml_obj->attrs->alt;
$title = $xml_obj->attrs->title;
$border = (int)$xml_obj->attrs->border;
$link_url = $xml_obj->attrs->link_url;
$open_window = $xml_obj->attrs->open_window;
$style = $xml_obj->attrs->style;
$margin = (int)$xml_obj->attrs->margin;
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->src;
$width = $xml_obj->attrs->width;
$height = $xml_obj->attrs->height;
$align = $xml_obj->attrs->align;
$alt = $xml_obj->attrs->alt;
$title = $xml_obj->attrs->title;
$border = (int)$xml_obj->attrs->border;
$link_url = $xml_obj->attrs->link_url;
$open_window = $xml_obj->attrs->open_window;
$style = $xml_obj->attrs->style;
$margin = (int)$xml_obj->attrs->margin;
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
$src = str_replace('&amp;amp;', '&amp;', $src);
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
$src = str_replace('&amp;amp;', '&amp;', $src);
// Image containing the address to the address conversion request uri (rss output, etc. purposes)
$temp_src = explode('/', $src);
if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
else if(substr($src , 0, 1)=='/')
{
if($_SERVER['HTTPS']=='on') $http_src = 'https://';
else $http_src = 'http://';
$src = $http_src.$_SERVER['HTTP_HOST'].$src;
}
else if(!strpos($temp_src[0],':') && $src) $src = Context::getRequestUri().$src;
// Image containing the address to the address conversion request uri (rss output, etc. purposes)
$temp_src = explode('/', $src);
if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
elseif(substr($src , 0, 1)=='/') {
if($_SERVER['HTTPS']=='on') $http_src = 'https://';
else $http_src = 'http://';
$src = $http_src.$_SERVER['HTTP_HOST'].$src;
}
elseif(!strpos($temp_src[0],':') && $src) $src = Context::getRequestUri().$src;
$attr_output = array();
$attr_output = array("src=\"".$src."\"");
$attr_output[] = "alt=\"".$alt."\"";
$attr_output = array();
$attr_output = array("src=\"".$src."\"");
$attr_output[] = "alt=\"".$alt."\"";
if($title)
{
$attr_output[] = "title=\"".$title."\"";
}
if($margin)
{
$style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
$style = str_replace(';;',';',$style);
if($style == ';') $style = '';
$style .= ' margin:'.$margin.'px;';
}
if($align) $attr_output[] = "align=\"".$align."\"";
if($title) {
$attr_output[] = "title=\"".$title."\"";
}
if($margin) {
$style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
$style = str_replace(';;',';',$style);
if($style == ';') $style = '';
$style .= ' margin:'.$margin.'px;';
}
if($align) $attr_output[] = "align=\"".$align."\"";
if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\"";
if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\"";
if($width) $attr_output[] = 'width="'.$width.'"';
if($height) $attr_output[] = 'height="'.$height.'"';
if($border)
{
$style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
$style = str_replace(';;',';',$style);
if($style == ';') $style = '';
$style .= ' border-style: solid; border-width:'.$border.'px;';
}
if($width) $attr_output[] = 'width="'.$width.'"';
if($height) $attr_output[] = 'height="'.$height.'"';
if($border) {
$style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
$style = str_replace(';;',';',$style);
if($style == ';') $style = '';
$style .= ' border-style: solid; border-width:'.$border.'px;';
}
$code = sprintf("<img %s style=\"%s\" />", implode(' ',$attr_output), $style);
$code = sprintf("<img %s style=\"%s\" />", implode(' ',$attr_output), $style);
if($link_url) {
if($open_window =='Y') $code = sprintf('<a href="%s" onclick="window.open(this.href);return false;">%s</a>', $link_url, $code);
else $code = sprintf('<a href="%s" >%s</a>', $link_url, $code);
}
return $code;
}
}
?>
if($link_url)
{
if($open_window =='Y') $code = sprintf('<a href="%s" onclick="window.open(this.href);return false;">%s</a>', $link_url, $code);
else $code = sprintf('<a href="%s" >%s</a>', $link_url, $code);
}
return $code;
}
}
/* End of file image_link.class.php */
/* Location: ./modules/editor/components/image_link/image_link.class.php */

View file

@ -1,70 +1,74 @@
<?php
/**
* @class multimedia_link
* @author NHN (developers@xpressengine.com)
* @brief The components connected to the body of multimedia data
**/
/**
* @class multimedia_link
* @author NHN (developers@xpressengine.com)
* @brief The components connected to the body of multimedia data
*/
class multimedia_link extends EditorHandler
{
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
class multimedia_link extends EditorHandler {
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence and components out of the path
*/
function multimedia_link($editor_sequence, $component_path)
{
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief editor_sequence and components out of the path
**/
function multimedia_link($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief popup window to display in popup window request is to add content
*/
function getPopupContent()
{
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
/**
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
Context::set("tpl_path", $tpl_path);
Context::set("tpl_path", $tpl_path);
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
*/
function transHTML($xml_obj)
{
$src = $xml_obj->attrs->multimedia_src;
$style = $xml_obj->attrs->style;
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->multimedia_src;
$style = $xml_obj->attrs->style;
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$style,$matches);
$width = trim($matches[3][0]);
$height = trim($matches[3][1]);
if(!$width) $width = 400;
if(!$height) $height = 400;
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$style,$matches);
$width = trim($matches[3][0]);
$height = trim($matches[3][1]);
if(!$width) $width = 400;
if(!$height) $height = 400;
$auto_start = $xml_obj->attrs->auto_start;
if($auto_start!="true") $auto_start = "false";
else $auto_start = "true";
$auto_start = $xml_obj->attrs->auto_start;
if($auto_start!="true") $auto_start = "false";
else $auto_start = "true";
$wmode = $xml_obj->attrs->wmode;
if($wmode == 'window') $wmode = 'window';
else if($wmode == 'opaque') $wmode = 'opaque';
else $wmode = 'transparent';
$wmode = $xml_obj->attrs->wmode;
if($wmode == 'window') $wmode = 'window';
elseif($wmode == 'opaque') $wmode = 'opaque';
else $wmode = 'transparent';
$caption = $xml_obj->body;
$caption = $xml_obj->body;
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
$src = str_replace('&amp;amp;', '&amp;', $src);
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
$src = str_replace('&amp;amp;', '&amp;', $src);
if(Context::getResponseMethod() != "XMLRPC") return sprintf("<script type=\"text/javascript\">displayMultimedia(\"%s\", \"%s\",\"%s\", { \"autostart\" : %s, \"wmode\" : \"%s\" });</script>", $src, $width, $height, $auto_start, $wmode);
else return sprintf("<div style=\"width: %dpx; height: %dpx;\"><span style=\"position:relative; top:%dpx;left:%d\"><img src=\"%s\" /><br />Attached Multimedia</span></div>", $width, $height, ($height/2-16), ($width/2-31), Context::getRequestUri().'./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif');
}
}
?>
if(Context::getResponseMethod() != "XMLRPC") return sprintf("<script type=\"text/javascript\">displayMultimedia(\"%s\", \"%s\",\"%s\", { \"autostart\" : %s, \"wmode\" : \"%s\" });</script>", $src, $width, $height, $auto_start, $wmode);
else return sprintf("<div style=\"width: %dpx; height: %dpx;\"><span style=\"position:relative; top:%dpx;left:%d\"><img src=\"%s\" /><br />Attached Multimedia</span></div>", $width, $height, ($height/2-16), ($width/2-31), Context::getRequestUri().'./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif');
}
}
/* End of file multimedia_link.class.php */
/* Location: ./modules/editor/components/multimedia_link/multimedia_link.class.php */

View file

@ -1,57 +1,61 @@
<?php
/**
* @class poll_maker
* @author NHN (developers@xpressengine.com)
* @brief Editor provides the ability to link to the url.
**/
/**
* @class poll_maker
* @author NHN (developers@xpressengine.com)
* @brief Editor provides the ability to link to the url.
*/
class poll_maker extends EditorHandler
{
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
class poll_maker extends EditorHandler {
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence and components out of the path
*/
function poll_maker($editor_sequence, $component_path)
{
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief editor_sequence and components out of the path
**/
function poll_maker($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
$this->component_path = $component_path;
}
/**
* @brief popup window to display in popup window request is to add content
*/
function getPopupContent()
{
// Wanted Skins survey
$oModuleModel = &getModel('module');
$skin_list = $oModuleModel->getSkins("./modules/poll/");
Context::set('skin_list', $skin_list);
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
/**
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// Wanted Skins survey
$oModuleModel = &getModel('module');
$skin_list = $oModuleModel->getSkins("./modules/poll/");
Context::set('skin_list', $skin_list);
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
*/
function transHTML($xml_obj)
{
$poll_srl = $xml_obj->attrs->poll_srl;
$skin = $xml_obj->attrs->skin;
if(!$skin) $skin = 'default';
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$poll_srl = $xml_obj->attrs->poll_srl;
$skin = $xml_obj->attrs->skin;
if(!$skin) $skin = 'default';
preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
$width = $matches[2];
if(!$width) $width = 400;
$style = sprintf('width:%dpx', $width);
// poll model object creation to come get it return html
$oPollModel = &getModel('poll');
return $oPollModel->getPollHtml($poll_srl, $style, $skin);
}
}
?>
preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
$width = $matches[2];
if(!$width) $width = 400;
$style = sprintf('width:%dpx', $width);
// poll model object creation to come get it return html
$oPollModel = &getModel('poll');
return $oPollModel->getPollHtml($poll_srl, $style, $skin);
}
}
/* End of file poll_maker.class.php */
/* Location: ./modules/editor/components/poll_maker/poll_maker.class.php */

View file

@ -1,177 +1,192 @@
<?php
/**
* @class editorAdminController
* @author NHN (developers@xpressengine.com)
* @brief editor of the module admin controller class
**/
/**
* @class editorAdminController
* @author NHN (developers@xpressengine.com)
* @brief editor of the module admin controller class
*/
class editorAdminController extends editor
{
/**
* @brief Initialization
*/
function init()
{
}
class editorAdminController extends editor {
/**
* @brief 컴포넌트 사용설정, 목록 순서 변경
*/
function procEditorAdminCheckUseListOrder()
{
$site_module_info = Context::get('site_module_info');
$enables = Context::get('enables');
$component_names = Context::get('component_names');
/**
* @brief Initialization
**/
function init() {
}
/**
* @brief 컴포넌트 사용설정, 목록 순서 변경
**/
function procEditorAdminCheckUseListOrder(){
$site_module_info = Context::get('site_module_info');
$enables = Context::get('enables');
$component_names = Context::get('component_names');
if(!is_array($component_names)) $component_names = array();
if(!is_array($enables)) $enables = array();
if(!is_array($component_names)) $component_names = array();
if(!is_array($enables)) $enables = array();
$unables = array_diff($component_names, $enables);
$componentList = array();
$unables = array_diff($component_names, $enables);
$componentList = array();
foreach($enables as $component_name) {
$componentList[$component_name] = 'Y';
}
foreach($unables as $component_name) {
$componentList[$component_name] = 'N';
}
$output = $this->editorListOrder($component_names,$site_module_info->site_srl);
if(!$output->toBool()) return new Object();
$output = $this->editorCheckUse($componentList,$site_module_info->site_srl);
if(!$output->toBool()) return new Object();
$oEditorController = &getController('editor');
$oEditorController->removeCache($site_module_info->site_srl);
$this->setRedirectUrl(Context::get('error_return_url'));
foreach($enables as $component_name)
{
$componentList[$component_name] = 'Y';
}
/**
* @brief check use component
**/
function editorCheckUse($componentList, $site_srl = 0){
$args->site_srl = $site_srl;
foreach($componentList as $componentName => $value){
$args->component_name = $componentName;
$args->enabled = $value;
if($site_srl == 0) {
foreach($unables as $component_name)
{
$componentList[$component_name] = 'N';
}
$output = $this->editorListOrder($component_names,$site_module_info->site_srl);
if(!$output->toBool()) return new Object();
$output = $this->editorCheckUse($componentList,$site_module_info->site_srl);
if(!$output->toBool()) return new Object();
$oEditorController = &getController('editor');
$oEditorController->removeCache($site_module_info->site_srl);
$this->setRedirectUrl(Context::get('error_return_url'));
}
/**
* @brief check use component
*/
function editorCheckUse($componentList, $site_srl = 0)
{
$args->site_srl = $site_srl;
foreach($componentList as $componentName => $value)
{
$args->component_name = $componentName;
$args->enabled = $value;
if($site_srl == 0)
{
$output = executeQuery('editor.updateComponent', $args);
}
else
{
$output = executeQuery('editor.updateSiteComponent', $args);
}
}
if(!$output->toBool()) return new Object();
unset($componentList);
return $output;
}
/**
* @brief list order componet
*/
function editorListOrder($component_names, $site_srl = 0)
{
$args->site_srl = $site_srl;
$list_order_num = '30';
if(is_array($component_names))
{
foreach($component_names as $name)
{
$args->list_order = $list_order_num;
$args->component_name = $name;
if($site_srl == 0)
{
$output = executeQuery('editor.updateComponent', $args);
} else {
}
else
{
$output = executeQuery('editor.updateSiteComponent', $args);
}
if(!$output->toBool()) return new Object();
$list_order_num++;
}
if(!$output->toBool()) return new Object();
unset($componentList);
return $output;
}
/**
* @brief list order componet
**/
function editorListOrder($component_names, $site_srl = 0){
$args->site_srl = $site_srl;
$list_order_num = '30';
if(is_array($component_names)) {
foreach($component_names as $name){
$args->list_order = $list_order_num;
$args->component_name = $name;
if($site_srl == 0) {
$output = executeQuery('editor.updateComponent', $args);
} else {
$output = executeQuery('editor.updateSiteComponent', $args);
}
}
unset($component_names);
return $output;
}
if(!$output->toBool()) return new Object();
$list_order_num++;
}
}
unset($component_names);
return $output;
}
/**
* @brief Set components
*/
function procEditorAdminSetupComponent()
{
$site_module_info = Context::get('site_module_info');
/**
* @brief Set components
**/
function procEditorAdminSetupComponent() {
$site_module_info = Context::get('site_module_info');
$component_name = Context::get('component_name');
$extra_vars = Context::getRequestVars();
unset($extra_vars->component_name);
unset($extra_vars->module);
unset($extra_vars->act);
unset($extra_vars->body);
$component_name = Context::get('component_name');
$extra_vars = Context::getRequestVars();
unset($extra_vars->component_name);
unset($extra_vars->module);
unset($extra_vars->act);
unset($extra_vars->body);
$args->component_name = $component_name;
$args->extra_vars = serialize($extra_vars);
$args->site_srl = (int)$site_module_info->site_srl;
$args->component_name = $component_name;
$args->extra_vars = serialize($extra_vars);
$args->site_srl = (int)$site_module_info->site_srl;
if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $args);
else $output = executeQuery('editor.updateSiteComponent', $args);
if(!$output->toBool()) return $output;
if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $args);
else $output = executeQuery('editor.updateSiteComponent', $args);
if(!$output->toBool()) return $output;
$oEditorController = &getController('editor');
$oEditorController->removeCache($args->site_srl);
$oEditorController = &getController('editor');
$oEditorController->removeCache($args->site_srl);
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('error_return_url'));
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('error_return_url'));
}
/**
* @brief Config components
**/
function procEditorAdminGeneralConfig(){
$oModuleController = &getController('module');
$configVars = Context::getRequestVars();
if($configVars->font_defined != 'Y') $config->font_defined = $configVars->font_defined = 'N';
else $config->font_defined = 'Y';
/**
* @brief Config components
*/
function procEditorAdminGeneralConfig()
{
$oModuleController = &getController('module');
$configVars = Context::getRequestVars();
if($config->font_defined == 'Y')
$config->content_font = addslashes($configVars->content_font_defined);
else
$config->content_font = addslashes($configVars->content_font);
$config->editor_skin = $configVars->editor_skin;
$config->editor_height = $configVars->editor_height;
$config->comment_editor_skin = $configVars->comment_editor_skin;
$config->comment_editor_height = $configVars->comment_editor_height;
$config->content_style = $configVars->content_style;
$config->content_font_size= $configVars->content_font_size.'px';
$config->sel_editor_colorset= $configVars->sel_editor_colorset;
$config->sel_comment_editor_colorset= $configVars->sel_comment_editor_colorset;
$oModuleController->insertModuleConfig('editor',$config);
$this->setRedirectUrl(Context::get('error_return_url'));
}
if($configVars->font_defined != 'Y') $config->font_defined = $configVars->font_defined = 'N';
else $config->font_defined = 'Y';
/**
* @brief Add a component to DB
**/
function insertComponent($component_name, $enabled = false, $site_srl = 0) {
if($enabled) $enabled = 'Y';
else $enabled = 'N';
if($config->font_defined == 'Y')
$config->content_font = addslashes($configVars->content_font_defined);
else
$config->content_font = addslashes($configVars->content_font);
$args->component_name = $component_name;
$args->enabled = $enabled;
$args->site_srl = $site_srl;
// Check if the component exists
if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
else $output = executeQuery('editor.isSiteComponentInserted', $args);
if($output->data->count) return new Object(-1, 'msg_component_is_not_founded');
// Inert a component
$args->list_order = getNextSequence();
if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);
else $output = executeQuery('editor.insertSiteComponent', $args);
$config->editor_skin = $configVars->editor_skin;
$config->editor_height = $configVars->editor_height;
$config->comment_editor_skin = $configVars->comment_editor_skin;
$config->comment_editor_height = $configVars->comment_editor_height;
$config->content_style = $configVars->content_style;
$oEditorController = &getController('editor');
$oEditorController->removeCache($site_srl);
return $output;
}
}
?>
$config->content_font_size= $configVars->content_font_size.'px';
$config->sel_editor_colorset= $configVars->sel_editor_colorset;
$config->sel_comment_editor_colorset= $configVars->sel_comment_editor_colorset;
$oModuleController->insertModuleConfig('editor',$config);
$this->setRedirectUrl(Context::get('error_return_url'));
}
/**
* @brief Add a component to DB
*/
function insertComponent($component_name, $enabled = false, $site_srl = 0)
{
if($enabled) $enabled = 'Y';
else $enabled = 'N';
$args->component_name = $component_name;
$args->enabled = $enabled;
$args->site_srl = $site_srl;
// Check if the component exists
if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
else $output = executeQuery('editor.isSiteComponentInserted', $args);
if($output->data->count) return new Object(-1, 'msg_component_is_not_founded');
// Inert a component
$args->list_order = getNextSequence();
if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);
else $output = executeQuery('editor.insertSiteComponent', $args);
$oEditorController = &getController('editor');
$oEditorController->removeCache($site_srl);
return $output;
}
}
/* End of file editor.admin.controller.php */
/* Location: ./modules/editor/editor.admin.controller.php */

View file

@ -1,168 +1,178 @@
<?php
/**
* @class editorAdminView
* @author NHN (developers@xpressengine.com)
* @brief editor admin view of the module class
**/
/**
* @class editorAdminView
* @author NHN (developers@xpressengine.com)
* @brief editor admin view of the module class
*/
class editorAdminView extends editor
{
/**
* @brief Initialization
*/
function init()
{
}
class editorAdminView extends editor {
/**
* @brief Administrator Setting page
* Settings to enable/disable editor component and other features
*/
function dispEditorAdminIndex()
{
$component_count = 0;
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
/**
* @brief Initialization
**/
function init() {
}
// Get a type of component
$oEditorModel = &getModel('editor');
$oModuleModel = &getModel('module');
$editor_config = $oModuleModel->getModuleConfig('editor');
/**
* @brief Administrator Setting page
* Settings to enable/disable editor component and other features
**/
function dispEditorAdminIndex() {
$component_count = 0;
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// Get a type of component
$oEditorModel = &getModel('editor');
$oModuleModel = &getModel('module');
$editor_config = $oModuleModel->getModuleConfig('editor');
//editor_config init
if(!$editor_config->editor_height) $editor_config->editor_height = 300;
if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100;
if(!$editor_config->editor_skin) $editor_config->editor_skin = 'xpresseditor';
if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'xpresseditor';
if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'white';
if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'white';
//editor_config init
if(!$editor_config->editor_height) $editor_config->editor_height = 300;
if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100;
if(!$editor_config->editor_skin) $editor_config->editor_skin = 'xpresseditor';
if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'xpresseditor';
if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'white';
if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'white';
$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
for($i=0,$c=count($contents);$i<$c;$i++) {
$style = $contents[$i];
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
$content_style_list[$style]->title = $info->title;
}
// Get install info, update info, count
$oAutoinstallModel = &getModel('autoinstall');
foreach($component_list as $component_name => $xml_info) {
$component_count++;
$xml_info->path = './modules/editor/components/'.$xml_info->component_name;
$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path);
$xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path);
if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0;
}
if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
foreach($component_list as $component_name => $xml_info) {
if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
for($i=0,$c=count($contents);$i<$c;$i++)
{
$style = $contents[$i];
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
$content_style_list[$style]->title = $info->title;
}
// Get install info, update info, count
$oAutoinstallModel = &getModel('autoinstall');
foreach($component_list as $component_name => $xml_info)
{
$component_count++;
$xml_info->path = './modules/editor/components/'.$xml_info->component_name;
$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path);
$xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path);
if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0;
}
if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
foreach($component_list as $component_name => $xml_info)
{
if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
}
$editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"12");
//editor preview
$config = $oEditorModel->getEditorConfig();
$option->allow_fileupload = false;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;
$option->content_font_size = $config->content_font_size;
$option->enable_autosave = false;
$option->enable_default_component = true;
$option->enable_component = true;
$option->disable_html = false;
$option->height = $config->editor_height;
$option->skin = $config->editor_skin;
$option->content_key_name = 'dummy_content';
$option->primary_key_name = 'dummy_key';
$option->colorset = $config->sel_editor_colorset;
$editor = $oEditorModel->getEditor(0, $option);
Context::set('preview_editor', $editor);
$option_com->allow_fileupload = false;
$option_com->content_style = $config->content_style;
$option_com->content_font = $config->content_font;
$option_com->content_font_size = $config->content_font_size;
$option_com->enable_autosave = false;
$option_com->enable_default_component = true;
$option_com->enable_component = true;
$option_com->disable_html = false;
$option_com->height = $config->comment_editor_height;
$option_com->skin = $config->comment_editor_skin;
$option_com->content_key_name = 'dummy_content2';
$option_com->primary_key_name = 'dummy_key2';
$option_com->content_style = $config->comment_content_style;
$option_com->colorset = $config->sel_comment_editor_colorset;
$editor_comment = $oEditorModel->getEditor(0, $option_com);
Context::set('preview_editor_comment', $editor_comment);
Context::set('editor_config', $editor_config);
Context::set('editor_skin_list', $editor_skin_list);
Context::set('editor_colorset_list', $skin_info->colorset);
Context::set('content_style_list', $content_style_list);
Context::set('component_list', $component_list);
Context::set('component_count', $component_count);
Context::set('editor_config_default', $editor_config_default);
$security = new Security();
$security->encodeHTML('component_list....');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('admin_index');
}
/**
* @brief Component setup
*/
function dispEditorAdminSetupComponent()
{
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
$component_name = Context::get('component_name');
// Get information of the editor component
$oEditorModel = &getModel('editor');
$component = $oEditorModel->getComponent($component_name,$site_srl);
Context::set('component', $component);
// Get a group list to set a group
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($site_srl);
Context::set('group_list', $group_list);
// Get a mid list
$oModuleModel = &getModel('module');
$args->site_srl = $site_srl;
$columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title');
$mid_list = $oModuleModel->getMidList($args, $columnList);
// Combination of module_category and module
if(!$args->site_srl)
{
// Get a list of module category
$module_categories = $oModuleModel->getModuleCategories();
if(!is_array($mid_list)) $mid_list = array($mid_list);
foreach($mid_list as $module_srl => $module)
{
if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module;
}
$editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"12");
}
else
{
$module_categories[0]->list = $mid_list;
}
//editor preview
$config = $oEditorModel->getEditorConfig();
Context::set('mid_list',$module_categories);
$option->allow_fileupload = false;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;
$option->content_font_size = $config->content_font_size;
$option->enable_autosave = false;
$option->enable_default_component = true;
$option->enable_component = true;
$option->disable_html = false;
$option->height = $config->editor_height;
$option->skin = $config->editor_skin;
$option->content_key_name = 'dummy_content';
$option->primary_key_name = 'dummy_key';
$option->colorset = $config->sel_editor_colorset;
$editor = $oEditorModel->getEditor(0, $option);
//Security
$security = new Security();
$security->encodeHTML('group_list..title');
$security->encodeHTML('component...');
$security->encodeHTML('mid_list..title','mid_list..list..browser_title');
Context::set('preview_editor', $editor);
$option_com->allow_fileupload = false;
$option_com->content_style = $config->content_style;
$option_com->content_font = $config->content_font;
$option_com->content_font_size = $config->content_font_size;
$option_com->enable_autosave = false;
$option_com->enable_default_component = true;
$option_com->enable_component = true;
$option_com->disable_html = false;
$option_com->height = $config->comment_editor_height;
$option_com->skin = $config->comment_editor_skin;
$option_com->content_key_name = 'dummy_content2';
$option_com->primary_key_name = 'dummy_key2';
$option_com->content_style = $config->comment_content_style;
$option_com->colorset = $config->sel_comment_editor_colorset;
$editor_comment = $oEditorModel->getEditor(0, $option_com);
Context::set('preview_editor_comment', $editor_comment);
Context::set('editor_config', $editor_config);
Context::set('editor_skin_list', $editor_skin_list);
Context::set('editor_colorset_list', $skin_info->colorset);
Context::set('content_style_list', $content_style_list);
Context::set('component_list', $component_list);
Context::set('component_count', $component_count);
Context::set('editor_config_default', $editor_config_default);
$security = new Security();
$security->encodeHTML('component_list....');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('admin_index');
}
/**
* @brief Component setup
**/
function dispEditorAdminSetupComponent() {
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
$component_name = Context::get('component_name');
// Get information of the editor component
$oEditorModel = &getModel('editor');
$component = $oEditorModel->getComponent($component_name,$site_srl);
Context::set('component', $component);
// Get a group list to set a group
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($site_srl);
Context::set('group_list', $group_list);
// Get a mid list
$oModuleModel = &getModel('module');
$args->site_srl = $site_srl;
$columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title');
$mid_list = $oModuleModel->getMidList($args, $columnList);
// Combination of module_category and module
if(!$args->site_srl) {
// Get a list of module category
$module_categories = $oModuleModel->getModuleCategories();
if(!is_array($mid_list)) $mid_list = array($mid_list);
foreach($mid_list as $module_srl => $module) {
if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module;
}
} else {
$module_categories[0]->list = $mid_list;
}
Context::set('mid_list',$module_categories);
//Security
$security = new Security();
$security->encodeHTML('group_list..title');
$security->encodeHTML('component...');
$security->encodeHTML('mid_list..title','mid_list..list..browser_title');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('setup_component');
}
}
?>
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('setup_component');
}
}
/* End of file editor.admin.view.php */
/* Location: ./modules/editor/editor.admin.view.php */

View file

@ -1,13 +1,15 @@
<?php
/**
* @class editorAPI
* @author NHN (developers@xpressengine.com)
* @brief
**/
class editorAPI extends editor {
function dispEditorSkinColorset(&$oModule) {
$oModule->add('colorset', Context::get('colorset'));
}
}
?>
/**
* @class editorAPI
* @author NHN (developers@xpressengine.com)
* @brief
*/
class editorAPI extends editor
{
function dispEditorSkinColorset(&$oModule)
{
$oModule->add('colorset', Context::get('colorset'));
}
}
/* End of file editor.api.php */
/* Location: ./modules/editor/editor.api.php */

View file

@ -1,114 +1,117 @@
<?php
/**
* @class editor
* @author NHN (developers@xpressengine.com)
* @brief high class of the editor odule
**/
/**
* @class editor
* @author NHN (developers@xpressengine.com)
* @brief high class of the editor odule
*/
class editor extends ModuleObject
{
/**
* @brief Implement if additional tasks are necessary when installing
*/
function moduleInstall()
{
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
// Add the default editor component
$oEditorController = &getAdminController('editor');
$oEditorController->insertComponent('colorpicker_text',true);
$oEditorController->insertComponent('colorpicker_bg',true);
$oEditorController->insertComponent('emoticon',true);
$oEditorController->insertComponent('url_link',true);
$oEditorController->insertComponent('image_link',true);
$oEditorController->insertComponent('multimedia_link',true);
$oEditorController->insertComponent('quotation',true);
$oEditorController->insertComponent('table_maker',true);
$oEditorController->insertComponent('poll_maker',true);
$oEditorController->insertComponent('image_gallery',true);
// Create a directory to use in the editor module
FileHandler::makeDir('./files/cache/editor');
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
// 2007. 10. 23 Add an editor trigger on the module addition setup
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
class editor extends ModuleObject {
return new Object();
}
/**
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
// Add the default editor component
$oEditorController = &getAdminController('editor');
$oEditorController->insertComponent('colorpicker_text',true);
$oEditorController->insertComponent('colorpicker_bg',true);
$oEditorController->insertComponent('emoticon',true);
$oEditorController->insertComponent('url_link',true);
$oEditorController->insertComponent('image_link',true);
$oEditorController->insertComponent('multimedia_link',true);
$oEditorController->insertComponent('quotation',true);
$oEditorController->insertComponent('table_maker',true);
$oEditorController->insertComponent('poll_maker',true);
$oEditorController->insertComponent('image_gallery',true);
// Create a directory to use in the editor module
FileHandler::makeDir('./files/cache/editor');
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
// 2007. 10. 23 Add an editor trigger on the module addition setup
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
/**
* @brief a method to check if successfully installed
*/
function checkUpdate()
{
$oModuleModel = &getModel('module');
return new Object();
}
$oDB = &DB::getInstance();
// 2009. 06. 15 Save module_srl when auto-saving
if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
/**
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oModuleModel = &getModel('module');
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
// 2007. 10. 23 Add an editor trigger on the module addition setup
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
// 2009. 06. 19 Remove unused trigger
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
$oDB = &DB::getInstance();
// 2009. 06. 15 Save module_srl when auto-saving
if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) return true;
return false;
}
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
// 2007. 10. 23 Add an editor trigger on the module addition setup
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
// 2009. 06. 19 Remove unused trigger
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
/**
* @brief Execute update
*/
function moduleUpdate()
{
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) return true;
$oDB = &DB::getInstance();
// Save module_srl when auto-saving 15/06/2009
if(!$oDB->isColumnExists("editor_autosave","module_srl"))
$oDB->addColumn("editor_autosave","module_srl","number",11);
return false;
}
// create an index on module_srl
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
/**
* @brief Execute update
**/
function moduleUpdate() {
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
// 2007. 10. Add an editor trigger on the module addition setup
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'))
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
// 2009. 06. 19 Remove unused trigger
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
$oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
$oDB = &DB::getInstance();
// Save module_srl when auto-saving 15/06/2009
if(!$oDB->isColumnExists("editor_autosave","module_srl"))
$oDB->addColumn("editor_autosave","module_srl","number",11);
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'))
{
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after');
}
// create an index on module_srl
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
return new Object(0, 'success_updated');
}
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
// 2007. 10. Add an editor trigger on the module addition setup
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'))
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
// 2009. 06. 19 Remove unused trigger
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
$oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'))
{
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after');
}
return new Object(0, 'success_updated');
}
/**
* @brief Re-generate the cache file
**/
function recompileCache() {
}
}
?>
/**
* @brief Re-generate the cache file
*/
function recompileCache()
{
}
}
/* End of file editor.class.php */
/* Location: ./modules/editor/editor.class.php */

View file

@ -1,445 +1,487 @@
<?php
/**
* @class editor
* @author NHN (developers@xpressengine.com)
* @brief editor module's controller class
**/
/**
* @class editor
* @author NHN (developers@xpressengine.com)
* @brief editor module's controller class
*/
class editorController extends editor
{
/**
* @brief Initialization
*/
function init()
{
}
class editorController extends editor {
/**
* @brief AutoSave
*/
function procEditorSaveDoc()
{
/**
* @brief Initialization
**/
function init() {
}
$this->deleteSavedDoc(false);
/**
* @brief AutoSave
**/
function procEditorSaveDoc() {
$args->document_srl = Context::get('document_srl');
$args->content = Context::get('content');
$args->title = Context::get('title');
$output = $this->doSaveDoc($args);
$this->deleteSavedDoc(false);
$this->setMessage('msg_auto_saved');
}
$args->document_srl = Context::get('document_srl');
$args->content = Context::get('content');
$args->title = Context::get('title');
$output = $this->doSaveDoc($args);
/**
* @brief Delete autosaved documents
*/
function procEditorRemoveSavedDoc()
{
$oEditorController = &getController('editor');
$oEditorController->deleteSavedDoc(true);
}
$this->setMessage('msg_auto_saved');
}
/**
* @brief Execute a method of the component when the component requests ajax
*/
function procEditorCall()
{
$component = Context::get('component');
$method = Context::get('method');
if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
/**
* @brief Delete autosaved documents
**/
function procEditorRemoveSavedDoc() {
$oEditorController = &getController('editor');
$oEditorController->deleteSavedDoc(true);
}
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component);
if(!$oComponent->toBool()) return $oComponent;
/**
* @brief Execute a method of the component when the component requests ajax
**/
function procEditorCall() {
$component = Context::get('component');
$method = Context::get('method');
if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component);
if(!$oComponent->toBool()) return $oComponent;
//$output = call_user_method($method, $oComponent);
//$output = call_user_func(array($oComponent, $method));
if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
else return new Object(-1,sprintf('%s method is not exists', $method));
if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
//$output = call_user_method($method, $oComponent);
//$output = call_user_func(array($oComponent, $method));
if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
else return new Object(-1,sprintf('%s method is not exists', $method));
$this->setError($oComponent->getError());
$this->setMessage($oComponent->getMessage());
if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
$this->setError($oComponent->getError());
$this->setMessage($oComponent->getMessage());
$vars = $oComponent->getVariables();
if(count($vars)) {
foreach($vars as $key=>$val) $this->add($key, $val);
}
}
/**
* @brief Save Editor's additional form for each module
**/
function procEditorInsertModuleConfig() {
$module_srl = Context::get('target_module_srl');
// To configure many of modules at once
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
$editor_config = null;
$editor_config->editor_skin = Context::get('editor_skin');
$editor_config->comment_editor_skin = Context::get('comment_editor_skin');
$editor_config->content_style = Context::get('content_style');
$editor_config->comment_content_style = Context::get('comment_content_style');
$editor_config->content_font = Context::get('content_font');
if($editor_config->content_font) {
$font_list = array();
$fonts = explode(',',$editor_config->content_font);
for($i=0,$c=count($fonts);$i<$c;$i++) {
$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
if(!$font) continue;
$font_list[] = $font;
}
if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
}
$editor_config->content_font_size = Context::get('content_font_size');
$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
$editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset');
$grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant');
foreach($grants as $key)
{
$grant = Context::get($key);
if(!$grant)
{
$editor_config->{$key} = array();
}
else if(is_array($grant))
{
$editor_config->{$key} = $grant;
}
else
{
$editor_config->{$key} = explode('|@|', $grant);
}
}
$editor_config->editor_height = (int)Context::get('editor_height');
$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
$editor_config->enable_autosave = Context::get('enable_autosave');
if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
$oModuleController = &getController('module');
for($i=0;$i<count($module_srl);$i++) {
$srl = trim($module_srl[$i]);
if(!$srl) continue;
$oModuleController->insertModulePartConfig('editor',$srl,$editor_config);
}
$this->setError(-1);
$this->setMessage('success_updated', 'info');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
$this->setRedirectUrl($returnUrl);
}
/**
* @brief convert editor component codes to be returned and specify content style.
**/
function triggerEditorComponentCompile(&$content) {
if(Context::getResponseMethod()!='HTML') return new Object();
$module_info = Context::get('module_info');
$module_srl = $module_info->module_srl;
if($module_srl) {
$oEditorModel = &getModel('editor');
$editor_config = $oEditorModel->getEditorConfig($module_srl);
$content_style = $editor_config->content_style;
if($content_style) {
$path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/';
if(is_dir($path) && file_exists($path.'style.ini')) {
$ini = file($path.'style.ini');
for($i=0,$c=count($ini);$i<$c;$i++) {
$file = trim($ini[$i]);
if(!$file) continue;
if(preg_match('/\.css$/i',$file)) Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
elseif(preg_match('/\.js/i',$file)) Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
}
}
}
$content_font = $editor_config->content_font;
$content_font_size = $editor_config->content_font_size;
if($content_font || $content_font_size) {
$buff = '<style> .xe_content { ';
if($content_font) $buff .= 'font-family:'.$content_font.';';
if($content_font_size) $buff .= 'font-size:'.$content_font_size.';';
$buff .= ' }</style>';
Context::addHtmlHeader($buff);
}
}
$content = $this->transComponent($content);
return new Object();
}
/**
* @brief Convert editor component codes to be returned
**/
function transComponent($content) {
$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content);
return $content;
}
/**
* @brief Convert editor component code of the contents
**/
function transEditorComponent($match) {
$script = " {$match[2]} editor_component={$match[3]}";
$script = preg_replace('/([\w:-]+)\s*=(?:\s*(["\']))?((?(2).*?|[^ ]+))\2/i', '\1="\3"', $script);
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m);
$xml_obj = new stdClass;
for($i=0,$c=count($m[0]);$i<$c;$i++) {
$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
}
$xml_obj->body = $match[4];
if(!$xml_obj->attrs->editor_component) return $match[0];
// Get converted codes by using component::transHTML()
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
return $oComponent->transHTML($xml_obj);
}
/**
* @brief AutoSave
**/
function doSaveDoc($args) {
if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
$args->member_srl = $logged_info->member_srl;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
// Get the current module if module_srl doesn't exist
if(!$args->module_srl) {
$args->module_srl = Context::get('module_srl');
}
if(!$args->module_srl) {
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
// Save
return executeQuery('editor.insertSavedDoc', $args);
}
/**
* @brief Load the srl of autosaved document - for those who uses XE older versions.
**/
function procEditorLoadSavedDocument() {
$editor_sequence = Context::get('editor_sequence');
$primary_key = Context::get('primary_key');
$oEditorModel = &getModel('editor');
$oFileController = &getController('file');
$saved_doc = $oEditorModel->getSavedDoc(null);
$oFileController->setUploadInfo($editor_sequence, $saved_doc->document_srl);
$vars = $this->getVariables();
$this->add("editor_sequence", $editor_sequence);
$this->add("key", $primary_key);
$this->add("title", $saved_doc->title);
$this->add("content", $saved_doc->content);
$this->add("document_srl", $saved_doc->document_srl);
}
/**
* @brief A trigger to remove auto-saved document when inserting/updating the document
**/
function triggerDeleteSavedDoc(&$obj) {
$this->deleteSavedDoc(false);
return new Object();
}
/**
* @brief Delete the auto-saved document
* Based on the current logged-in user
**/
function deleteSavedDoc($mode = false) {
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
$args->member_srl = $logged_info->member_srl;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->module_srl = Context::get('module_srl');
// Get the current module if module_srl doesn't exist
if(!$args->module_srl) {
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
// Check if the auto-saved document already exists
$output = executeQuery('editor.getSavedDocument', $args);
$saved_doc = $output->data;
if(!$saved_doc) return;
$oDocumentModel = &getModel('document');
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
if(!$oSaved->isExists()) {
if($mode) {
$output = executeQuery('editor.getSavedDocument', $args);
$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
}
}
// Delete the saved document
return executeQuery('editor.deleteSavedDoc', $args);
}
/**
* @brief ERemove editor component information used on the virtual site
**/
function removeEditorConfig($site_srl) {
$args->site_srl = $site_srl;
executeQuery('editor.deleteSiteComponent', $args);
}
/**
* @brief Caching a list of editor component (editorModel::getComponentList)
* For the editor component list, use a caching file because of DB query and Xml parsing
**/
function makeCache($filter_enabled = true, $site_srl) {
$oEditorModel = &getModel('editor');
if($filter_enabled) $args->enabled = "Y";
if($site_srl) {
$args->site_srl = $site_srl;
$output = executeQuery('editor.getSiteComponentList', $args);
} else $output = executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
// Get a list of files
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
// Get information about log-in status and its group
$is_logged = Context::get('is_logged');
if($is_logged) {
$logged_info = Context::get('logged_info');
if($logged_info->group_list && is_array($logged_info->group_list)) {
$group_list = array_keys($logged_info->group_list);
} else $group_list = array();
}
// Get xml information for looping DB list
if(!is_array($db_list)) $db_list = array($db_list);
foreach($db_list as $component) {
if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
$component_name = $component->component_name;
if(!$component_name) continue;
if(!in_array($component_name, $downloaded_list)) continue;
unset($xml_info);
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
$xml_info->enabled = $component->enabled;
if($component->extra_vars) {
$extra_vars = unserialize($component->extra_vars);
if($extra_vars->target_group) {
$xml_info->target_group = $extra_vars->target_group;
}
if($extra_vars->mid_list && count($extra_vars->mid_list))
{
$xml_info->mid_list = $extra_vars->mid_list;
}
/*
// Permisshin check if you are granted
if($extra_vars->target_group) {
// Stop using if not logged-in
if(!$is_logged) continue;
// Compare a target group with the current logged-in user group
$target_group = $extra_vars->target_group;
unset($extra_vars->target_group);
$is_granted = false;
foreach($group_list as $group_srl) {
if(in_array($group_srl, $target_group)) {
$is_granted = true;
break;
}
}
if(!$is_granted) continue;
}
// Check if the target module exists
if($extra_vars->mid_list && count($extra_vars->mid_list) && Context::get('mid')) {
if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
}*/
// Check the configuration of the editor component
if($xml_info->extra_vars) {
foreach($xml_info->extra_vars as $key => $val) {
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
}
}
}
$component_list->{$component_name} = $xml_info;
// Get buttons, icons, images
$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
}
// Return if it checks enabled only
if($filter_enabled) {
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
FileHandler::writeFile($cache_file, $buff);
return $component_list;
}
// Get xml_info of downloaded list
foreach($downloaded_list as $component_name) {
if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
// Pass if configured
if($component_list->{$component_name}) continue;
// Insert data into the DB
$oEditorController = &getAdminController('editor');
$oEditorController->insertComponent($component_name, false, $site_srl);
// Add to component_list
unset($xml_info);
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
$xml_info->enabled = 'N';
$component_list->{$component_name} = $xml_info;
}
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
FileHandler::writeFile($cache_file, $buff);
return $component_list;
}
/**
* @brief Delete cache files
**/
function removeCache($site_srl = 0) {
$oEditorModel = &getModel('editor');
FileHandler::removeFile($oEditorModel->getCacheFile(true, $site_srl));
FileHandler::removeFile($oEditorModel->getCacheFile(false, $site_srl));
}
function triggerCopyModule(&$obj)
$vars = $oComponent->getVariables();
if(count($vars))
{
$oModuleModel = &getModel('module');
$editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl);
foreach($vars as $key=>$val) $this->add($key, $val);
}
}
$oModuleController = &getController('module');
if(is_array($obj->moduleSrlList))
/**
* @brief Save Editor's additional form for each module
*/
function procEditorInsertModuleConfig()
{
$module_srl = Context::get('target_module_srl');
// To configure many of modules at once
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
$editor_config = null;
$editor_config->editor_skin = Context::get('editor_skin');
$editor_config->comment_editor_skin = Context::get('comment_editor_skin');
$editor_config->content_style = Context::get('content_style');
$editor_config->comment_content_style = Context::get('comment_content_style');
$editor_config->content_font = Context::get('content_font');
if($editor_config->content_font)
{
$font_list = array();
$fonts = explode(',',$editor_config->content_font);
for($i=0,$c=count($fonts);$i<$c;$i++)
{
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
{
$oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig);
}
$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
if(!$font) continue;
$font_list[] = $font;
}
if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
}
$editor_config->content_font_size = Context::get('content_font_size');
$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
$editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset');
$grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant');
foreach($grants as $key)
{
$grant = Context::get($key);
if(!$grant)
{
$editor_config->{$key} = array();
}
else if(is_array($grant))
{
$editor_config->{$key} = $grant;
}
else
{
$editor_config->{$key} = explode('|@|', $grant);
}
}
}
?>
$editor_config->editor_height = (int)Context::get('editor_height');
$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
$editor_config->enable_autosave = Context::get('enable_autosave');
if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
$oModuleController = &getController('module');
for($i=0;$i<count($module_srl);$i++)
{
$srl = trim($module_srl[$i]);
if(!$srl) continue;
$oModuleController->insertModulePartConfig('editor',$srl,$editor_config);
}
$this->setError(-1);
$this->setMessage('success_updated', 'info');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
$this->setRedirectUrl($returnUrl);
}
/**
* @brief convert editor component codes to be returned and specify content style.
*/
function triggerEditorComponentCompile(&$content)
{
if(Context::getResponseMethod()!='HTML') return new Object();
$module_info = Context::get('module_info');
$module_srl = $module_info->module_srl;
if($module_srl)
{
$oEditorModel = &getModel('editor');
$editor_config = $oEditorModel->getEditorConfig($module_srl);
$content_style = $editor_config->content_style;
if($content_style)
{
$path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/';
if(is_dir($path) && file_exists($path.'style.ini'))
{
$ini = file($path.'style.ini');
for($i=0,$c=count($ini);$i<$c;$i++)
{
$file = trim($ini[$i]);
if(!$file) continue;
if(preg_match('/\.css$/i',$file)) Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
elseif(preg_match('/\.js/i',$file)) Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
}
}
}
$content_font = $editor_config->content_font;
$content_font_size = $editor_config->content_font_size;
if($content_font || $content_font_size)
{
$buff = '<style> .xe_content { ';
if($content_font) $buff .= 'font-family:'.$content_font.';';
if($content_font_size) $buff .= 'font-size:'.$content_font_size.';';
$buff .= ' }</style>';
Context::addHtmlHeader($buff);
}
}
$content = $this->transComponent($content);
return new Object();
}
/**
* @brief Convert editor component codes to be returned
*/
function transComponent($content)
{
$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content);
return $content;
}
/**
* @brief Convert editor component code of the contents
*/
function transEditorComponent($match)
{
$script = " {$match[2]} editor_component={$match[3]}";
$script = preg_replace('/([\w:-]+)\s*=(?:\s*(["\']))?((?(2).*?|[^ ]+))\2/i', '\1="\3"', $script);
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m);
$xml_obj = new stdClass;
for($i=0,$c=count($m[0]);$i<$c;$i++)
{
$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
}
$xml_obj->body = $match[4];
if(!$xml_obj->attrs->editor_component) return $match[0];
// Get converted codes by using component::transHTML()
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
return $oComponent->transHTML($xml_obj);
}
/**
* @brief AutoSave
*/
function doSaveDoc($args)
{
if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
$args->member_srl = $logged_info->member_srl;
}
else
{
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
// Get the current module if module_srl doesn't exist
if(!$args->module_srl)
{
$args->module_srl = Context::get('module_srl');
}
if(!$args->module_srl)
{
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
// Save
return executeQuery('editor.insertSavedDoc', $args);
}
/**
* @brief Load the srl of autosaved document - for those who uses XE older versions.
*/
function procEditorLoadSavedDocument()
{
$editor_sequence = Context::get('editor_sequence');
$primary_key = Context::get('primary_key');
$oEditorModel = &getModel('editor');
$oFileController = &getController('file');
$saved_doc = $oEditorModel->getSavedDoc(null);
$oFileController->setUploadInfo($editor_sequence, $saved_doc->document_srl);
$vars = $this->getVariables();
$this->add("editor_sequence", $editor_sequence);
$this->add("key", $primary_key);
$this->add("title", $saved_doc->title);
$this->add("content", $saved_doc->content);
$this->add("document_srl", $saved_doc->document_srl);
}
/**
* @brief A trigger to remove auto-saved document when inserting/updating the document
*/
function triggerDeleteSavedDoc(&$obj)
{
$this->deleteSavedDoc(false);
return new Object();
}
/**
* @brief Delete the auto-saved document
* Based on the current logged-in user
*/
function deleteSavedDoc($mode = false)
{
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
$args->member_srl = $logged_info->member_srl;
}
else
{
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->module_srl = Context::get('module_srl');
// Get the current module if module_srl doesn't exist
if(!$args->module_srl)
{
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
// Check if the auto-saved document already exists
$output = executeQuery('editor.getSavedDocument', $args);
$saved_doc = $output->data;
if(!$saved_doc) return;
$oDocumentModel = &getModel('document');
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
if(!$oSaved->isExists())
{
if($mode)
{
$output = executeQuery('editor.getSavedDocument', $args);
$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
}
}
// Delete the saved document
return executeQuery('editor.deleteSavedDoc', $args);
}
/**
* @brief ERemove editor component information used on the virtual site
*/
function removeEditorConfig($site_srl)
{
$args->site_srl = $site_srl;
executeQuery('editor.deleteSiteComponent', $args);
}
/**
* @brief Caching a list of editor component (editorModel::getComponentList)
* For the editor component list, use a caching file because of DB query and Xml parsing
*/
function makeCache($filter_enabled = true, $site_srl)
{
$oEditorModel = &getModel('editor');
if($filter_enabled) $args->enabled = "Y";
if($site_srl)
{
$args->site_srl = $site_srl;
$output = executeQuery('editor.getSiteComponentList', $args);
}
else $output = executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
// Get a list of files
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
// Get information about log-in status and its group
$is_logged = Context::get('is_logged');
if($is_logged)
{
$logged_info = Context::get('logged_info');
if($logged_info->group_list && is_array($logged_info->group_list))
{
$group_list = array_keys($logged_info->group_list);
}
else $group_list = array();
}
// Get xml information for looping DB list
if(!is_array($db_list)) $db_list = array($db_list);
foreach($db_list as $component)
{
if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
$component_name = $component->component_name;
if(!$component_name) continue;
if(!in_array($component_name, $downloaded_list)) continue;
unset($xml_info);
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
$xml_info->enabled = $component->enabled;
if($component->extra_vars)
{
$extra_vars = unserialize($component->extra_vars);
if($extra_vars->target_group)
{
$xml_info->target_group = $extra_vars->target_group;
}
if($extra_vars->mid_list && count($extra_vars->mid_list))
{
$xml_info->mid_list = $extra_vars->mid_list;
}
/*
// Permisshin check if you are granted
if($extra_vars->target_group) {
// Stop using if not logged-in
if(!$is_logged) continue;
// Compare a target group with the current logged-in user group
$target_group = $extra_vars->target_group;
unset($extra_vars->target_group);
$is_granted = false;
foreach($group_list as $group_srl) {
if(in_array($group_srl, $target_group)) {
$is_granted = true;
break;
}
}
if(!$is_granted) continue;
}
// Check if the target module exists
if($extra_vars->mid_list && count($extra_vars->mid_list) && Context::get('mid')) {
if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
}*/
// Check the configuration of the editor component
if($xml_info->extra_vars)
{
foreach($xml_info->extra_vars as $key => $val)
{
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
}
}
}
$component_list->{$component_name} = $xml_info;
// Get buttons, icons, images
$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
}
// Return if it checks enabled only
if($filter_enabled)
{
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
FileHandler::writeFile($cache_file, $buff);
return $component_list;
}
// Get xml_info of downloaded list
foreach($downloaded_list as $component_name)
{
if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
// Pass if configured
if($component_list->{$component_name}) continue;
// Insert data into the DB
$oEditorController = &getAdminController('editor');
$oEditorController->insertComponent($component_name, false, $site_srl);
// Add to component_list
unset($xml_info);
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
$xml_info->enabled = 'N';
$component_list->{$component_name} = $xml_info;
}
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
FileHandler::writeFile($cache_file, $buff);
return $component_list;
}
/**
* @brief Delete cache files
*/
function removeCache($site_srl = 0)
{
$oEditorModel = &getModel('editor');
FileHandler::removeFile($oEditorModel->getCacheFile(true, $site_srl));
FileHandler::removeFile($oEditorModel->getCacheFile(false, $site_srl));
}
function triggerCopyModule(&$obj)
{
$oModuleModel = &getModel('module');
$editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl);
$oModuleController = &getController('module');
if(is_array($obj->moduleSrlList))
{
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
{
$oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig);
}
}
}
}
/* End of file editor.controller.php */
/* Location: ./modules/editor/editor.controller.php */

File diff suppressed because it is too large Load diff

View file

@ -1,146 +1,157 @@
<?php
/**
* @class editorView
* @author NHN (developers@xpressengine.com)
* @brief view class of the editor module
**/
/**
* @class editorView
* @author NHN (developers@xpressengine.com)
* @brief view class of the editor module
*/
class editorView extends editor
{
/**
* @brief Initialization
*/
function init()
{
}
class editorView extends editor {
/**
* @brief Action to get a request to display compoenet pop-up
*/
function dispEditorPopup()
{
// add a css file
Context::loadFile($this->module_path."tpl/css/editor.css", true);
// List variables
$editor_sequence = Context::get('editor_sequence');
$component = Context::get('component');
/**
* @brief Initialization
**/
function init() {
}
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// Get compoenet object
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
if(!$oComponent->toBool())
{
Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('component_not_founded');
}
else
{
// Get the result after executing a method to display popup url of the component
$popup_content = $oComponent->getPopupContent();
Context::set('popup_content', $popup_content);
// Set layout to popup_layout
$this->setLayoutFile('popup_layout');
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('popup');
}
}
/**
* @brief Action to get a request to display compoenet pop-up
**/
function dispEditorPopup() {
// add a css file
Context::loadFile($this->module_path."tpl/css/editor.css", true);
// List variables
$editor_sequence = Context::get('editor_sequence');
$component = Context::get('component');
/**
* @brief Get component information
*/
function dispEditorComponentInfo()
{
$component_name = Context::get('component_name');
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// Get compoenet object
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
if(!$oComponent->toBool()) {
Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('component_not_founded');
} else {
// Get the result after executing a method to display popup url of the component
$popup_content = $oComponent->getPopupContent();
Context::set('popup_content', $popup_content);
// Set layout to popup_layout
$this->setLayoutFile('popup_layout');
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('popup');
}
}
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
/**
* @brief Get component information
**/
function dispEditorComponentInfo() {
$component_name = Context::get('component_name');
$oEditorModel = &getModel('editor');
$component = $oEditorModel->getComponent($component_name, $site_srl);
Context::set('component', $component);
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('view_component');
$this->setLayoutFile("popup_layout");
}
$oEditorModel = &getModel('editor');
$component = $oEditorModel->getComponent($component_name, $site_srl);
Context::set('component', $component);
/**
* @brief Add a form for editor addition setup
*/
function triggerDispEditorAdditionSetup(&$obj)
{
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('view_component');
$this->setLayoutFile("popup_layout");
}
if(!$current_module_srl && !$current_module_srls)
{
// Get information of the current module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();
}
// Get editors settings
$oEditorModel = &getModel('editor');
$editor_config = $oEditorModel->getEditorConfig($current_module_srl);
/**
* @brief Add a form for editor addition setup
**/
function triggerDispEditorAdditionSetup(&$obj) {
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
Context::set('editor_config', $editor_config);
if(!$current_module_srl && !$current_module_srls) {
// Get information of the current module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();
}
// Get editors settings
$oEditorModel = &getModel('editor');
$editor_config = $oEditorModel->getEditorConfig($current_module_srl);
$oModuleModel = &getModel('module');
// Get a list of editor skin
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
Context::set('editor_skin_list', $editor_skin_list);
Context::set('editor_config', $editor_config);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
Context::set('editor_colorset_list', $skin_info->colorset);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin);
Context::set('editor_comment_colorset_list', $skin_info->colorset);
$oModuleModel = &getModel('module');
// Get a list of editor skin
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
Context::set('editor_skin_list', $editor_skin_list);
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
for($i=0,$c=count($contents);$i<$c;$i++)
{
$style = $contents[$i];
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
$content_style_list[$style]->title = $info->title;
}
Context::set('content_style_list', $content_style_list);
// Get a group list
$oMemberModel = &getModel('member');
$site_module_info = Context::get('site_module_info');
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
Context::set('group_list', $group_list);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
Context::set('editor_colorset_list', $skin_info->colorset);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin);
Context::set('editor_comment_colorset_list', $skin_info->colorset);
//Security
$security = new Security();
$security->encodeHTML('group_list..title');
$security->encodeHTML('group_list..description');
$security->encodeHTML('content_style_list..');
$security->encodeHTML('editor_comment_colorset_list..title');
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
for($i=0,$c=count($contents);$i<$c;$i++) {
$style = $contents[$i];
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
$content_style_list[$style]->title = $info->title;
}
Context::set('content_style_list', $content_style_list);
// Get a group list
$oMemberModel = &getModel('member');
$site_module_info = Context::get('site_module_info');
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
Context::set('group_list', $group_list);
// Set a template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config');
$obj .= $tpl;
//Security
$security = new Security();
$security->encodeHTML('group_list..title');
$security->encodeHTML('group_list..description');
$security->encodeHTML('content_style_list..');
$security->encodeHTML('editor_comment_colorset_list..title');
// Set a template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config');
$obj .= $tpl;
return new Object();
}
return new Object();
}
function dispEditorPreview(){
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('preview');
}
function dispEditorPreview()
{
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('preview');
}
function dispEditorSkinColorset(){
$skin = Context::get('skin');
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin);
$colorset = $skin_info->colorset;
Context::set('colorset', $colorset);
}
function dispEditorSkinColorset()
{
$skin = Context::get('skin');
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin);
$colorset = $skin_info->colorset;
Context::set('colorset', $colorset);
}
function dispEditorConfigPreview() {
$oEditorModel = &getModel('editor');
$config = $oEditorModel->getEditorConfig();
function dispEditorConfigPreview()
{
$oEditorModel = &getModel('editor');
$config = $oEditorModel->getEditorConfig();
$mode = Context::get('mode');
$mode = Context::get('mode');
if($mode != 'main')
{
if($mode != 'main')
{
$option_com->allow_fileupload = false;
$option_com->content_style = $config->content_style;
$option_com->content_font = $config->content_font;
@ -156,32 +167,31 @@
$option_com->content_style = $config->comment_content_style;
$option_com->colorset = $config->sel_comment_editor_colorset;
$editor = $oEditorModel->getEditor(0, $option_com);
}
else
{
$option->allow_fileupload = false;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;
$option->content_font_size = $config->content_font_size;
$option->enable_autosave = false;
$option->enable_default_component = true;
$option->enable_component = true;
$option->disable_html = false;
$option->height = $config->editor_height;
$option->skin = $config->editor_skin;
$option->content_key_name = 'dummy_content';
$option->primary_key_name = 'dummy_key';
$option->colorset = $config->sel_editor_colorset;
$editor = $oEditorModel->getEditor(0, $option);
}
Context::set('editor', $editor);
$this->setLayoutFile('popup_layout');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('config_preview');
}
}
?>
else
{
$option->allow_fileupload = false;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;
$option->content_font_size = $config->content_font_size;
$option->enable_autosave = false;
$option->enable_default_component = true;
$option->enable_component = true;
$option->disable_html = false;
$option->height = $config->editor_height;
$option->skin = $config->editor_skin;
$option->content_key_name = 'dummy_content';
$option->primary_key_name = 'dummy_key';
$option->colorset = $config->sel_editor_colorset;
$editor = $oEditorModel->getEditor(0, $option);
}
Context::set('editor', $editor);
$this->setLayoutFile('popup_layout');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('config_preview');
}
}
/* End of file editor.view.php */
/* Location: ./modules/editor/editor.view.php */