Changeset 265

Show
Ignore:
Timestamp:
06/24/07 12:14:06 (1 year ago)
Author:
bermiferrer
Message:

Adding a SIntags version of the scaffold generator. Just need to add --sintags at the end of the generate scaffold command.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/script/generators/AkelosGenerator.php

    r2 r265  
    7878    { 
    7979        $i = 0; 
     80        $extra_commands = array(); 
     81        $unnamed_commands = array(); 
    8082        foreach ($commands as $param=>$value){ 
     83            if($value[0] == '-'){ 
     84                $next_is_value_for = trim($value,'- '); 
     85                $extra_commands[$next_is_value_for] = true; 
     86                continue; 
     87            } 
     88             
     89            if(isset($next_is_value_for)){ 
     90                $extra_commands[$next_is_value_for] = trim($value,'- '); 
     91                unset($next_is_value_for); 
     92                continue; 
     93            } 
     94             
    8195            if(is_numeric($param)){ 
    8296                if(!empty($this->command_values[$i])){ 
     
    8498                    if(substr($this->command_values[$i],0,7) == '(array)'){ 
    8599                        $index =substr($this->command_values[$i],7); 
    86                         $commands[$index][] = $value; 
     100                        $unnamed_commands[$index][] = $value; 
    87101                        $i--; 
    88102                    }else{ 
    89                         $commands[$index] = $value; 
     103                        $unnamed_commands[$index] = $value; 
    90104                    } 
    91105                } 
     
    93107            } 
    94108        } 
    95     } 
    96  
    97     function render($template) 
     109        $commands = array_merge($extra_commands, $unnamed_commands);         
     110    } 
     111 
     112    function render($template, $sintags_version = false) 
    98113    { 
    99114        extract($this->_template_vars); 
    100115 
    101116        ob_start(); 
    102         include(AK_SCRIPT_DIR.DS.'generators'.DS.$this->type.DS.'templates'.DS.(strstr($template,'.') ? $template : $template.'.tpl')); 
     117        include(AK_SCRIPT_DIR.DS.'generators'.DS.$this->type.DS.($sintags_version?'sintags_':'').'templates'.DS.(strstr($template,'.') ? $template : $template.'.tpl')); 
    103118        $result = ob_get_contents(); 
    104119        ob_end_clean(); 
  • trunk/script/generators/scaffold/scaffold_generator.php

    r232 r265  
    8383        foreach ($model_files as $template=>$file_path){ 
    8484            if(!file_exists($file_path)){ 
    85                 $this->save($file_path, $this->render($template)); 
     85                $this->save($file_path, $this->render($template, !empty($this->sintags))); 
    8686            } 
    8787        } 
     
    129129        $this->_template_vars = (array)$this; 
    130130        foreach ($this->files as $template=>$file_path){ 
    131             $this->save($file_path, $this->render($template)); 
     131            $this->save($file_path, $this->render($template, !empty($this->sintags))); 
    132132        } 
    133133        foreach ($this->user_actions as $action=>$file_path){ 
    134134            $this->assignVarToTemplate('action',$action); 
    135             $this->save($file_path, $this->render('view')); 
     135            $this->save($file_path, $this->render('view', !empty($this->sintags))); 
    136136        } 
    137137 
  • trunk/script/generators/scaffold/templates/form.tpl

    r155 r265  
    55<?php  else :  
    66        foreach ($content_columns as $column=>$details){ 
     7            if($column == 'id'){ 
     8                continue; 
     9            } 
    710            echo " 
    811    <p>