* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBXinha_Dialog'); /** * Xinha Dialog Module * * TOC - Table of content * * @version 0.1.0 * @package WB * @subpackage base */ class WBXinha_Dialog_Toc extends WBXinha_Dialog { /** * tells whWBXinha_Dialog_Tocether form processing was successufl * @var bool */ protected $valid = false; /** * Run dialog * * @param bool $submit * @return bool whehther dialog was successful and may be closed */ public function run($submit = true) { $values = array(); if (!$submit) { $template = $this->getAttribute('template'); $tags = trim($this->getAttribute('tags')); if (empty($tags)) { $tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); } else { $tags = explode(',', $tags); } if (!empty($template)) { $values = array( 'class' => $this->value, 'template' => $template, 'stopat' => $this->getAttribute('stopat'), 'tags' => $tags ); } $values['title'] = strip_tags($this->select); $values['tags'] = $tags; } $this->tmpl->addGlobalVars($values); $this->processForm('toc', $values); return $this->valid; } /** * Form "Toc" validated * * mangle "internal" URLs as such and generate HTML snippet to * past into editor * * @param patForms $forn * @param array $values * @return bool always false - don't display valid-template */ protected function onTocValid($forn, $values) { $this->loadTemplates('insert'); if (!isset($values['class']) || empty($values['class'])) { $values['class'] = ''; } if (isset($values['tags']) && is_array($values['tags'])) { $values['tags'] = implode(',', $values['tags']); } $this->tmpl->addGlobalVars($values); $this->insert = $this->tmpl->getParsedTemplate('snippet'); $this->valid = true; return false; } } ?>