phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: etemplate/inc class.uietemplate.inc.php,1.40,1.4


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.uietemplate.inc.php,1.40,1.41 class.xul_io.inc.php,1.18,1.19
Date: Thu, 10 Oct 2002 07:28:41 -0400

Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv10828

Modified Files:
        class.uietemplate.inc.php class.xul_io.inc.php 
Log Message:
implemented possibility to disable rows and cols,
disabling can depend on a value of $content

Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** class.uietemplate.inc.php   9 Oct 2002 00:31:01 -0000       1.40
--- class.uietemplate.inc.php   10 Oct 2002 11:28:39 -0000      1.41
***************
*** 186,189 ****
--- 186,212 ----
                }
  
+               function check_disabled($disabled,$content)
+               {
+                       //return False;
+                       if ($not = $disabled[0] == '!')
+                       {
+                               $disabled = substr($disabled,1);
+                       }
+                       list($val,$check_val) = $vals = explode('=',$disabled);
+ 
+                       if ($val[0] == '@')
+                       {
+                               $val = 
$this->get_array($content,substr($val,1));
+                       }
+                       if ($check_val[0] == '@')
+                       {
+                               $check_val = 
$this->get_array($content,substr($check_val,1));
+                       }
+                       $result = count($vals) == 1 ? $val != '' : $val == 
$check_val;
+                       if ($not) $result = !$result;
+                       echo "<p>check_disabled: '".($not?'!':'')."$disabled' = 
'$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = 
".($result?'True':'False')."</p>\n";
+                       return $result;
+               }
+ 
                /*!
                @function show
***************
*** 229,237 ****
                        if (isset($this->data[0]))
                        {
!                               list(,$width) = each($this->data);
                        }
                        else
                        {
!                               $width = array();
                        }
                        for ($r = 0; $row = 1+$r /*list($row,$cols) = 
each($this->data)*/; ++$r)
--- 252,260 ----
                        if (isset($this->data[0]))
                        {
!                               list(,$opts) = each($this->data);
                        }
                        else
                        {
!                               $opts = array();
                        }
                        for ($r = 0; $row = 1+$r /*list($row,$cols) = 
each($this->data)*/; ++$r)
***************
*** 249,254 ****
                                {
                                        $cols = &$this->data[$r_key];
!                                       $height = &$this->data[0]["h$row"];
!                                       $class = &$this->data[0]["c$row"];
                                }
                                reset ($cols);
--- 272,281 ----
                                {
                                        $cols = &$this->data[$r_key];
!                                       list($height,$disabled) = 
explode(',',$opts["h$row"]);
!                                       $class = $opts["c$row"];
!                               }
!                               if ($disabled != '' && 
$this->check_disabled($disabled,$content))
!                               {
!                                       continue;       // row is disabled
                                }
                                reset ($cols);
***************
*** 256,259 ****
--- 283,287 ----
                                for ($c = 0; True /*list($col,$cell) = 
each($cols)*/; ++$c)
                                {
+                                       $col = $this->num2chrs($c);
                                        if (!(list($c_key) = each($cols)))      
        // no further cols
                                        {
***************
*** 267,272 ****
                                        {
                                                $cell = &$cols[$c_key];
                                        }
-                                       $col = $this->num2chrs($c);
                                        $row_data[$col] = 
$this->show_cell($cell,$content,$sel_options,$readonlys,$cname,
                                                $c,$r,$span);
--- 295,304 ----
                                        {
                                                $cell = &$cols[$c_key];
+                                               list(,$col_disabled) = 
explode(',',$opts[$col]);
+                                       }
+                                       if ($col_disabled != '' && 
$this->check_disabled($col_disabled,$content))
+                                       {
+                                               continue;       // col is 
disabled
                                        }
                                        $row_data[$col] = 
$this->show_cell($cell,$content,$sel_options,$readonlys,$cname,
                                                $c,$r,$span);
***************
*** 285,292 ****
                                                }
                                        }
!                                       elseif ($width[$col])   // width only 
once for a non colspan cell
                                        {
!                                               $row_data[".$col"] .= ' 
WIDTH='.$width[$col];
!                                               $width[$col] = 0;
                                        }
                                        $row_data[".$col"] .= 
$this->html->formatOptions($cell['align'],'ALIGN');
--- 317,324 ----
                                                }
                                        }
!                                       elseif ($opts[$col])    // width only 
once for a non colspan cell
                                        {
!                                               $row_data[".$col"] .= ' 
WIDTH='.$opts[$col];
!                                               $opts[$col] = 0;
                                        }
                                        $row_data[".$col"] .= 
$this->html->formatOptions($cell['align'],'ALIGN');
***************
*** 414,417 ****
--- 446,451 ----
                        {
                                case 'label':           //  size: 
[[b]old][[i]talic]
+                                       if (is_array($value))
+                                               break;
                                        $value = strlen($value) > 1 && 
!$cell['no_lang'] ? lang($value) : $value;
                                        if ($value != '' && 
strstr($cell['size'],'b')) $value = $this->html->bold($value);

Index: class.xul_io.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.xul_io.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** class.xul_io.inc.php        6 Oct 2002 08:50:23 -0000       1.18
--- class.xul_io.inc.php        10 Oct 2002 11:28:39 -0000      1.19
***************
*** 141,145 ****
                                $xul_row = new xmlnode('row');
                                
$this->set_attributes($xul_row,'class,valign',$opts["c$r"]);
!                               
$this->set_attributes($xul_row,'height',$opts["h$r"]);
  
                                $spanned = 0;
--- 141,145 ----
                                $xul_row = new xmlnode('row');
                                
$this->set_attributes($xul_row,'class,valign',$opts["c$r"]);
!                               
$this->set_attributes($xul_row,'height,disabled',$opts["h$r"]);
  
                                $spanned = 0;
***************
*** 149,153 ****
                                        {
                                                $xul_column = new 
xmlnode('column');
!                                               
$this->set_attributes($xul_column,'width',$opts[$c]);
                                                
$xul_columns->add_node($xul_column);
                                        }
--- 149,153 ----
                                        {
                                                $xul_column = new 
xmlnode('column');
!                                               
$this->set_attributes($xul_column,'width,disabled',$opts[$c]);
                                                
$xul_columns->add_node($xul_column);
                                        }
***************
*** 392,396 ****
                                                        return 'place widgets 
in <row> and not in <column> !!!';
                                                }
!                                               
$etempl->data[0][$etempl->num2chrs($etempl->cols++)] = $attr['width'];
                                                break;
                                        case 'row':
--- 392,397 ----
                                                        return 'place widgets 
in <row> and not in <column> !!!';
                                                }
!                                               
$etempl->data[0][$etempl->num2chrs($etempl->cols++)] = $attr['width'] .
!                                                       ($attr['disabled'] ? 
','.$attr['disabled'] : '');
                                                break;
                                        case 'row':
***************
*** 402,406 ****
                                                $col = 0;
                                                $etempl->data[0]["c$r"] = 
$attr['class'] . ($attr['valign'] ? ','.$attr['valign'] : '');
!                                               $etempl->data[0]["h$r"] = 
$attr['height'];
                                                break;
                                        case 'styles':
--- 403,408 ----
                                                $col = 0;
                                                $etempl->data[0]["c$r"] = 
$attr['class'] . ($attr['valign'] ? ','.$attr['valign'] : '');
!                                               $etempl->data[0]["h$r"] = 
$attr['height'] .
!                                                       ($attr['disabled'] ? 
','.$attr['disabled'] : '');
                                                break;
                                        case 'styles':
***************
*** 529,531 ****
        }
  
! ?>
\ No newline at end of file
--- 531,533 ----
        }
  
! ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]