Beispiel #1
0
 function Spaw($config)
 {
     $this->instance = $config['name'];
     $this->content = $config['content'];
     parent::SpawEditor($this->instance, $this->content);
     // load plugin configs
     $spaw_pgdir = SpawConfig::getStaticConfigValue('SPAW_ROOT') . 'plugins/';
     if (is_dir($spaw_pgdir)) {
         if ($spaw_dh = opendir($spaw_pgdir)) {
             while (($spaw_pg = readdir($spaw_dh)) != false) {
                 if ($spaw_pg != '.' && $spaw_pg != '..') {
                     if (is_dir($spaw_pgdir . $spaw_pg . '/config')) {
                         if ($spaw_pgdh = opendir($spaw_pgdir . $spaw_pg . '/config')) {
                             while (($spaw_fn = readdir($spaw_pgdh)) !== false) {
                                 if ($spaw_fn != '.' && $spaw_fn != '..' && !is_dir($spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn)) {
                                     include $spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn;
                                 }
                             }
                             closedir($spaw_pgdh);
                         }
                     }
                 }
             }
             closedir($spaw_dh);
         }
     }
 }
<?php

$lang->setModule("core");
$lang->setBlock("table_prop");
$spaw_table_styles = $config->getConfigValue("table_styles");
?>
<script type="text/javascript" src="<?php 
echo SpawConfig::getStaticConfigValue('SPAW_DIR');
?>
plugins/core/dialogs/table_prop.js"></script>

<script type="text/javascript">
<!--
var spawErrorMessages = new Array();
<?php 
echo 'spawErrorMessages["error_rows_nan"] = "' . $lang->m('error_rows_nan') . '";' . "\n";
echo 'spawErrorMessages["error_columns_nan"] = "' . $lang->m('error_columns_nan') . '";' . "\n";
echo 'spawErrorMessages["error_width_nan"] = "' . $lang->m('error_width_nan') . '";' . "\n";
echo 'spawErrorMessages["error_height_nan"] = "' . $lang->m('error_height_nan') . '";' . "\n";
echo 'spawErrorMessages["error_border_nan"] = "' . $lang->m('error_border_nan') . '";' . "\n";
echo 'spawErrorMessages["error_cellpadding_nan"] = "' . $lang->m('error_cellpadding_nan') . '";' . "\n";
echo 'spawErrorMessages["error_cellspacing_nan"] = "' . $lang->m('error_cellspacing_nan') . '";' . "\n";
?>
//-->
</script>

<table border="0" cellspacing="0" cellpadding="2" width="336">
<form name="table_prop" id="table_prop" onsubmit="return false;">
<tr>
  <td><?php 
echo $lang->m('rows');
// specifies in which directions resizing is allowed (values: none, horizontal, vertical, both)
SpawConfig::setStaticConfigItem('resizing_directions', 'vertical', SPAW_CFG_TRANSFER_JS);
// specifies that special characters should be converted to the respective html entities
SpawConfig::setStaticConfigItem('convert_html_entities', false, SPAW_CFG_TRANSFER_JS);
// data for style (css class) dropdown list
SpawConfig::setStaticConfigItem("dropdown_data_core_style", array('' => 'Normal', 'style1' => 'Style No.1', 'style2' => 'Style No.2'));
// data for style (css class) dropdown in table properties dialog
SpawConfig::setStaticConfigItem("table_styles", array('' => 'Normal', 'style1' => 'Style No.1', 'style2' => 'Style No.2'));
// data for fonts dropdown list
SpawConfig::setStaticConfigItem("dropdown_data_core_fontname", array('Arial' => 'Arial', 'Courier' => 'Courier', 'Tahoma' => 'Tahoma', 'Times New Roman' => 'Times', 'Verdana' => 'Verdana'));
// data for fontsize dropdown list
SpawConfig::setStaticConfigItem("dropdown_data_core_fontsize", array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6'));
// data for paragraph dropdown list
SpawConfig::setStaticConfigItem("dropdown_data_core_formatBlock", array('Normal' => 'Normal', '<H1>' => 'Heading 1', '<H2>' => 'Heading 2', '<H3>' => 'Heading 3', '<H4>' => 'Heading 4', '<H5>' => 'Heading 5', '<H6>' => 'Heading 6', '<pre>' => 'Preformatted', '<address>' => 'Address', '<p>' => 'Paragraph'));
// data for link targets drodown list in hyperlink dialog
SpawConfig::setStaticConfigItem("a_targets", array('_self' => 'Self', '_blank' => 'Blank', '_top' => 'Top', '_parent' => 'Parent'));
// toolbar sets (should start with "toolbarset_"
// standard core toolbars
SpawConfig::setStaticConfigItem('toolbarset_standard', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools"));
// all core toolbars
SpawConfig::setStaticConfigItem('toolbarset_all', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools", "font" => "font"));
// mini core toolbars
SpawConfig::setStaticConfigItem('toolbarset_mini', array("format" => "format_mini", "edit" => "edit", "tools" => "tools"));
// colorpicker config
SpawConfig::setStaticConfigItem('colorpicker_predefined_colors', array('black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', '#fedcba', 'aqua'), SPAW_CFG_TRANSFER_SECURE);
// SpawFm plugin config:
// global filemanager settings
SpawConfig::setStaticConfigItem('PG_SPAWFM_SETTINGS', array('allowed_filetypes' => array('any'), 'allow_modify' => false, 'allow_upload' => false, 'max_upload_filesize' => 0, 'max_img_width' => 0, 'max_img_height' => 0, 'recursive' => false, 'allow_modify_subdirectories' => false, 'allow_create_subdirectories' => false), SPAW_CFG_TRANSFER_SECURE);
// directories
SpawConfig::setStaticConfigItem('PG_SPAWFM_DIRECTORIES', array(array('dir' => SpawConfig::getStaticConfigValue('SPAW_DIR') . 'uploads/flash/', 'caption' => 'Flash movies', 'params' => array('allowed_filetypes' => array('flash'))), array('dir' => SpawConfig::getStaticConfigValue('SPAW_DIR') . 'uploads/images/', 'caption' => 'Images', 'params' => array('default_dir' => true, 'allowed_filetypes' => array('images'))), array('dir' => SpawConfig::getStaticConfigValue('SPAW_DIR') . 'uploads/files/', 'fsdir' => SpawConfig::getStaticConfigValue('SPAW_ROOT') . 'uploads/files/', 'caption' => 'Files', 'params' => array('allowed_filetypes' => array('any')))), SPAW_CFG_TRANSFER_SECURE);
Beispiel #4
0
 /**
  * Loads theme data
  * @access private
  */
 function loadData()
 {
     $pgdir = SpawConfig::getStaticConfigValue("SPAW_ROOT") . 'plugins/';
     if (is_dir($pgdir)) {
         // load theme settings
         if ($dh = opendir($pgdir)) {
             while (($pg = readdir($dh)) !== false) {
                 if (file_exists($pgdir . $pg . '/lib/theme/' . $this->name . '/config/theme.config.php')) {
                     // load theme config file for each plugin
                     include $pgdir . $pg . '/lib/theme/' . $this->name . '/config/theme.config.php';
                     // load default styles for "core" only
                     if ($pg == "core") {
                         if (isset($default_tb_button_style)) {
                             $this->default_tb_button_style = $default_tb_button_style;
                             unset($default_tb_button_style);
                         }
                         if (isset($default_tb_image_style)) {
                             $this->default_tb_image_style = $default_tb_image_style;
                             unset($default_tb_image_style);
                         }
                         if (isset($default_tb_dropdown_style)) {
                             $this->default_tb_dropdown_style = $default_tb_dropdown_style;
                             unset($default_tb_dropdown_style);
                         }
                         if (isset($default_tb_button_css_class)) {
                             $this->default_tb_button_css_class = $default_tb_button_css_class;
                             unset($default_tb_button_css_class);
                         }
                         if (isset($default_tb_image_css_class)) {
                             $this->default_tb_image_css_class = $default_tb_image_css_class;
                             unset($default_tb_image_css_class);
                         }
                         if (isset($default_tb_dropdown_css_class)) {
                             $this->default_tb_dropdown_css_class = $default_tb_dropdown_css_class;
                             unset($default_tb_dropdown_css_class);
                         }
                         if (isset($default_tb_button_events)) {
                             $this->default_tb_button_events = $default_tb_button_events;
                             unset($default_tb_button_events);
                         }
                     }
                     if (isset($custom_tbi_styles)) {
                         $this->custom_tbi_styles = array_merge($this->custom_tbi_styles, $custom_tbi_styles);
                         unset($custom_tbi_styles);
                     }
                     if (isset($custom_tbi_css_classes)) {
                         $this->custom_tbi_css_classes = array_merge($this->custom_tbi_css_classes, $custom_tbi_css_classes);
                         unset($custom_tbi_css_classes);
                     }
                     if (isset($custom_tbi_events)) {
                         $this->custom_tbi_events = array_merge($this->custom_tbi_events, $custom_tbi_events);
                         unset($custom_tbi_events);
                     }
                 }
             }
             closedir($dh);
         }
         // load template
         if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/editor.tpl")) {
             $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/editor.tpl";
             $handle = fopen($fn, "r");
             $this->template = fread($handle, filesize($fn));
             fclose($handle);
         }
         // load editor template for floating toolbar mode
         if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/editor_floating.tpl")) {
             $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/editor_floating.tpl";
             $handle = fopen($fn, "r");
             $this->template_floating = fread($handle, filesize($fn));
             fclose($handle);
         }
         // load toolbar template for floating toolbar mode
         if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/toolbar_floating.tpl")) {
             $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/toolbar_floating.tpl";
             $handle = fopen($fn, "r");
             $this->template_toolbar = fread($handle, filesize($fn));
             fclose($handle);
         }
         // load template for standard dialog header
         if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_header.tpl")) {
             $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_header.tpl";
             $handle = fopen($fn, "r");
             $this->template_dialog_header = fread($handle, filesize($fn));
             fclose($handle);
         }
         // load template for standard dialog footer
         if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_footer.tpl")) {
             $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_footer.tpl";
             $handle = fopen($fn, "r");
             $this->template_dialog_footer = fread($handle, filesize($fn));
             fclose($handle);
         }
     }
 }
Beispiel #5
0
<?php

/**
 * SPAW Editor v.2 Main include file
 * 
 * Include this file in your script
 *   
 * @package spaw2
 * @author Alan Mendelevich <*****@*****.**> 
 * @copyright UAB Solmetra   
 */
require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/config/config.php';
require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/class/editor.class.php';
// load plugin configs
$spaw_pgdir = SpawConfig::getStaticConfigValue('SPAW_ROOT') . 'plugins/';
if (is_dir($spaw_pgdir)) {
    if ($spaw_dh = opendir($spaw_pgdir)) {
        while (($spaw_pg = readdir($spaw_dh)) != false) {
            if ($spaw_pg != '.' && $spaw_pg != '..') {
                if (is_dir($spaw_pgdir . $spaw_pg . '/config')) {
                    if ($spaw_pgdh = opendir($spaw_pgdir . $spaw_pg . '/config')) {
                        while (($spaw_fn = readdir($spaw_pgdh)) !== false) {
                            if ($spaw_fn != '.' && $spaw_fn != '..' && !is_dir($spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn)) {
                                include $spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn;
                            }
                        }
                        closedir($spaw_pgdh);
                    }
                }
            }
        }
Beispiel #6
0
// under IIS you will probably need to setup the above paths manually. it would be something like this
SpawConfig::setStaticConfigItem('DOCUMENT_ROOT', 'c:/inetpub/wwwroot/');
SpawConfig::setStaticConfigItem('SPAW_ROOT', 'c:/inetpub/wwwroot/spaw2/');
SpawConfig::setStaticConfigItem('SPAW_DIR', '/spaw2/');
*/
// DEFAULTS used when no value is set from code
// language
SpawConfig::setStaticConfigItem('default_lang', 'en');
// output charset (empty strings means charset specified in language file)
SpawConfig::setStaticConfigItem('default_output_charset', '');
// theme
SpawConfig::setStaticConfigItem('default_theme', 'spaw2');
// toolbarset
SpawConfig::setStaticConfigItem('default_toolbarset', 'standard');
// stylesheet
SpawConfig::setStaticConfigItem('default_stylesheet', SpawConfig::getStaticConfigValue('SPAW_DIR') . 'wysiwyg.css');
// width
SpawConfig::setStaticConfigItem('default_width', '100%');
// height
SpawConfig::setStaticConfigItem('default_height', '200px');
// specifies if language subsystem should use iconv functions to convert strings to the specified charset
SpawConfig::setStaticConfigItem('USE_ICONV', true);
// specifies rendering mode to use: "xhtml" - renders using spaw's engine, "builtin" - renders using browsers engine
SpawConfig::setStaticConfigItem('rendering_mode', 'xhtml', SPAW_CFG_TRANSFER_JS);
// specifies that xhtml rendering engine should indent it's output
SpawConfig::setStaticConfigItem('beautify_xhtml_output', true, SPAW_CFG_TRANSFER_JS);
// specifies host and protocol part (like http://mydomain.com) that should be added to urls returned from file manager (and probably other places in the future)
SpawConfig::setStaticConfigItem('base_href', '', SPAW_CFG_TRANSFER_JS);
// specifies if spaw should strip domain part from absolute urls (IE makes all links absolute)
SpawConfig::setStaticConfigItem('strip_absolute_urls', true, SPAW_CFG_TRANSFER_JS);
// specifies in which directions resizing is allowed (values: none, horizontal, vertical, both)
Beispiel #7
0
 /**
  * Returns HTML and JavaScript code for the editor
  * @returns string
  */
 function getHtml()
 {
     $res = '';
     $this->setDefaults();
     if (SpawAgent::getAgent() != SPAW_AGENT_UNSUPPORTED) {
         // supported browser
         $head_res = '';
         $js_res = '';
         $html_res = '';
         $ssent =& SpawEditor::scriptSent();
         if (!$ssent) {
             $head_res .= '<script type="text/javascript" src="' . SpawConfig::getStaticConfigValue("SPAW_DIR") . 'js/spaw.js.php" charset="utf-8"></script>';
             $js_res .= 'SpawEngine.setSpawDir("' . SpawConfig::getStaticConfigValue("SPAW_DIR") . '");';
             $ssent = true;
         }
         $objname = $this->name . '_obj';
         $js_res .= 'var ' . $objname . ' = new SpawEditor("' . $this->name . '");';
         $js_res .= 'SpawEngine.registerEditor(' . $objname . ');';
         $js_res .= $objname . '.setTheme(SpawTheme' . $this->theme->name . ');';
         $js_res .= $objname . '.setLang("' . $this->lang->lang . '");';
         $js_res .= $objname . '.setOutputCharset("' . $this->lang->getOutputCharset() . '");';
         $js_res .= $objname . '.stylesheet = "' . $this->stylesheet . '";';
         $js_res .= $objname . '.scid = "' . $this->config->storeSecureConfig() . '";';
         // add javascript or request uri config items
         $reqstr = '';
         foreach ($this->config->config as $cfg) {
             if ($cfg->transfer_type & SPAW_CFG_TRANSFER_JS && is_scalar($cfg->value)) {
                 if (is_numeric($cfg->value)) {
                     $js_res .= $objname . '.setConfigValue("' . $cfg->name . '", ' . $cfg->value . ');';
                 } else {
                     if (is_bool($cfg->value)) {
                         $js_res .= $objname . '.setConfigValue("' . $cfg->name . '", ' . ($cfg->value ? 'true' : 'false') . ');';
                     } else {
                         // string
                         $js_res .= $objname . '.setConfigValue("' . $cfg->name . '", "' . $cfg->value . '");';
                     }
                 }
             }
             if ($cfg->transfer_type & SPAW_CFG_TRANSFER_REQUEST && is_scalar($cfg->value)) {
                 if (is_bool($cfg->value)) {
                     $reqstr .= '&' . $cfg->name . '=' . ($cfg->value ? 'true' : 'false');
                 } else {
                     // string, number
                     $reqstr .= '&' . $cfg->name . '=' . $cfg->value;
                 }
             }
         }
         if ($reqstr != '') {
         }
         $js_res .= $objname . '.setConfigValue("__request_uri", "' . $reqstr . '");';
         $tpl = '';
         // template
         $fedtpl = '';
         // editor template in floating mode
         $other_present = false;
         $tbfrom = $this->getToolbarFrom();
         // parse template
         if (!$this->getFloatingMode()) {
             // standard mode
             $tpl = $this->theme->getTemplate();
         } else {
             // floating mode
             $tpl = '<span id="' . $this->name . '_toolbox" ';
             $tpl .= ' style="z-index: 10000; position: absolute; cursor: move;"';
             $tpl .= ' onMouseDown="' . $objname . '.floatingMouseDown(event);"';
             $tpl .= ' >';
             $tpl .= $this->theme->getTemplateToolbar();
             $tpl .= '</span>';
             $tpl .= $this->theme->getTemplateFloating();
         }
         // if this is the main toolbar instance, add toolbars
         if ($tbfrom->name == $this->name) {
             foreach ($this->toolbars as $key => $tb) {
                 if (strpos($tpl, '{SPAW TB=' . strtoupper($key) . '}')) {
                     // toolbar placeholder found
                     $tpl = preg_replace('/(\\{SPAW TB=' . strtoupper($key) . '\\})(.*)(\\{SPAW TOOLBAR\\})(.*)(\\{\\/SPAW TB\\})/sU', '$2' . $tb->renderToolbar($this->name, $this->theme) . '$4', $tpl);
                 } else {
                     // add to other toolbar placeholder
                     $tpl = preg_replace('/(\\{SPAW TB=_OTHER\\})(.*)(\\{SPAW TOOLBAR\\})(.*)(\\{\\/SPAW TB\\})/sU', '$1$2' . $tb->renderToolbar($this->name, $this->theme) . '{SPAW TOOLBAR}$4$5', $tpl);
                     $other_present = true;
                 }
             }
         } elseif ($this->getFloatingMode() && $this->toolbar_from->name != $this->name) {
             // editor template for floating mode slave
             $tpl = $this->theme->getTemplateFloating();
         }
         // replace all spaw dir references
         $tpl = str_replace("{SPAW DIR}", SpawConfig::getStaticConfigValue("SPAW_DIR"), $tpl);
         if ($this->getFloatingMode()) {
             $js_res .= $objname . '.floating_mode = true;';
         }
         // register this editor as controlled by other editors toolbar
         $js_res .= $tbfrom->name . '_obj.addControlledEditor(' . $objname . ');' . "\n";
         $js_res .= $objname . '.controlled_by = ' . $tbfrom->name . '_obj;' . "\n";
         // remove unused toolbars
         if ($other_present) {
             // remove other toolbar tags leaving inner content intact
             $tpl = preg_replace('/(\\{SPAW TB=_OTHER\\})(.*)(\\{SPAW TOOLBAR\\})(.*)(\\{\\/SPAW TB\\})/sU', '$2$4', $tpl);
         }
         // remove all toolbar tags and inner code
         $tpl = preg_replace('/(\\{SPAW TB=[^\\}]*\\})(.*)(\\{\\/SPAW TB\\})/sU', '', $tpl);
         // pages and tabs
         // setup tab templates
         $tabtpl = '';
         $atabtpl = '';
         if (sizeof($this->pages) > 1) {
             // tab template
             if (preg_match("/(\\{SPAW TABSTRIP\\})(.*)(\\{SPAW TAB\\})(.*)(\\{\\/SPAW TAB\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU", $tpl, $matches)) {
                 $tabtpl = $matches[4];
             }
             // active tab template
             if (preg_match("/(\\{SPAW TABSTRIP\\})(.*)(\\{SPAW TAB ACTIVE\\})(.*)(\\{\\/SPAW TAB\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU", $tpl, $matches)) {
                 $atabtpl = $matches[4];
             }
             // remove tabstrip markers and mark tab place
             $tpl = preg_replace('/(\\{SPAW TABSTRIP\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU', '$2', $tpl);
             $tpl = preg_replace('/(\\{SPAW TAB ACTIVE\\})(.*)(\\{\\/SPAW TAB\\})/sU', '{SPAW TABS}', $tpl);
             $tpl = preg_replace('/(\\{SPAW TAB\\})(.*)(\\{\\/SPAW TAB\\})/sU', '', $tpl);
         } else {
             // tabs not needed, remove tab strip
             $tpl = preg_replace('/(\\{SPAW TABSTRIP\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU', '', $tpl);
         }
         // mode strip
         if (strpos($tpl, '{SPAW MODESTRIP}')) {
             if ($this->isModeStripVisible()) {
                 // modestrip placeholder found
                 $mstrip = SpawToolbar::getToolbar("mode_strip");
                 $mstrip->editor =& $this;
                 $tpl = preg_replace('/(\\{SPAW MODESTRIP\\})(.*)(\\{SPAW MODES\\})(.*)(\\{\\/SPAW MODESTRIP\\})/sU', '$2' . $mstrip->renderToolbar($this->name, $this->theme) . '$4', $tpl);
             } else {
                 // just remove the placeholder
                 $tpl = preg_replace('/(\\{SPAW MODESTRIP\\})(.*)(\\{\\/SPAW MODESTRIP\\})/sU', '', $tpl);
             }
         }
         // statusbar
         if (strpos($tpl, '{SPAW STATUSBAR}')) {
             if ($this->isStatusBarVisible()) {
                 // modestrip placeholder found
                 if ($this->isResizingGripVisible() && $this->config->getConfigValue('resizing_directions') != 'none') {
                     $grip = '<img src="' . SpawConfig::getStaticConfigValue("SPAW_DIR") . 'plugins/core/lib/theme/' . $this->theme->name . '/img/sizing_grip.gif" border="0" style="cursor: se-resize;"';
                     $grip .= ' onmousedown="' . $objname . '.resizingGripMouseDown(event);"';
                     $grip .= ' unselectable="on"';
                     $grip .= ' alt="" />';
                 } else {
                     $grip = '';
                 }
                 $tpl = preg_replace('/(\\{SPAW STATUSBAR\\})(.*)(\\{SPAW STATUS\\})(.*)(\\{SPAW SIZINGGRIP\\})(.*)(\\{\\/SPAW STATUSBAR\\})/sU', '$2<span id="' . $this->name . '_status"></span>$4' . $grip . '$6', $tpl);
             } else {
                 // remove status bar placeholder
                 $tpl = preg_replace('/(\\{SPAW STATUSBAR\\})(.*)(\\{\\/SPAW STATUSBAR\\})/sU', '', $tpl);
             }
         }
         $pagetpl = '';
         $tabstpl = '';
         foreach ($this->pages as $pname => $page) {
             $pagetpl .= '<textarea name="' . $page->inputName . '" id="' . $pname . '" style="width: 100%; height: ' . $this->height . '; display: none; overflow: scroll;" rows="10" cols="10">' . htmlspecialchars($page->value) . '</textarea>';
             $js_res .= 'var ' . $pname . '_page = new SpawEditorPage("' . $pname . '","' . htmlspecialchars($page->caption) . '","' . $page->direction . '");' . "\n";
             //$js_res .= $pname.'_page.value = "'.htmlspecialchars($page->value).'";'."\n";
             $js_res .= $objname . '.addPage(' . $pname . '_page);' . "\n";
             $js_res .= $objname . '.getTab("' . $pname . '").template = "' . addslashes(str_replace("{SPAW TAB CAPTION}", $page->caption, $tabtpl)) . '";' . "\n";
             $js_res .= $objname . '.getTab("' . $pname . '").active_template = "' . addslashes(str_replace("{SPAW TAB CAPTION}", $page->caption, $atabtpl)) . '";' . "\n";
             if ($this->name == $pname) {
                 $js_res .= $objname . '.active_page =' . $pname . '_page;' . "\n";
             }
             $pagetpl .= '<iframe name="' . $pname . '_rEdit" id="' . $pname . '_rEdit" style="width: 100%; height: ' . $this->height . '; display: ' . ($this->name == $pname ? 'inline' : 'none') . ';" frameborder="no" src="' . SpawConfig::getStaticConfigValue("SPAW_DIR") . 'empty/empty.html?' . microtime() . '"></iframe>';
             $tabstpl .= '<span id="' . $pname . '_tab" style="cursor: default;" onclick="' . $objname . '.setActivePage(\'' . $pname . '\');">' . str_replace("{SPAW TAB CAPTION}", $page->caption, $pname == $this->name ? $atabtpl : $tabtpl) . '</span>';
         }
         $tpl = str_replace('{SPAW EDITOR}', $pagetpl, $tpl);
         $tpl = str_replace('{SPAW TABS}', $tabstpl, $tpl);
         $html_res .= '<table border="0" cellpadding="0" cellspacing="0" id="' . $this->name . '_enclosure" class="' . $this->theme->name . '" style="padding: 0px 0px 0px 0px; width: ' . $this->width . ';"><tr><td>' . $tpl . '</td></tr></table>';
         $js_res .= $objname . '.onLoadHookup();' . "\n";
         $res = $head_res . '<script type="text/javascript">' . "\n<!--\n" . $js_res . "\n//-->\n" . '</script>' . $html_res;
     } else {
         // standard textarea fallback
         foreach ($this->pages as $pname => $page) {
             if (sizeof($this->pages) > 1) {
                 $res .= '<label for="' . $pname . '">' . $page->caption . '</label><br />';
             }
             $res .= '<textarea name="' . $pname . '" id="' . $pname . '" width="' . $this->width . '" height="' . $this->height . '" style="width: ' . $this->width . '; height: ' . $this->height . ';" wrap="off">' . htmlspecialchars($page->value) . '</textarea><br />';
         }
     }
     return $res;
 }
Beispiel #8
0
<?php

/**
 * SPAW Editor v.2 Javascript file
 *
 * Outputs javascript code for the editor 
 * @package spaw2
 * @subpackage JavaScript  
 * @author Alan Mendelevich <*****@*****.**> 
 * @copyright UAB Solmetra
 */
header('Content-Type: application/x-javascript; charset=utf-8');
require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/../config/config.php';
require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/../class/util.class.php';
$spaw_root = SpawConfig::getStaticConfigValue("SPAW_ROOT");
$agent = SpawAgent::getAgentName();
// load main javascript for all browsers
if (is_dir($spaw_root . 'js/common')) {
    if ($dh = opendir($spaw_root . 'js/common')) {
        while (($fn = readdir($dh)) !== false) {
            if ($fn != '.' && $fn != '..' && !is_dir($spaw_root . 'js/common/' . $fn)) {
                include $spaw_root . 'js/common/' . $fn;
            }
        }
        closedir($dh);
    }
}
// load main javascript specific for current browser
if (is_dir($spaw_root . 'js/' . $agent)) {
    if ($dh = opendir($spaw_root . 'js/' . $agent)) {
        while (($fn = readdir($dh)) !== false) {
Beispiel #9
0
  if (spawArgs.callback)
  {
    eval('window.opener.'+spawArgs.callback + '(spawEditor, result, spawArgs.tbi, spawArgs.sender)');
  }
}
//-->
</script>
</head>
<body onload="SpawDialog.dialogInit();" dir="<?php 
echo $lang->getDir();
?>
">
<?php 
echo $htpl;
?>

<?php 
include SpawConfig::getStaticConfigValue('SPAW_ROOT') . 'plugins/' . $module . '/dialogs/' . $dialog . '.inc.php';
?>

<?php 
echo $ftpl;
?>

</body>
</html>
<?php 
ob_end_flush();
?>

Beispiel #10
0
 /**
  * Returns message string
  * @param string $message Message id
  * @param string $block Block id
  * @param string $module Module name
  * @returns string
  */
 function getMessage($message, $block = '', $module = '')
 {
     $_module = $module == '' ? $this->module : $module;
     $_block = $block == '' ? $this->block : $block;
     if (empty($this->lang_data[$_module])) {
         // load module data
         $this->loadData($_module);
     }
     $msg = '';
     if (!empty($this->lang_data[$_module][$_block][$message])) {
         $msg = $this->lang_data[$_module][$_block][$message];
     } else {
         if (!empty($this->en_lang_data[$_module][$_block][$message])) {
             $msg = $this->en_lang_data[$_module][$_block][$message];
         }
     }
     if ($msg != '') {
         if (SpawConfig::getStaticConfigValue("USE_ICONV") && isset($this->output_charset) && $this->charset != $this->output_charset) {
             // convert charsets (ignore illegal characters)
             $msg = iconv($this->charset, $this->output_charset . '//IGNORE', $msg);
         }
         // return message
         return $msg;
     } else {
         // return empty string
         return '';
     }
 }
Beispiel #11
0
 /**
  * Renders code for specified toolbar
  * @param string $prefix prefix to use for id's (editor name)
  * @param SpawTheme $theme theme/skin to use   
  * @returns string   
  */
 function renderToolbar($prefix, $theme)
 {
     $js_res = '';
     $html_res = '<span style="white-space: nowrap;">';
     $pgdir = SpawConfig::getStaticConfigValue("SPAW_DIR") . 'plugins/';
     $i = 0;
     if ($this->items) {
         foreach ($this->items as $obj) {
             if (is_object($obj) && $obj->agent & SpawAgent::getAgent()) {
                 $id = $prefix . '_' . $this->name . '_' . $i;
                 switch (strtolower(get_class($obj))) {
                     case "spawtbimage":
                         $js_res .= $prefix . '_obj.addToolbarItem(new SpawTbImage("' . $obj->module . '","' . $obj->name . '","' . $id . '"),"' . $this->name . '");';
                         $html_res .= '<img id="' . $id . '" src="' . $pgdir . $obj->module . '/lib/theme/' . $theme->name . '/img/tb_' . $obj->name . '.gif"';
                         if ($theme->isCustomStyleTbi($obj->name)) {
                             $html_res .= ' style="' . $theme->getCustomTbiStyle($obj->name) . '"';
                         } elseif ($theme->getDefaultTbImageStyle()) {
                             $html_res .= ' style="' . $theme->getDefaultTbImageStyle() . '"';
                         }
                         if ($theme->isCustomCssClassTbi($obj->name)) {
                             $html_res .= ' class="' . $theme->getCustomTbiCssClass($obj->name) . '"';
                         } elseif ($theme->getDefaultTbImageCssClass()) {
                             $html_res .= ' class="' . $theme->getDefaultTbImageCssClass() . '"';
                         }
                         $html_res .= ' alt="" />';
                         break;
                     case "spawtbbutton":
                         $img_src = $obj->module . '/lib/theme/' . $theme->name . '/img/tb_' . $obj->name . '.gif';
                         if (!file_exists(SpawConfig::getStaticConfigValue("SPAW_ROOT") . 'plugins/' . $img_src)) {
                             // use default plugin button
                             $img_src = 'core/lib/theme/' . $theme->name . '/img/tb__plugin.gif';
                         }
                         $js_res .= $prefix . '_obj.addToolbarItem(new SpawTbButton("' . $obj->module . '","' . $obj->name . '","' . $id . '","' . $obj->on_enabled_check . '","' . $obj->on_pushed_check . '","' . $obj->on_click . '","' . $pgdir . $img_src . '",' . ($obj->show_in_context_menu ? "true" : "false") . '),"' . $this->name . '");';
                         $html_res .= '<img id="' . $id . '" src="' . $pgdir . $img_src . '"';
                         if ($theme->isCustomStyleTbi($obj->name)) {
                             $html_res .= ' style="' . $theme->getCustomTbiStyle($obj->name) . ' cursor: default;"';
                         } elseif ($theme->getDefaultTbButtonStyle()) {
                             $html_res .= ' style="' . $theme->getDefaultTbButtonStyle() . ' cursor: default;"';
                         } else {
                             $html_res .= ' style="cursor: default;"';
                         }
                         if ($theme->isCustomCssClassTbi($obj->name)) {
                             $html_res .= ' class="' . $theme->getCustomTbiCssClass($obj->name) . '"';
                         } elseif ($theme->getDefaultTbButtonCssClass()) {
                             $html_res .= ' class="' . $theme->getDefaultTbButtonCssClass() . '"';
                         }
                         $html_res .= ' onclick="SpawPG' . $obj->module . '.' . $obj->on_click . '(' . $prefix . '_obj.getTargetEditor(),' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                         $html_res .= ' onmouseover="' . $prefix . '_obj.theme.buttonOver(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                         $html_res .= ' onmouseout="' . $prefix . '_obj.theme.buttonOut(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                         $html_res .= ' onmousedown="' . $prefix . '_obj.theme.buttonDown(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                         $html_res .= ' onmouseup="' . $prefix . '_obj.theme.buttonUp(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                         $html_res .= ' alt="' . $this->editor->lang->m('title', $obj->name, $obj->module) . '"';
                         $html_res .= ' title="' . $this->editor->lang->m('title', $obj->name, $obj->module) . '"';
                         $html_res .= ' unselectable="on"';
                         $html_res .= ' />';
                         break;
                     case "spawtbdropdown":
                         if (empty($obj->data)) {
                             // try getting data from config
                             $obj->data = $this->editor->config->getConfigValue('dropdown_data_' . $obj->module . '_' . $obj->name);
                         }
                         if (is_array($obj->data)) {
                             $js_res .= $prefix . '_obj.addToolbarItem(new SpawTbDropdown("' . $obj->module . '","' . $obj->name . '","' . $id . '","' . $obj->on_enabled_check . '","' . $obj->on_status_check . '","' . $obj->on_change . '"),"' . $this->name . '");';
                             $html_res .= '<select size="1" id="' . $id . '" ';
                             if ($theme->isCustomStyleTbi($obj->name)) {
                                 $html_res .= ' style="' . $theme->getCustomTbiStyle($obj->name) . '"';
                             } elseif ($theme->getDefaultTbDropdownStyle()) {
                                 $html_res .= ' style="' . $theme->getDefaultTbDropdownStyle() . '"';
                             }
                             if ($theme->isCustomCssClassTbi($obj->name)) {
                                 $html_res .= ' class="' . $theme->getCustomTbiCssClass($obj->name) . '"';
                             } elseif ($theme->getDefaultTbDropdownCssClass()) {
                                 $html_res .= ' class="' . $theme->getDefaultTbDropdownCssClass() . '"';
                             }
                             $html_res .= ' onchange="SpawPG' . $obj->module . '.' . $obj->on_change . '(' . $prefix . '_obj.getTargetEditor(),' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                             $html_res .= ' onmouseover="' . $prefix . '_obj.theme.dropdownOver(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                             $html_res .= ' onmouseout="' . $prefix . '_obj.theme.dropdownOut(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                             $html_res .= ' onmousedown="' . $prefix . '_obj.theme.dropdownDown(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                             $html_res .= ' onmouseup="' . $prefix . '_obj.theme.dropdownUp(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"';
                             $html_res .= '>';
                             $html_res .= '<option>' . $this->editor->lang->m('title', $obj->name, $obj->module) . '</option>';
                             foreach ($obj->data as $key => $value) {
                                 $html_res .= '<option value="' . $key . '">' . $value . '</option>';
                             }
                             $html_res .= '</select>';
                         }
                 }
             }
             $i++;
         }
         $html_res .= '</span>';
         $res = '<script type="text/javascript">' . "\n<!--\n" . $js_res . "\n//-->\n" . '</script>' . $html_res;
         return $res;
     }
 }
Beispiel #12
0
// under IIS you will probably need to setup the above paths manually. it would be something like this
SpawConfig::setStaticConfigItem('DOCUMENT_ROOT', 'c:/inetpub/wwwroot/');
SpawConfig::setStaticConfigItem('SPAW_ROOT', 'c:/inetpub/wwwroot/spaw2/');
SpawConfig::setStaticConfigItem('SPAW_DIR', '/spaw2/');
*/
// DEFAULTS used when no value is set from code
// language
SpawConfig::setStaticConfigItem('default_lang', 'ru');
// output charset (empty strings means charset specified in language file)
SpawConfig::setStaticConfigItem('default_output_charset', 'utf-8');
// theme
SpawConfig::setStaticConfigItem('default_theme', 'spaw2');
// toolbarset
SpawConfig::setStaticConfigItem('default_toolbarset', 'my');
// stylesheet
SpawConfig::setStaticConfigItem('default_stylesheet', SpawConfig::getStaticConfigValue('SPAW_DIR') . 'style.css?st=' . rand());
// width
SpawConfig::setStaticConfigItem('default_width', '100%');
// height
SpawConfig::setStaticConfigItem('default_height', '200px');
// specifies if language subsystem should use iconv functions to convert strings to the specified charset
SpawConfig::setStaticConfigItem('USE_ICONV', true);
// specifies rendering mode to use: "xhtml" - renders using spaw's engine, "builtin" - renders using browsers engine
SpawConfig::setStaticConfigItem('rendering_mode', 'xhtml', SPAW_CFG_TRANSFER_JS);
// specifies that xhtml rendering engine should indent it's output
SpawConfig::setStaticConfigItem('beautify_xhtml_output', true, SPAW_CFG_TRANSFER_JS);
// specifies host and protocol part (like http://mydomain.com) that should be added to urls returned from file manager (and probably other places in the future)
SpawConfig::setStaticConfigItem('base_href', '', SPAW_CFG_TRANSFER_JS);
// specifies if spaw should strip domain part from absolute urls (IE makes all links absolute)
SpawConfig::setStaticConfigItem('strip_absolute_urls', true, SPAW_CFG_TRANSFER_JS);
// specifies in which directions resizing is allowed (values: none, horizontal, vertical, both)