示例#1
0
 /**
  * Return the needed form field tag for current object field
  *
  * @param array $values : parameters values array(parameterName => parameterValue) in :
  *     id : the form field id to set
  * @param multidimentionnal array $tags : xml2Array content of atm-function tag
  * @return string : the form field HTML tag
  * @access public
  */
 function getInput($fieldID, $language, $inputParams)
 {
     //hidden field : use parent method
     if (isset($inputParams['hidden']) && ($inputParams['hidden'] == 'true' || $inputParams['hidden'] == 1)) {
         return parent::getInput($fieldID, $language, $inputParams);
     }
     global $cms_user;
     $params = $this->getParamsValues();
     if (isset($inputParams['prefix'])) {
         $prefixName = $inputParams['prefix'];
     } else {
         $prefixName = '';
     }
     //serialize all htmlparameters
     //$htmlParameters = $this->serializeHTMLParameters($inputParams);
     $html = '';
     //create fieldname
     $fieldName = $prefixName . $this->_field->getID() . '_0';
     //create field value
     $value = $this->_subfieldValues[0]->getValue();
     if ($params['html']) {
         // Insert prefered text editor for textarea field
         $module = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
         $toolbarset = !$params['toolbar'] ? $module : $params['toolbar'];
         if (class_exists('CMS_wysiwyg_toolbar')) {
             $toolbar = CMS_wysiwyg_toolbar::getByCode($toolbarset, $cms_user);
             $value = $toolbar->hasModulePlugins() ? CMS_textEditor::parseInnerContent($value, $module) : $value;
         }
         $CKEditor = new CKEditor(PATH_MAIN_WR . '/ckeditor/');
         $CKEditor->returnOutput = true;
         $html .= $CKEditor->editor($fieldName, $value, array('language' => $language->getCode(), 'width' => $params['toolbarWidth'] ? $params['toolbarWidth'] : '100%', 'height' => sensitiveIO::isPositiveInteger($params['toolbarHeight']) ? $params['toolbarHeight'] : 200, 'customConfig' => PATH_MAIN_WR . '/ckeditor/config.php?toolbar=' . $toolbarset));
     } else {
         //serialize all htmlparameters
         $htmlParameters = $this->serializeHTMLParameters($inputParams);
         //append field id to html field parameters (if not already exists)
         $htmlParameters .= !isset($inputParams['id']) ? ' id="' . $prefixName . $this->_field->getID() . '_0"' : '';
         $width = '100%';
         if ($params['toolbarWidth']) {
             $width = io::substr($params['toolbarWidth'], -1, 1) == '%' ? $params['toolbarWidth'] : $params['toolbarWidth'] . 'px';
         }
         $html .= '<textarea type="text" name="' . $fieldName . '"' . $htmlParameters . ' style="width:' . $width . ';height:' . (sensitiveIO::isPositiveInteger($params['toolbarHeight']) ? $params['toolbarHeight'] : 200) . 'px">' . str_replace('<br />', "\n", str_replace(array("\n", "\r"), "", $value)) . '</textarea>' . "\n";
     }
     if (POLYMOD_DEBUG) {
         $html .= ' <span class="admin_text_alert">(Field : ' . $this->_field->getID() . ' - SubField : 0)</span>';
     }
     //append html hidden field which store field name
     if ($html) {
         $html .= '<input type="hidden" name="polymodFields[' . $this->_field->getID() . ']" value="' . $this->_field->getID() . '" />';
     }
     return $html;
 }
示例#2
0
 /**
  * This function is only used for old Automne modules compatibility
  * @author Sébastien Pauchet <*****@*****.**>
  */
 function parsePluginsTags($value, $module = MOD_STANDARD_CODENAME)
 {
     return CMS_textEditor::parseInnerContent($value, $module);
 }
示例#3
0
 /**
  * Get the HTML form given the block HTML example data.
  *
  * @param CMS_language &$language The language of the administration frontend
  * @param CMS_page &$page The page which contains the client space
  * @param CMS_clientSpace &$clientSpace The client space which contains the row
  * @param CMS_row &$row The row which contains the block
  * @param integer $blockID The tag ID of the block
  * @param string $data The data to show as example
  * @return string The HTML form which can send to the page that will modify the block
  * @access private
  */
 protected function _getHTMLForm($language, &$page, &$clientSpace, &$row, $blockID, $data)
 {
     global $cms_user;
     $rawDatas = $this->getRawData($page->getID(), $clientSpace->getTagID(), $row->getTagID(), RESOURCE_LOCATION_EDITION, false);
     $this->_jsBlockClass = 'Automne.blockText';
     $this->_value = CMS_textEditor::parseInnerContent($rawDatas['value']);
     $this->_value = base64_encode($this->_value);
     //set editor options
     $this->_options = array('styles' => isset($this->_attributes['styles']) ? $this->_attributes['styles'] : '', 'bgcolor' => isset($this->_attributes['bgcolor']) ? $this->_attributes['bgcolor'] : '', 'language' => $language->getCode(), 'atmToolbar' => isset($this->_attributes['toolbar']) ? $this->_attributes['toolbar'] : '', 'utf8' => strtolower(APPLICATION_DEFAULT_ENCODING) == 'utf-8');
     $this->_administrable = false;
     $html = parent::_getHTMLForm($language, $page, $clientSpace, $row, $blockID, $data);
     //encode brackets to avoid vars ( {something:type:var} ) to be interpretted
     //decoded into CMS_row::getData
     $html = preg_replace('#{([a-zA-Z0-9._{}:-]*)}#U', '||bo||\\1||bc||', $html);
     $replace = array('||bovd||' => '&#123;', '||bcvd||' => '&#125;');
     $html = str_replace(array_keys($replace), $replace, $html);
     return $html;
 }