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: public function __construct($rawSettings, $id, array $contentTypes) {
37:
38:
39: parent::__construct($rawSettings, $id, $contentTypes);
40:
41:
42: $this->_type = 'CMS_HTML';
43: $this->_prefix = 'html';
44:
45: }
46:
47: 48: 49: 50: 51: 52: 53:
54: public function generateViewCode() {
55: return $this->_encodeForOutput($this->_rawSettings);
56: }
57:
58: 59: 60: 61: 62: 63:
64: public function generateEditCode() {
65: $wysiwygDiv = new cHTMLDiv();
66:
67:
68:
69: $id = str_replace('CMS_', '', $this->_type) . '_';
70: $db = cRegistry::getDb();
71: $sql = 'SELECT `idtype` FROM `' . $this->_cfg['tab']['type'] . '` WHERE `type`=\'' . $this->_type . '\'';
72: $db->query($sql);
73: $db->nextRecord();
74: $id .= $db->f('idtype') . '_' . $this->_id;
75: $wysiwygDiv->setId($id);
76: $wysiwygDiv->setClass(htmlentities($this->_type));
77:
78: $wysiwygDiv->setEvent('Focus', "this.style.border='1px solid #bb5577';");
79: $wysiwygDiv->setEvent('Blur', "this.style.border='1px dashed #bfbfbf';");
80: $wysiwygDiv->appendStyleDefinitions(array(
81: 'border' => '1px dashed #bfbfbf',
82: 'direction' => langGetTextDirection($this->_lang),
83: 'min-height' => '20px'
84: ));
85: $wysiwygDiv->updateAttribute('contentEditable', 'true');
86: if (strlen($this->_rawSettings) == 0) {
87: $wysiwygDiv->setContent(' ');
88: } else {
89: $wysiwygDiv->setContent($this->_rawSettings);
90: }
91:
92:
93:
94: $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);
95: $editAnchor = new cHTMLLink('#');
96: $editAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "','" . $editLink . "'); return false;");
97: $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithtml.gif');
98: $editButton->appendStyleDefinition('margin-right', '2px');
99: $editButton->setClass('content_type_zindex');
100: $editAnchor->setContent($editButton);
101:
102:
103: $saveAnchor = new cHTMLLink('#');
104: $saveAnchor->setAttribute('onclick', "javascript:Con.Tiny.setContent('" . $this->_idArtLang . "', '0'); return false;");
105: $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_ok.gif');
106: $saveAnchor->setContent($saveButton);
107:
108: return $this->_encodeForOutput($wysiwygDiv->render() . $editAnchor->render() . $saveAnchor->render());
109: }
110:
111: 112: 113: 114: 115:
116: public function isWysiwygCompatible() {
117: return true;
118: }
119:
120: }
121: