Example #1
0
 /** get textarea as HTML - internal, do not use
  * this method returns a string contains an textarea in HMTL-Code
  *
  * @param array value form element: textarea, see class cs_form
  *
  * @return string textarea as HMTL
  */
 function _getTextAreaAsHTML($form_element)
 {
     $html = '';
     $form_element['value_for_output'] = '';
     $form_element['value_for_output_html'] = '';
     $form_element['value_for_output_html_security'] = '';
     $form_element['value_for_output_html_security_hidden'] = '';
     if (!empty($form_element['value'])) {
         $form_element['value_for_output'] = $this->_text_as_form($form_element['value']);
         $form_element['value_for_output_html'] = $this->_text_as_form_for_html_editor($form_element['value']);
         // value translations
         $value = str_replace('<!-- KFC TEXT -->', '', $form_element['value_for_output_html']);
         // security KFC (hidden)
         $hidden_value = str_replace('"', 'COMMSY_QUOT', $value);
         $hidden_value = str_replace('&', 'COMMSY_AMPERSEND', $hidden_value);
         $form_element['value_for_output_html_security_hidden'] = $hidden_value;
         unset($hidden_value);
         // security KFC
         $values = array();
         preg_match('~<!-- KFC TEXT ([a-z0-9]*) -->~u', $value, $values);
         if (!empty($values[1])) {
             $hash = $values[1];
             $temp_text = str_replace('<!-- KFC TEXT ' . $hash . ' -->', '', $value);
             global $c_enable_htmltextarea_security;
             if (isset($c_enable_htmltextarea_security) and !empty($c_enable_htmltextarea_security) and $c_enable_htmltextarea_security) {
                 include_once 'functions/security_functions.php';
                 if (getSecurityHash($temp_text) != $hash) {
                     $value = $this->_environment->getTextConverter()->text_as_html_long($temp_text);
                     $value = '<!-- KFC TEXT ' . getSecurityHash($value) . ' -->' . $value . '<!-- KFC TEXT ' . getSecurityHash($value) . ' -->';
                 }
             }
         } elseif (!strstr($value, '<!-- KFC TEXT')) {
             include_once 'functions/security_functions.php';
             $value = '<!-- KFC TEXT ' . getSecurityHash($value) . ' -->' . $value . '<!-- KFC TEXT ' . getSecurityHash($value) . ' -->';
         }
         // this is for migration of texts not insert with an HTML editor
         $value = str_replace("\n\n", '<br/><br/>', $value);
         $form_element['value_for_output_html_security'] = $value;
         unset($value);
     }
     $form_element['tabindex'] = $this->_count_form_elements;
     $this->_count_form_elements++;
     if ($form_element['with_html_area']) {
         include_once 'functions/misc_functions.php';
         $html = plugin_hook_output_all('getTextAreaAsHTML', $form_element);
     }
     if (empty($html)) {
         $vsize = '';
         $normal = '<textarea style="width:98%" name="' . $form_element['name'] . '"';
         #      $normal .= ' cols="'.$form_element['vsize'].'"';
         $normal .= ' rows="' . $form_element['hsize'] . '"';
         #      $normal .= ' wrap="'.$form_element['wrap'].'"';
         $normal .= ' tabindex="' . $form_element['tabindex'] . '"';
         if (isset($form_element['is_disabled']) and $form_element['is_disabled']) {
             $normal .= ' disabled="disabled"';
         }
         $normal .= '>';
         $specialTextArea = false;
         global $c_html_textarea;
         if (isset($c_html_textarea) and $c_html_textarea) {
             $specialTextArea = true;
         }
         $normal .= $form_element['value_for_output'];
         $normal .= '</textarea>' . LF;
         $normal .= LF;
         $current_module = $this->_environment->getCurrentModule();
         $current_function = $this->_environment->getCurrentFunction();
         if ($current_module == 'configuration' and $current_function == 'common' or $current_module == 'configuration' and $current_function == 'preferences' or $current_module == 'project' and $current_function == 'edit' or $current_module == 'community' and $current_function == 'edit') {
             if (isset($form_element['vsize']) and !empty($form_element['vsize'])) {
                 $vsize = $form_element['vsize'];
             }
             $html_status = $form_element['with_html_area_status'];
             if (!empty($html_status) and $html_status != '3') {
                 $with_htmltextarea = true;
                 // control over $form_element['with_html_area']
             } else {
                 $with_htmltextarea = false;
                 // control over $form_element['with_html_area']
             }
         } else {
             $current_context = $this->_environment->getCurrentContextItem();
             $with_htmltextarea = $current_context->withHtmlTextArea();
             $html_status = $current_context->getHtmlTextAreaStatus();
         }
         $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
         $current_browser_version = $this->_environment->getCurrentBrowserVersion();
         if (!isset($c_html_textarea) or !$c_html_textarea or !$form_element['with_html_area'] or !$with_htmltextarea) {
             $html .= $normal;
         } elseif ($current_browser != 'msie' and $current_browser != 'firefox' and $current_browser != 'netscape' and $current_browser != 'mozilla' and $current_browser != 'camino' and $current_browser != 'opera' and $current_browser != 'safari') {
             $html .= $normal;
         } else {
             $session = $this->_environment->getSessionItem();
             if ($session->issetValue('javascript')) {
                 $javascript = $session->getValue('javascript');
                 if ($javascript == 1) {
                     include_once 'classes/cs_html_textarea.php';
                     $html_area = new cs_html_textarea();
                     $html .= $html_area->getAsHTML($form_element['name'], $form_element['value_for_output_html'], $form_element['hsize'] + 10, $html_status, $this->_count_form_elements, $vsize);
                     // hidden field for HTML editor corrections
                     // to check if a post field is a textarea
                     $html .= LF . $this->_getHiddenFieldasHTML(array('name' => $form_element['name'] . '_is_textarea', 'value' => '1'));
                 } else {
                     $html .= $normal;
                 }
             } else {
                 $html .= $normal;
             }
         }
     } else {
         $html .= LF . $this->_getHiddenFieldasHTML(array('name' => $form_element['name'] . '_is_textarea', 'value' => '1'));
         if (!empty($form_element['value_for_output_html_security_hidden'])) {
             $html .= LF . $this->_getHiddenFieldasHTML(array('name' => $form_element['name'] . '_fck_hidden', 'value' => $form_element['value_for_output_html_security_hidden']));
         }
     }
     return $html;
 }
Example #2
0
 /** get textarea as HTML - internal, do not use
  * this method returns a string contains an textarea in HMTL-Code
  *
  * @param array value form element: textarea, see class cs_form
  *
  * @return string textarea as HMTL
  *
  * @author CommSy Development Group
  */
 function _getTextAreaAsHTML($form_element)
 {
     global $c_html_textarea;
     $html = '';
     $vsize = '';
     $normal = '<textarea name="' . $form_element['name'] . '"';
     $normal .= ' cols="' . $form_element['vsize'] . '"';
     $normal .= ' rows="' . $form_element['hsize'] . '"';
     #      $normal .= ' wrap="'.$form_element['wrap'].'"';
     $normal .= ' tabindex="' . $this->_count_form_elements . '"';
     $this->_count_form_elements++;
     if (isset($form_element['is_disabled']) and $form_element['is_disabled']) {
         $normal .= ' disabled="disabled"';
     }
     $normal .= '>';
     $specialTextArea = false;
     if (isset($c_html_textarea) and $c_html_textarea) {
         $specialTextArea = true;
     }
     $normal .= $this->_text_as_form($form_element['value'], $specialTextArea);
     $normal .= '</textarea>' . LF;
     $normal .= LF;
     $current_module = $this->_environment->getCurrentModule();
     $current_function = $this->_environment->getCurrentFunction();
     if ($current_module == 'configuration' and $current_function == 'common' or $current_module == 'configuration' and $current_function == 'preferences' or $current_module == 'project' and $current_function == 'edit' or $current_module == 'community' and $current_function == 'edit') {
         if (isset($form_element['vsize']) and !empty($form_element['vsize'])) {
             $vsize = $form_element['vsize'];
         }
         $html_status = $form_element['with_html_area_status'];
         if (!empty($html_status) and $html_status != '3') {
             $with_htmltextarea = true;
             // control over $form_element['with_html_area']
         } else {
             $with_htmltextarea = false;
             // control over $form_element['with_html_area']
         }
     } else {
         $current_context = $this->_environment->getCurrentContextItem();
         $with_htmltextarea = $current_context->withHtmlTextArea();
         $html_status = $current_context->getHtmlTextAreaStatus();
     }
     $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
     $current_browser_version = $this->_environment->getCurrentBrowserVersion();
     if (!isset($c_html_textarea) or !$c_html_textarea or !$form_element['with_html_area'] or !$with_htmltextarea) {
         $html .= $normal;
     } elseif ($current_browser != 'msie' and $current_browser != 'firefox' and $current_browser != 'netscape' and $current_browser != 'mozilla' and $current_browser != 'camino' and $current_browser != 'opera' and $current_browser != 'safari') {
         $html .= $normal;
     } else {
         $session = $this->_environment->getSessionItem();
         if ($session->issetValue('javascript')) {
             $javascript = $session->getValue('javascript');
             if ($javascript == 1) {
                 include_once 'classes/cs_html_textarea.php';
                 $html_area = new cs_html_textarea();
                 $html .= $html_area->getAsHTML($form_element['name'], $this->_text_as_form_for_html_editor($form_element['value'], $specialTextArea), $form_element['hsize'] + 10, $html_status, $this->_count_form_elements, $vsize);
             } else {
                 $html .= $normal;
             }
         } else {
             $html .= $normal;
         }
     }
     return $html;
 }
 private function _getTextAreaAsHTML($name)
 {
     $form_element = array();
     $form_element['name'] = $name;
     $form_element['vsize'] = '94';
     $form_element['hsize'] = '25';
     $form_element['wrap'] = 'virtual';
     $form_element['tabindex'] = 2;
     if (!empty($this->_form_values[$name])) {
         $form_element['value'] = $this->_form_values[$name];
     }
     $html = '';
     $normal = '<textarea name="' . $form_element['name'] . '"';
     $normal .= ' cols="' . $form_element['vsize'] . '"';
     $normal .= ' rows="' . $form_element['hsize'] . '"';
     $normal .= ' wrap="' . $form_element['wrap'] . '"';
     $normal .= ' tabindex="' . $form_element['tabindex'] . '"';
     if (isset($form_element['is_disabled']) and $form_element['is_disabled']) {
         $normal .= ' disabled="disabled"';
     }
     $normal .= '>';
     if (!empty($form_element['value'])) {
         $normal .= $this->_text_as_form($form_element['value']);
     } else {
         $form_element['value'] = '';
     }
     $normal .= '</textarea>' . LF;
     $normal .= LF;
     global $c_html_textarea;
     $current_module = $this->_environment->getCurrentModule();
     $current_function = $this->_environment->getCurrentFunction();
     $current_context = $this->_environment->getCurrentContextItem();
     # always with html_text_area
     # $with_htmltextarea = $current_context->withHtmlTextArea();
     $with_htmltextarea = true;
     $html_status = $current_context->getHtmlTextAreaStatus();
     $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
     if (!isset($c_html_textarea) or !$c_html_textarea or !$with_htmltextarea) {
         $html .= $normal;
     } elseif ($current_browser != 'msie' and $current_browser != 'firefox' and $current_browser != 'netscape' and $current_browser != 'mozilla') {
         $html .= $normal;
     } else {
         $session = $this->_environment->getSessionItem();
         if ($session->issetValue('javascript')) {
             $javascript = $session->getValue('javascript');
             if ($javascript == 1) {
                 include_once 'classes/cs_html_textarea.php';
                 $html_area = new cs_html_textarea();
                 $form_element['vsize'] = 94 * 0.875;
                 $html .= $html_area->getAsHTML($form_element['name'], $this->_text_as_form($form_element['value']), $form_element['hsize'], 'homepage', 2, $form_element['vsize']);
             } else {
                 $html .= $normal;
             }
         } else {
             $html .= $normal;
         }
     }
     return $html;
 }
Example #4
0
 function _getDiscussionFormAsHTML()
 {
     if (!(isset($_GET['mode']) and $_GET['mode'] == 'print')) {
         $html = '<!-- BEGIN OF ANNOTATION FORM VIEW -->' . LF . LF;
         $item = $this->getItem();
         $count = 1;
         $subitems = $item->getAnnotationList();
         if (isset($subitems) and !empty($subitems)) {
             $count = $subitems->getCount();
             $count++;
         }
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         if ($count != 1) {
             $html .= '<div class="sub_item_main" style="border-top: 1px solid #B0B0B0; margin:20px 5px 0px 5px; padding-top:20px; background-color:white;">' . LF;
         } else {
             $html .= '<div class="sub_item_main" style="margin-top:0px; padding:5px; background-color:white;">' . LF;
         }
         $html .= '<div style="width:100%;" >' . LF;
         $html .= '<a name="form"></a>' . LF;
         $params['ref_iid'] = $item->getItemID();
         $params['mode'] = 'annotate';
         $params['iid'] = 'NEW';
         $html .= '<form style="padding:0px; margin:0px;" action="' . curl($this->_environment->getCurrentContextID(), 'annotation', 'edit', $params) . '" method="post" enctype="multipart/form-data" name="f">' . LF;
         $html .= '   <input type="hidden" name="version" value="' . $item->getVersionID() . '"/>' . LF;
         $html .= '   <input type="hidden" name="ref_iid" value="' . $item->getItemID() . '"/>' . LF;
         $html .= '<table style="width:100%; border-collapse:collapse; margin-bottom:0px; padding-bottom:0px;" summary="Layout">' . LF;
         $html .= '<tr>' . LF;
         $html .= '<td style="width:70px; vertical-align:middle;">' . LF;
         $html .= '<h3 class="subitemtitle">' . $this->_translator->getMessage('COMMON_SUBJECT') . ': </h3>';
         $html .= '</td>' . LF;
         $html .= '<td style="width:1%; vertical-align:middle;">' . LF;
         $html .= '<h3 class="subitemtitle">' . $count . '.&nbsp;</h3>';
         $html .= '</td>' . LF;
         $html .= '<td style="padding-top:5px; padding-bottom:5px; vertical-align:top; text-align:left;">' . LF;
         $html .= '<input name="title" style="width:98%; font-size:12pt; font-weight:bold; font-family: \'Trebuchet MS\',\'lucida grande\',tahoma,\'ms sans serif\',verdana,arial,sans-serif;" value="" maxlength="200" tabindex="8" type="text"/>';
         $html .= '</td>' . LF;
         $html .= '</tr>' . LF;
         $html .= '<tr>' . LF;
         $html .= '<td style="width:70px; padding-top:5px; vertical-align:top;">' . LF;
         $html .= $this->_translator->getMessage('COMMON_TEXT') . ': ';
         $html .= '</td>' . LF;
         $html .= '<td colspan="2">' . LF;
         $html .= '<div style=" margin:0px;padding:0px;">' . LF;
         $normal = '<textarea style="font-size:10pt; width:98%;" name="description" rows="10" tabindex="8"></textarea>';
         $text = '';
         global $c_html_textarea;
         $current_context = $this->_environment->getCurrentContextItem();
         $with_htmltextarea = $current_context->withHtmlTextArea();
         $html_status = $current_context->getHtmlTextAreaStatus();
         $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
         $current_browser_version = $this->_environment->getCurrentBrowserVersion();
         if (!isset($c_html_textarea) or !$c_html_textarea or !$with_htmltextarea) {
             $html .= $normal;
             $title = '&nbsp;' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_FULL');
             $html .= '<div style="padding-top:5px;">';
             $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('HELP_COMMON_FORMAT_TITLE') . ':</div>';
             $text .= $this->_translator->getMessage('COMMON_TEXT_FORMATING_FORMAT_TEXT');
             $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
             $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
             $html .= '<img id="toggle' . $current_context->getItemID() . '" src="images/more.gif"/>';
             $html .= $title;
             $html .= '<div id="creator_information' . $current_context->getItemID() . '">' . LF;
             $html .= '<div style="padding:2px;">' . LF;
             $html .= '<div id="form_formatting_box" style="width:98%">' . LF;
             $html .= $text;
             $html .= '</div>' . LF;
             $html .= '</div>' . LF;
             $html .= '</div>' . LF;
             $html .= '</div>' . LF;
         } elseif ($current_browser != 'msie' and $current_browser != 'firefox' and $current_browser != 'netscape' and $current_browser != 'mozilla' and $current_browser != 'camino' and $current_browser != 'opera' and $current_browser != 'safari') {
             $html .= $normal;
             $title = '&nbsp;' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_FULL');
             $html .= '<div style="padding-top:5px;">';
             $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('HELP_COMMON_FORMAT_TITLE') . ':</div>';
             $text .= $this->_translator->getMessage('COMMON_TEXT_FORMATING_FORMAT_TEXT');
             $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
             $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
             $html .= '<img id="toggle' . $current_context->getItemID() . '" src="images/more.gif"/>';
             $html .= $title;
             $html .= '<div id="creator_information' . $current_context->getItemID() . '">' . LF;
             $html .= '<div style="padding:2px;">' . LF;
             $html .= '<div id="form_formatting_box" style="width:98%">' . LF;
             $html .= $text;
             $html .= '</div>' . LF;
             $html .= '</div>' . LF;
             $html .= '</div>' . LF;
             $html .= '</div>' . LF;
         } else {
             $session = $this->_environment->getSessionItem();
             if ($session->issetValue('javascript')) {
                 $javascript = $session->getValue('javascript');
                 if ($javascript == 1) {
                     include_once 'classes/cs_html_textarea.php';
                     $html_area = new cs_html_textarea();
                     $html .= $html_area->getAsHTML('description', '', 20, $html_status, '', '', false);
                     $title = '&nbsp;' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_SHORT');
                     $html .= '<div style="padding-top:0px;">';
                     $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
                     $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
                     $html .= '<img id="toggle' . $current_context->getItemID() . '" src="images/more.gif"/>';
                     $html .= $title;
                     $html .= '<div id="creator_information' . $current_context->getItemID() . '">' . LF;
                     $html .= '<div style="padding:2px;">' . LF;
                     $html .= '<div id="form_formatting_box" style="width:98%">' . LF;
                     $html .= $text;
                     $html .= '</div>' . LF;
                     $html .= '</div>' . LF;
                     $html .= '</div>' . LF;
                     $html .= '</div>' . BRLF;
                 } else {
                     $html .= $normal;
                     $title = '&nbsp;' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_FULL');
                     $html .= '<div style="padding-top:5px;">';
                     $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('HELP_COMMON_FORMAT_TITLE') . ':</div>';
                     $text .= $this->_translator->getMessage('COMMON_TEXT_FORMATING_FORMAT_TEXT');
                     $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
                     $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
                     $html .= '<img id="toggle' . $current_context->getItemID() . '" src="images/more.gif"/>';
                     $html .= $title;
                     $html .= '<div id="creator_information' . $current_context->getItemID() . '">' . LF;
                     $html .= '<div style="padding:2px;">' . LF;
                     $html .= '<div id="form_formatting_box" style="width:98%">' . LF;
                     $html .= $text;
                     $html .= '</div>' . LF;
                     $html .= '</div>' . LF;
                     $html .= '</div>' . LF;
                     $html .= '</div>' . LF;
                 }
             } else {
                 $html .= $normal;
                 $title = '&nbsp;' . $this->_translator->getMessage('COMMON_TEXT_FORMATING_HELP_FULL');
                 $html .= '<div style="padding-top:5px;">';
                 $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('HELP_COMMON_FORMAT_TITLE') . ':</div>';
                 $text .= $this->_translator->getMessage('COMMON_TEXT_FORMATING_FORMAT_TEXT');
                 $text .= '<div class="bold" style="padding-bottom:5px;">' . $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA') . ':</div>';
                 $text .= $this->_translator->getMessage('COMMON_TEXT_INCLUDING_MEDIA_TEXT');
                 $html .= '<img id="toggle' . $current_context->getItemID() . '" src="images/more.gif"/>';
                 $html .= $title;
                 $html .= '<div id="creator_information' . $current_context->getItemID() . '">' . LF;
                 $html .= '<div style="padding:2px;">' . LF;
                 $html .= '<div id="form_formatting_box" style="width:98%">' . LF;
                 $html .= $text;
                 $html .= '</div>' . LF;
                 $html .= '</div>' . LF;
                 $html .= '</div>' . LF;
                 $html .= '</div>' . LF;
             }
         }
         $html .= '</div>';
         $html .= '</td>' . LF;
         $html .= '</tr>' . LF;
         $html .= '<tr>' . LF;
         $html .= '<td>&nbsp;' . LF;
         $html .= '</td>' . LF;
         $html .= '<td colspan="2" style="padding-top:10px; vertical-align:top; white-space:nowrap;">' . LF;
         $html .= '<input name="option" value="' . $this->_translator->getMessage('ANNOTATION_ADD_NEW_BUTTON') . '" tabindex="8" type="submit"/>';
         $current_user = $this->_environment->getCurrentUser();
         if ($current_user->isAutoSaveOn()) {
             $html .= '<span class="formcounter">' . LF;
             global $c_autosave_mode;
             if ($c_autosave_mode == 1) {
                 $currTime = time();
                 global $c_autosave_limit;
                 $sessEnds = $currTime + $c_autosave_limit * 60;
                 $sessEnds = date("H:i", $sessEnds);
                 $html .= '&nbsp;' . $this->_translator->getMessage('COMMON_SAVE_AT_TIME') . ' ' . $sessEnds . LF;
             } elseif ($c_autosave_mode == 2) {
                 $html .= '&nbsp;' . $this->_translator->getMessage('COMMON_SAVE_AT_TIME') . ' <input type="text" size="5" name="timerField" value="..." class="formcounterfield" />' . LF;
             }
             $html .= '</span>' . LF;
         }
         $html .= '</td>' . LF;
         $html .= '</tr>' . LF;
         $html .= '</table>' . BRLF;
         $html .= '</form>';
         $html .= '<script type="text/javascript">initTextFormatingInformation("' . $current_context->getItemID() . '",false)</script>';
         if ($current_user->isAutoSaveOn()) {
             $html .= '   <script type="text/javascript">' . LF;
             $html .= '      <!--' . LF;
             $html .= '         var breakCrit = "' . $this->_translator->getMessage('ANNOTATION_ADD_NEW_BUTTON') . '"' . ';' . LF;
             $html .= '         startclock();' . LF;
             $html .= '      -->' . LF;
             $html .= '   </script>' . LF;
         }
         $html .= '</div>' . LF;
         $html .= '<!-- END OF ANNOTATION FORM VIEW -->' . LF . LF;
         return $html;
     }
 }