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