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: class cContentTypeText extends cContentTypeAbstract {
25:
26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
36: public function __construct($rawSettings, $id, array $contentTypes) {
37: $rawSettings = conHtmlSpecialChars($rawSettings);
38:
39:
40: parent::__construct($rawSettings, $id, $contentTypes);
41: $this->_type = 'CMS_TEXT';
42: $this->_prefix = 'text';
43:
44:
45:
46:
47: if (isset($_POST[$this->_prefix . '_action']) && $_POST[$this->_prefix . '_action'] === 'store' && isset($_POST[$this->_prefix . '_id']) && (int) $_POST[$this->_prefix . '_id'] == $this->_id) {
48: $this->_settings = $_POST[$this->_prefix . '_text_' . $this->_id];
49: $this->_rawSettings = $this->_settings;
50: $this->_storeSettings();
51:
52:
53: $this->_settings = stripslashes($this->_settings);
54: $this->_settings = conHtmlSpecialChars($this->_settings);
55: $this->_rawSettings = stripslashes($this->_rawSettings);
56: $this->_rawSettings = conHtmlSpecialChars($this->_rawSettings);
57: }
58: }
59:
60: 61: 62: 63: 64: 65:
66: public function generateEditCode() {
67: $script = $this->_getEditJavaScript();
68:
69: $div = new cHTMLDiv($this->_rawSettings);
70: $div->setID($this->_prefix . '_text_' . $this->_id);
71: $div->appendStyleDefinition('display', 'inline');
72:
73: $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithead.gif');
74: $editButton->setID($this->_prefix . '_editbutton_' . $this->_id);
75: $editButton->appendStyleDefinitions(array(
76: 'margin-left' => '5px',
77: 'cursor' => 'pointer'
78: ));
79:
80: return $this->_encodeForOutput($script . $div->render() . $editButton->render());
81: }
82:
83: 84: 85: 86: 87:
88: protected function _getEditJavaScript() {
89: $textbox = new cHTMLTextarea($this->_prefix . '_text_' . $this->_id, '', '', '', $this->_prefix . '_text_' . $this->_id, false, NULL, '', 'edit-textfield edit-' . $this->_prefix . '-textfield');
90: $textbox->setClass("$this->_id");
91:
92: $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . 'images/but_ok.gif');
93: $saveButton->setID($this->_prefix . '_savebutton_' . $this->_id);
94: $saveButton->appendStyleDefinitions(array(
95: 'margin-left' => '5px',
96: 'cursor' => 'pointer'
97: ));
98:
99: $template = new cTemplate();
100: $template->set('s', 'PREFIX', $this->_prefix);
101: $template->set('s', 'ID', $this->_id);
102: $template->set('s', 'TEXTBOX', $textbox->render());
103: $template->set('s', 'SAVEBUTTON', $saveButton->render());
104: $template->set('s', 'IDARTLANG', $this->_idArtLang);
105:
106: return $template->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_text_js.html', true);
107: }
108:
109: 110: 111: 112: 113: 114: 115:
116: public function generateViewCode() {
117: return $this->_encodeForOutput($this->_rawSettings);
118: }
119:
120: }