* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBXinha_Dialog'); /** * Xinha Dialog Module * * * * @version 0.1.1 * @package WB * @subpackage base */ class WBXinha_Dialog_A extends WBXinha_Dialog { /** * tells whether 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) { $values = array( 'text' => $this->select, 'url' => urldecode($this->getAttribute('href')), 'title' => $this->value ); } // add server for internal links if (!empty($values['url']) && $values['url'][0] == '/') { $values['url'] = 'http://[[SERVER]]'. $values['url']; } $this->tmpl->addGlobalVars($values); $this->processForm('a', $values); return $this->valid; } /** * Form "A" validated * * mangle "internal" URLs as suche 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 onAValid($forn, $values) { // add server for internal URLs if ($values['url'][0] == '/') { $values['url'] = 'http://[[SERVER]]' . $values['url']; } $this->loadTemplates('insert'); $this->tmpl->addGlobalVars($values); $this->insert = $this->tmpl->getParsedTemplate('snippet'); $this->valid = true; return false; } } ?>