phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: sitemgr/inc class.Categories_BO.inc.php,1.3,1.4


From: Patrick Walsh <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/inc class.Categories_BO.inc.php,1.3,1.4 class.Categories_db_SO.inc.php,1.3,1.4 class.MainMenu_UI.inc.php,1.1.1.1,1.2
Date: Sat, 07 Sep 2002 01:57:31 -0400

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

Modified Files:
        class.Categories_BO.inc.php class.Categories_db_SO.inc.php 
        class.MainMenu_UI.inc.php 
Log Message:
Made for an automatic upgrade to new categories.


Index: class.Categories_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_BO.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Categories_BO.inc.php 5 Sep 2002 09:06:03 -0000       1.3
--- class.Categories_BO.inc.php 7 Sep 2002 05:57:28 -0000       1.4
***************
*** 11,14 ****
--- 11,31 ----
                }
  
+               function needUpdateCategories()
+               {
+                       $prefs = CreateObject('sitemgr.sitePreference_SO');
+                       return !$prefs->getPreference('catsupdated');
+               }
+ 
+               function updateCategories()
+               {
+                       $prefs = CreateObject('sitemgr.sitePreference_SO');
+                       $db_so = CreateObject('sitemgr.Categories_db_SO');
+                       $rv = $db_so->convert_to_phpgwapi();
+                       $prefs->setPreference('catsupdated','True');
+                       unset($db_so);
+                       unset($prefs);
+                       return $rv;
+               }
+                       
                function getCategoryOptionList()
                {

Index: class.Categories_db_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_db_SO.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Categories_db_SO.inc.php      7 Sep 2002 05:18:44 -0000       1.3
--- class.Categories_db_SO.inc.php      7 Sep 2002 05:57:28 -0000       1.4
***************
*** 88,94 ****
                        {
                                $new_cat_id = $cat_so->addCategory('','',0);
                                if (!$new_cat_id)
                                {
!                                       die("ERROR!  Can't upgrade tables until 
you get the latest phpgwapi/inc/class.categories.inc.php from the 0.9.14 branch 
of CVS!  Please get this now.");
                                }
                                $old_cat = $this->getCategory($old_cat_id);
--- 88,95 ----
                        {
                                $new_cat_id = $cat_so->addCategory('','',0);
+                               $rv='';
                                if (!$new_cat_id)
                                {
!                                       return("ERROR!  I need to update your 
tables, but I can't upgrade tables until you get the latest 
phpgwapi/inc/class.categories.inc.php from the 0.9.14 branch of CVS!  Please 
get this now.");
                                }
                                $old_cat = $this->getCategory($old_cat_id);
***************
*** 96,100 ****
                                $cat_so->saveCategory($old_cat);
                                $cat_conv[$old_cat_id] = $new_cat_id;
!                               echo "\n<br>&nbsp;&nbsp;Old category id 
$old_cat_id is becoming $new_cat_id";
                        }
  
--- 97,101 ----
                                $cat_so->saveCategory($old_cat);
                                $cat_conv[$old_cat_id] = $new_cat_id;
!                               $rv .= "\n<br>&nbsp;&nbsp;Old category id 
$old_cat_id is becoming $new_cat_id";
                        }
  
***************
*** 118,123 ****
                                        '" WHERE page_id="'.$page_id.'"';
                                $this->db->query($sql,__LINE__,__FILE__);
!                               echo "\n<br>&nbsp;&nbsp;&nbsp;&nbsp;Updating 
page ".$page_id;
                        }
                }
        }
--- 119,125 ----
                                        '" WHERE page_id="'.$page_id.'"';
                                $this->db->query($sql,__LINE__,__FILE__);
!                               $rv .= "\n<br>&nbsp;&nbsp;&nbsp;&nbsp;Updating 
page ".$page_id;
                        }
+                       return $rv;
                }
        }

Index: class.MainMenu_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.MainMenu_UI.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** class.MainMenu_UI.inc.php   29 Aug 2002 03:03:17 -0000      1.1.1.1
--- class.MainMenu_UI.inc.php   7 Sep 2002 05:57:28 -0000       1.2
***************
*** 34,37 ****
--- 34,50 ----
                        {
                                $this->t->set_var('menutitle','Administrative 
Menu');
+                               $catbo = CreateObject('sitemgr.Categories_BO');
+                               if ($catbo->needUpdateCategories())
+                               {
+                                       $updatemsg = $catbo->updateCategories();
+                                       $updatemsg = "\n".'<br><b>Updating to 
new category system:</b><br>'.
+                                               
$updatemsg.'<br><b>Done.</b><br>';
+                                       
$this->t->set_var('updatecats',$updatemsg);
+                               }
+                               else
+                               {
+                                       $this->t->set_var('updatecats','');
+                               }
+                               unset($catbo);
                        }
                        else
***************
*** 67,70 ****
--- 80,84 ----
                        $common_ui->DisplayFooter();
                }
+ 
        }       
  ?>





reply via email to

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