phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: sitemgr/inc class.Sites_BO.inc.php,NONE,1.1 clas


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/inc class.Sites_BO.inc.php,NONE,1.1 class.Sites_SO.inc.php,NONE,1.1 class.Sites_UI.inc.php,NONE,1.1 class.ACL_BO.inc.php,1.2,1.3 class.Categories_BO.inc.php,1.6,1.7 class.Categories_SO.inc.php,1.13,1.14 class.Categories_UI.inc.php,1.1,1.2 class.Common_BO.inc.php,1.2,1.3 class.Common_UI.inc.php,1.9,1.10 class.Content_BO.inc.php,1.2,1.3 class.Content_SO.inc.php,1.6,1.7 class.Content_UI.inc.php,1.4,1.5 class.MainMenu_UI.inc.php,1.6,1.7 class.Pages_BO.inc.php,1.5,1.6 class.Pages_UI.inc.php,1.1,1.2 class.Theme_BO.inc.php,1.4,1.5 class.Translations_UI.inc.php,1.3,1.4 hook_admin.inc.php,1.3,1.4 class.SiteContent_UI.inc.php,1.2,NONE class.headerFooter_BO.inc.php,1.2,NONE class.sitePreference_SO.inc.php,1.3,NONE
Date: Wed, 21 May 2003 22:36:56 -0400

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

Modified Files:
        class.ACL_BO.inc.php class.Categories_BO.inc.php 
        class.Categories_SO.inc.php class.Categories_UI.inc.php 
        class.Common_BO.inc.php class.Common_UI.inc.php 
        class.Content_BO.inc.php class.Content_SO.inc.php 
        class.Content_UI.inc.php class.MainMenu_UI.inc.php 
        class.Pages_BO.inc.php class.Pages_UI.inc.php 
        class.Theme_BO.inc.php class.Translations_UI.inc.php 
        hook_admin.inc.php 
Added Files:
        class.Sites_BO.inc.php class.Sites_SO.inc.php 
        class.Sites_UI.inc.php 
Removed Files:
        class.SiteContent_UI.inc.php class.headerFooter_BO.inc.php 
        class.sitePreference_SO.inc.php 
Log Message:
make sitemgr capable of editing multiple sites


***** Error reading new file: [Errno 2] No such file or directory: 
'class.Sites_BO.inc.php'
--- NEW FILE ---
<?php
        class Sites_SO
        {
                var $db;
                
                function Sites_SO()
                {
                        $this->db = $GLOBALS['phpgw']->db;
                }

                function list_siteids()
                {
                        $result = array();
                        $sql = "SELECT site_id FROM phpgw_sitemgr_sites";
                        $this->db->query($sql,__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
                                $result[] = $this->db->f('site_id');
                        }
                        return $result;
                }

                function getWebsites($limit,$start,$sort,$order,$query,&$total)
                {
                        if ($limit)
                        {
                                if (!$sort)
                                {
                                        $sort = 'DESC';
                                }
                                if ($query)
                                {
                                        $whereclause = "WHERE site_name LIKE 
'%$query%'"
                                                . "OR site_url LIKE '%$query%'"
                                                . "OR site_dir LIKE '%$query%'";
                                }
                                if ($order)
                                {
                                        $orderclause = 'ORDER BY ' . $order . ' 
' . $sort;
                                }
                                else
                                {
                                        $orderclause = 'ORDER BY site_name ASC';
                                }
                                $sql = "SELECT site_id,site_name,site_url from 
phpgw_sitemgr_sites $whereclause $orderclause";  
                                $this->db->query($sql,__LINE__,__FILE__);
                                $total = $this->db->num_rows();
                                
$this->db->limit_query($sql,$start,__LINE__,__FILE__);
                        }
                        else
                        {
                                $sql = "SELECT site_id,site_name,site_url from 
phpgw_sitemgr_sites";
                                $this->db->query($sql,__LINE__,__FILE__);
                        }
                        while ($this->db->next_record())
                        {
                                foreach(array('site_id', 'site_name', 
'site_url') as $col)
                                {
                                        $site[$col] = $this->db->f($col);
                                }
                                $result[$site['site_id']] = $site;
                        }
                        return $result;
                }

                function getnumberofsites()
                {
                        $sql = "SELECT COUNT(*) FROM phpgw_sitemgr_sites";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
                }

                function urltoid($url)
                {
                        $sql = "SELECT site_id FROM phpgw_sitemgr_sites WHERE 
site_url = '$url'";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f('site_id');
                }

                function read($id)
                {
                        $sql = "SELECT * from phpgw_sitemgr_sites WHERE site_id 
= $id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
                        {
                                foreach(
                                        array(
                                                'site_id', 'site_name', 
'site_url', 'site_dir', 'themesel', 
                                                'site_languages', 
'home_page_id', 'anonymous_user','anonymous_passwd'
                                        ) as $col
                                )
                                {
                                        $site[$col] = $this->db->f($col);
                                }
                                return $site;
                        }
                        else
                        {
                                return false;
                        }
                }

                function read2($id)
                {
                        $sql = "SELECT site_url,site_dir from 
phpgw_sitemgr_sites WHERE site_id = $id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
                        {
                                foreach(
                                        array(
                                                'site_url', 'site_dir'
                                        ) as $col
                                )
                                {
                                        $site[$col] = $this->db->f($col);
                                }
                                return $site;
                        }
                        else
                        {
                                return false;
                        }
                }

                function add($id,$site)
                {
                        $sql = "INSERT INTO phpgw_sitemgr_sites 
(site_id,site_name,site_url,site_dir,anonymous_user,anonymous_passwd) VALUES 
($id,'" . 
                                $site['name'] . "','" . $site['url'] . "','" . 
$site['dir'] . "','" . $site['anonuser'] . "','" . $site['anonpasswd'] .
                                "')";
                        $this->db->query($sql,__LINE__,__FILE__);
                }

                function update($id,$site)
                {
                        $sql = "UPDATE phpgw_sitemgr_sites SET site_name = '" . 
$site['name'] . "', site_url = '" . $site['url'] . "', site_dir = '" . 
                                $site['dir'] . "', anonymous_user = '" . 
$site['anonuser'] . "', anonymous_passwd = '" . $site['anonpasswd'] . 
                                "' WHERE site_id = $id";
                         $this->db->query($sql,__LINE__,__FILE__);
                }

                function delete($id)
                {
                        $sql = "DELETE FROM phpgw_sitemgr_sites WHERE site_id = 
$id";
                        $this->db->query($sql,__LINE__,__FILE__);
                }

                function saveprefs($prefs)
                {
                        $sql = "UPDATE phpgw_sitemgr_sites SET themesel = '" . 
$prefs['themesel'] . "', site_languages = '" . $prefs['site_languages'] .
                                "', home_page_id = " . $prefs['home_page_id'] . 
" WHERE site_id = " . CURRENT_SITE_ID;
                        $this->db->query($sql,__LINE__,__FILE__);
                }
        }
***** Error reading new file: [Errno 2] No such file or directory: 
'class.Sites_UI.inc.php'
Index: class.ACL_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.ACL_BO.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.ACL_BO.inc.php        17 Jan 2003 03:37:52 -0000      1.2
--- class.ACL_BO.inc.php        22 May 2003 02:36:53 -0000      1.3
***************
*** 10,13 ****
--- 10,15 ----
        
\***************************************************************************/
  
+ define('SITEMGR_ACL_IS_ADMIN',1);
+ 
        class ACL_BO
        {
***************
*** 22,27 ****
                        $this->logged_in_user = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->acct = 
CreateObject('phpgwapi.accounts',$this->logged_in_user);
-                       $this->acl = 
CreateObject('phpgwapi.acl',$this->logged_in_user);
                        $this->pages_so = CreateObject('sitemgr.Pages_SO');
                        $this->acl_so = CreateObject('sitemgr.ACL_SO');
                }
--- 24,29 ----
                        $this->logged_in_user = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->acct = 
CreateObject('phpgwapi.accounts',$this->logged_in_user);
                        $this->pages_so = CreateObject('sitemgr.Pages_SO');
+                       $this->acl = 
CreateObject('phpgwapi.acl',$this->logged_in_user);
                        $this->acl_so = CreateObject('sitemgr.ACL_SO');
                }
***************
*** 42,46 ****
                                //$this->acl = 
CreateObject('phpgwapi.acl',$this->logged_in_user);
                                //return 
($this->acl->get_rights('L'.$category_id,'sitemgr') & PHPGW_ACL_READ);
!                               return 
($this->acl_so->get_permission('L'.$category_id) & PHPGW_ACL_READ);
                        }
                        else
--- 44,48 ----
                                //$this->acl = 
CreateObject('phpgwapi.acl',$this->logged_in_user);
                                //return 
($this->acl->get_rights('L'.$category_id,'sitemgr') & PHPGW_ACL_READ);
!                               return 
($this->acl_so->get_permission('L'.$category_id) & PHPGW_ACL_READ);
                        }
                        else
***************
*** 50,60 ****
                }
  
!               function is_admin()
                {
!                       if($GLOBALS['phpgw']->acl->check('run',1,'admin'))
                        {
!                               define('HAS_ADMIN_RIGHTS',1);
                        }
!                       if(HAS_ADMIN_RIGHTS == 1)
                        {
                                return True;
--- 52,66 ----
                }
  
!               function is_admin($site_id=False,$account_id=False)
                {
!                       if (!$site_id)
                        {
!                               $site_id = CURRENT_SITE_ID;
                        }
!                       if (!$account_id)
!                       {
!                               $account_id = $this->logged_in_user;
!                       }
!                       if ($this->acl_so->get_rights($account_id,'L'.$site_id) 
& SITEMGR_ACL_IS_ADMIN)
                        {
                                return True;
***************
*** 66,69 ****
--- 72,102 ----
                }
  
+               function set_adminlist($site_id,$account_list)
+               {
+                       $this->remove_location($site_id);
+                       while (list($null,$account_id) = @each($account_list))
+                       {
+                               
$this->acl->add_repository('sitemgr','L'.$site_id,$account_id,SITEMGR_ACL_IS_ADMIN);
+                       }
+               }
+ 
+               function get_adminlist($site_id)
+               {
+                       $users = $this->acct->get_list($acct_type);
+ 
+                       $adminlist = Array();
+ 
+                       reset($users);
+                       while(list($k,$v) = each($users))
+                       {
+                               $account_id = $v['account_id'];
+                               if ($this->is_admin($site_id,$account_id))
+                               {
+                                       $adminlist[] = $account_id;
+                               }
+                       }
+                       return $adminlist;
+               }
+ 
                function remove_location($category_id)
                {
***************
*** 90,94 ****
                        }
  
-                       $this->acl = CreateObject('phpgwapi.acl',$user);
                        if ($rights == 0)
                        {
--- 123,126 ----
***************
*** 135,141 ****
                }
  
                function can_read_category($category_id)
                {
!                       if ($this->is_admin())
                        {
                                return true;
--- 167,175 ----
                }
  
+               //at there are only implicit permissions for the toplevel 
site_category, is this a problem?
+               //everybody can read it, only admins can write it. 
                function can_read_category($category_id)
                {
!                       if ($this->is_admin() || ($category_id == 
CURRENT_SITE_ID))
                        {
                                return true;
***************
*** 155,166 ****
                                return true;
                        }
!                       else
                        {
                                //$this->acl = 
CreateObject('phpgwapi.acl',$this->logged_in_user);
                                //return 
($this->acl->get_rights($account_id,'L'.$category_id) & PHPGW_ACL_ADD);
                                // if category_id = 0, we are in site-wide 
scope, and only admin can add content
!                               return $category_id ? 
!                                       
($this->acl_so->get_permission('L'.$category_id) & PHPGW_ACL_ADD) :
!                                       $this->is_admin();
                        }
                }
--- 189,202 ----
                                return true;
                        }
!                       elseif ($category_id != CURRENT_SITE_ID)
                        {
                                //$this->acl = 
CreateObject('phpgwapi.acl',$this->logged_in_user);
                                //return 
($this->acl->get_rights($account_id,'L'.$category_id) & PHPGW_ACL_ADD);
                                // if category_id = 0, we are in site-wide 
scope, and only admin can add content
!                               return 
$this->acl_so->get_permission('L'.$category_id) & PHPGW_ACL_ADD;
!                       }
!                       else
!                       {
!                               return False;
                        }
                }

Index: class.Categories_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_BO.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.Categories_BO.inc.php 17 Jan 2003 03:37:52 -0000      1.6
--- class.Categories_BO.inc.php 22 May 2003 02:36:53 -0000      1.7
***************
*** 23,44 ****
                }
  
!               function getPermittedCatReadNested($cat_id=0)
                {
                        return $this->getPermittedCatNested($cat_id,'read');
                }
!               function getPermittedCatWriteNested($cat_id=0)
                {
                        return $this->getPermittedCatNested($cat_id,'write');
                }
  
                // Don't call this function directly.  Use above funcs.
!               function getPermittedCatNested($cat_id=0,$check='')
                {
-                       if (!$check)
-                       {
-                               // You should use the getPermittedCatReadNested 
and WriteNested funcs
-                               die("Whatcha doin callin this function, 
Willis?");
-                       }
- 
                        $root_list = $this->so->getChildrenIDList($cat_id);
                        $permitted_list=array();
--- 23,46 ----
                }
  
!               function getPermittedCatReadNested($cat_id=False)
                {
+                       if (!$cat_id)
+                       {
+                               $cat_id = CURRENT_SITE_ID;
+                       }
                        return $this->getPermittedCatNested($cat_id,'read');
                }
!               function getPermittedCatWriteNested($cat_id=False)
                {
+                       if (!$cat_id)
+                       {
+                               $cat_id = CURRENT_SITE_ID;
+                       }
                        return $this->getPermittedCatNested($cat_id,'write');
                }
  
                // Don't call this function directly.  Use above funcs.
!               function getPermittedCatNested($cat_id,$check)
                {
                        $root_list = $this->so->getChildrenIDList($cat_id);
                        $permitted_list=array();
***************
*** 57,61 ****
                                        else
                                        {
!                                               die("What'd I tell you about 
calling this function?");
                                        }
  
--- 59,63 ----
                                        else
                                        {
!                                               die("Illegal call of function 
getPermittedCatNested");
                                        }
  
***************
*** 78,83 ****
  
                //the next two functions do not recurse!
!               function getPermittedCategoryIDWriteList($cat_id=0)
                {
                        $full_list = $this->so->getChildrenIDList($cat_id);
  
--- 80,90 ----
  
                //the next two functions do not recurse!
!               function getPermittedCategoryIDWriteList($cat_id=False)
                {
+                       if (!$cat_id)
+                       {
+                               $cat_id = CURRENT_SITE_ID;
+                       }
+ 
                        $full_list = $this->so->getChildrenIDList($cat_id);
  
***************
*** 96,101 ****
                }
  
!               function getPermittedCategoryIDReadList($cat_id=0)
                {
                        $full_list = $this->so->getChildrenIDList($cat_id);
                        
--- 103,112 ----
                }
  
!               function getPermittedCategoryIDReadList($cat_id=False)
                {
+                       if (!$cat_id)
+                       {
+                               $cat_id = CURRENT_SITE_ID;
+                       }
                        $full_list = $this->so->getChildrenIDList($cat_id);
                        
***************
*** 115,120 ****
                }
  
!               function addCategory($name, $description, $parent=0)            
                {
                        if ($GLOBALS['Common_BO']->acl->is_admin())
                        {
--- 126,136 ----
                }
  
!               function addCategory($name, $description, $parent=False)        
        
                {
+                       if (!$parent)
+                       {
+                               $parent = CURRENT_SITE_ID;
+                       }
+ 
                        if ($GLOBALS['Common_BO']->acl->is_admin())
                        {
***************
*** 127,134 ****
                }
  
!               function removeCategory($cat_id)
                {
!                       if ($GLOBALS['Common_BO']->acl->is_admin())
                        {
                                /********************************************\
                                * We have to remove the category, all the    *
--- 143,160 ----
                }
  
!               //$force for use by Sites_BO, since when we are editing the 
files list, the concept of admin of a current site does not apply
!               //$frecurse also removes subcats
!               function removeCategory($cat_id,$force=False,$recurse=False)
                {
!                       if ($GLOBALS['Common_BO']->acl->is_admin() || $force)
                        {
+                               if ($recurse)
+                               {
+                                       $children = 
$this->so->getChildrenIDList($cat_id);
+                                       while (list($null,$subcat) = 
@each($children))
+                                       {
+                                               
$this->removeCategory($subcat,$force,$recurse);
+                                       }
+                               }
                                /********************************************\
                                * We have to remove the category, all the    *
***************
*** 138,149 ****
                                $this->so->removeCategory($cat_id);
                                
$GLOBALS['Common_BO']->acl->remove_location($cat_id);
!                               
$GLOBALS['Common_BO']->pages->removePagesInCat($cat_id);
!                               
$GLOBALS['Common_BO']->content->removeBlocksInPageOrCat($cat_id,0);
                                return True;
                        }
                }
  
!               function saveCategoryInfo($cat_id, $cat_name, $cat_description, 
$lang, $sort_order=0, $parent=0, $old_parent=0)
                {
                        $cat_info = CreateObject('sitemgr.Category_SO', True);
                        $cat_info->id = $cat_id;
--- 164,179 ----
                                $this->so->removeCategory($cat_id);
                                
$GLOBALS['Common_BO']->acl->remove_location($cat_id);
!                               
$GLOBALS['Common_BO']->pages->removePagesInCat($cat_id,$force);
!                               
$GLOBALS['Common_BO']->content->removeBlocksInPageOrCat($cat_id,0,$force);
                                return True;
                        }
                }
  
!               function saveCategoryInfo($cat_id, $cat_name, $cat_description, 
$lang, $sort_order=0, $parent=False, $old_parent=False)
                {
+                       if (!$parent)
+                       {
+                               $parent = CURRENT_SITE_ID;
+                       }
                        $cat_info = CreateObject('sitemgr.Category_SO', True);
                        $cat_info->id = $cat_id;
***************
*** 152,163 ****
                        $cat_info->sort_order = $sort_order;
                        $cat_info->parent = $parent;
!                       if ($old_parent!='')
!                       {
!                               $cat_info->old_parent = $old_parent;
!                       }
!                       else
!                       {
!                               $cat_info->old_parent = $parent;
!                       }
  
                        if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
--- 182,186 ----
                        $cat_info->sort_order = $sort_order;
                        $cat_info->parent = $parent;
!                       $cat_info->old_parent = $old_parent ? $old_parent : 
$parent;
  
                        if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
***************
*** 202,207 ****
                function getCategoryancestorids($cat_id,$permittedonly=False)
                {
                        $result = array();
!                       while ($cat_id != 0)
                        {
                                if (!$permittedonly || 
$GLOBALS['Common_BO']->acl->can_read_category($cat_id))
--- 225,231 ----
                function getCategoryancestorids($cat_id,$permittedonly=False)
                {
+                       $cat_id = $cat_id ? $cat_id : CURRENT_SITE_ID;
                        $result = array();
!                       while ($cat_id != CURRENT_SITE_ID)
                        {
                                if (!$permittedonly || 
$GLOBALS['Common_BO']->acl->can_read_category($cat_id))

Index: class.Categories_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_SO.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.Categories_SO.inc.php 28 Jan 2003 20:00:00 -0000      1.13
--- class.Categories_SO.inc.php 22 May 2003 02:36:53 -0000      1.14
***************
*** 4,24 ****
                var $cats;
                var $db;
                
                function Categories_SO()
                {
                        $this->cats = 
CreateObject('phpgwapi.categories',-1,'sitemgr');
!                       $this->db = $GLOBALS['phpgw']->db;
                }
  
!               function getChildrenIDList($parent=0)
                {
!                       if ($parent)
!                       {
!                               $cats = 
$this->cats->return_array('all','',False,'','','',False,$parent);
!                       }
!                       else
!                       {
!                               $cats = 
$this->cats->return_array('mains','',False,'','','',False, 0);
!                       }
                        while (list(,$subs) = @each($cats))
                        {
--- 4,19 ----
                var $cats;
                var $db;
+               var $site_id;
                
                function Categories_SO()
                {
                        $this->cats = 
CreateObject('phpgwapi.categories',-1,'sitemgr');
!                       $this->db = $GLOBALS['phpgw']->db;                      
 
                }
  
!               function getChildrenIDList($parent)
                {
!                       $cats = 
$this->cats->return_array('all','',False,'','','',False,$parent);
! 
                        while (list(,$subs) = @each($cats))
                        {
***************
*** 31,46 ****
                }
  
!               function getFullCategoryIDList()
!               {
!                       $cats = 
$this->cats->return_array('all','',False,'','','',False);
! 
!                       while (list(,$cat) = @each($cats))
!                       {
!                               $cat_id_list[] = $cat['id'];
!                       }
!                       return $cat_id_list;
!               }
  
!               function addCategory($name, $description, $parent = '')
                {
                        $data = array
--- 26,42 ----
                }
  
! //this does not seem to be called anywhere
! //            function getFullCategoryIDList()
! //            {
! //                    $cats = 
$this->cats->return_array('all','',False,'','','',False);
! 
! //                    while (list(,$cat) = @each($cats))
! //                    {
! //                            $cat_id_list[] = $cat['id'];
! //                    }
! //                    return $cat_id_list;
! //            }
  
!               function addCategory($name, $description, $parent = False)
                {
                        $data = array
***************
*** 59,62 ****
--- 55,60 ----
                {
                        $this->cats->delete($cat_id,False,True);
+                       $sql = "DELETE FROM phpgw_sitemgr_categories_lang WHERE 
cat_id = $cat_id";
+                       $this->db->query($sql, __LINE__,__FILE__);
                        return True;
                }
***************
*** 79,93 ****
  
                function saveCategoryLang($cat_id, $cat_name, $cat_description, 
$lang)
!                 {
!                   $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'", 
__LINE__,__FILE__);
!                   if ($this->db->next_record())
!                     {
!                       $this->db->query("UPDATE phpgw_sitemgr_categories_lang 
SET name='$cat_name', description='$cat_description' WHERE cat_id='$cat_id' and 
lang='$lang'", __LINE__,__FILE__);
!                     }
!                   else
!                     {
!                       $this->db->query("INSERT INTO 
phpgw_sitemgr_categories_lang (cat_id,lang,name,description) VALUES 
('$cat_id','$lang','$cat_name','$cat_description')", __LINE__,__FILE__);
!                     }
!                 }
  
                function getlangarrayforcategory($cat_id)
--- 77,91 ----
  
                function saveCategoryLang($cat_id, $cat_name, $cat_description, 
$lang)
!               {
!                       $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'", 
__LINE__,__FILE__);
!                       if ($this->db->next_record())
!                       {
!                               $this->db->query("UPDATE 
phpgw_sitemgr_categories_lang SET name='$cat_name', 
description='$cat_description' WHERE cat_id='$cat_id' and lang='$lang'", 
__LINE__,__FILE__);
!                       }
!                       else
!                       {
!                               $this->db->query("INSERT INTO 
phpgw_sitemgr_categories_lang (cat_id,lang,name,description) VALUES 
('$cat_id','$lang','$cat_name','$cat_description')", __LINE__,__FILE__);
!                       }
!               }
  
                function getlangarrayforcategory($cat_id)
***************
*** 118,150 ****
                                
                                if ($lang)
!                                 {
!                                   $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'");
!                                   if ($this->db->next_record())
!                                     {
!                                       $cat_info->name        = 
$this->db->f('name');
!                                       $cat_info->description = 
$this->db->f('description');
!                                     }
!                                   else
!                                     {
!                                       //return False;
!                                       $cat_info->name        = lang("not yet 
translated");
!                                     }
!                                 }
  
                                //if there is no lang argument we return the 
content in whatever languages turns up first
                                else
!                                 {
!                                   $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id'");
!                                   if ($this->db->next_record())
!                                     {
!                                       $cat_info->name        = 
$this->db->f('name');
!                                       $cat_info->description = 
$this->db->f('description');
!                                       $cat_info->lang = $this->db->f('lang');
!                                     }
!                                   else
!                                     {
!                                       $cat_info->name = "This category has no 
data in any langugage: this should not happen";
!                                     }
!                                 }
                                
                                return $cat_info;
--- 116,148 ----
                                
                                if ($lang)
!                               {
!                                       $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'");
!                                       if ($this->db->next_record())
!                                       {
!                                               $cat_info->name = 
$this->db->f('name');
!                                               $cat_info->description = 
$this->db->f('description');
!                                       }
!                                       else
!                                       {
!                                               //return False;
!                                               $cat_info->name = lang("not yet 
translated");
!                                       }
!                               }
  
                                //if there is no lang argument we return the 
content in whatever languages turns up first
                                else
!                               {
!                                       $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id'");
!                                       if ($this->db->next_record())
!                                       {
!                                               $cat_info->name = 
$this->db->f('name');
!                                               $cat_info->description = 
$this->db->f('description');
!                                               $cat_info->lang = 
$this->db->f('lang');
!                                       }
!                                       else
!                                       {
!                                               $cat_info->name = "This 
category has no data in any langugage: this should not happen";
!                                       }
!                               }
                                
                                return $cat_info;

Index: class.Categories_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_UI.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.Categories_UI.inc.php 17 Jan 2003 03:37:52 -0000      1.1
--- class.Categories_UI.inc.php 22 May 2003 02:36:53 -0000      1.2
***************
*** 36,41 ****
                        $this->acl = $GLOBALS['Common_BO']->acl;
                        $this->isadmin = $this->acl->is_admin();
!                       $preferenceso = 
CreateObject('sitemgr.sitePreference_SO', true);
!                       $this->sitelanguages = 
explode(',',$preferenceso->getPreference('sitelanguages'));
                }
  
--- 36,40 ----
                        $this->acl = $GLOBALS['Common_BO']->acl;
                        $this->isadmin = $this->acl->is_admin();
!                       $this->sitelanguages = 
explode(',',$GLOBALS['Common_BO']->sites->current_site['site_languages']);
                }
  

Index: class.Common_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_BO.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.Common_BO.inc.php     4 Apr 2003 18:35:51 -0000       1.2
--- class.Common_BO.inc.php     22 May 2003 02:36:53 -0000      1.3
***************
*** 7,10 ****
--- 7,11 ----
                function Common_BO()
                {
+                       $this->sites = CreateObject('sitemgr.Sites_BO',True);
                        $this->acl = CreateObject('sitemgr.ACL_BO',True);
                        $this->theme = CreateObject('sitemgr.Theme_BO',True);
***************
*** 13,17 ****
                        $this->content = 
CreateObject('sitemgr.Content_BO',True);
                        $this->modules = 
CreateObject('sitemgr.Modules_BO',True);
!                       $this->headerfooter = 
CreateObject('sitemgr.headerFooter_BO', True);
                }
  
--- 14,18 ----
                        $this->content = 
CreateObject('sitemgr.Content_BO',True);
                        $this->modules = 
CreateObject('sitemgr.Modules_BO',True);
! //                    $this->headerfooter = 
CreateObject('sitemgr.headerFooter_BO', True);
                }
  

Index: class.Common_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_UI.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.Common_UI.inc.php     3 May 2003 21:08:11 -0000       1.9
--- class.Common_UI.inc.php     22 May 2003 02:36:53 -0000      1.10
***************
*** 12,16 ****
        class Common_UI
        {
!               var $t, $acl, $theme, $prefs_so;
                var $public_functions = array
                (
--- 12,16 ----
        class Common_UI
        {
!               var $t, $acl, $theme, $do_sites_exist;
                var $public_functions = array
                (
***************
*** 21,29 ****
                {
                        global $Common_BO;
!                       $Common_BO = CreateObject('sitemgr.Common_BO',True);
                        $this->t = $GLOBALS['phpgw']->template;
                        $this->acl = &$Common_BO->acl;
                        $this->theme = &$Common_BO->theme;
-                       $this->prefs_so = 
CreateObject('sitemgr.sitePreference_SO', True);
                        $this->pages_bo = &$Common_BO->pages;
                        $this->cat_bo = &$Common_BO->cats;
--- 21,29 ----
                {
                        global $Common_BO;
!                       $Common_BO = CreateObject('sitemgr.Common_BO');
!                       $this->do_sites_exist = 
$Common_BO->sites->set_currentsite(False);
                        $this->t = $GLOBALS['phpgw']->template;
                        $this->acl = &$Common_BO->acl;
                        $this->theme = &$Common_BO->theme;
                        $this->pages_bo = &$Common_BO->pages;
                        $this->cat_bo = &$Common_BO->cats;
***************
*** 51,55 ****
                                                                        
$GLOBALS['Common_BO']->getlangname($oldlang),
                                                                        
$GLOBALS['Common_BO']->getlangname($newlang)) . 
!                                                         '</b><br>';
                                                        
$this->pages_bo->migratealllang($oldlang,$newlang);
                                                        
$this->cat_bo->migratealllang($oldlang,$newlang);
--- 51,55 ----
                                                                        
$GLOBALS['Common_BO']->getlangname($oldlang),
                                                                        
$GLOBALS['Common_BO']->getlangname($newlang)) . 
!                                                       '</b><br>';
                                                        
$this->pages_bo->migratealllang($oldlang,$newlang);
                                                        
$this->cat_bo->migratealllang($oldlang,$newlang);
***************
*** 62,73 ****
                                {
                                        $preferences = array(
!                                               
'sitemgr-site-url','sitemgr-site-dir','home-page-id',
!                                               
'anonymous-user','anonymous-passwd','themesel','sitelanguages');
  
!                                       $oldsitelanguages = 
$this->prefs_so->getPreference('sitelanguages');
!                                       if ($oldsitelanguages && 
($oldsitelanguages != $_POST['sitelanguages']))
                                        {
                                                $oldsitelanguages = 
explode(',',$oldsitelanguages);
!                                               $newsitelanguages = 
explode(',',$_POST['sitelanguages']);
                                                $replacedlang = 
array_diff($oldsitelanguages,$newsitelanguages);
                                                $addedlang = 
array_diff($newsitelanguages,$oldsitelanguages);
--- 62,72 ----
                                {
                                        $preferences = array(
!                                               
'home_page_id','themesel','site_languages');
  
!                                       $oldsitelanguages = 
$GLOBALS['Common_BO']->sites->current_site['site_languages'];
!                                       if ($oldsitelanguages && 
($oldsitelanguages != $_POST['pref']['site_languages']))
                                        {
                                                $oldsitelanguages = 
explode(',',$oldsitelanguages);
!                                               $newsitelanguages = 
explode(',',$_POST['pref']['site_languages']);
                                                $replacedlang = 
array_diff($oldsitelanguages,$newsitelanguages);
                                                $addedlang = 
array_diff($newsitelanguages,$oldsitelanguages);
***************
*** 75,79 ****
                                                {
                                                        echo lang('You removed 
one ore more languages from your site languages.') . '<br>' .
!                                                         lang('What do you 
want to do with existing translations of categories and pages for this 
language?') . '<br>';
                                                        if ($addedlang)
                                                        {
--- 74,78 ----
                                                {
                                                        echo lang('You removed 
one ore more languages from your site languages.') . '<br>' .
!                                                       lang('What do you want 
to do with existing translations of categories and pages for this language?') . 
'<br>';
                                                        if ($addedlang)
                                                        {
***************
*** 85,90 ****
                                                        }
                                                        echo '<form action="' . 
!                                                         
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs')
 .
!                                                         '" 
method="post"><table>';
                                                        foreach ($replacedlang 
as $oldlang)
                                                        {
--- 84,89 ----
                                                        }
                                                        echo '<form action="' . 
!                                                       
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs')
 .
!                                                       '" 
method="post"><table>';
                                                        foreach ($replacedlang 
as $oldlang)
                                                        {
***************
*** 96,101 ****
                                                                        {
                                                                                
echo '<td><input type="radio" name="change[' . $oldlang . 
!                                                                               
  ']" value="' . $newlang . '"> Migrate to ' . 
!                                                                               
  $GLOBALS['Common_BO']->getlangname($newlang) . "</td>";
                                                                        }
                                                                }
--- 95,100 ----
                                                                        {
                                                                                
echo '<td><input type="radio" name="change[' . $oldlang . 
!                                                                               
']" value="' . $newlang . '"> Migrate to ' . 
!                                                                               
$GLOBALS['Common_BO']->getlangname($newlang) . "</td>";
                                                                        }
                                                                }
***************
*** 103,107 ****
                                                        }
                                                        echo '<tr><td><input 
type="submit" name="btnlangchange" value="' . 
!                                                         lang('Submit') . 
'"></td></tr></table></form>';
                                                }
                                        }
--- 102,106 ----
                                                        }
                                                        echo '<tr><td><input 
type="submit" name="btnlangchange" value="' . 
!                                                       lang('Submit') . 
'"></td></tr></table></form>';
                                                }
                                        }
***************
*** 113,145 ****
                                        }
  
!                                       foreach ($preferences as $name)
!                                       {
!                                               
$this->prefs_so->setPreference($name,$_POST[$name]);
!                                       }
                                        echo '<p><b>' . lang('Changes Saved.') 
. '</b></p>';
                                        unset($preferences);
                                }
                                
!                               $sitelanguages = 
explode(',',$this->prefs_so->getPreference('sitelanguages'));
                                $sitelanguages = $sitelanguages ? 
$sitelanguages : array("en");
                                
                                foreach ($sitelanguages as $lang)
!                                 {
!                                   $preferences['sitemgr-site-name-' . $lang] 
= array(
!                                       'title'=>lang('Site name'). ' ' . 
$GLOBALS['Common_BO']->getlangname($lang),
!                                       'note'=>lang('This is used chiefly for 
meta data and the title bar. If you change the site languages below you have to 
save before being able to set this preference for a new language.'),
!                                       'default'=>lang('New sitemgr site')
!                                   );
!                                 }
! 
!                               $preferences['sitemgr-site-url']=array(
!                                       'title'=>lang('URL to sitemgr-site'),
!                                       'note'=>lang('The URL can be relative 
or absolute.  Name must end in a slash.')
!                               );
!                               $preferences['sitemgr-site-dir']=array(
!                                       'title'=>lang('Filesystem path to 
sitemgr-site directory'),
!                                       'note'=>lang('This must be an absolute 
directory location.  <b>No trailing slash</b>.')
!                               );
!                               $preferences['home-page-id'] = array(
                                        'title'=>lang('Default home page ID 
number'),
                                        'note'=>lang('This should be a page 
that is readable by everyone. If you leave this blank, the site index will be 
shown by default.'),
--- 112,139 ----
                                        }
  
!                                       
$GLOBALS['Common_BO']->sites->saveprefs($_POST['pref']);
! 
                                        echo '<p><b>' . lang('Changes Saved.') 
. '</b></p>';
                                        unset($preferences);
                                }
                                
!                               $sitelanguages = 
explode(',',$GLOBALS['Common_BO']->sites->current_site['site_languages']);
                                $sitelanguages = $sitelanguages ? 
$sitelanguages : array("en");
                                
                                foreach ($sitelanguages as $lang)
!                               {
!                                       $langname = 
$GLOBALS['Common_BO']->getlangname($lang);
!                                       $preferences['site_name_' . $lang] = 
array(
!                                               'title'=>lang('Site name'). ' ' 
. $langname,
!                                               'note'=>lang('This is used 
chiefly for meta data and the title bar. If you change the site languages below 
you have to save before being able to set this preference for a new language.'),
!                                               'default'=>lang('New sitemgr 
site')
!                                       );
!                                        $preferences['site_desc_' . $lang] = 
array(
!                                               'title'=>lang('Site 
descriptioin'). ' ' . $langname,
!                                               'note'=>lang('This is used 
chiefly for meta data. If you change the site languages below you have to save 
before being able to set this preference for a new language.'),
!                                       );
!                               }
! 
!                               $preferences['home_page_id'] = array(
                                        'title'=>lang('Default home page ID 
number'),
                                        'note'=>lang('This should be a page 
that is readable by everyone. If you leave this blank, the site index will be 
shown by default.'),
***************
*** 147,166 ****
                                        
'options'=>$this->pages_bo->getPageOptionList()
                                );
- // this does not seem to be used anywhere
- //                            $preferences['login-domain'] = array(
- //                                    'title'=>lang('Anonymous user login 
domain'),
- //                                    'note'=>'If you\'re not sure, enter 
Default.',
- //                                    'default'=>'Default'
- //                            );
-                               $preferences['anonymous-user'] = array(
-                                       'title'=>lang('Anonymous user\'s 
username'),
-                                       'note'=>lang('If you haven\'t done so 
already, create a user that will be used for public viewing of the site.  
Recommended name: anonymous.'),
-                                       'default'=>'anonymous'
-                               );
-                               $preferences['anonymous-passwd'] = array(
-                                       'title'=>lang('Anonymous user\'s 
password'),
-                                       'note'=>lang('Password that you 
assigned for the aonymous user account.'),
-                                       'default'=>'anonymous'
-                               );
                                $preferences['themesel'] = array(
                                        'title'=>lang('Template select'),
--- 141,144 ----
***************
*** 170,174 ****
                                        'default'=>'NukeNews'
                                );
!                               $preferences['sitelanguages'] = array(
                                        'title'=>lang('Languages the site user 
can choose from'),
                                        'note'=>lang('This should be a 
comma-separated list of language-codes.'),
--- 148,152 ----
                                        'default'=>'NukeNews'
                                );
!                               $preferences['site_languages'] = array(
                                        'title'=>lang('Languages the site user 
can choose from'),
                                        'note'=>lang('This should be a 
comma-separated list of language-codes.'),
***************
*** 187,191 ****
                                                        'lang_edit_config_inc}' 
=> lang('The config.inc.php file needs to be edited to point to the 
phpGroupWare directory. Copy the config.inc.php.template file to config.inc.php 
and then edit it.')
                                ));
!                                                      
                                
$this->t->set_block('sitemgr_prefs','PrefBlock','PBlock');
                                reset($preferences);
--- 165,169 ----
                                                        'lang_edit_config_inc}' 
=> lang('The config.inc.php file needs to be edited to point to the 
phpGroupWare directory. Copy the config.inc.php.template file to config.inc.php 
and then edit it.')
                                ));
! 
                                
$this->t->set_block('sitemgr_prefs','PrefBlock','PBlock');
                                reset($preferences);
***************
*** 227,231 ****
                                $size=40;
                        }
!                       $val = $this->prefs_so->getPreference($name);
                        if (!$val)
                        {
--- 205,209 ----
                                $size=40;
                        }
!                       $val = 
$GLOBALS['Common_BO']->sites->current_site[$name];
                        if (!$val)
                        {
***************
*** 234,243 ****
  
                        return '<input type="text" size="'.$size.
!                               '" name="'.$name.'" value="'.$val.'">';
                }
  
                function inputCheck($name = '')
                {
!                       $val = $this->prefs_so->getPreference($name);
                        if ($val)
                        {
--- 212,221 ----
  
                        return '<input type="text" size="'.$size.
!                               '" name="pref['.$name.']" value="'.$val.'">';
                }
  
                function inputCheck($name = '')
                {
!                       $val = 
$GLOBALS['Common_BO']->sites->current_site[$name];
                        if ($val)
                        {
***************
*** 250,254 ****
                                $checked_no = ' CHECKED';
                        }
!                       return '<INPUT TYPE="radio" NAME="'.$name.'" VALUE="1"'.
                                $checked_yes.'>Yes</INPUT>'."\n".
                                '<INPUT TYPE="radio" NAME="'.$name.'" 
VALUE="0"'.
--- 228,232 ----
                                $checked_no = ' CHECKED';
                        }
!                       return '<INPUT TYPE="radio" NAME="pref['.$name.']" 
VALUE="1"'.
                                $checked_yes.'>Yes</INPUT>'."\n".
                                '<INPUT TYPE="radio" NAME="'.$name.'" 
VALUE="0"'.
***************
*** 263,272 ****
                                return lang('No options available.');
                        }
!                       $val = $this->prefs_so->getPreference($name);
                        if(!$val)
                        {
                                $val = $default;
                        }
!                       $returnValue = '<SELECT NAME="'.$name.'">'."\n";
                        
                        foreach($options as $option)
--- 241,250 ----
                                return lang('No options available.');
                        }
!                       $val = 
$GLOBALS['Common_BO']->sites->current_site[$name];
                        if(!$val)
                        {
                                $val = $default;
                        }
!                       $returnValue = '<SELECT NAME="pref['.$name.']">'."\n";
                        
                        foreach($options as $option)
***************
*** 298,317 ****
                        echo parse_navbar();
                        
$this->t->set_file('sitemgr_header','sitemgr_header.tpl');
!                       $this->t->set_var('mainmenu',
!                               $GLOBALS['phpgw']->link('/index.php',
!                               'menuaction=sitemgr.MainMenu_UI.DisplayMenu')
!                       );
!                       $this->t->set_var('sitemgr-site', 
$GLOBALS['phpgw']->link('/sitemgr-link/'));
!                       $this->t->set_var(Array('sitemgr_administration' => 
lang('Web Content Manager Administration'),
!                                               'view_menu' => lang('View 
Administrative Menu'),
!                                               'view_site' => lang('View 
Generated Site')
!                       ));
!                       $this->t->pfp('out','sitemgr_header');
                }
  
                function DisplayFooter()
                {
                        
$this->t->set_file('sitemgr_footer','sitemgr_footer.tpl');
                        $this->t->pfp('out','sitemgr_footer');
                }
        }       
--- 276,325 ----
                        echo parse_navbar();
                        
$this->t->set_file('sitemgr_header','sitemgr_header.tpl');
!                       
$this->t->set_block('sitemgr_header','switch','switchhandle');
!                       if ($this->do_sites_exist)
!                       {
!                               $this->t->set_var(Array(
!                                       'mainmenu' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.MainMenu_UI.DisplayMenu'),
!                                       'sitemgr-site' => 
$GLOBALS['phpgw']->link('/sitemgr-link/'),
!                                       'sitemgr_administration' => lang('Web 
Content Manager Administration'),
!                                       'lang_sitename' => lang('Website name'),
!                                       'sitename' => 
$GLOBALS['Common_BO']->sites->current_site['site_name'],
!                                       'view_menu' => lang('View 
Administrative Menu'),
!                                       'view_site' => lang('View Generated 
Site')
!                               ));
!                               if 
($GLOBALS['Common_BO']->sites->getnumberofsites() > 1)
!                               {
!                                       
$this->t->set_var('sitelist',$this->siteselectlist());
!                                       
$this->t->parse('switchhandle','switch');
!                               }
!                               else
!                               {
!                                       $this->t->set_var('switchhandle','');
!                               }
!                               $this->t->pparse('out','sitemgr_header');
!                       }
!                       else
!                       {
!                               echo lang('No websites defined');
!                               $GLOBALS['phpgw']->common->phpgw_exit(True);
!                       }
                }
  
                function DisplayFooter()
                {
+ echo (int)substr($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],4);
                        
$this->t->set_file('sitemgr_footer','sitemgr_footer.tpl');
                        $this->t->pfp('out','sitemgr_footer');
+               }
+ 
+               function siteselectlist()
+               {
+                       $sites = 
$GLOBALS['Common_BO']->sites->list_sites(False);
+                       $selectlist= '<option>' . lang('Switch website') . 
'</option>';
+                       while(list($site_id,$site) = @each($sites))
+                       {
+                               $selectlist .= '<option value="' . $site_id . 
'">' . $site['site_name'] . '</option>' . "\n";
+                       }
+                       return $selectlist;
                }
        }       

Index: class.Content_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_BO.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.Content_BO.inc.php    4 Mar 2003 17:26:43 -0000       1.2
--- class.Content_BO.inc.php    22 May 2003 02:36:53 -0000      1.3
***************
*** 10,24 ****
                {
                        $this->so = CreateObject('sitemgr.Content_SO', true);
-                       $prefs_so = CreateObject('sitemgr.sitePreference_SO', 
True);
-                       $sitemgr_dir = 
$prefs_so->getPreference('sitemgr-site-dir');
-                       $themesel = $prefs_so->getPreference('themesel');
-                       $this->templatefile = $sitemgr_dir . SEP . 'templates' 
. SEP . $themesel . SEP . 'main.tpl';
                }
  
                function getContentAreas()
                {
!                       $str = implode('', @file($this->templatefile));
!                       preg_match_all("/\{contentarea:([^{ 
]+)\}/",$str,$matches);
!                       return $matches[1];
                }
  
--- 10,36 ----
                {
                        $this->so = CreateObject('sitemgr.Content_SO', true);
                }
  
                function getContentAreas()
                {
!                       $templatefile =  
$GLOBALS['Common_BO']->sites->current_site['site_dir'] .  SEP . 'templates' . 
!                               SEP . 
$GLOBALS['Common_BO']->sites->current_site['themesel'] . SEP . 'main.tpl';
! 
!                       if (file_exists($templatefile))
!                       {
!                               $str = implode('', @file($templatefile));
!                               if (preg_match_all("/\{contentarea:([^{ 
]+)\}/",$str,$matches))
!                               {
!                                       return $matches[1];
!                               }
!                               else
!                               {
!                                       return lang('No content areas found in 
selected template');
!                               }
!                       }
!                       else
!                       {
!                               return lang('No template file found.');
!                       }
                }
  
***************
*** 41,57 ****
                }
  
!               function removeBlocksInPageOrCat($cat_id,$page_id)
                {
                        $blocks = 
$this->so->getblocksforscope($cat_id,$page_id);
                        while(list($blockid,) = each($blocks))
                        {
!                               $this->removeblock($blockid);
                        }
                }
  
!               function removeblock($blockid)
                {
                        $block = $this->so->getblockdef($blockid);
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($block->cat_id))
                        {
                                return $this->so->removeblock($blockid);
--- 53,70 ----
                }
  
!               function removeBlocksInPageOrCat($cat_id,$page_id,$force=False)
                {
                        $blocks = 
$this->so->getblocksforscope($cat_id,$page_id);
                        while(list($blockid,) = each($blocks))
                        {
!                               $this->removeblock($blockid,$force);
                        }
                }
  
!               function removeblock($blockid,$force=False)
                {
                        $block = $this->so->getblockdef($blockid);
! 
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($block->cat_id) || $force)
                        {
                                return $this->so->removeblock($blockid);
***************
*** 63,68 ****
                }
  
!               //the next two functions retrieves all blocks for a certain 
area, if cat_id and page_id are 0, only site-wide blocks are retrieved.
!               //if cat_id is non zero and page_id is 0, site-wide blocks and 
all blocks for the category and all its ancestor categories are retrieved.
                //if page_id is non zero, cat_id should be the page's category. 
Page blocks + category blocks + site blocks are retrieved.
                function getvisibleblockdefsforarea($area,$cat_id,$page_id)
--- 76,81 ----
                }
  
!               //the next two functions retrieves all blocks for a certain 
area, if (cat_id = $site_id and page_id = 0), only site-wide blocks are 
retrieved.
!               //if (cat_id != $site_id and page_id is 0), site-wide blocks 
and all blocks for the category and all its ancestor categories are retrieved.
                //if page_id is non zero, cat_id should be the page's category. 
Page blocks + category blocks + site blocks are retrieved.
                function getvisibleblockdefsforarea($area,$cat_id,$page_id)

Index: class.Content_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_SO.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.Content_SO.inc.php    10 Mar 2003 07:00:41 -0000      1.6
--- class.Content_SO.inc.php    22 May 2003 02:36:53 -0000      1.7
***************
*** 64,68 ****
                                . " phpgw_sitemgr_modules AS t2 on 
t1.module_id=t2.module_id LEFT JOIN "
                                . " phpgw_sitemgr_content_lang as t3 ON 
(t1.block_id=t3.block_id AND lang='$lang') "
!                               . " WHERE area = '$area' AND ((page_id = 0 and 
cat_id = 0)";
                        if ($cat_list)
                        {
--- 64,68 ----
                                . " phpgw_sitemgr_modules AS t2 on 
t1.module_id=t2.module_id LEFT JOIN "
                                . " phpgw_sitemgr_content_lang as t3 ON 
(t1.block_id=t3.block_id AND lang='$lang') "
!                               . " WHERE area = '$area' AND ((page_id = 0 and 
cat_id = ". CURRENT_SITE_ID  . ")";
                        if ($cat_list)
                        {
***************
*** 103,107 ****
                function getvisibleblockdefsforarea($area,$cat_list,$page_id)
                {
!                       $sql = "SELECT 
t1.block_id,area,cat_id,page_id,t1.module_id,module_name,viewable FROM 
phpgw_sitemgr_content AS t1,phpgw_sitemgr_modules AS t2 WHERE t1.module_id = 
t2.module_id AND area = '$area' AND  ((page_id = 0 and cat_id = 0)";
                        if ($cat_list)
                        {
--- 103,107 ----
                function getvisibleblockdefsforarea($area,$cat_list,$page_id)
                {
!                       $sql = "SELECT 
t1.block_id,area,cat_id,page_id,t1.module_id,module_name,viewable FROM 
phpgw_sitemgr_content AS t1,phpgw_sitemgr_modules AS t2 WHERE t1.module_id = 
t2.module_id AND area = '$area' AND  ((page_id = 0 and cat_id = ". 
CURRENT_SITE_ID  . ")";
                        if ($cat_list)
                        {

Index: class.Content_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_UI.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.Content_UI.inc.php    3 May 2003 21:08:11 -0000       1.4
--- class.Content_UI.inc.php    22 May 2003 02:36:53 -0000      1.5
***************
*** 31,36 ****
                                '3' => lang('anonymous')
                        );
!                       $preferenceso = 
CreateObject('sitemgr.sitePreference_SO', true);
!                       $this->sitelanguages = 
explode(',',$preferenceso->getPreference('sitelanguages'));
                        $sessionlang = 
$GLOBALS['phpgw']->session->appsession('worklanguage','sitemgr');
                        $this->worklanguage = $sessionlang ? $sessionlang : 
$this->sitelanguages[0];
--- 31,35 ----
                                '3' => lang('anonymous')
                        );
!                       $this->sitelanguages = 
explode(',',$GLOBALS['Common_BO']->sites->current_site['site_languages']);
                        $sessionlang = 
$GLOBALS['phpgw']->session->appsession('worklanguage','sitemgr');
                        $this->worklanguage = $sessionlang ? $sessionlang : 
$this->sitelanguages[0];
***************
*** 46,50 ****
                        $page_id = $_GET['page_id'];
                        $cat_id = $_GET['cat_id'];
-                       $scopename = $page_id ? lang('Page') : ($cat_id ? 
lang('Category') : lang('Site'));
  
                        if ($page_id)
--- 45,48 ----
***************
*** 57,61 ****
                                $scopename = lang('Page');
                        }
!                       elseif ($cat_id)
                        {
                                $cat = 
$GLOBALS['Common_BO']->cats->getCategory($cat_id);
--- 55,59 ----
                                $scopename = lang('Page');
                        }
!                       elseif ($cat_id != CURRENT_SITE_ID)
                        {
                                $cat = 
$GLOBALS['Common_BO']->cats->getCategory($cat_id);
***************
*** 68,73 ****
                        else
                        {
-                               $cat_id = 0;
                                $page_id = 0;
                        }
  
--- 66,71 ----
                        else
                        {
                                $page_id = 0;
+                               $scopename = lang('Site');
                        }
  
***************
*** 145,149 ****
  
                        $contentareas = $this->bo->getContentAreas();
!                       if ($contentareas)
                        {
                                $this->t->set_var('help', lang('You can 
override each content blocks default title. Be aware that not in all content 
areas the block title will be visible.'));
--- 143,147 ----
  
                        $contentareas = $this->bo->getContentAreas();
!                       if (is_array($contentareas))
                        {
                                $this->t->set_var('help', lang('You can 
override each content blocks default title. Be aware that not in all content 
areas the block title will be visible.'));
***************
*** 311,315 ****
                        else
                        {
!                               $this->t->set_var('CBlock',lang('No content 
areas found in selected template'));
                        }
                        $this->t->pfp('out', 'Managecontent');
--- 309,313 ----
                        else
                        {
!                               $this->t->set_var('CBlock',$contentareas);
                        }
                        $this->t->pfp('out', 'Managecontent');

Index: class.MainMenu_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.MainMenu_UI.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.MainMenu_UI.inc.php   17 Jan 2003 03:37:52 -0000      1.6
--- class.MainMenu_UI.inc.php   22 May 2003 02:36:53 -0000      1.7
***************
*** 51,58 ****
                                        'lang_managesitemodules' => 
lang('Manage site-wide module properties'),
                                        'lang_managesitecontent' => 
lang('Manage Site Content'),
!                                       'headerandfooter' => 
$GLOBALS['phpgw']->link('/index.php', 
'menuaction=sitemgr.SiteContent_UI._editHeaderAndFooter'),
                                        'setup' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs')
                                ));
!                               $link_data['cat_id'] = 0;
                                $link_data['menuaction'] = 
"sitemgr.Modules_UI._manageModules";
                                
$this->t->set_var('managesitemodules',$GLOBALS['phpgw']->link('/index.php',$link_data));
--- 51,58 ----
                                        'lang_managesitemodules' => 
lang('Manage site-wide module properties'),
                                        'lang_managesitecontent' => 
lang('Manage Site Content'),
! //                                    'headerandfooter' => 
$GLOBALS['phpgw']->link('/index.php', 
'menuaction=sitemgr.SiteContent_UI._editHeaderAndFooter'),
                                        'setup' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs')
                                ));
!                               $link_data['cat_id'] = CURRENT_SITE_ID;
                                $link_data['menuaction'] = 
"sitemgr.Modules_UI._manageModules";
                                
$this->t->set_var('managesitemodules',$GLOBALS['phpgw']->link('/index.php',$link_data));

Index: class.Pages_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_BO.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.Pages_BO.inc.php      18 Jan 2003 04:30:34 -0000      1.5
--- class.Pages_BO.inc.php      22 May 2003 02:36:53 -0000      1.6
***************
*** 12,16 ****
                {
                        $pagelist = $this->pageso->getPageIDList();
!                       $retval[]=array('value'=>'','display'=>'[' .lang('Show 
Site Index') . ']');
                        foreach($pagelist as $page_id)
                        {
--- 12,16 ----
                {
                        $pagelist = $this->pageso->getPageIDList();
!                       $retval[]=array('value'=>0,'display'=>'[' .lang('Show 
Site Index') . ']');
                        foreach($pagelist as $page_id)
                        {
***************
*** 45,60 ****
                }
  
!               function removePagesInCat($cat_id)
                {
                        $pages = $this->pageso->getPageIDList($cat_id);
                        while(list(,$page_id) = each($pages))
                        {
!                               $this->removePage($cat_id,$page_id);
                        }
                }
  
!               function removePage($cat_id, $page_id)
                {
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
                        {
                                $this->pageso->removePage($page_id);
--- 45,60 ----
                }
  
!               function removePagesInCat($cat_id,$force=False)
                {
                        $pages = $this->pageso->getPageIDList($cat_id);
                        while(list(,$page_id) = each($pages))
                        {
!                               $this->removePage($cat_id,$page_id,$force);
                        }
                }
  
!               function removePage($cat_id, $page_id,$force=False)
                {
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id) || $force)
                        {
                                $this->pageso->removePage($page_id);

Index: class.Pages_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_UI.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.Pages_UI.inc.php      17 Jan 2003 03:37:52 -0000      1.1
--- class.Pages_UI.inc.php      22 May 2003 02:36:53 -0000      1.2
***************
*** 35,40 ****
                        $this->pagebo = &$GLOBALS['Common_BO']->pages;
                        $this->categorybo = &$GLOBALS['Common_BO']->cats;
!                       $preferenceso = 
CreateObject('sitemgr.sitePreference_SO', true);
!                       $this->sitelanguages = 
explode(',',$preferenceso->getPreference('sitelanguages'));
                }
                
--- 35,39 ----
                        $this->pagebo = &$GLOBALS['Common_BO']->pages;
                        $this->categorybo = &$GLOBALS['Common_BO']->cats;
!                       $this->sitelanguages = 
explode(',',$GLOBALS['Common_BO']->sites->current_site['site_languages']);
                }
                

Index: class.Theme_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Theme_BO.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.Theme_BO.inc.php      17 Jan 2003 03:37:52 -0000      1.4
--- class.Theme_BO.inc.php      22 May 2003 02:36:53 -0000      1.5
***************
*** 6,25 ****
                function Theme_BO()
                {
-                       $this->preferenceso = 
CreateObject('sitemgr.sitePreference_SO', True);
-               }
- 
-               function setTheme($theme)
-               {
-                       $this->preferenceso->setPreference('themesel',$theme);
-               }
-               
-               function getTheme()
-               {
-                       return $this->preferenceso->getPreference('themesel');
                }
  
                function getAvailableThemes()
                {
!                       $sitemgr_dir = 
$this->preferenceso->getPreference('sitemgr-site-dir');
                        $dirname = $sitemgr_dir . SEP . 'templates' . SEP;
                        $result_array=array();
--- 6,14 ----
                function Theme_BO()
                {
                }
  
                function getAvailableThemes()
                {
!                       $sitemgr_dir = 
$GLOBALS['Common_BO']->sites->current_site['site_dir'];
                        $dirname = $sitemgr_dir . SEP . 'templates' . SEP;
                        $result_array=array();

Index: class.Translations_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Translations_UI.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Translations_UI.inc.php       4 Mar 2003 17:26:43 -0000       1.3
--- class.Translations_UI.inc.php       22 May 2003 02:36:53 -0000      1.4
***************
*** 15,19 ****
                var $cat_bo;
                var $acl;
-               var $preferenceso;
                var $sitelanguages;
                var $common_ui;
--- 15,18 ----
***************
*** 36,41 ****
                        $this->cat_bo = &$GLOBALS['Common_BO']->cats;
                        $this->acl = &$GLOBALS['Common_BO']->acl;
!                       $this->preferenceso = 
CreateObject('sitemgr.sitePreference_SO', true);
!                       $this->sitelanguages = 
explode(',',$this->preferenceso->getPreference('sitelanguages'));
                        $this->pagebo = &$GLOBALS['Common_BO']->pages;
                        $this->contentbo = &$GLOBALS['Common_BO']->content;
--- 35,39 ----
                        $this->cat_bo = &$GLOBALS['Common_BO']->cats;
                        $this->acl = &$GLOBALS['Common_BO']->acl;
!                       $this->sitelanguages = 
explode(',',$GLOBALS['Common_BO']->sites->current_site['site_languages']);
                        $this->pagebo = &$GLOBALS['Common_BO']->pages;
                        $this->contentbo = &$GLOBALS['Common_BO']->content;
***************
*** 277,281 ****
                        $this->templatehelper();
  
!                       
$this->process_blocks($this->contentbo->getblocksforscope(0,0));
                        $this->t->pfp('out','TranslateSitecontent');
                }
--- 275,279 ----
                        $this->templatehelper();
  
!                       
$this->process_blocks($this->contentbo->getblocksforscope(CURRENT_SITE_ID,0));
                        $this->t->pfp('out','TranslateSitecontent');
                }

Index: hook_admin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/hook_admin.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** hook_admin.inc.php  23 Apr 2003 01:49:43 -0000      1.3
--- hook_admin.inc.php  22 May 2003 02:36:53 -0000      1.4
***************
*** 16,27 ****
                $file = Array
                (
!                       'Site Setup'                                            
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs'),
!                       'Edit Categories and Permissions'       => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Categories_UI._manageCategories'),
!                       'Edit Site Header and Footer'           => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.SiteContent_UI._editHeaderAndFooter'),
!                       'Edit Individual Pages'                         => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Pages_UI._managePage')
                );
  
  //Do not modify below this line
                $GLOBALS['phpgw']->common->display_mainscreen($appname,$file);
        }
  ?>
--- 16,31 ----
                $file = Array
                (
!                       'Define Websites' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.list_sites'),
                );
  
  //Do not modify below this line
+               if 
((int)substr($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],4)>14)
+               {
                $GLOBALS['phpgw']->common->display_mainscreen($appname,$file);
+               }
+               else
+               {
+               display_section($appname,$title,$file);
+               }
        }
  ?>

--- class.SiteContent_UI.inc.php DELETED ---

--- class.headerFooter_BO.inc.php DELETED ---

--- class.sitePreference_SO.inc.php DELETED ---





reply via email to

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