phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: sitemgr/inc class.module.inc.php,1.1,1.2 class.m


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/inc class.module.inc.php,1.1,1.2 class.module_amazon.inc.php,1.1,1.2class.module_appdir.inc.php,1.2,1.3 class.module_calendar.inc.php,1.1,1.2class.module_forum.inc.php,1.2,1.3 class.module_news.inc.php,1.1,1.2
Date: Sat, 18 Jan 2003 20:10:04 -0500

Update of /cvsroot/phpgroupware/sitemgr/inc
In directory subversions:/tmp/cvs-serv21057/inc

Modified Files:
        class.module.inc.php class.module_amazon.inc.php 
        class.module_appdir.inc.php class.module_calendar.inc.php 
        class.module_forum.inc.php class.module_news.inc.php 
Log Message:
add some code to make migration of existing templates easier
add function find_template_dir


Index: class.module.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.module.inc.php        17 Jan 2003 03:37:52 -0000      1.1
--- class.module.inc.php        19 Jan 2003 01:10:02 -0000      1.2
***************
*** 95,99 ****
                }
                $extravars['page_id'] = $this->block->page_id;
!               return sitemgr_link2('/index.php',$extravars);
        }
  
--- 95,113 ----
                }
                $extravars['page_id'] = $this->block->page_id;
!               return sitemgr_link($extravars);
!       }
! 
!       function find_template_dir()
!       {
!               $templaterootformat = 
$GLOBALS['sitemgr_info']['sitemgr-site-dir']. SEP . 'templates' . SEP . '%s' . 
SEP . $this->block->app_name . SEP . $this->block->module_name;
!               $themetemplatedir = 
sprintf($templaterootformat,$GLOBALS['sitemgr_info']['themesel']);
!               if (is_dir($themetemplatedir))
!               {
!                       return $themetemplatedir;
!               }
!               else
!               {
!                       return sprintf($templaterootformat,'default');
!               }
        }
  

Index: class.module_amazon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module_amazon.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.module_amazon.inc.php 17 Jan 2003 03:37:52 -0000      1.1
--- class.module_amazon.inc.php 19 Jan 2003 01:10:02 -0000      1.2
***************
*** 1,4 ****
--- 1,20 ----
  <?php 
+ /**************************************************************\
+ * this was originally a phpNuke block.  the amazon_id has been *
+ * changed.  feel free to change it yourself, of course.  the   *
+ * below directions still apply.                                *
+ \**************************************************************/
  
+ /***************************************************************/
+ /* To use this block you only need to download .jpg or .gif    */
+ /* images from amazon.com and copy them to the /images/amazon  */
+ /* directory, then edit the $amazon_id variable to fit your ID */
+ /* of the Associates program. If you don't change the ID, all  */
+ /* the comissions ($) will go to my account! You're advised.   */
+ /*                                                             */
+ /* You need to know that any image in the amazon's directory   */
+ /* has the same ASIN name as its filename given by Amazon. If  */
+ /* you don't know what this is, leave it as is or disable it.  */
+ /***************************************************************/
  class module_amazon extends Module
  {
***************
*** 28,34 ****
                $image = $imglist[$random];
                $asin = explode(".", $image);
!               $content = "<br><center><a 
href=\"http://www.amazon.com/exec/obidos/ASIN/$asin[0]/$amazon_id\"; 
target=\"_blank\">";
!               $content .= "<img src=\"images/amazon/$image\" border=\"0\" 
alt=\"\"><br><br></center>";
        }
- 
  }
--- 44,49 ----
                $image = $imglist[$random];
                $asin = explode(".", $image);
!               return "<br><center><a 
href=\"http://www.amazon.com/exec/obidos/ASIN/$asin[0]/$amazon_id\"; 
target=\"_blank\">" .
!                       "<img src=\"images/amazon/$image\" border=\"0\" 
alt=\"\"><br><br></center>";
        }
  }

Index: class.module_appdir.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module_appdir.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.module_appdir.inc.php 17 Jan 2003 04:22:16 -0000      1.2
--- class.module_appdir.inc.php 19 Jan 2003 01:10:02 -0000      1.3
***************
*** 113,117 ****
                {
                        require_once(PHPGW_INCLUDE_ROOT . SEP . 'sitemgr' . SEP 
. 'inc' . SEP . 'class.xslt_transform.inc.php');
!                       $this->add_transformer(new 
xslt_transform($GLOBALS['sitemgr_info']['sitemgr-site-dir']. SEP . 
'templates/default/sitemgr/appdir/list.xsl'));
                }
        }
--- 113,117 ----
                {
                        require_once(PHPGW_INCLUDE_ROOT . SEP . 'sitemgr' . SEP 
. 'inc' . SEP . 'class.xslt_transform.inc.php');
!                       $this->add_transformer(new 
xslt_transform($this->find_template_dir() . SEP . 'list.xsl'));
                }
        }

Index: class.module_calendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module_calendar.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.module_calendar.inc.php       17 Jan 2003 03:37:52 -0000      1.1
--- class.module_calendar.inc.php       19 Jan 2003 01:10:02 -0000      1.2
***************
*** 26,30 ****
      {
                $t = Createobject('phpgwapi.Template');
!               $t->set_root($GLOBALS['sitemgr_info']['sitemgr-site-dir']. SEP 
. 'templates/modules/sitemgr/calendar/');
                $t->set_file('mini_calendar','mini_cal.tpl');
  
--- 26,30 ----
      {
                $t = Createobject('phpgwapi.Template');
!               $t->set_root($this->find_template_dir());
                $t->set_file('mini_calendar','mini_cal.tpl');
  

Index: class.module_forum.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module_forum.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.module_forum.inc.php  17 Jan 2003 04:22:16 -0000      1.2
--- class.module_forum.inc.php  19 Jan 2003 01:10:02 -0000      1.3
***************
*** 79,83 ****
                }
                $this->template = CreateObject('phpgwapi.Template');
!               
$this->template->set_root($GLOBALS['sitemgr_info']['sitemgr-site-dir']. SEP . 
'templates/default/sitemgr/forum/');
  
                if ($arguments['level'] == 1)
--- 79,83 ----
                }
                $this->template = CreateObject('phpgwapi.Template');
!               $this->template->set_root($this->find_template_dir());
  
                if ($arguments['level'] == 1)

Index: class.module_news.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module_news.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.module_news.inc.php   17 Jan 2003 03:37:52 -0000      1.1
--- class.module_news.inc.php   19 Jan 2003 01:10:02 -0000      1.2
***************
*** 3,24 ****
        class news_transform
        {
                function apply_transform($title,$content)
                {
-                       $t = Createobject('phpgwapi.Template');
-                       $templaterootformat = 
$GLOBALS['sitemgr_info']['sitemgr-site-dir']. SEP . 'templates' . SEP . '%s' . 
SEP . 'sitemgr' . SEP . 'news';
-                       $themetemplatedir = 
sprintf($templaterootformat,$GLOBALS['sitemgr_info']['themesel']);
-                       if (is_dir($themetemplatedir))
-                       {
-                               $t->set_root($themetemplatedir);
-                       }
-                       else
-                       {
-                               
$t->set_root(sprintf($templaterootformat,'default'));
-                       }
-                       $t->set_file('news','newsblock.tpl');
                        $result ='';
                        while (list(,$newsitem) = @each($content))
                        {
!                               $t->set_var(array(
                                        'news_title' => $newsitem['subject'],
                                        'news_submitter' => 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']),
--- 3,17 ----
        class news_transform
        {
+               function news_transform(&$template)
+               {
+                       $this->template = $template;
+               }
+ 
                function apply_transform($title,$content)
                {
                        $result ='';
                        while (list(,$newsitem) = @each($content))
                        {
!                               $this->template->set_var(array(
                                        'news_title' => $newsitem['subject'],
                                        'news_submitter' => 
$GLOBALS['phpgw']->accounts->id2name($newsitem['submittedby']),
***************
*** 26,30 ****
                                        'news_content' => 
nl2br($newsitem['content'])
                                ));
!                               $result .= $t->parse('out','news');
                        }
                        return $result;
--- 19,23 ----
                                        'news_content' => 
nl2br($newsitem['content'])
                                ));
!                               $result .= $this->template->parse('out','news');
                        }
                        return $result;
***************
*** 63,67 ****
                        if ($produce)
                        {
!                               $this->add_transformer(new news_transform());
                        }
                }
--- 56,63 ----
                        if ($produce)
                        {
!                               $t = Createobject('phpgwapi.Template');
!                               $t->set_root($this->find_template_dir());
!                               $t->set_file('news','newsblock.tpl');
!                               $this->add_transformer(new news_transform($t));
                        }
                }





reply via email to

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