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: public function generateEditCode() {
67: $wysiwygDiv = new cHTMLDiv();
68:
69:
70:
71: $id = str_replace('CMS_', '', $this->_type) . '_';
72: $db = cRegistry::getDb();
73: $sql = 'SELECT `idtype` FROM `' . $this->_cfg['tab']['type'] . '` WHERE `type`=\'' . $this->_type . '\'';
74: $db->query($sql);
75: $db->nextRecord();
76: $id .= $db->f('idtype') . '_' . $this->_id;
77: $wysiwygDiv->setID($id);
78: $wysiwygDiv->setClass(htmlentities($this->_type));
79:
80: $wysiwygDiv->setEvent('Focus', "this.style.border='1px solid #bb5577';");
81: $wysiwygDiv->setEvent('Blur', "this.style.border='1px dashed #bfbfbf';");
82: $wysiwygDiv->appendStyleDefinitions(array(
83: 'border' => '1px dashed #bfbfbf',
84: 'direction' => langGetTextDirection($this->_lang),
85: 'min-height' => '20px'
86: ));
87: $wysiwygDiv->updateAttribute('contentEditable', 'true');
88: if (strlen($this->_rawSettings) == 0) {
89: $wysiwygDiv->setContent(' ');
90: } else {
91: $wysiwygDiv->setContent($this->_rawSettings);
92: }
93:
94:
95:
96: $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);
97: $editAnchor = new cHTMLLink('#');
98: $editAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "','" . $editLink . "'); return false;");
99: $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithtml.gif');
100: $editButton->appendStyleDefinition('margin-right', '2px');
101: $editButton->setClass('content_type_zindex');
102: $editAnchor->setContent($editButton);
103:
104:
105: $saveAnchor = new cHTMLLink('#');
106: $saveAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "', '0'); return false;");
107: $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_ok.gif');
108: $saveAnchor->setContent($saveButton);
109:
110: return $this->_encodeForOutput($wysiwygDiv->render() . $editAnchor->render() . $saveAnchor->render());
111: }
112:
113: 114: 115: 116: 117:
118: public function isWysiwygCompatible() {
119: return true;
120: }
121:
122: }
123: