[Wact-cvs] wact/framework/template/tags/data clip.filter.php,1.7,1.8 data_dump.tag.php,1.7,1.8 data_
Status: Pre-Alpha
Brought to you by:
jeffmoore
From: Pavel C. <pac...@us...> - 2005-10-31 15:05:59
|
Update of /cvsroot/wact/wact/framework/template/tags/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5053/framework/template/tags/data Modified Files: clip.filter.php data_dump.tag.php data_table.tag.php math.filter.php stats.filter.php Log Message: -- ClassAnnotationParser => WactClassAnnotationParser -- WactClassAnnotationParser::process() method signature changed to process($listener, $php), constructor doesn't accept these arguments anymore -- Compiler artifacts registration reimplementation using class annotations parser. Index: clip.filter.php =================================================================== RCS file: /cvsroot/wact/wact/framework/template/tags/data/clip.filter.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** clip.filter.php 30 Oct 2005 00:52:15 -0000 1.7 --- clip.filter.php 31 Oct 2005 15:05:46 -0000 1.8 *************** *** 10,16 **** */ - FilterDictionary::registerFilter( - new FilterInfo('clip', 'ClipFilter', 1, 4), __FILE__); - /** * substr wraper --- 10,13 ---- *************** *** 22,25 **** --- 19,25 ---- * - terminator - string - optional - what to append to the end, i.e. "..." * - word boundary - char - anything but first letter "n" treated as yes, trim at a word boundary + * @filter clip + * @min_attributes 1 + * @max_attributes 4 * @package WACT_FILTER * @author Jason E. Sweat < jsweat_php AT yahoo DOT com > Index: math.filter.php =================================================================== RCS file: /cvsroot/wact/wact/framework/template/tags/data/math.filter.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** math.filter.php 30 Oct 2005 00:52:15 -0000 1.8 --- math.filter.php 31 Oct 2005 15:05:46 -0000 1.9 *************** *** 5,8 **** --- 5,11 ---- //-------------------------------------------------------------------------------- /** + * @filter math + * @min_attributes 1 + * @max_attributes 9999 * @package WACT_FILTER * @author Jason E. Sweat < jsweat_php AT yahoo DOT com > *************** *** 10,62 **** */ - FilterDictionary::registerFilter( - new FilterInfo('math', 'MathFilter', 1, 9999), __FILE__); - class MathFilter extends CompilerFilter { ! /** ! * Return this value as a PHP value ! * @return String ! * @access public ! */ ! function getValue() { ! if ($this->isConstant()) { ! $value = $this->base->getValue(); ! $exp = ''; ! foreach (array_keys($this->parameters) as $i) { ! $exp .= $this->parameters[$i]->getValue(); ! } ! $code->writeHTML(math_filter($value, $exp)); ! } else { WactRaiseError('compiler', 'UNRESOLVED_BINDING'); ! } } ! /** ! * Generate the code to read the data value at run time ! * Must generate only a valid PHP Expression. ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function generateExpression(&$code) { ! $code->registerInclude(WACT_ROOT . '/template/components/data/math_filter.inc.php'); ! $code->writePHP('math_filter('); ! $this->base->generateExpression($code); ! $code->writePHP(','); ! $first = true; ! foreach (array_keys($this->parameters) as $i) { ! if (!$first) { ! $code->writePHP('.'); ! } else { ! $first = false; ! } ! $this->parameters[$i]->generateExpression($code); ! } ! $code->writePHP(','); ! $code->writePHPLiteral( (is_object($this->SourceLocation)) ? $this->SourceLocation->file : 'file'); ! $code->writePHP(','); ! $code->writePHPLiteral( (is_object($this->SourceLocation)) ? $this->SourceLocation->line : 'line'); ! $code->writePHP(')'); } --- 13,62 ---- */ class MathFilter extends CompilerFilter { ! /** ! * Return this value as a PHP value ! * @return String ! * @access public ! */ ! function getValue() { ! if ($this->isConstant()) { ! $value = $this->base->getValue(); ! $exp = ''; ! foreach (array_keys($this->parameters) as $i) { ! $exp .= $this->parameters[$i]->getValue(); ! } ! $code->writeHTML(math_filter($value, $exp)); ! } else { WactRaiseError('compiler', 'UNRESOLVED_BINDING'); ! } } ! /** ! * Generate the code to read the data value at run time ! * Must generate only a valid PHP Expression. ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function generateExpression(&$code) { ! $code->registerInclude(WACT_ROOT . '/template/components/data/math_filter.inc.php'); ! $code->writePHP('math_filter('); ! $this->base->generateExpression($code); ! $code->writePHP(','); ! $first = true; ! foreach (array_keys($this->parameters) as $i) { ! if (!$first) { ! $code->writePHP('.'); ! } else { ! $first = false; ! } ! $this->parameters[$i]->generateExpression($code); ! } ! $code->writePHP(','); ! $code->writePHPLiteral( (is_object($this->SourceLocation)) ? $this->SourceLocation->file : 'file'); ! $code->writePHP(','); ! $code->writePHPLiteral( (is_object($this->SourceLocation)) ? $this->SourceLocation->line : 'line'); ! $code->writePHP(')'); } Index: data_dump.tag.php =================================================================== RCS file: /cvsroot/wact/wact/framework/template/tags/data/data_dump.tag.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** data_dump.tag.php 24 Oct 2005 09:09:26 -0000 1.7 --- data_dump.tag.php 31 Oct 2005 15:05:46 -0000 1.8 *************** *** 10,19 **** /** - * Register tag - */ - TagDictionary::registerTag(new TagInfo('data:DUMP', 'DataDumpTag'), __FILE__); - - /** * The compile time component to dump a result set * @author Jason E. Sweat * @see http://wact.sourceforge.net/index.php/ResultsetDumpTag --- 10,15 ---- /** * The compile time component to dump a result set + * @tag data:DUMP * @author Jason E. Sweat * @see http://wact.sourceforge.net/index.php/ResultsetDumpTag *************** *** 22,73 **** */ class DataDumpTag extends ServerComponentTag { ! /** ! * File to include at runtime ! * @var string path to runtime component relative to WACT_ROOT ! * @access private ! */ ! var $runtimeIncludeFile = '%WACT_ROOT%/template/components/list/list.inc.php'; ! //var $runtimeIncludeFile = '%WACT_ROOT%/template/components/resultset_dump.inc.php'; ! /** ! * Name of runtime component class ! * @var string ! * @access private ! */ ! var $runtimeComponentName = 'ListComponent'; ! //var $runtimeComponentName = 'ResultsetDumpComponent'; ! /** ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function preGenerate(&$code) { ! parent::preGenerate($code); ! $code->writePHP($this->getComponentRefCode() . '->prepare();'); ! } ! /** ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function generateContents(&$code) { ! $code->writeHTML('<pre style="text-align:left">'); ! $code->writePHP('echo get_class('.$this->getComponentRefCode().'->DataSet), "\n";'); ! $code->writePHP('if (is_a('.$this->getComponentRefCode().'->DataSet, "arraydataset")) {'); ! $code->writePHP('var_dump('.$this->getComponentRefCode().'->DataSet->exportDataSetAsArray());'); ! $code->writePHP('} elseif (is_a('.$this->getComponentRefCode().'->DataSet, "AdodbRecordSet")) {'); ! $code->writePHP('var_dump('.$this->getComponentRefCode().'->DataSet->QueryId->GetArray());'); ! $code->writePHP('} else { var_dump('.$this->getComponentRefCode().'->DataSet);}'); ! $code->writeHTML('</pre>'); ! } ! /** ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function postGenerate(&$code) { ! } } --- 18,69 ---- */ class DataDumpTag extends ServerComponentTag { ! /** ! * File to include at runtime ! * @var string path to runtime component relative to WACT_ROOT ! * @access private ! */ ! var $runtimeIncludeFile = '%WACT_ROOT%/template/components/list/list.inc.php'; ! //var $runtimeIncludeFile = '%WACT_ROOT%/template/components/resultset_dump.inc.php'; ! /** ! * Name of runtime component class ! * @var string ! * @access private ! */ ! var $runtimeComponentName = 'ListComponent'; ! //var $runtimeComponentName = 'ResultsetDumpComponent'; ! /** ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function preGenerate(&$code) { ! parent::preGenerate($code); ! $code->writePHP($this->getComponentRefCode() . '->prepare();'); ! } ! /** ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function generateContents(&$code) { ! $code->writeHTML('<pre style="text-align:left">'); ! $code->writePHP('echo get_class('.$this->getComponentRefCode().'->DataSet), "\n";'); ! $code->writePHP('if (is_a('.$this->getComponentRefCode().'->DataSet, "arraydataset")) {'); ! $code->writePHP('var_dump('.$this->getComponentRefCode().'->DataSet->exportDataSetAsArray());'); ! $code->writePHP('} elseif (is_a('.$this->getComponentRefCode().'->DataSet, "AdodbRecordSet")) {'); ! $code->writePHP('var_dump('.$this->getComponentRefCode().'->DataSet->QueryId->GetArray());'); ! $code->writePHP('} else { var_dump('.$this->getComponentRefCode().'->DataSet);}'); ! $code->writeHTML('</pre>'); ! } ! /** ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function postGenerate(&$code) { ! } } Index: stats.filter.php =================================================================== RCS file: /cvsroot/wact/wact/framework/template/tags/data/stats.filter.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** stats.filter.php 30 Oct 2005 00:52:15 -0000 1.8 --- stats.filter.php 31 Oct 2005 15:05:46 -0000 1.9 *************** *** 5,57 **** //-------------------------------------------------------------------------------- /** * @package WACT_TAG * @author Jason E. Sweat < jsweat_php AT yahoo DOT com > * @version $Id$ */ - - FilterDictionary::registerFilter( - new FilterInfo('stats', 'StatsFilter', 1, 2), __FILE__); - - class StatsFilter extends CompilerFilter { ! /** ! * Return this value as a PHP value ! * @return String ! * @access public ! */ ! function getValue() { ! if ($this->isConstant()) { ! $value = $this->base->getValue(); ! $id = $this->parameters[0]->getValue(); ! if (array_key_exists(1,$this->parameters)) { ! $mode = $this->parameters[1]->getValue(); ! $code->writeHTML(wact_stats_filter($value, $id, $mode)); ! } else { ! $code->writeHTML(wact_stats_filter($value, $id)); ! } ! } else { WactRaiseError('compiler', 'UNRESOLVED_BINDING'); ! } } ! /** ! * Generate the code to read the data value at run time ! * Must generate only a valid PHP Expression. ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function generateExpression(&$code) { ! $code->registerInclude(WACT_ROOT . '/template/components/data/stats_filter.inc.php'); ! $code->writePHP('wact_stats_filter('); ! $this->base->generateExpression($code); ! $code->writePHP(','); $this->parameters[0]->generateExpression($code); if (array_key_exists(1,$this->parameters)) { ! $code->writePHP(','); ! $this->parameters[1]->generateExpression($code); } ! $code->writePHP(')'); } --- 5,55 ---- //-------------------------------------------------------------------------------- /** + * @filter stats + * @min_attributes 1 + * @max_attributes 2 * @package WACT_TAG * @author Jason E. Sweat < jsweat_php AT yahoo DOT com > * @version $Id$ */ class StatsFilter extends CompilerFilter { ! /** ! * Return this value as a PHP value ! * @return String ! * @access public ! */ ! function getValue() { ! if ($this->isConstant()) { ! $value = $this->base->getValue(); ! $id = $this->parameters[0]->getValue(); ! if (array_key_exists(1,$this->parameters)) { ! $mode = $this->parameters[1]->getValue(); ! $code->writeHTML(wact_stats_filter($value, $id, $mode)); ! } else { ! $code->writeHTML(wact_stats_filter($value, $id)); ! } ! } else { WactRaiseError('compiler', 'UNRESOLVED_BINDING'); ! } } ! /** ! * Generate the code to read the data value at run time ! * Must generate only a valid PHP Expression. ! * @param CodeWriter ! * @return void ! * @access protected ! */ ! function generateExpression(&$code) { ! $code->registerInclude(WACT_ROOT . '/template/components/data/stats_filter.inc.php'); ! $code->writePHP('wact_stats_filter('); ! $this->base->generateExpression($code); ! $code->writePHP(','); $this->parameters[0]->generateExpression($code); if (array_key_exists(1,$this->parameters)) { ! $code->writePHP(','); ! $this->parameters[1]->generateExpression($code); } ! $code->writePHP(')'); } Index: data_table.tag.php =================================================================== RCS file: /cvsroot/wact/wact/framework/template/tags/data/data_table.tag.php,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** data_table.tag.php 24 Oct 2005 09:09:26 -0000 1.63 --- data_table.tag.php 31 Oct 2005 15:05:46 -0000 1.64 *************** *** 15,30 **** /** - * Register tags - */ - TagDictionary::registerTag(new TagInfo('data:TABLE', 'DataTableTag'), __FILE__); - TagDictionary::registerTag(new TagInfo('data:GROUP', 'DataGroupTag'), __FILE__); - TagDictionary::registerTag(new TagInfo('data:COLUMN', 'DataColumnTag'), __FILE__); - TagDictionary::registerTag(new TagInfo('data:CELL', 'DataCellTag'), __FILE__); - TagDictionary::registerTag(new TagInfo('data:HEADER', 'DataHeaderTag'), __FILE__); - TagDictionary::registerTag(new TagInfo('data:FOOTER', 'DataFooterTag'), __FILE__); - TagDictionary::registerTag(new TagInfo('data:DEFAULT', 'DataDefaultTag'), __FILE__); - - /** * The compile time component to output a result set as an HTML table * @author Jason E. Sweat <jsweat_php AT yahoo DOT com> * @see http://wact.sourceforge.net/index.php/ResultsetTableTag --- 15,20 ---- /** * The compile time component to output a result set as an HTML table + * @tag data:TABLE * @author Jason E. Sweat <jsweat_php AT yahoo DOT com> * @see http://wact.sourceforge.net/index.php/ResultsetTableTag *************** *** 286,289 **** --- 276,280 ---- /** * The compile time component representing a group of columns + * @tag data:GROUP * @author Jason E. Sweat * @see http://wact.sourceforge.net/index.php/ResultsetTableTag *************** *** 350,353 **** --- 341,345 ---- /** * The compile time component representing common attributes for a column of table cells + * @tag data:COLUMN * @author Jason E. Sweat * @see http://wact.sourceforge.net/index.php/ResultsetTableTag *************** *** 477,480 **** --- 469,473 ---- /** * The compile time component to output when the DataSet is empty + * @tag data:DEFAULT * @author Jason E. Sweat < jsweat_php AT yahoo DOT com > * @see http://wact.sourceforge.net/index.php/ResultsetTableTag *************** *** 497,500 **** --- 490,494 ---- /** * The compile time component for a cell template + * @tag data:CELL * @author Jason E. Sweat * @see http://wact.sourceforge.net/index.php/ResultsetTableTag *************** *** 525,528 **** --- 519,523 ---- /** * The compile time component to output a heading for a column, group or table + * @tag data:HEADER * @author Jason E. Sweat * @see http://wact.sourceforge.net/index.php/ResultsetTableTag *************** *** 548,551 **** --- 543,547 ---- /** * The compile time component to output a footer for a column or table + * @tag data:FOOTER * @author Jason E. Sweat * @see http://wact.sourceforge.net/index.php/ResultsetTableTag |