logo       

cvs: pear /HTML_Template_Flexy/Flexy Token.php Tokenizer.php /HTML_Templat: msg#00584

Subject: cvs: pear /HTML_Template_Flexy/Flexy Token.php Tokenizer.php /HTML_Template_Flexy/Flexy/Token Tag.php
alan_k          Fri Jan 31 12:28:40 2003 EDT

  Modified files:              
    /pear/HTML_Template_Flexy/Flexy     Token.php Tokenizer.php 
    /pear/HTML_Template_Flexy/Flexy/Token       Tag.php 
  Log:
  provisional select support - looks like the whole form replacement stuff 
should depend on tags being added to form eg.  <form name="_object" 
useflexy="true"> , select replacement can be turned off using <select 
name="xxxx" static="true">
  
Index: pear/HTML_Template_Flexy/Flexy/Token.php
diff -u pear/HTML_Template_Flexy/Flexy/Token.php:1.4 
pear/HTML_Template_Flexy/Flexy/Token.php:1.5
--- pear/HTML_Template_Flexy/Flexy/Token.php:1.4        Fri Jan 31 11:22:06 2003
+++ pear/HTML_Template_Flexy/Flexy/Token.php    Fri Jan 31 12:28:39 2003
@@ -16,7 +16,7 @@
 // | Authors:  Alan Knowles <alan@akbkhome>                               |
 // +----------------------------------------------------------------------+
 //
-// $Id: Token.php,v 1.4 2003/01/31 16:22:06 alan_k Exp $
+// $Id: Token.php,v 1.5 2003/01/31 17:28:39 alan_k Exp $
 //
 //  This is the master Token file for The New Token driver Engine.
 //  All the Token output, and building routines are in here.
@@ -183,11 +183,19 @@
         // first record is a filler - to stick all the children on !
         // reset my globals..
   
+        $_HTML_TEMPLATE_FLEXY_TOKEN['statevars'] = array();
+        $_HTML_TEMPLATE_FLEXY_TOKEN['state'] = 0;
+        
+        
         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'] = array(new 
HTML_Template_Flexy_Token);
         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][0]->id =0;
         $i=1;
         
         
+        // initialize state - this trys to make sure that
+        // you dont do to many elses etc.
+       
+        
         // step one just tokenize it.
         while ($t = $tokenizer->yylex()) {  
             
@@ -281,7 +289,7 @@
     /**
     * Build the child array for each element.
     * 
-    * @param   object    Tokenizer to run.. - Theoretically other Tokenizers 
could be done for email,rtf etc.
+    * @param   int  id of node to add children to.
     *
     * @access   public
     * @static
@@ -312,6 +320,7 @@
             
     /**
     * Flag to ignore children - Used to block output for select/text area etc.
+    * may not be required as I moved the Tag parsing into the toString ph
     *
     * @var boolean ingore children
     * @access public
@@ -329,15 +338,7 @@
     * raw variables are assumed to be $this->, unless defined by foreach..
     * it also monitors syntax - eg. end without an if/foreach etc.
     */
-
-    /**
-    * reset the state = do this before parsing another file.
-    *
-    * @access   public
-    */
-    function reset() {
-        $_HTML_TEMPLATE_FLEXY_TOKEN['state'] = 0;
-    }
+ 
     
     /**
     * tell the generator you are entering a block
Index: pear/HTML_Template_Flexy/Flexy/Tokenizer.php
diff -u pear/HTML_Template_Flexy/Flexy/Tokenizer.php:1.4 
pear/HTML_Template_Flexy/Flexy/Tokenizer.php:1.5
--- pear/HTML_Template_Flexy/Flexy/Tokenizer.php:1.4    Fri Jan 31 11:22:06 2003
+++ pear/HTML_Template_Flexy/Flexy/Tokenizer.php        Fri Jan 31 12:28:39 2003
@@ -16,7 +16,7 @@
 // | Authors:  nobody <nobody@localhost>                                  |
 // +----------------------------------------------------------------------+
 //
-// $Id: Tokenizer.php,v 1.4 2003/01/31 16:22:06 alan_k Exp $
+// $Id: Tokenizer.php,v 1.5 2003/01/31 17:28:39 alan_k Exp $
 //
 //  The Source Lex file. (Tokenizer.lex) and the Generated one (Tokenizer.php)
 // You should always work with the .lex file and generate by
Index: pear/HTML_Template_Flexy/Flexy/Token/Tag.php
diff -u pear/HTML_Template_Flexy/Flexy/Token/Tag.php:1.1 
pear/HTML_Template_Flexy/Flexy/Token/Tag.php:1.2
--- pear/HTML_Template_Flexy/Flexy/Token/Tag.php:1.1    Fri Jan 31 11:22:08 2003
+++ pear/HTML_Template_Flexy/Flexy/Token/Tag.php        Fri Jan 31 12:28:40 2003
@@ -16,7 +16,7 @@
 // | Authors:  Alan Knowles <alan@akbkhome>                               |
 // +----------------------------------------------------------------------+
 //
-// $Id: Tag.php,v 1.1 2003/01/31 16:22:08 alan_k Exp $
+// $Id: Tag.php,v 1.2 2003/01/31 17:28:40 alan_k Exp $
  
 /**
 * A standard HTML Tag = eg. Table/Body etc.
@@ -157,7 +157,7 @@
                 $ret .= $e->toString();
             }
         }
-        $ret .= $this->childrentoString();
+        $ret .= $this->childrenToString();
         if ($this->close) {
             $ret .= $this->close->toString();
         }
@@ -277,6 +277,78 @@
         
         
     }
+    /**
+    * Deal with Selects
+    *
+    * if you set static="true" in the select tag - it will get left alone
+    * (you can also turn it off by setting the flexy option ignoreTags TODO!
+    *
+    * the value of the select is going to be $t->theform->the_name_of_the_tag
+    *
+    * the options is the pullldown will have to be
+    *        $t->theform->getOptions('the_name_of_the_tag')
+    *
+    * the tag is generated using HTML_Select
+    *
+    * However this requires that toString outputs something different. - eg.
+    * an overriden value..
+    * 
+    * otherwise, It needs to generate a child like:
+    * - for a key=>value array.
+    * foreach($t->theform->getOptions('name') as $_k=>$_v) {
+    *    printf('<OPTION VALUE="%s"%s>%s</OPTION>',
+    *               htmlspecialchars($k), 
+    *               ($k == $this->theform->thename_of_the_tag) ? ' SELECTED' : 
'', 
+    *               htmlspecialchars($v)
+    *           )
+    *    
+    * }
+    * 
+    *
+    * @return   none
+    * @access   public
+    */
+  
+    function parseTagSelect() 
+    {
+        
+        global $_HTML_TEMPLATE_FLEXY_TOKEN;
+          
+        $call_object = '$t';
+        
+        if ($this->getAttribute('static')) {
+            return;
+        }
+         
+         
+        $basename =    $this->getAttribute('name');
+        $name = $basename;
+        if ($_HTML_TEMPLATE_FLEXY_TOKEN['activeForm']) {
+            $name = $_HTML_TEMPLATE_FLEXY_TOKEN['activeForm'] .'.'.$name;
+            $call_object =  
$this->toVar($_HTML_TEMPLATE_FLEXY_TOKEN['activeForm']);
+        }
+        
+        
+        
+        
+        $this->children =   array(
+                $this->factory("PHP", 
+                    "<?php if (method_exists({$call_object},'getOptions'))
+                    foreach(". $call_object ."->getOptions('{$basename}') as 
\$_k=>\$_v) {
+                        printf(\"<OPTION VALUE=\\\"%s\\\"%s>%s</OPTION>\",
+                                   htmlspecialchars(\$_k), 
+                                   (\$_k == " . $this->toVar($name) .") ? ' 
SELECTED' : '', 
+                                   htmlspecialchars(\$_v)
+                               ); } ?>",
+                    $this->line)
+            );
+        
+    }
+    
+    
+    
+    
+    
     
      /**
     * Reads an Form tag and stores the current name (used as a prefix for input



-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe