1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: 18: 19: 20: 21: 22: 23:
24: class cContentTypeHtml extends cContentTypeAbstract {
25:
26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37:
38: public function __construct($rawSettings, $id, array $contentTypes) {
39:
40:
41: parent::__construct($rawSettings, $id, $contentTypes);
42:
43:
44: $this->_type = 'CMS_HTML';
45: $this->_prefix = 'html';
46:
47: }
48:
49: 50: 51: 52: 53: 54: 55:
56: public function generateViewCode() {
57: return $this->_encodeForOutput($this->_rawSettings);
58: }
59:
60: 61: 62: 63: 64: 65: 66:
67: public function generateEditCode() {
68: $wysiwygDiv = new cHTMLDiv();
69:
70:
71:
72: $id = str_replace('CMS_', '', $this->_type) . '_';
73: $db = cRegistry::getDb();
74: $sql = 'SELECT `idtype` FROM `' . $this->_cfg['tab']['type'] . '` WHERE `type`=\'' . $this->_type . '\'';
75: $db->query($sql);
76: $db->nextRecord();
77: $id .= $db->f('idtype') . '_' . $this->_id;
78: $wysiwygDiv->setID($id);
79: $wysiwygDiv->setClass(htmlentities($this->_type));
80:
81: $wysiwygDiv->setEvent('Focus', "this.style.border='1px solid #bb5577';");
82: $wysiwygDiv->setEvent('Blur', "this.style.border='1px dashed #bfbfbf';");
83: $wysiwygDiv->appendStyleDefinitions(array(
84: 'border' => '1px dashed #bfbfbf',
85: 'direction' => langGetTextDirection($this->_lang),
86: 'min-height' => '20px'
87: ));
88: $wysiwygDiv->updateAttribute('contentEditable', 'true');
89: if (cString::getStringLength($this->_rawSettings) == 0) {
90: $wysiwygDiv->setContent(' ');
91: } else {
92: $wysiwygDiv->setContent($this->_rawSettings);
93: }
94:
95:
96:
97: $editLink = $this->_session->url($this->_cfg['path']['contenido_fullhtml'] . 'external/backendedit/' . 'front_content.php?action=10&idcat=' . $this->_idCat . '&idart=' . $this->_idArt . '&idartlang=' . $this->_idArtLang . '&type=' . $this->_type . '&typenr=' . $this->_id. '&client=' . $this->_client);
98: $editAnchor = new cHTMLLink('#');
99: $editAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "','" . $editLink . "'); return false;");
100: $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithtml.gif');
101: $editButton->appendStyleDefinition('margin-right', '2px');
102: $editButton->setClass('content_type_zindex');
103: $editAnchor->setContent($editButton);
104:
105:
106: $saveAnchor = new cHTMLLink('#');
107: $saveAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "', '0'); return false;");
108: $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_ok.gif');
109: $saveAnchor->setContent($saveButton);
110:
111: return $this->_encodeForOutput($wysiwygDiv->render() . $editAnchor->render() . $saveAnchor->render());
112: }
113:
114: 115: 116: 117: 118:
119: public function isWysiwygCompatible() {
120: return true;
121: }
122:
123: }
124: