modx->getTemplateVar($tvName, '*', $docID); $field_name = isset($tv['id']) ? $tv['id'] : $tv['name']; // Handle default TVs switch ($tvName) { case 'pagetitle' : $tv['type'] = 'text'; $tv['caption'] = $this->getDefaultTvCaption($tvName); $access = TRUE; break; case 'longtitle' : $tv['type'] = 'text'; $tv['caption'] = $this->getDefaultTvCaption($tvName); $access = TRUE; break; case 'description' : $tv['type'] = 'textarea'; $tv['caption'] = $this->getDefaultTvCaption($tvName); $access = TRUE; break; case 'content' : $tv['type'] = getTvType();$tv['caption'] = $this->getDefaultTvCaption($tvName); $access = TRUE; break; case 'menutitle' : $tv['type'] = 'text'; $tv['caption'] = $this->getDefaultTvCaption($tvName); $access = TRUE; break; case 'introtext' : $tv['type'] = 'textarea'; $tv['caption'] = $this->getDefaultTvCaption($tvName); $access = TRUE; break; } // Check TV access if (!$access) { $access = $this->checkTvAccess($tv['id']); } if (!$access) { return 'Error: Access denied.'; } // User can access TV // Show TV form if ($save == 0) { // Check is document locked? Someone else is editing the document... //$_lang['lock_msg'] if ($this->checkLocked()) { $locked = true; } else { $this->setLocked(1); } // Set document locked // Handle RTE if($tv['type'] === 'richtext') { // Invoke OnRichTextEditorInit event $tmp = array('editor'=>$this->modx->config['which_editor'], 'elements'=>array('tv'.$tvName)); $eventOutput = $this->modx->invokeEvent("OnRichTextEditorInit", $tmp); if(is_array($eventOutput)) { $editorHtml = implode("",$eventOutput); } } // Render TV html $tvHtml = $this->modx->renderFormElement($tv['type'], addslashes($field_name), $tv['default_text'], $tv['elements'], $tv['value']); } else { // Save TV $this->setLocked(0); // Remove document locked // Save TV $this->saveTv($tvName); } // Page output: header $theme = $this->modx->config['manager_theme']; $output = <<< EOT