phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.Template.inc.php,1.18,1.19 fu


From: Dan Kuykendall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.Template.inc.php,1.18,1.19 functions.inc.php,1.135,1.136
Date: Thu, 23 May 2002 17:29:01 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv10265

Modified Files:
        class.Template.inc.php functions.inc.php 
Log Message:
added new css support, common/shared template file support, and printer 
templates support

Index: class.Template.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.Template.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** class.Template.inc.php      3 Feb 2002 00:52:53 -0000       1.18
--- class.Template.inc.php      23 May 2002 21:28:59 -0000      1.19
***************
*** 43,47 ****
                /* last error message is retained here */
                var $last_error = '';
! 
                
/***************************************************************************/
                /* public: Constructor.
--- 43,48 ----
                /* last error message is retained here */
                var $last_error = '';
!               var $print = False;
!               
                
/***************************************************************************/
                /* public: Constructor.
***************
*** 49,54 ****
                 * unknowns: how to handle unknown variables.
                 */
!               function Template($root = '.', $unknowns = 'remove')
                {
                        $this->set_root($root);
                        $this->set_unknowns($unknowns);
--- 50,65 ----
                 * unknowns: how to handle unknown variables.
                 */
!               function Template($root = '.', $unknowns = 'remove', $print = 
False)
                {
+                       if ($print)
+                       {
+                               $this->print = True;
+                       }
+                       /* This covers loading up the common tpl file and CSS 
data */
+                       $this->set_root(PHPGW_TEMPLATE_DIR);
+                       $this->set_file('common', 'common.tpl');
+                       
$this->set_var('phpgw_css',$GLOBALS['phpgw_info']['theme']['css']);
+ 
+                       /* Now move on to loading up the requested template set 
*/
                        $this->set_root($root);
                        $this->set_unknowns($unknowns);
***************
*** 374,387 ****
                        }
  
                        if (!file_exists($new_filename))
                        {
!                               if($time==2)
                                {
!                                       $this->halt("filename: file 
$new_filename does not exist.");
!                               }
!                               else
!                               {
!                                       $new_root = 
str_replace($GLOBALS['phpgw_info']['server']['template_set'],'default',$root);
!                                       $new_filename = 
$this->filename(str_replace($root.'/','',$new_filename),$new_root,2);
                                }
                        }
--- 385,417 ----
                        }
  
+                       if ($this->print && $time!=2 && $time!=4)
+                       {
+                               $new_filename = $new_filename.'_print';
+                       }
+                       
                        if (!file_exists($new_filename))
                        {
!                               switch($time)
                                {
!                                       case 2:
!                                               $new_root = 
str_replace($GLOBALS['phpgw_info']['server']['template_set'],'default',$root);
!                                               $new_filename = 
$this->filename($filename,$new_root,3);
!                                               break;
!                                       case 3:
!                                               $new_filename = 
$this->filename($filename,$root,4);
!                                               break;
!                                       case 4:
!                                               $this->halt("filename: file 
$new_filename does not exist.");
!                                               break;
!                                       default:
!                                               if (!$this->print)
!                                               {
!                                                       $new_root = 
str_replace($GLOBALS['phpgw_info']['server']['template_set'],'default',$root);
!                                                       $new_filename = 
$this->filename(str_replace($root.'/','',$new_filename),$new_root,4);
!                                               }
!                                               else
!                                               {
!                                                       $new_filename = 
$this->filename($filename,$root,2);
!                                               }
                                }
                        }

Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.135
retrieving revision 1.136
diff -C2 -r1.135 -r1.136
*** functions.inc.php   6 May 2002 09:05:44 -0000       1.135
--- functions.inc.php   23 May 2002 21:28:59 -0000      1.136
***************
*** 351,364 ****
                reset($GLOBALS['phpgw_info']['flags']);
  
-               
/*************************************************************************\
-               * These lines load up the templates class                       
          *
-               
\*************************************************************************/
-               
if(address@hidden'phpgw_info']['flags']['disable_Template_class'])
-               {
-                       $GLOBALS['phpgw']->template = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
-               }
  
                
/*************************************************************************\
!               * These lines load up the themes                                
          *
                
\*************************************************************************/
                if (! 
$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'])
--- 351,357 ----
                reset($GLOBALS['phpgw_info']['flags']);
  
  
                
/*************************************************************************\
!               * These lines load up the themes and CSS data                   
          *
                
\*************************************************************************/
                if (! 
$GLOBALS['phpgw_info']['user']['preferences']['common']['theme'])
***************
*** 405,409 ****
--- 398,451 ----
                        exit;
                }
+ 
+               if (!isset($GLOBALS['phpgw_info']['theme']['css']))
+               {
+                       $GLOBALS['phpgw_info']['theme']['css'] = '';
+               }
+ 
+               if (isset($GLOBALS['phpgw_info']['theme']['hovlink'])
+                        && ($GLOBALS['phpgw_info']['theme']['hovlink'] != ''))
+               {
+                       $csshover = "\t".'A:hover{ text-decoration:none; color: 
' .$GLOBALS['phpgw_info']['theme']['hovlink'] .'; }'."\n";
+               }
+               else
+               {
+                       $csshover = '';
+               }
+               $GLOBALS['phpgw_info']['theme']['css'] = "\t".'a { 
text-decoration:none; }'."\n"
+                 ."\t".'A:link{ text-decoration:none; color: 
'.$GLOBALS['phpgw_info']['theme']['link'].'; }'."\n"
+                 ."\t".'A:visted{ text-decoration:none; color: 
'.$GLOBALS['phpgw_info']['theme']['vlink'].'; }'."\n"
+                 ."\t".'A:active{ text-decoration:none; color: 
'.$GLOBALS['phpgw_info']['theme']['alink'].'; }'."\n"
+                       .$csshover
+                       .$GLOBALS['phpgw_info']['theme']['css'];
+ 
+               unset($csshover);
+ 
+               if(@file_exists(PHPGW_APP_TPL . '/app.css'))
+               {
+                       $app_css_file = fopen (PHPGW_APP_TPL . '/app.css', "r");
+                       $contents = fread ($app_css_file, filesize 
($app_css_file));
+                       fclose ($app_css_file);
+                       $GLOBALS['phpgw_info']['theme']['css'] .= 
"\n".$contents;
+               }
+               
                unset($theme_to_load);
+ 
+               
/*************************************************************************\
+               * These lines load up the templates class                       
          *
+               
\*************************************************************************/
+               
if(address@hidden'phpgw_info']['flags']['disable_Template_class'])
+               {
+                       $GLOBALS['phpgw']->template = 
CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+               }
+ 
+               
/*************************************************************************\
+               * These lines remove the css data from memory since the 
template set will *
+               * already have loaded it into its own memory space              
          *
+               
\*************************************************************************/
+               if(address@hidden'phpgw_info']['flags']['keep_phpgw_css'])
+               {
+ //                    unset($GLOBALS['phpgw_info']['theme']['css']);
+               }
  
                
/*************************************************************************\




reply via email to

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