/**
 * A method to create a text area control
 *
 * @internal
 * @access private
 * @param boolean Wether the currently selected wysiwyg area should be enabled (depends on user, and site preferences
 * @param string  The contents of the text area
 * @param string  The name of the text area
 * @param string  An optional class name
 * @param string  An optional ID (HTML ID) value
 * @param string  The optional encoding
 * @param string  Optional style information
 * @param integer Width (the number of columns) (CSS can and will override this)
 * @param integer Hieght (the number of rows) (CSS can and will override this)
 * @param string  A flag to indicate that the wysiwyg should be forced to a different type independant of user settings
 * @param string  The name of the syntax hilighter to use (if empty it is assumed that a wysiwyg text area is requested instead of a syntax hiliter)
 * @param string  Optional additional text to include in the textarea tag
 * @return string
 */
function create_textarea($enablewysiwyg, $text, $name, $classname = '', $id = '', $encoding = '', $stylesheet = '', $width = '80', $height = '15', $forcewysiwyg = '', $wantedsyntax = '', $addtext = '')
{
    $gCms = cmsms();
    $result = '';
    $uid = get_userid(false);
    if ($enablewysiwyg == true) {
        $module = cms_utils::get_wysiwyg_module($forcewysiwyg);
        if ($module) {
            $result = $module->WYSIWYGTextArea($name, $width, $height, $encoding, $text, $stylesheet, $addtext);
        }
    }
    if (!$result && $wantedsyntax) {
        $module = cms_utils::get_syntax_highlighter_module();
        if ($module) {
            $result = $module->SyntaxTextArea($name, $wantedsyntax, $width, $height, $encoding, $text, $addtext);
        }
    }
    if ($result == '') {
        $result = '<textarea name="' . $name . '" cols="' . $width . '" rows="' . $height . '"';
        if ($classname != '') {
            $result .= ' class="' . $classname . '"';
        } else {
            $result .= ' class="cms_textarea"';
        }
        if ($id != '') {
            $result .= ' id="' . $id . '"';
        }
        if (!empty($addtext)) {
            $result .= ' ' . $addtext;
        }
        $result .= '>' . cms_htmlentities($text, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
    }
    return $result;
}
Exemple #2
0
                print ']]></Details>';
            } else {
                print '<Response>Success</Response>';
                print '<Details><![CDATA[' . lang('contentupdated') . ']]></Details>';
            }
            print '</EditContent>';
            exit;
        }
    }
}
if (strlen($contentobj->Name()) > 0) {
    $CMS_ADMIN_SUBTITLE = $contentobj->Name();
}
// Detect if a WYSIWYG is in use, and grab its form submit action
$addlScriptSubmit = '';
$modobj = cms_utils::get_wysiwyg_module();
if ($modobj) {
    $addlScriptSubmit .= $modobj->WYSIWYGPageFormSubmit();
}
$closestr = cms_html_entity_decode(lang('close'));
$cancelstr = cms_html_entity_decode(lang('confirmcancel'));
$headtext .= <<<EOSCRIPT
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(function(){
  jQuery('[name=cancel]').click(function(){
    var tmp = jQuery(this).val();
    if( tmp == '{$closestr}' )
      {
\treturn true;
      }
Exemple #3
0
/**
 * A method to create a text area control
 *
 * @internal
 * @access private
 * @param boolean Wether or not we are enabling a wysiwyg.  If false, and forcewysiwyg is not empty then a syntax area is used.
 * @param string  The contents of the text area
 * @param string  The name of the text area
 * @param string  An optional class name
 * @param string  An optional ID (HTML ID) value
 * @param string  The optional encoding
 * @param string  Optional style information
 * @param integer Width (the number of columns) (CSS can and will override this)
 * @param integer Hieght (the number of rows) (CSS can and will override this)
 * @param string  Optional name of the syntax hilighter or wysiwyg to use.  If empty, preferences indicate which a syntax editor or wysiwyg should be used.
 * @param string  Optional name of the language used.  If non empty it indicates that a syntax highlihter will be used.
 * @param string  Optional additional text to include in the textarea tag
 * @return string
 */
function create_textarea($enablewysiwyg, $text, $name, $classname = '', $id = '', $encoding = '', $stylesheet = '', $width = '80', $height = '15', $forcewysiwyg = '', $wantedsyntax = '', $addtext = '')
{
    // todo: rewrite me with var args... to accept a numeric array of arguments, or a hash.
    $gCms = cmsms();
    $result = '';
    $uid = get_userid(false);
    if ($enablewysiwyg == true || $forcewysiwyg) {
        $module = cms_utils::get_wysiwyg_module($forcewysiwyg);
        if ($module) {
            $result = $module->WYSIWYGTextArea($name, $width, $height, $encoding, $text, $stylesheet, $addtext);
        }
    }
    if (!$result && $wantedsyntax) {
        // here we should get a list of installed/available modules.
        $module = cmsms()->GetModuleOperations()->GetSyntaxHighlighter($forcewysiwyg);
        if ($module) {
            $result = $module->SyntaxTextArea($name, $wantedsyntax, $width, $height, $encoding, $text, $addtext);
        }
    }
    if ($result == '') {
        $result = '<textarea name="' . $name . '" cols="' . $width . '" rows="' . $height . '"';
        if ($classname != '') {
            $result .= ' class="' . $classname . '"';
        } else {
            $result .= ' class="cms_textarea"';
        }
        if ($id != '') {
            $result .= ' id="' . $id . '"';
        }
        if (!empty($addtext)) {
            $result .= ' ' . $addtext;
        }
        $result .= '>' . cms_htmlentities($text, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
    }
    return $result;
}