phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/inc class.Block_SO.inc.php,1.3,1.4 class.Categories_BO.inc.php,1.9,1.10class.Categories_SO.inc.php,1.16,1.17 class.Categories_UI.inc.php,1.5,1.6 class.Common_BO.inc.php,1.3,1.4 class.Common_UI.inc.php,1.13,1.14 class.Content_BO.inc.php,1.3,1.4 class.Content_SO.inc.php,1.7,1.8 class.Content_UI.inc.php,1.7,1.8 class.Modules_BO.inc.php,1.3,1.4 class.Modules_UI.inc.php,1.5,1.6 class.Page_SO.inc.php,1.5,1.6 class.Pages_BO.inc.php,1.7,1.8 class.Pages_SO.inc.php,1.13,1.14 class.Pages_UI.inc.php,1.3,1.4 class.Sites_BO.inc.php,1.4,1.5 class.Sites_SO.inc.php,1.1,1.2 class.Translations_UI.inc.php,1.5,1.6 class.module.inc.php,1.8,1.9 hook_preferences.inc.php,1.2,1.3
Date: Fri, 30 May 2003 00:01:45 -0400

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

Modified Files:
        class.Block_SO.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.Modules_BO.inc.php 
        class.Modules_UI.inc.php class.Page_SO.inc.php 
        class.Pages_BO.inc.php class.Pages_SO.inc.php 
        class.Pages_UI.inc.php class.Sites_BO.inc.php 
        class.Sites_SO.inc.php class.Translations_UI.inc.php 
        class.module.inc.php hook_preferences.inc.php 
Log Message:
make sitemgr capable of handling versions


Index: class.Block_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Block_SO.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Block_SO.inc.php      4 Mar 2003 17:26:43 -0000       1.3
--- class.Block_SO.inc.php      30 May 2003 04:01:42 -0000      1.4
***************
*** 12,19 ****
                var $title;
                var $view;
!               var $actif;
                
                function Block_SO()
                {
                }
        }
--- 12,27 ----
                var $title;
                var $view;
!               var $state;
!               var $version;
                
                function Block_SO()
                {
+               }
+ 
+               function set_version($version)
+               {
+                       $this->arguments = $version['arguments'];
+                       $this->state = $version['state'];
+                       $this->version = $version['id'];
                }
        }

Index: class.Categories_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_BO.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.Categories_BO.inc.php 23 May 2003 06:56:39 -0000      1.9
--- class.Categories_BO.inc.php 30 May 2003 04:01:42 -0000      1.10
***************
*** 15,19 ****
                function setcurrentcats()
                {
!                       $this->currentcats = 
$this->so->getallcatidsforsite(CURRENT_SITE_ID);
                }
  
--- 15,19 ----
                function setcurrentcats()
                {
!                       $this->currentcats = 
$this->getpermittedcats(CURRENT_SITE_ID,'active',True);
                }
  
***************
*** 21,25 ****
                {
                        $retval[] = array('value'=>0,'display'=>'[No Parent]');
!                       $list = $this->getPermittedCatWriteNested();
                        foreach($list as $cat_id)
                        {
--- 21,25 ----
                {
                        $retval[] = array('value'=>0,'display'=>'[No Parent]');
!                       $list = $this->getpermittedcatsWrite();
                        foreach($list as $cat_id)
                        {
***************
*** 31,35 ****
                }
  
!               function getPermittedCatReadNested($cat_id=False)
                {
                        if (!$cat_id)
--- 31,35 ----
                }
  
!               function getpermittedcatsRead($cat_id=False,$recurse=true)
                {
                        if (!$cat_id)
***************
*** 37,47 ****
                                $cat_id = CURRENT_SITE_ID;
                        }
!                       else
                        {
!                               $this-check($cat_id);
                        }
!                       return $this->getPermittedCatNested($cat_id,'read');
                }
!               function getPermittedCatWriteNested($cat_id=False)
                {
                        if (!$cat_id)
--- 37,47 ----
                                $cat_id = CURRENT_SITE_ID;
                        }
!                       if ($cat_id != CURRENT_SITE_ID)
                        {
!                               $this->check($cat_id);
                        }
!                       return $this->getpermittedcats($cat_id,'read',$recurse);
                }
!               function getpermittedcatsWrite($cat_id=False,$recurse=true)
                {
                        if (!$cat_id)
***************
*** 49,146 ****
                                $cat_id = CURRENT_SITE_ID;
                        }       
!                       else
                        {
!                               $this-check($cat_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();
!                       if (is_array($root_list))
!                       {
!                               foreach($root_list as $root_cat)
!                               {
!                                       if ($check=='read')
!                                       {
!                                               $permitted = 
$GLOBALS['Common_BO']->acl->can_read_category($root_cat);
!                                       }
!                                       elseif ($check=='write')
!                                       {
!                                               $permitted = 
$GLOBALS['Common_BO']->acl->can_write_category($root_cat);
!                                       }
!                                       else
!                                       {
!                                               die("Illegal call of function 
getPermittedCatNested");
!                                       }
! 
!                                       if ($permitted)
!                                       {
!                                               $permitted_list[]=$root_cat;
!                                       }
!                                       //subcategories can be 
readable/writeable even when parent is not
!                                       $sub_list = 
$this->getPermittedCatNested($root_cat,$check);
!                                       if (is_array($sub_list) && 
count($sub_list)>0)
!                                       {
!                                               //array_push($permitted_list, 
$sub_list);
!                                               
$permitted_list=array_merge($permitted_list, $sub_list);
!                                       }
!                               }
!                       }
!                       return $permitted_list;
                }
  
!               //the next two functions do not recurse!
!               function getPermittedCategoryIDWriteList($cat_id=False)
                {
!                       if (!$cat_id)
!                       {
!                               $cat_id = CURRENT_SITE_ID;
!                       }
!                       else
!                       {
!                               $this-check($cat_id);
!                       }
! 
!                       $full_list = $this->so->getChildrenIDList($cat_id);
  
                        $permitted_list=array();
!                       if (is_array($full_list))
                        {
!                               foreach($full_list as $item)
                                {
!                                       if 
($GLOBALS['Common_BO']->acl->can_write_category($item))
!                                       {
!                                               $permitted_list[]=$item;
!                                       }
                                }
-                       }
-                       return $permitted_list;
-               }
  
!               function getPermittedCategoryIDReadList($cat_id=False)
!               {
!                       if (!$cat_id)
!                       {
!                               $cat_id = CURRENT_SITE_ID;
!                       }
!                       else
!                       {
!                               $this-check($cat_id);
!                       }
!                       $full_list = $this->so->getChildrenIDList($cat_id);
!                       
!                       $permitted_list=array();
!                       if (is_array($full_list))
!                       {
!                               reset($full_list);
!                               foreach($full_list as $item)
                                {
!                                       if 
($GLOBALS['Common_BO']->acl->can_read_category($item))
                                        {
!                                               $permitted_list[]=$item;
                                        }
                                }
--- 49,114 ----
                                $cat_id = CURRENT_SITE_ID;
                        }       
!                       if ($cat_id != CURRENT_SITE_ID)
                        {
!                               $this->check($cat_id);
                        }
!                       return 
$this->getpermittedcats($cat_id,'write',$recurse);
                }
!               function getpermittedcatsCommitable()
                {
!                       return 
$this->getpermittedcats(CURRENT_SITE_ID,'commitable',true);
                }
  
!               function getpermittedcatsArchived()
                {
!                       return 
$this->getpermittedcats(CURRENT_SITE_ID,'archived',true);
!               }
  
+               function getpermittedcats($cat_id,$check,$recurse)
+               {
+                       $root_list = $this->so->getChildrenIDList($cat_id);
                        $permitted_list=array();
!                       while(list(,$root_cat) = @each($root_list))
                        {
!                               switch ($check)
                                {
!                                       case 'commitable':
!                                               $permitted = (
!                                                       
$this->so->isactive($root_cat,$GLOBALS['Common_BO']->getstates('Commit')) &&
!                                                       
$GLOBALS['Common_BO']->acl->is_admin()
!                                               );
!                                               break;
!                                       case 'archived':
!                                               $permitted = (
!                                                       
$this->so->isactive($root_cat,$GLOBALS['Common_BO']->getstates('Archive')) &&
!                                                       
$GLOBALS['Common_BO']->acl->is_admin()
!                                               );
!                                               break;
!                                       case 'active':
!                                               $permitted = 
$this->so->isactive($root_cat);
!                                               break;
!                                       case 'read':
!                                               $permitted = 
(in_array($root_cat,$this->currentcats) && 
$GLOBALS['Common_BO']->acl->can_read_category($root_cat));
!                                               break;
!                                       case 'write':
!                                               $permitted = 
(in_array($root_cat,$this->currentcats) && 
$GLOBALS['Common_BO']->acl->can_write_category($root_cat));
                                }
  
!                               if ($permitted)
!                               {
!                                       $permitted_list[]=$root_cat;
!                               }
!                               //subcategories can be readable/writeable even 
when parent is not, but when parent is inactive subcats are too.
!                               elseif ($check == 'active')
!                               {
!                                       break;
!                               }
!                               if ($recurse)
                                {
!                                       $sub_list = 
$this->getpermittedcats($root_cat,$check,true);
!                                       if (count($sub_list)>0)
                                        {
!                                               //array_push($permitted_list, 
$sub_list);
!                                               
$permitted_list=array_merge($permitted_list, $sub_list);
                                        }
                                }
***************
*** 172,201 ****
                function removeCategory($cat_id,$force=False,$recurse=False)
                {
!                       $this->check($cat_id);
  
!                       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    *
-                               * associated pages, and all the associated   *
-                               * acl stuff too.  not to forget blocks       *
-                               \********************************************/
-                               $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)
--- 140,174 ----
                function removeCategory($cat_id,$force=False,$recurse=False)
                {
!                       if (!$force)
!                       {
!                               $this->check($cat_id);
  
!                               if (!$GLOBALS['Common_BO']->acl->is_admin())
!                               {
!                                       return False;
!                               }
!                       }
!                       if ($recurse)
                        {
!                               $children = 
$this->so->getChildrenIDList($cat_id);
!                               while (list($null,$subcat) = @each($children))
                                {
!                                       
$this->removeCategory($subcat,True,True);
                                }
                        }
+                       /********************************************\
+                       * We have to remove the category, all the    *
+                       * associated pages, and all the associated   *
+                       * acl stuff too.  not to forget blocks       *
+                       \********************************************/
+                       
$GLOBALS['Common_BO']->content->removeBlocksInPageOrCat($cat_id,0,True);
+                       
$GLOBALS['Common_BO']->pages->removePagesInCat($cat_id,True);
+                       $this->so->removeCategory($cat_id);
+                       $GLOBALS['Common_BO']->acl->remove_location($cat_id);
+                       
+                       return True;
                }
  
!               function saveCategoryInfo($cat_id, $cat_name, $cat_description, 
$lang, $sort_order=0, $state, $parent=False, $old_parent=False)
                {
                        if (!$parent)
***************
*** 208,240 ****
                        $cat_info->description = $cat_description;
                        $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))
-                       {       
-                         if ($this->so->saveCategory($cat_info));
-                         {
-                           if ($this->so->saveCategoryLang($cat_id, $cat_name, 
$cat_description, $lang))
-                             {
-                               return True;
-                             }
-                           return false;
-                         }
-                         return false;
-                       }
-                       else
                        {
!                               return false;
                        }
                }
  
                function saveCategoryLang($cat_id, $cat_name, $cat_description, 
$lang)
!                 {
!                   if ($this->so->saveCategoryLang($cat_id, $cat_name, 
$cat_description, $lang))
!                     {
!                       return True;
!                     }
!                   return false;
!                 }
                
                //$force is for bypassing ACL when we called from Sites_UI for 
building up the info for the currentsite
--- 181,209 ----
                        $cat_info->description = $cat_description;
                        $cat_info->sort_order = $sort_order;
+                       $cat_info->state = $state;
                        $cat_info->parent = $parent;
                        $cat_info->old_parent = $old_parent ? $old_parent : 
$parent;
  
                        if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
                        {
!                               if ($this->so->saveCategory($cat_info));
!                               {
!                                       if 
($this->so->saveCategoryLang($cat_id, $cat_name, $cat_description, $lang))
!                                       {
!                                               return true;
!                                       }
!                               }
                        }
+                       return false;
                }
  
                function saveCategoryLang($cat_id, $cat_name, $cat_description, 
$lang)
!               {
!                       if ($this->so->saveCategoryLang($cat_id, $cat_name, 
$cat_description, $lang))
!                       {
!                               return true;
!                       }
!                       return false;
!               }
                
                //$force is for bypassing ACL when we called from Sites_UI for 
building up the info for the currentsite
***************
*** 257,261 ****
                                $cat_id = CURRENT_SITE_ID;
                        }
!                       else
                        {
                                $this->check($cat_id);
--- 226,230 ----
                                $cat_id = CURRENT_SITE_ID;
                        }
!                       if ($cat_id != CURRENT_SITE_ID)
                        {
                                $this->check($cat_id);
***************
*** 276,280 ****
                function getlangarrayforcategory($cat_id)
                {
!                   return $this->so->getlangarrayforcategory($cat_id);
                }
  
--- 245,249 ----
                function getlangarrayforcategory($cat_id)
                {
!                       return $this->so->getlangarrayforcategory($cat_id);
                }
  
***************
*** 349,353 ****
                function applyCategoryPermstosubs($cat_id)
                {
!                       $sublist = $this->getPermittedCatWriteNested($cat_id);
  
                        while (list(,$sub) = @each($sublist))
--- 318,322 ----
                function applyCategoryPermstosubs($cat_id)
                {
!                       $sublist = $this->getpermittedcatsWrite($cat_id);
  
                        while (list(,$sub) = @each($sublist))
***************
*** 376,381 ****
--- 345,368 ----
                        else
                        {
+ print_r($this->currentcats);
+ var_dump(debug_backtrace());
                                echo '<p><center><b>'.lang('Attempt to access 
information outside current website').'</b></center>';
                                $GLOBALS['phpgw']->common->phpgw_exit(True);
+                       }
+               }
+ 
+               function commit($cat_id)
+               {
+                       if ($GLOBALS['Common_BO']->acl->is_admin())
+                       {
+                               $this->so->commit($cat_id);
+                       }
+               }
+ 
+               function reactivate($cat_id)
+               {
+                       if ($GLOBALS['Common_BO']->acl->is_admin())
+                       {
+                               $this->so->reactivate($cat_id);
                        }
                }

Index: class.Categories_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_SO.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** class.Categories_SO.inc.php 23 May 2003 03:37:25 -0000      1.16
--- class.Categories_SO.inc.php 30 May 2003 04:01:42 -0000      1.17
***************
*** 12,53 ****
                }
  
!               function getallcatidsforsite($site_id)
                {
!                       $result = array();
!                       //the API's category class does not permit to retrieve 
all children of a main category
!                       $this->db->query("SELECT cat_id from phpgw_categories 
WHERE cat_main = $site_id",__LINE__,__FILE__);
!                       while ($this->db->next_record())
                        {
!                               $result[] = $this->db->f('cat_id');
                        }
!                       return $result;
                }
  
                function getChildrenIDList($parent)
                {
                        $cats = 
$this->cats->return_array('all','',False,'','','',False,$parent);
  
                        while (list(,$subs) = @each($cats))
                        {
!                               if ($subs['parent']==$parent)
!                               {
!                                       $subs_id_list[] = $subs['id'];
!                               }
                        }
                        return $subs_id_list;
                }
  
- //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)
                {
--- 12,41 ----
                }
  
!               function isactive($cat_id,$states=false)
                {
!                       if (!$states)
                        {
!                               $states = $GLOBALS['Common_BO']->visiblestates;
                        }
! 
!                       $sql = "SELECT cat_id from 
phpgw_sitemgr_categories_state WHERE cat_id = $cat_id AND state IN (" . 
implode(',',$states) . ")";
! 
!                       $this->db->query($sql,__LINE__,__FILE__);
!                       return $this->db->next_record();
                }
  
                function getChildrenIDList($parent)
                {
+                       //TODO add a return_id_array function to the API 
category class
                        $cats = 
$this->cats->return_array('all','',False,'','','',False,$parent);
+                       $result = array();
  
                        while (list(,$subs) = @each($cats))
                        {
!                               $subs_id_list[] = $subs['id'];
                        }
                        return $subs_id_list;
                }
  
                function addCategory($name, $description, $parent = False)
                {
***************
*** 60,65 ****
                                'old_parent' => $parent
                        );
! 
!                       return $this->cats->add($data);
                }
  
--- 48,55 ----
                                'old_parent' => $parent
                        );
!                       $cat_id =  $this->cats->add($data);
!                       $sql = "INSERT INTO phpgw_sitemgr_categories_state 
(cat_id) VALUES ($cat_id)";
!                       $this->db->query($sql, __LINE__,__FILE__);
!                       return $cat_id;
                }
  
***************
*** 69,72 ****
--- 59,64 ----
                        $sql = "DELETE FROM phpgw_sitemgr_categories_lang WHERE 
cat_id = $cat_id";
                        $this->db->query($sql, __LINE__,__FILE__);
+                       $sql = "DELETE FROM phpgw_sitemgr_categories_state 
WHERE cat_id = $cat_id";
+                       $this->db->query($sql, __LINE__,__FILE__);
                        return True;
                }
***************
*** 84,89 ****
                                'old_parent' => $cat_info->old_parent
                        );
- 
                        $this->cats->edit($data);
                }
  
--- 76,82 ----
                                'old_parent' => $cat_info->old_parent
                        );
                        $this->cats->edit($data);
+                       $sql = "UPDATE phpgw_sitemgr_categories_state SET state 
= " . $cat_info->state . " WHERE cat_id = " . $cat_info->id;
+                       $this->db->query($sql, __LINE__,__FILE__);
                }
  
***************
*** 126,133 ****
                                $cat_info->depth                = 
$cat[0]['level'];
                                $cat_info->root                 = 
$cat[0]['main'];
!                               
                                if ($lang)
                                {
!                                       $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'");
                                        if ($this->db->next_record())
                                        {
--- 119,129 ----
                                $cat_info->depth                = 
$cat[0]['level'];
                                $cat_info->root                 = 
$cat[0]['main'];
! 
!                               $this->db->query("SELECT state FROM 
phpgw_sitemgr_categories_state WHERE cat_id=$cat_id");
!                               $cat_info->state = $this->db->next_record() ? 
$this->db->f('state') : 0;
! 
                                if ($lang)
                                {
!                                       $this->db->query("SELECT * FROM 
phpgw_sitemgr_categories_lang WHERE cat_id=$cat_id and lang='$lang'");
                                        if ($this->db->next_record())
                                        {
***************
*** 175,178 ****
--- 171,188 ----
                {
                        $sql = "UPDATE phpgw_sitemgr_categories_lang SET 
lang='$newlang' WHERE lang='$oldlang'";
+                       $this->db->query($sql, __LINE__,__FILE__);
+               }
+ 
+               function commit($cat_id)
+               {
+                       $sql = "UPDATE phpgw_sitemgr_categories_state SET state 
= " . SITEMGR_STATE_PUBLISH . " WHERE state = " . SITEMGR_STATE_PREPUBLISH . " 
AND cat_id = $cat_id";
+                       $this->db->query($sql, __LINE__,__FILE__);
+                       $sql = "UPDATE phpgw_sitemgr_categories_state SET state 
= " . SITEMGR_STATE_ARCHIVE . " WHERE state = " . SITEMGR_STATE_PREUNPUBLISH . 
" AND cat_id = $cat_id";;
+                       $this->db->query($sql, __LINE__,__FILE__);
+               }
+ 
+               function reactivate($cat_id)
+               {
+                       $sql = "UPDATE phpgw_sitemgr_categories_state SET state 
= " . SITEMGR_STATE_DRAFT . " WHERE state = " . SITEMGR_STATE_ARCHIVE . " AND 
cat_id = $cat_id";
                        $this->db->query($sql, __LINE__,__FILE__);
                }

Index: class.Categories_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_UI.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.Categories_UI.inc.php 23 May 2003 06:56:39 -0000      1.5
--- class.Categories_UI.inc.php 30 May 2003 04:01:43 -0000      1.6
***************
*** 13,18 ****
        {
                var $common_ui;
-               var $cat;
-               var $cat_list;
                var $cat_bo;
                var $acl;
--- 13,16 ----
***************
*** 23,29 ****
                var $public_functions = array
                (
!                       '_manageCategories' => True,
!                       '_editCategory' => True,
!                       '_deleteCategory' => True
                );
                        
--- 21,27 ----
                var $public_functions = array
                (
!                       'manage' => True,
!                       'edit' => True,
!                       'delete' => True
                );
                        
***************
*** 39,43 ****
                }
  
!               function _manageCategories()
                {
                        $this->common_ui->DisplayHeader();
--- 37,41 ----
                }
  
!               function manage()
                {
                        $this->common_ui->DisplayHeader();
***************
*** 49,60 ****
                        $this->t->set_block('ManageCategories', 
'CategoryBlock', 'CBlock');
  
!                       $this->cat_list = 
$this->cat_bo->getPermittedCatWriteNested();
!                       if($this->cat_list)
                        {
!                               for($i = 0; $i < sizeof($this->cat_list); $i++)
                                {
!                                       $this->cat = 
$this->cat_bo->getCategory($this->cat_list[$i],$this->sitelanguages[0]);
  
!                                       if ($this->cat->depth>1)
                                        {
                                                $buffer = '-';
--- 47,58 ----
                        $this->t->set_block('ManageCategories', 
'CategoryBlock', 'CBlock');
  
!                       $cat_list = $this->cat_bo->getpermittedcatsWrite();
!                       if($cat_list)
                        {
!                               for($i = 0; $i < sizeof($cat_list); $i++)
                                {
!                                       $cat = 
$this->cat_bo->getCategory($cat_list[$i],$this->sitelanguages[0]);
  
!                                       if ($cat->depth>1)
                                        {
                                                $buffer = '-';
***************
*** 64,72 ****
                                                $buffer = '';
                                        }
!                                       $buffer = 
str_pad('',$this->cat->depth*18,
                                                '&nbsp;',STR_PAD_LEFT).$buffer;
!                                       $cat_id = $this->cat_list[$i];
                                        $this->t->set_var('buffer', $buffer);
!                                       $this->t->set_var('category', 
sprintf('%s : %d',$this->cat->name,$cat_id));
  
  
--- 62,70 ----
                                                $buffer = '';
                                        }
!                                       $buffer = str_pad('',$cat->depth*18,
                                                '&nbsp;',STR_PAD_LEFT).$buffer;
!                                       $cat_id = $cat_list[$i];
                                        $this->t->set_var('buffer', $buffer);
!                                       $this->t->set_var('category', 
sprintf('%s : %d',$cat->name,$cat_id));
  
  
***************
*** 75,108 ****
                                        if ($this->isadmin)
                                        {
!                                               $this->t->set_var('edit', 
!                                                       '<form action="'.
!                                                       
$GLOBALS['phpgw']->link('/index.php',
!                                                       
'menuaction=sitemgr.Categories_UI._editCategory').
!                                                       '" method="POST"><input 
type="submit" value="' . lang('Edit') .'"><input type="hidden" name="cat_id" 
value="'.$cat_id.'">
!                                                       </form>');
!                                       
!                                               $this->t->set_var('remove',
!                                                       '<form action="'.
!                                                       
$GLOBALS['phpgw']->link('/index.php',
!                                                       
'menuaction=sitemgr.Categories_UI._deleteCategory').
!                                                       '" method="POST">
!                                                       <input type="submit" 
value="' . lang('Delete') .'">
!                                                       <input type="hidden" 
name="cat_id" value="'. $cat_id  .'">
!                                                       </form>');
! 
!                                               $link_data['menuaction'] = 
"sitemgr.Modules_UI._manageModules";
!                                               
$this->t->set_var('moduleconfig',
!                                                       '<form action="'.
!                                                       
$GLOBALS['phpgw']->link('/index.php',$link_data).
!                                                       '" method="POST">
!                                                       <input type="submit" 
value="' . lang('Manage Modules') .'"></form>');
!                                       }
! 
!                                       $link_data['menuaction'] = 
"sitemgr.Content_UI._manageContent";
!                                       $this->t->set_var('content',
!                                               '<form action="'.
!                                               
$GLOBALS['phpgw']->link('/index.php',$link_data).
!                                               '" method="POST">
!                                               <input type="submit" value="' . 
lang('Manage Content') .'"></form>');
  
                                        $this->t->parse('CBlock', 
'CategoryBlock', True);
--- 73,90 ----
                                        if ($this->isadmin)
                                        {
!                                               $link_data['menuaction'] = 
"sitemgr.Categories_UI.edit";
!                                               $this->t->set_var('edit','<form 
action="' . $GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                                       '" method="POST"><input 
type="submit" value="' . lang('Edit') .'"></form>');
!                                               $link_data['menuaction'] = 
"sitemgr.Categories_UI.delete";
!                                               
$this->t->set_var('remove','<form action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                                       '" method="POST"><input 
type="submit" value="' . lang('Delete') .'"></form>');
!                                               $link_data['menuaction'] = 
"sitemgr.Modules_UI.manage";
!                                               
$this->t->set_var('moduleconfig','<form action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data).
!                                                       '" method="POST"><input 
type="submit" value="' . lang('Manage Modules') .'"></form>');
!                                       }
! 
!                                       $link_data['menuaction'] = 
"sitemgr.Content_UI.manage";
!                                       $this->t->set_var('content','<form 
action="' . $GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                               '" method="POST"><input 
type="submit" value="' . lang('Manage Content') .'"></form>');
  
                                        $this->t->parse('CBlock', 
'CategoryBlock', True);
***************
*** 119,123 ****
                                        '<form action="'.
                                        $GLOBALS['phpgw']->link('/index.php',
!                                       
'menuaction=sitemgr.Categories_UI._editCategory').
                                        '" method="POST">
                                        <input type=submit value = "' . 
lang('Add a category') .'">
--- 101,105 ----
                                        '<form action="'.
                                        $GLOBALS['phpgw']->link('/index.php',
!                                       
'menuaction=sitemgr.Categories_UI.edit').
                                        '" method="POST">
                                        <input type=submit value = "' . 
lang('Add a category') .'">
***************
*** 128,132 ****
                        
$this->t->set_var('managepageslink',$GLOBALS['phpgw']->link(
                                '/index.php',
!                               'menuaction=sitemgr.Pages_UI._managePage')
                        );
                        $this->t->pfp('out', 'ManageCategories');       
--- 110,114 ----
                        
$this->t->set_var('managepageslink',$GLOBALS['phpgw']->link(
                                '/index.php',
!                               'menuaction=sitemgr.Pages_UI.manage')
                        );
                        $this->t->pfp('out', 'ManageCategories');       
***************
*** 135,162 ****
                }
  
!               function _editCategory()
                {
                        if (!$this->isadmin)
                        {
!                               $this->_manageCategories();
                                return False;
                        }
  
!                       
$GLOBALS['Common_BO']->globalize(array('btnSave','catname','catdesc','cat_id','sort_order','parent','parent_old','groupaccessread','groupaccesswrite','individualaccessread','individualaccesswrite','savelanguage','inputgetparentpermissions','inputapplypermissionstosubs'));
  
!                       global $btnSave, 
$cat_id,$catname,$catdesc,$sort_order,$parent,$parent_old;
!                       global $groupaccessread, $groupaccesswrite, 
$individualaccessread, $individualaccesswrite;
                        global $savelanguage, 
$inputgetparentpermissions,$inputapplypermissionstosubs;
  
!                       if ($btnSave && $catname && $catdesc)
                        {
!                               if (!$cat_id)
!                               {
!                                       
$cat_id=$this->cat_bo->addCategory('','');
!                               }
!                               $groupaccess = 
array_merge_recursive($groupaccessread, $groupaccesswrite);
!                               $individualaccess = 
array_merge_recursive($individualaccessread, $individualaccesswrite);
                                $savelanguage = $savelanguage ? $savelanguage : 
$this->sitelanguages[0];
!                               $this->cat_bo->saveCategoryInfo($cat_id, 
$catname, $catdesc, $savelanguage, $sort_order, $parent, $parent_old);
                                if ($inputgetparentpermissions)
                                {
--- 117,147 ----
                }
  
!               function edit()
                {
                        if (!$this->isadmin)
                        {
!                               $this->manage();
                                return False;
                        }
  
!                       $GLOBALS['Common_BO']->globalize(array(
!                               
'btnSave','inputcatname','inputcatdesc','inputcatid','inputsortorder','inputparent','inputstate',
!                               
'inputparentold','savelanguage','inputgetparentpermissions','inputapplypermissionstosubs',
!                               
'inputgroupaccessread','inputgroupaccesswrite','inputindividualaccessread','individualaccesswrite'
!                       ));
  
!                       global $btnSave, 
$inputcatid,$inputcatname,$inputcatdesc,$inputsortorder,$inputparent,$inputparentold,$inputstate;
!                       global $inputgroupaccessread, $inputgroupaccesswrite, 
$inputindividualaccessread, $inputindividualaccesswrite;
                        global $savelanguage, 
$inputgetparentpermissions,$inputapplypermissionstosubs;
+                       $cat_id = $inputcatid ? $inputcatid : $_GET['cat_id'];
  
!                       if ($btnSave && $inputcatname && $inputcatdesc)
                        {
!                               $cat_id =  $cat_id ? $cat_id : 
$this->cat_bo->addCategory('','');
! 
!                               $groupaccess = 
array_merge_recursive($inputgroupaccessread, $inputgroupaccesswrite);
!                               $individualaccess = 
array_merge_recursive($inputindividualaccessread, $inputindividualaccesswrite);
                                $savelanguage = $savelanguage ? $savelanguage : 
$this->sitelanguages[0];
!                               $this->cat_bo->saveCategoryInfo($cat_id, 
$inputcatname, $inputcatdesc, $savelanguage, $inputsortorder, $inputstate, 
$inputparent, $inputparentold);
                                if ($inputgetparentpermissions)
                                {
***************
*** 171,175 ****
                                        
$this->cat_bo->applyCategoryPermstosubs($cat_id);
                                }
!                               $this->_manageCategories();
                                return;
                        }
--- 156,160 ----
                                        
$this->cat_bo->applyCategoryPermstosubs($cat_id);
                                }
!                               $this->manage();
                                return;
                        }
***************
*** 179,183 ****
                        if ($cat_id)
                        {
!                               $this->cat = 
$this->cat_bo->getCategory($cat_id,$this->sitelanguages[0]); 
                        }
  
--- 164,168 ----
                        if ($cat_id)
                        {
!                               $cat = 
$this->cat_bo->getCategory($cat_id,$this->sitelanguages[0]); 
                        }
  
***************
*** 186,191 ****
                        {
                                $this->t->set_var('error_msg',lang('You failed 
to fill in one or more required fields.'));
!                               $this->cat->name = $catname;
!                               $this->cat->description = $catdesc;
                        }
  
--- 171,176 ----
                        {
                                $this->t->set_var('error_msg',lang('You failed 
to fill in one or more required fields.'));
!                               $cat->name = $inputcatname;
!                               $cat->description = $inputcatdesc;
                        }
  
***************
*** 207,215 ****
                                'add_edit' => ($cat_id ? lang('Edit Category') 
: lang('Add Category')),
                                'cat_id' => $cat_id,
!                               'catname' => $this->cat->name,
!                               'catdesc' => $this->cat->description,
!                               'sort_order' => $this->cat->sort_order,
!                               'parent_dropdown' => 
$this->getParentOptions($this->cat->parent,$cat_id),
!                               'old_parent' => $this->cat->parent,
                                'lang_basic' => lang('Basic Settings'),
                                'lang_catname' => lang('Category Name'),
--- 192,201 ----
                                'add_edit' => ($cat_id ? lang('Edit Category') 
: lang('Add Category')),
                                'cat_id' => $cat_id,
!                               'catname' => $cat->name,
!                               'catdesc' => $cat->description,
!                               'sort_order' => $cat->sort_order,
!                               'parent_dropdown' => 
$this->getParentOptions($cat->parent,$cat_id),
!                               'stateselect' => 
$GLOBALS['Common_BO']->inputstateselect($cat->state),
!                               'old_parent' => $cat->parent,
                                'lang_basic' => lang('Basic Settings'),
                                'lang_catname' => lang('Category Name'),
***************
*** 226,229 ****
--- 212,216 ----
                                'lang_reset' => lang('Reset'),
                                'lang_save' => lang('Save'),
+                               'lang_state' => lang('State'),
                                'lang_getparentpermissions' => lang('Fill in 
permissions from parent category? If you check this, below values will be 
ignored'),
                                'lang_applypermissionstosubs' => lang('Apply 
permissions also to subcategories?')
***************
*** 252,260 ****
  
                                        $this->t->set_var('groupname', 
$account_name);
- //I comment out the assumption, that when you write, you should necessarily 
read,
- //                                    if ($permission_id == PHPGW_ACL_ADD)
- //                                    {
- //                                            $permission_id = PHPGW_ACL_ADD 
| PHPGW_ACL_READ;
- //                                    }
                                        if ($permission_id & PHPGW_ACL_READ)  
                                        {
--- 239,242 ----
***************
*** 303,310 ****
                                        
                                        $this->t->set_var('username', 
$user_name);
- //                                    if ($user_permission_id == 
PHPGW_ACL_ADD)
- //                                    {
- //                                            $user_permission_id = 
PHPGW_ACL_ADD | PHPGW_ACL_READ;
- //                                    }
                                        if ($user_permission_id & 
PHPGW_ACL_READ )
                                        {
--- 285,288 ----
***************
*** 347,351 ****
                                $skip_id = -1;
                        }
!                       $retval="\n".'<SELECT NAME="parent">'."\n";
                        foreach($option_list as $option)
                        {
--- 325,329 ----
                                $skip_id = -1;
                        }
!                       $retval="\n".'<SELECT NAME="inputparent">'."\n";
                        foreach($option_list as $option)
                        {
***************
*** 365,387 ****
                }
  
!               function _deleteCategory()
                {
                        if (!$this->isadmin)
                        {
!                               $this->_manageCategories();
                                return;
                        }
  
!                       
$GLOBALS['Common_BO']->globalize(array('cat_id','btnDelete','btnCancel'));
!                       global $cat_id,$btnDelete,$btnCancel;
                        if ($btnDelete)
                        {
                                $this->cat_bo->removeCategory($cat_id);
!                               $this->_manageCategories();
                                return;
                        }
                        if ($btnCancel)
                        {
!                               $this->_manageCategories();
                                return;
                        }
--- 343,367 ----
                }
  
!               function delete()
                {
                        if (!$this->isadmin)
                        {
!                               $this->manage();
                                return;
                        }
  
!                       
$GLOBALS['Common_BO']->globalize(array('btnDelete','btnCancel'));
!                       global $btnDelete,$btnCancel;
!                       $cat_id = $_GET['cat_id'];
! 
                        if ($btnDelete)
                        {
                                $this->cat_bo->removeCategory($cat_id);
!                               $this->manage();
                                return;
                        }
                        if ($btnCancel)
                        {
!                               $this->manage();
                                return;
                        }

Index: class.Common_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_BO.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Common_BO.inc.php     22 May 2003 02:36:53 -0000      1.3
--- class.Common_BO.inc.php     30 May 2003 04:01:43 -0000      1.4
***************
*** 3,8 ****
        class Common_BO
        {
!               var $acl,$theme,$pages,$cats,$content,$modules,$headerfooter;
! 
                function Common_BO()
                {
--- 3,8 ----
        class Common_BO
        {
!               var $sites,$acl,$theme,$pages,$cats,$content,$modules;
!               var $state,$visiblestates;
                function Common_BO()
                {
***************
*** 14,18 ****
                        $this->content = 
CreateObject('sitemgr.Content_BO',True);
                        $this->modules = 
CreateObject('sitemgr.Modules_BO',True);
! //                    $this->headerfooter = 
CreateObject('sitemgr.headerFooter_BO', True);
                }
  
--- 14,47 ----
                        $this->content = 
CreateObject('sitemgr.Content_BO',True);
                        $this->modules = 
CreateObject('sitemgr.Modules_BO',True);
!                       $this->state = array(
!                               SITEMGR_STATE_DRAFT => lang('draft'),
!                               SITEMGR_STATE_PREPUBLISH => 
lang('prepublished'),
!                               SITEMGR_STATE_PUBLISH => lang('published'),
!                               SITEMGR_STATE_PREUNPUBLISH => 
lang('preunpublished'),
!                               SITEMGR_STATE_ARCHIVE => lang('archived'),
!                       );
!               }
! 
!               function setvisiblestates($mode)
!               {
!                       $this->visiblestates = $this->getstates($mode);
!               }
! 
!               function getstates($mode)
!               {
!                       switch ($mode)
!                       {
!                               case 'Administration' :
!                                       return 
array(SITEMGR_STATE_DRAFT,SITEMGR_STATE_PREPUBLISH,SITEMGR_STATE_PUBLISH,SITEMGR_STATE_PREUNPUBLISH);
!                               case 'Production' :
!                                       return 
array(SITEMGR_STATE_PUBLISH,SITEMGR_STATE_PREUNPUBLISH);
!                               case 'Draft' :
!                               case 'Edit' :
!                                       return 
array(SITEMGR_STATE_PREPUBLISH,SITEMGR_STATE_PUBLISH);
!                               case 'Commit' :
!                                       return 
array(SITEMGR_STATE_PREPUBLISH,SITEMGR_STATE_PREUNPUBLISH);
!                               case 'Archive' :
!                                       return array(SITEMGR_STATE_ARCHIVE);
!                       }
                }
  
***************
*** 33,41 ****
  
                function getlangname($lang)
!                 {
!                   $GLOBALS['phpgw']->db->query("select lang_name from 
phpgw_languages where lang_id = '$lang'",__LINE__,__FILE__);
!                   $GLOBALS['phpgw']->db->next_record();
!                   return $GLOBALS['phpgw']->db->f('lang_name');
!                 }
        }
  ?>
--- 62,83 ----
  
                function getlangname($lang)
!               {
!                       $GLOBALS['phpgw']->db->query("select lang_name from 
phpgw_languages where lang_id = '$lang'",__LINE__,__FILE__);
!                       $GLOBALS['phpgw']->db->next_record();
!                       return $GLOBALS['phpgw']->db->f('lang_name');
!               }
! 
!               function inputstateselect($default)
!               {
!                       $returnValue = '';
!                       foreach($this->state as $value => $display)
!                       {
!                               $selected = ($default == $value) ? $selected = 
'selected="selected" ' : '';
!                               $returnValue.='<option 
'.$selected.'value="'.$value.'">'.
!                                       $display.'</option>'."\n";
!                       }
!                       return $returnValue;
!               }
! 
        }
  ?>

Index: class.Common_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_UI.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.Common_UI.inc.php     23 May 2003 03:37:25 -0000      1.13
--- class.Common_UI.inc.php     30 May 2003 04:01:43 -0000      1.14
***************
*** 12,19 ****
        class Common_UI
        {
!               var $t, $acl, $theme, $do_sites_exist;
                var $public_functions = array
                (
!                       'DisplayPrefs' => True
                );
  
--- 12,20 ----
        class Common_UI
        {
!               var $t, $acl, $theme, $do_sites_exist, $menu;
                var $public_functions = array
                (
!                       'DisplayPrefs' => True,
!                       'DisplayMenu' => True
                );
  
***************
*** 22,26 ****
                        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;
--- 23,27 ----
                        global $Common_BO;
                        $Common_BO = CreateObject('sitemgr.Common_BO');
!                       $this->do_sites_exist = 
$Common_BO->sites->set_currentsite(False,'Administration');
                        $this->t = $GLOBALS['phpgw']->template;
                        $this->acl = &$Common_BO->acl;
***************
*** 28,33 ****
--- 29,93 ----
                        $this->pages_bo = &$Common_BO->pages;
                        $this->cat_bo = &$Common_BO->cats;
+                       $this->menu = array();
+                       if ($this->acl->is_admin())
+                       {
+                               $this->menu[] = array(
+                                       'value' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs'),
+                                       'display' => lang('Configure Website')
+                               );
+                               $link_data['cat_id'] = CURRENT_SITE_ID;
+                               $link_data['menuaction'] = 
"sitemgr.Modules_UI.manage";
+                               $this->menu[] = array(
+                                       'value' => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                                       'display' => lang('Manage site-wide 
module properties')
+                               );
+                               $link_data['page_id'] = 0;
+                               $link_data['menuaction'] = 
"sitemgr.Content_UI.manage";
+                               $this->menu[] = array(
+                                       'value' => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                                       'display' => lang('Manage Site Content')
+                               );
+                       }
+                       $this->menu[] = array(
+                               'value' => 
$GLOBALS['phpgw']->link('/index.php', 
'menuaction=sitemgr.Categories_UI.manage'),
+                               'display' => lang('Manage Categories')
+                       );
+                       $this->menu[] = array(
+                               'value' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Pages_UI.manage'),
+                               'display' => lang('Manage Pages')
+                       );
+                       $this->menu[] = array(
+                               'value' => 
$GLOBALS['phpgw']->link('/index.php', 
'menuaction=sitemgr.Translations_UI.manage'),
+                               'display' => lang('Manage Translations')
+                       );
+                       $this->menu[] = array(
+                               'value' => 
$GLOBALS['phpgw']->link('/index.php', 'menuaction=sitemgr.Content_UI.commit'),
+                               'display' => lang('Commit Changes')
+                       );
+                       $this->menu[] = array(
+                               'value' => 
$GLOBALS['phpgw']->link('/index.php', 'menuaction=sitemgr.Content_UI.archive'),
+                               'display' => lang('Manage archived content')
+                       );
                }
  
+ 
+               function DisplayMenu()
+               {
+ 
+                       $this->DisplayHeader();
+                       reset($this->menu);
+                       $this->t->set_file('MainMenu','mainmenu.tpl');
+                       $this->t->set_block('MainMenu','menuentry','MeBlock');
+ 
+                       while (list($test,$menuentry) = each($this->menu))
+                       {
+                               $this->t->set_var($menuentry);
+                               $this->t->parse('MeBlock','menuentry', true);
+                       }
+                       $this->t->pfp('out','MainMenu');
+                       $this->DisplayFooter();
+               }
+ 
+ 
                function DisplayPrefs()
                {
***************
*** 287,297 ****
                        {
                                $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)
--- 347,357 ----
                        {
                                $this->t->set_var(Array(
                                        '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_site' => lang('View Generated 
Site'),
!                                       'menulist' => $this->menuselectlist(),
!                                       'mainmenu' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayMenu')
                                ));
                                if 
($GLOBALS['Common_BO']->sites->getnumberofsites() > 1)
***************
*** 338,341 ****
--- 398,412 ----
                        {
                                $selectlist .= '<option value="' . $site_id . 
'">' . $site['site_name'] . '</option>' . "\n";
+                       }
+                       return $selectlist;
+               }
+ 
+               function menuselectlist()
+               {
+                       $sites = 
$GLOBALS['Common_BO']->sites->list_sites(False);
+                       $selectlist= '<option>' . lang('Choose action') . 
'</option>';
+                       while(list(,$menuentry) = @each($this->menu))
+                       {
+                               $selectlist .= '<option value="' . 
$menuentry['value'] . '">' . $menuentry['display'] . '</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.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Content_BO.inc.php    22 May 2003 02:36:53 -0000      1.3
--- class.Content_BO.inc.php    30 May 2003 04:01:43 -0000      1.4
***************
*** 3,6 ****
--- 3,16 ----
  require_once(PHPGW_INCLUDE_ROOT . SEP . 'sitemgr' . SEP . 'inc' . SEP . 
'class.module.inc.php');
  
+ define('SITEMGR_STATE_DRAFT',0);
+ define('SITEMGR_STATE_PREPUBLISH',1);
+ define('SITEMGR_STATE_PUBLISH',2);
+ define('SITEMGR_STATE_PREUNPUBLISH',3);
+ define('SITEMGR_STATE_ARCHIVE',4);
+ 
+ define('SITEMGR_VIEWABLE_EVERBODY',0);
+ define('SITEMGR_VIEWABLE_USER',1);
+ define('SITEMGR_VIEWABLE_ADMIN',2);
+ define('SITEMGR_VIEWABLE_ANONYMOUS',3);
        class Content_BO
        {
***************
*** 53,62 ****
                }
  
                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);
                        }
                }
--- 63,99 ----
                }
  
+               function createversion($blockid)
+               {
+                       return $this->so->createversion($blockid);
+               }
+ 
+               function deleteversion($versionid,$force=False)
+               {
+                       if (!$force)
+                       {
+                               $blockid = 
$this->so->getblockidforversion($versionid);
+                               if (!$blockid)
+                               {
+                                       return false;
+                               }
+                               $block = $this->so->getblockdef($blockid);
+                               if (!($block && 
$GLOBALS['Common_BO']->acl->can_write_category($block->cat_id)))
+                               {
+                                       return false;
+                               }
+                       }
+                       return $this->so->deleteversion($versionid);
+               }
+ 
                function removeBlocksInPageOrCat($cat_id,$page_id,$force=False)
                {
+                       if (!($force || 
$GLOBALS['Common_BO']->acl->can_write_category($cat_id)))
+                       {
+                               return false;
+                       }
                        $blocks = 
$this->so->getblocksforscope($cat_id,$page_id);
                        while(list($blockid,) = each($blocks))
                        {
!                               $this->removeblock($blockid,True);
                        }
                }
***************
*** 64,77 ****
                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);
                        }
!                       else
                        {
!                               return false;
                        }
                }
  
--- 101,123 ----
                function removeblock($blockid,$force=False)
                {
!                       if (!$force)
                        {
!                               $block = $this->so->getblockdef($blockid);
!                               if (!($block && 
$GLOBALS['Common_BO']->acl->can_write_category($block->cat_id)))
!                               {
!                                       return false;
!                               }
                        }
!                       if ($this->so->removeblock($blockid))
                        {
!                               $versions = 
$this->so->getversionidsforblock($blockid);
!                               while(list(,$versionid) = @each($versions))
!                               {
!                                       //since we already did the ACL we force
!                                       $this->deleteversion($versionid,True);
!                               }
!                               return true;
                        }
+                       return false;
                }
  
***************
*** 79,95 ****
                //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)
                {
!                       $cat_ancestorlist = $cat_id ? 
$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id,True) : False;
                        if ($page_id && 
!$GLOBALS['Common_BO']->acl->can_read_category($cat_id))
                        {
                           $page_id = False;
                        }
!                       return 
$this->so->getvisibleblockdefsforarea($area,$cat_ancestorlist,$page_id,$visibleonly);
                }
  
                function getallblocksforarea($area,$cat_id,$page_id,$lang)
                {
!                       $cat_ancestorlist = $cat_id ? 
$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id,True) : False;
                        if ($page_id && 
!$GLOBALS['Common_BO']->acl->can_read_category($cat_id))
                        {
--- 125,143 ----
                //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,$isadmin,$isuser)
                {
!                       $cat_ancestorlist = $cat_id ? 
!                               
implode(',',$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id,True)) 
: 
!                               False;
                        if ($page_id && 
!$GLOBALS['Common_BO']->acl->can_read_category($cat_id))
                        {
                           $page_id = False;
                        }
!                       return 
$this->so->getvisibleblockdefsforarea($area,$cat_ancestorlist,$page_id,$isadmin,$isuser);
                }
  
                function getallblocksforarea($area,$cat_id,$page_id,$lang)
                {
!                       $cat_ancestorlist = ($cat_id != CURRENT_SITE_ID) ? 
$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id,True) : False;
                        if ($page_id && 
!$GLOBALS['Common_BO']->acl->can_read_category($cat_id))
                        {
***************
*** 99,111 ****
                }
  
!               function getblock($block_id,$lang)
                {
                        //do we need ACL here, since we have ACL when getting 
the block lists, we could do without it here?
!                       return $this->so->getblock($block_id,$lang);
                }
  
!               function getlangarrayforblock($block_id)
                {
!                       return $this->so->getlangarrayforblock($block_id);
                }
  
--- 147,183 ----
                }
  
!               function getcommitableblocks()
!               {
!                       return 
$this->so->getallblocks($GLOBALS['Common_BO']->cats->getpermittedcatsWrite(),$GLOBALS['Common_BO']->getstates('Commit'));
!               }
! 
!               function getarchivedblocks()
!               {
!                       return 
$this->so->getallblocks($GLOBALS['Common_BO']->cats->getpermittedcatsWrite(),$GLOBALS['Common_BO']->getstates('Archive'));
!               }
!               function getallversionsforblock($blockid,$lang)
!               {
!                       return 
$this->so->getallversionsforblock($blockid,$lang);
!               }
! 
!               function getblock($id,$lang)
                {
                        //do we need ACL here, since we have ACL when getting 
the block lists, we could do without it here?
!                       return $this->so->getblock($id,$lang);
!               }
! 
!               function getlangblocktitle($block_id,$lang=false)
!               {
!                               return 
$this->so->getlangblocktitle($block_id,$lang);
                }
  
!               function getlangarrayforblocktitle($block_id)
                {
!                       return $this->so->getlangarrayforblocktitle($block_id);
!               }
! 
!               function getlangarrayforversion($version_id)
!               {
!                       return $this->so->getlangarrayforversion($version_id);
                }
  
***************
*** 124,145 ****
                }
  
!               function getlangblockdata($blockid,$lang)
                {
!                       //TODO: add ACL
!                       return $this->so->getlangblockdata($blockid,$lang);
                }
!               function saveblockdata($block,$data,$lang)
                {
                        $oldblock = $this->so->getblockdef($block->id);
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($oldblock->cat_id))
                        {
!                               
$this->so->saveblockdatalang($block,$data['i18n'],$lang);
!                               unset($data['i18n']);
!                               return $this->so->saveblockdata($block,$data);
                        }
!                       else
                        {
!                               return false;
                        }
                }
  
--- 196,235 ----
                }
  
!               function getversion($version_id,$lang)
                {
!                       //TODO: add ACL ?
!                       return $this->so->getversion($version_id,$lang);
                }
! 
!               function saveblockdata($block,$data,$state,$lang)
                {
                        $oldblock = $this->so->getblockdef($block->id);
!                       if (!($oldblock && 
$GLOBALS['Common_BO']->acl->can_write_category($oldblock->cat_id)))
                        {
!                               return lang("You are not entitled to edit block 
%1",$block->id);
                        }
!                       $this->so->saveblockdata($block);
!                       
$this->so->saveblockdatalang($block->id,$block->title,$lang);
!                       if (!$this->saveversionstate($block->id,$state))
                        {
!                               $validationerrors[] = lang('There can only be 
one version in (pre(un))published state, with the one exeption that one 
prepublished version can coexist with one preunpublished version');
!                       }
!                       $moduleobject = $this->getblockmodule($block->id);
!                       while (list($versionid,$versiondata) = @each($data))
!                       {
!                               if ($moduleobject->validate($versiondata))
!                               {
!                                       if 
($this->saveversiondatalang($block->id,$versionid,$versiondata['i18n'],$lang))
!                                       {
!                                               unset($versiondata['i18n']);
!                                               
$this->so->saveversiondata($block->id,$versionid,$versiondata);
!                                       }
!                               }
!                               if ($moduleobject->validation_error)
!                               {
!                                       $validationerrors[] = 
$moduleobject->validation_error;
!                               }
                        }
+                       return $validationerrors ? $validationerrors : True;
                }
  
***************
*** 147,153 ****
                {
                        $oldblock = $this->so->getblockdef($block->id);
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($block->cat_id))
                        {
!                               return 
$this->so->saveblockdatalang($block,$data['i18n'],$lang);
                        }
                        else
--- 237,277 ----
                {
                        $oldblock = $this->so->getblockdef($block->id);
!                       if (!($oldblock && 
$GLOBALS['Common_BO']->acl->can_write_category($oldblock->cat_id)))
!                       {
!                               return lang("You are not entitled to edit block 
%1",$block->id);
!                       }
!                       
$this->so->saveblockdatalang($block->id,$block->title,$lang);
!                       $moduleobject = $this->getblockmodule($block->id);
!                       while (list($versionid,$versiondata) = @@each($data))
!                       //TODO: check if version really belongs to block
!                       {
!                               if ($moduleobject->validate($versiondata))
!                               {
!                                       
$this->saveversiondatalang($block->id,$versionid,$versiondata['i18n'],$lang);
!                               }
!                               else
!                               {
!                                       $validationerrors[] = 
$moduleobject->validation_error;
!                               }
!                       }
!                       return $validationerrors ? $validationerrors : True;
!               }
! 
!               //takes the array (version_id => version_state) posted from the 
UI as argument
!               //and checks if there is only one in (pre(un))published state 
!               //(exeption one prepublished, and one preunpublished can 
coexsit)
!               function saveversionstate($block_id,$state)
!               {
!                       $count_array = array_count_values($state);
!                       $active_versions = 
$count_array[SITEMGR_STATE_PREPUBLISH] + 
!                               $count_array[SITEMGR_STATE_PUBLISH] + 
!                               $count_array[SITEMGR_STATE_PREUNPUBLISH];
!                       if (($active_versions < 2) || (($active_versions == 2) 
&& ($count_array[SITEMGR_STATE_PUBLISH] == 0)))
                        {
!                               while (list($versionid,$versionstate) = 
each($state))
!                               {
!                                       
$this->so->saveversionstate($block_id,$versionid,$versionstate);
!                               }
!                               return true;
                        }
                        else
***************
*** 157,164 ****
--- 281,313 ----
                }
  
+               function saveversiondatalang($block_id,$version_id,$data,$lang)
+               {
+                       return ($this->so->getblockidforversion($version_id) == 
$block_id) ?
+                               
$this->so->saveversiondatalang($version_id,$data,$lang) :
+                               false;
+               }
+ 
                function getblockmodule($blockid)
                {
                        $block = $this->so->getblockdef($blockid);
                        return 
$GLOBALS['Common_BO']->modules->createmodule($block->module_name);
+               }
+ 
+               function commit($block_id)
+               {
+                       $block = $this->so->getblockdef($block_id);
+                       if 
($GLOBALS['Common_BO']->acl->can_write_category($block->cat_id))
+                       {
+                               $this->so->commit($block_id);
+                       }
+               }
+ 
+               function reactivate($block_id)
+               {
+                       $block = $this->so->getblockdef($block_id);
+                       if 
($GLOBALS['Common_BO']->acl->can_write_category($block->cat_id))
+                       {
+                               $this->so->reactivate($block_id);
+                       }
                }
        }

Index: class.Content_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_SO.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.Content_SO.inc.php    22 May 2003 02:36:53 -0000      1.7
--- class.Content_SO.inc.php    30 May 2003 04:01:43 -0000      1.8
***************
*** 20,36 ****
                                $block->page__id = 0;
                        }
!                       $sql = "INSERT INTO phpgw_sitemgr_content 
(area,module_id,page_id,cat_id,sort_order,viewable,actif) VALUES ('" .
!                               $block->area . "'," . $block->module_id . "," . 
$block->page_id . "," . $block->cat_id . ",0,0,0)";
                        return $this->db->query($sql,__LINE__,__FILE__);
                }
  
!               function removeblock($blockid)
                {
!                       $sql = "DELETE FROM phpgw_sitemgr_content WHERE 
block_id = $blockid";
                        if ($this->db->query($sql,__LINE__,__FILE__))
!                       {
!                               $sql = "DELETE FROM phpgw_sitemgr_content_lang 
WHERE block_id = $blockid";
                                return $this->db->query($sql,__LINE__,__FILE__);
                        }
                        else
                        {
--- 20,63 ----
                                $block->page__id = 0;
                        }
!                       $sql = "INSERT INTO phpgw_sitemgr_blocks 
(area,module_id,page_id,cat_id,sort_order,viewable) VALUES ('" .
!                               $block->area . "'," . $block->module_id . "," . 
$block->page_id . "," . $block->cat_id . ",0,0)";
                        return $this->db->query($sql,__LINE__,__FILE__);
                }
  
!               function createversion($blockid)
                {
!                       $sql = "INSERT INTO phpgw_sitemgr_content 
(block_id,state) VALUES ($blockid," . SITEMGR_STATE_DRAFT  . ")";
!                               return $this->db->query($sql,__LINE__,__FILE__);
!               }
! 
!               function deleteversion($id)
!               {
!                       $sql = "DELETE FROM phpgw_sitemgr_content WHERE 
version_id = $id";
                        if ($this->db->query($sql,__LINE__,__FILE__))
!                       {
!                               $sql = "DELETE FROM phpgw_sitemgr_content_lang 
WHERE version_id = $id";
                                return $this->db->query($sql,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               return false;
                        }
+               }
+ 
+               function getblockidforversion($versionid)
+               {
+                       $sql = "SELECT block_id FROM phpgw_sitemgr_content 
WHERE version_id = $versionid";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       return $this->db->next_record() ? 
$this->db->f('block_id') : false;
+               }
+ 
+               function removeblock($id)
+               {
+                       $sql = "DELETE FROM phpgw_sitemgr_blocks WHERE block_id 
= $id";
+                       if ($this->db->query($sql,__LINE__,__FILE__))
+                       {
+                               $sql = "DELETE FROM phpgw_sitemgr_blocks_lang 
WHERE block_id = $id";
+                               return $this->db->query($sql,__LINE__,__FILE__);
+                       }
                        else
                        {
***************
*** 41,46 ****
                function getblocksforscope($cat_id,$page_id)
                {
!                       $sql = "SELECT 
t1.block_id,t1.module_id,module_name,area FROM phpgw_sitemgr_content AS 
t1,phpgw_sitemgr_modules AS t2 WHERE t1.module_id = t2.module_id AND cat_id = 
$cat_id AND page_id = $page_id ORDER by sort_order";
                        $block = CreateObject('sitemgr.Block_SO',True);
                        $result = array();
                        $this->db->query($sql,__LINE__,__FILE__);
--- 68,74 ----
                function getblocksforscope($cat_id,$page_id)
                {
!                       $sql = "SELECT 
t1.block_id,t1.module_id,module_name,area FROM phpgw_sitemgr_blocks AS 
t1,phpgw_sitemgr_modules AS t2 WHERE t1.module_id = t2.module_id AND cat_id = 
$cat_id AND page_id = $page_id ORDER by sort_order";
                        $block = CreateObject('sitemgr.Block_SO',True);
+ 
                        $result = array();
                        $this->db->query($sql,__LINE__,__FILE__);
***************
*** 60,67 ****
                function getallblocksforarea($area,$cat_list,$page_id,$lang)
                {
!                       $sql = "SELECT t1.block_id, area, cat_id, page_id, 
t1.module_id, module_name, arguments, arguments_lang, sort_order, title, 
viewable, actif"
!                               . " FROM phpgw_sitemgr_content AS t1 LEFT JOIN "
!                               . " 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)
--- 88,95 ----
                function getallblocksforarea($area,$cat_list,$page_id,$lang)
                {
!                       $sql = "SELECT t1.block_id, area, cat_id, page_id, 
t1.module_id, module_name, sort_order, title, viewable"
!                               . " FROM phpgw_sitemgr_blocks AS t1 LEFT JOIN "
!                               . " phpgw_sitemgr_modules AS t2 ON 
t1.module_id=t2.module_id LEFT JOIN "
!                               . " phpgw_sitemgr_blocks_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)
***************
*** 88,99 ****
                                $block->module_id = $this->db->f('module_id');
                                $block->module_name = 
$this->db->f('module_name');
-                               $block->arguments = array_merge(
-                                       
unserialize(stripslashes($this->db->f('arguments'))),
-                                       
unserialize(stripslashes($this->db->f('arguments_lang')))
-                               );
                                $block->sort_order = $this->db->f('sort_order');
                                $block->title = 
stripslashes($this->db->f('title'));
                                $block->view = $this->db->f('viewable');
-                               $block->actif = $this->db->f('actif');
                                $result[$id] = $block;
                        }
--- 116,122 ----
***************
*** 101,110 ****
                }
  
!               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)
                        {
!                               $sql .= " OR (page_id = 0 AND cat_id IN (" . 
implode(',',$cat_list) . "))";
                        }
                        if ($page_id)
--- 124,209 ----
                }
  
!               function getversionidsforblock($blockid)
!               {
!                       $sql = "SELECT version_id FROM phpgw_sitemgr_content 
WHERE block_id = $blockid";
!                       $result = array();
!                       $this->db->query($sql,__LINE__,__FILE__);
! 
!                       while ($this->db->next_record())
!                       {
!                               $result[] = $this->db->f('version_id');
!                       }
!                       return $result;
!               }
! 
! 
!               function getallversionsforblock($blockid,$lang)
                {
!                       $sql = "SELECT t1.version_id, 
arguments,arguments_lang,state FROM phpgw_sitemgr_content AS t1 LEFT JOIN "
!                               . "phpgw_sitemgr_content_lang AS t2 ON 
(t1.version_id=t2.version_id AND lang = '$lang') WHERE block_id = $blockid ";
!                       $result = array();
!                       $this->db->query($sql,__LINE__,__FILE__);
! 
!                       while ($this->db->next_record())
!                       {
!                               $id = $this->db->f('version_id');
!                               $version['arguments'] = array_merge(
!                                       
unserialize(stripslashes($this->db->f('arguments'))),
!                                       
unserialize(stripslashes($this->db->f('arguments_lang')))
!                               );
!                               $version['state'] = $this->db->f('state');
!                               $version['id'] = $id;
!                               $result[$id] = $version;
!                       }
!                       return $result;
!               }
! 
!               //selects all blocks from a given cat_list + site-wide blocks 
that are in given states
!               function getallblocks($cat_list,$states)
!               {
!                       $sql = "SELECT COUNT(*) AS 
cnt,t1.block_id,area,cat_id,page_id,viewable,state FROM phpgw_sitemgr_blocks AS 
t1,phpgw_sitemgr_content as t2 WHERE t1.block_id=t2.block_id AND ((cat_id = " . 
CURRENT_SITE_ID  . ")";
                        if ($cat_list)
                        {
!                               $sql .= " OR (cat_id IN (" . 
implode(',',$cat_list) . "))";
!                       }
!                       $sql .= ") AND state IN (" . implode(',',$states) .") 
GROUP BY block_id";
!                       $block = CreateObject('sitemgr.Block_SO',True);
!                       $result = array();
! 
!                       $this->db->query($sql,__LINE__,__FILE__);
! 
!                       while ($this->db->next_record())
!                       {
!                               $id = $this->db->f('block_id');
!                               $block->id = $id;
!                               $block->area = $this->db->f('area');
!                               $block->cat_id = $this->db->f('cat_id');
!                               $block->page_id = $this->db->f('page_id');
! //                            $block->module_id = $this->db->f('module_id');
! //                            $block->module_name = 
$this->db->f('module_name');
!                               $block->view = $this->db->f('viewable');
!                               $block->state = $this->db->f('state');
!                               //in cnt we retrieve the numbers of versions 
that are commitable for a block,
!                               //i.e. if there are more than one, it should 
normally be a prepublished version 
!                               //that will replace a preunpublished version
!                               $block->cnt =  $this->db->f('cnt');
!                               $result[$id] = $block;
!                       }
!                       return $result;
!               }
! 
!               function 
getvisibleblockdefsforarea($area,$cat_list,$page_id,$isadmin,$isuser)
!               {
!                       $viewable = SITEMGR_VIEWABLE_EVERBODY  . ',';
!                       $viewable .= $isuser ? SITEMGR_VIEWABLE_USER : 
SITEMGR_VIEWABLE_ANONYMOUS;
!                       $viewable .= $isadmin ? (',' . SITEMGR_VIEWABLE_ADMIN) 
: '';
! 
!                       $sql = "SELECT 
t1.block_id,area,cat_id,page_id,t1.module_id,module_name,state,version_id " . 
!                               "FROM phpgw_sitemgr_blocks AS 
t1,phpgw_sitemgr_modules AS t2,phpgw_sitemgr_content AS t3 " . 
!                               "WHERE t1.module_id = t2.module_id AND 
t1.block_id=t3.block_id AND area = '$area' " . 
!                               "AND  ((page_id = 0 and cat_id = ". 
CURRENT_SITE_ID  . ")";
!                       if ($cat_list)
!                       {
!                               $sql .= " OR (page_id = 0 AND cat_id IN (" . 
$cat_list . "))";
                        }
                        if ($page_id)
***************
*** 112,119 ****
                                $sql .= " OR (page_id = $page_id) ";
                        }
!                       $sql .= ") AND actif = 1 ORDER by sort_order";
!       
                        $block = CreateObject('sitemgr.Block_SO',True);
                        $result = array();
                        $this->db->query($sql,__LINE__,__FILE__);
  
--- 211,218 ----
                                $sql .= " OR (page_id = $page_id) ";
                        }
!                       $sql .= ") AND viewable IN (" . $viewable . ") AND 
state IN (" . implode(',',$GLOBALS['Common_BO']->visiblestates) . ") ORDER by 
sort_order";
                        $block = CreateObject('sitemgr.Block_SO',True);
                        $result = array();
+ 
                        $this->db->query($sql,__LINE__,__FILE__);
  
***************
*** 128,131 ****
--- 227,232 ----
                                $block->module_name = 
$this->db->f('module_name');
                                $block->view = $this->db->f('viewable');
+                               $block->state = $this->db->f('state');
+                               $block->version = $this->db->f('version_id');
                                $result[$id] = $block;
                        }
***************
*** 133,140 ****
                }
  
!               function getlangarrayforblock($block_id)
                {
                        $retval = array();
!                       $this->db->query("SELECT lang FROM 
phpgw_sitemgr_content_lang WHERE block_id = $block_id",__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
--- 234,241 ----
                }
  
!               function getlangarrayforblocktitle($block_id)
                {
                        $retval = array();
!                       $this->db->query("SELECT lang FROM 
phpgw_sitemgr_blocks_lang WHERE block_id = $block_id",__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
***************
*** 144,150 ****
                }
  
!               function getlangblockdata($blockid,$lang)
                {
!                       $sql = "SELECT title, arguments, arguments_lang FROM 
phpgw_sitemgr_content AS t1 LEFT JOIN phpgw_sitemgr_content_lang AS t2 ON 
(t1.block_id=t2.block_id AND lang='$lang') WHERE t1.block_id = $blockid";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
--- 245,264 ----
                }
  
!               //find out in what languages this block has data and return 
!               function getlangarrayforversion($version_id)
                {
!                       $retval = array();
!                       $this->db->query("SELECT lang FROM 
phpgw_sitemgr_content_lang WHERE version_id = $version_id",__LINE__,__FILE__);
!                       while ($this->db->next_record())
!                       {
!                               $retval[] = $this->db->f('lang');
!                       }
!                       return $retval;
!               }
! 
!               function getversion($version_id,$lang)
!               {
!                       $sql = "SELECT arguments, arguments_lang FROM 
phpgw_sitemgr_content AS t1 LEFT JOIN phpgw_sitemgr_content_lang AS t2 ON 
(t1.version_id = t2.version_id AND lang='$lang') WHERE t1.version_id = 
$version_id";
! 
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
***************
*** 155,159 ****
                                        
unserialize(stripslashes($this->db->f('arguments_lang')))
                                );
-                               $block->title = 
stripslashes($this->db->f('title'));
                                return $block;
                        }
--- 269,272 ----
***************
*** 166,170 ****
                function getblock($block_id,$lang)
                {
!                       $sql = "SELECT 
t1.block_id,cat_id,page_id,area,t1.module_id,module_name,arguments,arguments_lang,sort_order,title,viewable,actif
 FROM phpgw_sitemgr_modules AS t2, phpgw_sitemgr_content AS t1 LEFT JOIN 
phpgw_sitemgr_content_lang as t3 ON (t1.block_id=t3.block_id AND lang='$lang') 
WHERE t1.module_id = t2.module_id AND t1.block_id = $block_id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
--- 279,286 ----
                function getblock($block_id,$lang)
                {
!                       $sql = "SELECT 
area,cat_id,page_id,area,t1.module_id,module_name,sort_order,title,viewable"
!                               . " FROM phpgw_sitemgr_blocks AS t1 LEFT JOIN "
!                               . " phpgw_sitemgr_modules as t2 ON 
t1.module_id=t2.module_id LEFT JOIN "
!                               . " phpgw_sitemgr_blocks_lang AS t3 ON 
(t1.block_id=t3.block_id AND lang='$lang') WHERE t1.block_id = $block_id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
***************
*** 177,188 ****
                                $block->module_id = $this->db->f('module_id');
                                $block->module_name = 
$this->db->f('module_name');
-                               $block->arguments = array_merge(
-                                       
unserialize(stripslashes($this->db->f('arguments'))),
-                                       
unserialize(stripslashes($this->db->f('arguments_lang')))
-                               );
                                $block->sort_order = $this->db->f('sort_order');
                                $block->title = 
stripslashes($this->db->f('title'));
                                $block->view = $this->db->f('viewable');
-                               $block->actif = $this->db->f('actif');
                                return $block;
                        }
--- 293,299 ----
***************
*** 196,200 ****
                function getblockdef($block_id)
                {
!                       $sql = "SELECT 
cat_id,page_id,area,t1.module_id,module_name FROM phpgw_sitemgr_content AS 
t1,phpgw_sitemgr_modules AS t2 WHERE t1.module_id = t2.module_id AND 
t1.block_id = $block_id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
--- 307,311 ----
                function getblockdef($block_id)
                {
!                       $sql = "SELECT 
cat_id,page_id,area,t1.module_id,module_name FROM phpgw_sitemgr_blocks AS 
t1,phpgw_sitemgr_modules AS t2 WHERE t1.module_id = t2.module_id AND 
t1.block_id = $block_id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
***************
*** 215,219 ****
                }
  
!               function saveblockdata($block,$data)
                {
                        //this is necessary because double slashed data breaks 
while serialized
--- 326,361 ----
                }
  
!               function getlangblocktitle($id,$lang)
!               {
!                       if ($lang)
!                       {
!                               $sql = "SELECT title FROM 
phpgw_sitemgr_blocks_lang WHERE block_id = $id AND lang = '$lang'";
!                               $this->db->query($sql,__LINE__,__FILE__);
!                               return $this->db->next_record() ? 
$this->db->f('title') : false;
!                       }
!                       else
!                       {
!                               $sql = "SELECT title FROM 
phpgw_sitemgr_blocks_lang WHERE block_id = $id";
!                               $this->db->query($sql,__LINE__,__FILE__);
!                               return $this->db->next_record() ? 
$this->db->f('title') : false;
!                       }
!               }
! 
!               function saveblockdata($block)
!               {
!                       $sql = "UPDATE phpgw_sitemgr_blocks SET sort_order = " 
. (int)$block->sort_order . 
!                               ", viewable = " . $block->view . " WHERE 
block_id = " . $block->id;
!                       return $this->db->query($sql,__LINE__,__FILE__);
!               }
! 
!               function saveblockdatalang($id,$title,$lang)
!               {
!                       $sql = "DELETE FROM phpgw_sitemgr_blocks_lang WHERE 
block_id = $id AND lang = '$lang'";
!                       $this->db->query($sql,__LINE__,__FILE__);
!                       $sql = "INSERT INTO phpgw_sitemgr_blocks_lang 
(block_id,title,lang) VALUES ($id,'$title','$lang')";
!                       return $this->db->query($sql,__LINE__,__FILE__);
!               }
! 
!               function saveversiondata($block_id,$version_id,$data)
                {
                        //this is necessary because double slashed data breaks 
while serialized
***************
*** 223,232 ****
                        }
                        $s = $this->db->db_addslashes(serialize($data));
!                       $sql = "UPDATE phpgw_sitemgr_content SET arguments = 
'$s', sort_order = " . (int)$block->sort_order . 
!                               ", viewable = " . $block->view . ", actif = " . 
$block->actif . " WHERE block_id = " . $block->id;
                        return $this->db->query($sql,__LINE__,__FILE__);
                }
  
!               function saveblockdatalang($block,$data,$lang)
                {
                        //this is necessary because double slashed data breaks 
while serialized
--- 365,380 ----
                        }
                        $s = $this->db->db_addslashes(serialize($data));
!                       //by requiring block_id, we make sur that we only touch 
versions that really belong to the block
!                       $sql = "UPDATE phpgw_sitemgr_content SET arguments = 
'$s' WHERE version_id = $version_id AND block_id = $block_id";
!                       return $this->db->query($sql,__LINE__,__FILE__);
!               }
! 
!               function saveversionstate($block_id,$version_id,$state)
!               {
!                       $sql = "UPDATE phpgw_sitemgr_content SET state = $state 
 WHERE version_id = $version_id AND block_id = $block_id";
                        return $this->db->query($sql,__LINE__,__FILE__);
                }
  
!               function saveversiondatalang($id,$data,$lang)
                {
                        //this is necessary because double slashed data breaks 
while serialized
***************
*** 236,244 ****
                        }
                        $s = $this->db->db_addslashes(serialize($data));
-                       $title = $this->db->db_addslashes($block->title);
                        $blockid = $block->id;
!                       $sql = "DELETE FROM phpgw_sitemgr_content_lang WHERE 
block_id = $blockid AND lang = '$lang'";
                        $this->db->query($sql,__LINE__,__FILE__);
!                       $sql = "INSERT INTO phpgw_sitemgr_content_lang 
(block_id,lang,arguments_lang,title) VALUES ($blockid,'$lang','$s','$title')";
                        return $this->db->query($sql,__LINE__,__FILE__);
                }
--- 384,391 ----
                        }
                        $s = $this->db->db_addslashes(serialize($data));
                        $blockid = $block->id;
!                       $sql = "DELETE FROM phpgw_sitemgr_content_lang WHERE 
version_id = $id AND lang = '$lang'";
                        $this->db->query($sql,__LINE__,__FILE__);
!                       $sql = "INSERT INTO phpgw_sitemgr_content_lang 
(version_id,lang,arguments_lang) VALUES ($id,'$lang','$s')";
                        return $this->db->query($sql,__LINE__,__FILE__);
                }
***************
*** 258,261 ****
--- 405,422 ----
                                $data = stripslashes($data);
                        }
+               }
+ 
+               function commit($block_id)
+               {
+                       $sql = "UPDATE phpgw_sitemgr_content SET state = " . 
SITEMGR_STATE_PUBLISH . " WHERE state = " . SITEMGR_STATE_PREPUBLISH . " AND 
block_id = $block_id";
+                       $this->db->query($sql, __LINE__,__FILE__);
+                       $sql = "UPDATE phpgw_sitemgr_content SET state = " . 
SITEMGR_STATE_ARCHIVE . " WHERE state = " . SITEMGR_STATE_PREUNPUBLISH . " AND 
block_id = $block_id";;
+                       $this->db->query($sql, __LINE__,__FILE__);
+               }
+ 
+               function reactivate($block_id)
+               {
+                               $sql = "UPDATE phpgw_sitemgr_content SET state 
= " . SITEMGR_STATE_DRAFT . " WHERE state = " . SITEMGR_STATE_ARCHIVE . " AND 
block_id = $block_id";;
+                       $this->db->query($sql, __LINE__,__FILE__);
                }
        }

Index: class.Content_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_UI.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.Content_UI.inc.php    23 May 2003 03:37:25 -0000      1.7
--- class.Content_UI.inc.php    30 May 2003 04:01:43 -0000      1.8
***************
*** 12,19 ****
                var $worklanguage;
                var $errormsg;
  
                var $public_functions = array
                (
!                       '_manageContent' => True
                );
  
--- 12,22 ----
                var $worklanguage;
                var $errormsg;
+               var $langselect;
  
                var $public_functions = array
                (
!                       'manage' => True,
!                       'commit' => True,
!                       'archive' => True
                );
  
***************
*** 26,55 ****
                        $this->modulebo = &$GLOBALS['Common_BO']->modules;
                        $this->viewable = array(
!                               '0' => lang('everybody'),
!                               '1' => lang('phpgw users'),
!                               '2' => lang('administrators'),
!                               '3' => lang('anonymous')
                        );
                        $this->sitelanguages = 
$GLOBALS['Common_BO']->sites->current_site['sitelanguages'];
!                       $sessionlang = 
$GLOBALS['phpgw']->session->appsession('worklanguage','sitemgr');
!                       $this->worklanguage = $sessionlang ? $sessionlang : 
$this->sitelanguages[0];
                        $this->errormsg = array();
                }
  
!               function _manageContent()
                {
!                       $this->common_ui->DisplayHeader();
  
!                       
$GLOBALS['Common_BO']->globalize(array('blockid','blocktitle','blocksort','blockview','blockactif','btnSaveBlock','btnDeleteBlock','module_id','area','btnAddBlock','element','savelanguage'));
!                       global $blockid, $blocktitle, 
$blocksort,$blockview,$blockactif,$btnSaveBlock,$btnDeleteBlock, $module_id, 
$area, $btnAddBlock, $element, $savelanguage;
                        $page_id = $_GET['page_id'];
                        $cat_id = $_GET['cat_id'];
  
!                       if ($page_id)
                        {
                                $page = 
$GLOBALS['Common_BO']->pages->getPage($page_id);
                                $page_or_cat_name = $page->name;
                                $cat_id = $page->cat_id;
!                               $managelink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Pages_UI._managePage');
                                $goto = lang('Page manager');
                                $scopename = lang('Page');
--- 29,93 ----
                        $this->modulebo = &$GLOBALS['Common_BO']->modules;
                        $this->viewable = array(
!                               SITEMGR_VIEWABLE_EVERBODY => lang('everybody'),
!                               SITEMGR_VIEWABLE_USER => lang('phpgw users'),
!                               SITEMGR_VIEWABLE_ADMIN => 
lang('administrators'),
!                               SITEMGR_VIEWABLE_ANONYMOUS => lang('anonymous')
                        );
+ 
                        $this->sitelanguages = 
$GLOBALS['Common_BO']->sites->current_site['sitelanguages'];
!                       $savelanguage = $_POST['savelanguage'];
!                       if ($savelanguage)
!                       {
!                               //we save the language the user chooses as 
session variable
!                               $this->worklanguage = $savelanguage;
!                               
$GLOBALS['phpgw']->session->appsession('worklanguage','sitemgr',$savelanguage);
!                       }
!                       else
!                       {
!                               $sessionlang = 
$GLOBALS['phpgw']->session->appsession('worklanguage','sitemgr');
!                               $this->worklanguage = $sessionlang ? 
$sessionlang : $this->sitelanguages[0];
!                       }
                        $this->errormsg = array();
+ 
+                       if (count($this->sitelanguages) > 1)
+                       {
+                               $this->langselect = lang('as') . ' <select 
name="savelanguage">';
+                               foreach ($this->sitelanguages as $lang)
+                               {
+                                       $selected= '';
+                                       if ($lang == $this->worklanguage)
+                                       {
+                                               $selected = 
'selected="selected" ';
+                                       }
+                                       $this->langselect .= '<option ' . 
$selected .'value="' . $lang . '">'. $GLOBALS['Common_BO']->getlangname($lang) 
. '</option>';
+                               }
+                               $this->langselect .= '</select> ';
+                       }
                }
  
!               function manage()
                {
!                       $GLOBALS['Common_BO']->globalize(array(
!                               
'inputblockid','inputblocktitle','inputblocksort','inputblockview',
!                               
'inputstate','btnSaveBlock','btnDeleteBlock','btnCreateVersion',
!                               
'btnDeleteVersion','inputmoduleid','inputarea','btnAddBlock','element'
!                       ));
!                       global $inputblockid, $inputblocktitle, 
$inputblocksort,$inputblockview;
!                       global 
$inputstate,$btnSaveBlock,$btnDeleteBlock,$btnCreateVersion;
!                       global $inputmoduleid, $inputarea, $btnAddBlock, 
$btnDeleteVersion, $element;
  
!                       global $page_id,$cat_id;
                        $page_id = $_GET['page_id'];
                        $cat_id = $_GET['cat_id'];
+                       $block_id = $_GET['block_id'];
  
!                       if ($block_id)
!                       {}
!                       elseif ($page_id)
                        {
                                $page = 
$GLOBALS['Common_BO']->pages->getPage($page_id);
                                $page_or_cat_name = $page->name;
                                $cat_id = $page->cat_id;
!                               $managelink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Pages_UI.manage');
                                $goto = lang('Page manager');
                                $scopename = lang('Page');
***************
*** 60,64 ****
                                $page_or_cat_name = $cat->name;
                                $page_id = 0;
!                               $managelink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Categories_UI._manageCategories');
                                $goto = lang('Category manager');
                                $scopename = lang('Category');
--- 98,102 ----
                                $page_or_cat_name = $cat->name;
                                $page_id = 0;
!                               $managelink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Categories_UI.manage');
                                $goto = lang('Category manager');
                                $scopename = lang('Category');
***************
*** 70,95 ****
                        }
  
-                       $this->t->set_file('Managecontent', 
'manage_content.tpl');
-                       
$this->t->set_block('Managecontent','Contentarea','CBlock');
-                       $this->t->set_block('Contentarea','Module','MBlock');
-                       $this->t->set_block('Module','Moduleeditor','MeBlock');
-                       $this->t->set_block('Module','Moduleview','MvBlock');
-                       
$this->t->set_block('Moduleeditor','EditorElement','EeBlock');
-                       
$this->t->set_block('Moduleview','ViewElement','VeBlock');
-                       $this->t->set_var(Array(
-                               'lang_reset' => lang('Reset'),
-                               'lang_save' => lang('Save'),
-                               'content_manager' => lang('%1 content manager', 
$scopename),
-                               'page_or_cat_name' => ($page_or_cat_name ? (' - 
' . $page_or_cat_name) : ''),
-                               'managelink' => ($managelink ? ('<a href="' . 
$managelink . '">&lt; ' . lang('Go to') . ' ' . $goto . ' &gt;</a>') : '')
-                               ));
- 
                        if ($btnAddBlock)
                        {
!                               if ($module_id)
                                {
                                        $block = 
CreateObject('sitemgr.Block_SO',True);
!                                       $block->module_id = $module_id;
!                                       $block->area = $area;
                                        $block->page_id = $page_id;
                                        $block->cat_id = $cat_id;
--- 108,118 ----
                        }
  
                        if ($btnAddBlock)
                        {
!                               if ($inputmoduleid)
                                {
                                        $block = 
CreateObject('sitemgr.Block_SO',True);
!                                       $block->module_id = $inputmoduleid;
!                                       $block->area = $inputarea;
                                        $block->page_id = $page_id;
                                        $block->cat_id = $cat_id;
***************
*** 97,101 ****
                                        if (!$this->bo->addblock($block))
                                        {
!                                               $this->errormsg[] = lang("You 
are not entitled to create module %1 on this scope",$module_id);
                                        }
                                }
--- 120,124 ----
                                        if (!$this->bo->addblock($block))
                                        {
!                                               $this->errormsg[] = lang("You 
are not entitled to create module %1 on this scope",$inputmoduleid);
                                        }
                                }
***************
*** 107,149 ****
                        elseif ($btnSaveBlock)
                        {
!                               $moduleobject = 
$this->bo->getblockmodule($blockid);
! 
!                               if ($moduleobject->validate($element))
                                {
!                                       if ($savelanguage)
!                                       {
!                                               //we save the language the user 
chooses as session variable
!                                               $this->worklanguage = 
$savelanguage;
!                                               
$GLOBALS['phpgw']->session->appsession('worklanguage','sitemgr',$savelanguage);
!                                       }
! 
!                                       $block = 
CreateObject('sitemgr.Block_SO',True);
!                                       $block->id = $blockid;
!                                       $block->title = $blocktitle;
!                                       $block->sort_order = $blocksort;
!                                       $block->view = $blockview;
!                                       $block->actif = $blockactif ? 1 : 0;
!                                       if 
(!$this->bo->saveblockdata($block,$element,$this->worklanguage))
!                                       {
!                                               $this->errormsg[] = lang("You 
are not entitled to edit block %1",$blockid);
!                                       }
                                }
!                               if ($moduleobject->validation_error)
                                {
!                                       $this->errormsg[] = 
$moduleobject->validation_error;
                                }
                        }
!                       elseif ($btnDeleteBlock)
                        {
!                               if (!$this->bo->removeblock($blockid))
                                {
!                                       $this->errormsg[] =  lang("You are not 
entitled to edit block %1",$blockid);
                                }
                        }
  
                        $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.'));
  
                                foreach ($contentareas as $contentarea)
--- 130,225 ----
                        elseif ($btnSaveBlock)
                        {
!                               $block = CreateObject('sitemgr.Block_SO',True);
!                               $block->id = $inputblockid;
!                               $block->title = $inputblocktitle;
!                               $block->sort_order = $inputblocksort;
!                               $block->view = $inputblockview;
!                               $result = 
$this->bo->saveblockdata($block,$element,$inputstate,$this->worklanguage);
!                               if ($result !== True)
                                {
!                                       //result should be an array of 
validationerrors
!                                       $this->errormsg = $result;
!                               }
!                       }
!                       elseif ($btnDeleteBlock)
!                       {
!                               if (!$this->bo->removeblock($inputblockid))
!                               {
!                                       $this->errormsg[] =  lang("You are not 
entitled to edit block %1",$inputblockid);
                                }
!                               //if we delete a block we were editing, there 
is nothing left to do
!                               if ($block_id)
                                {
!                                       echo '<html><head></head><body 
onload="opener.location.reload();self.close()"></body></html>';
                                }
                        }
!                       elseif ($btnCreateVersion)
!                       {
!                               $this->bo->createversion($inputblockid);
!                       }
!                       elseif ($btnDeleteVersion)
!                       {
!                               $version_id = array_keys($btnDeleteVersion);
!                               $this->bo->deleteversion($version_id[0]);
!                       }
! 
!                       //if we are called with a block_id GET parameter, it is 
from sitemgr-site edit mode
!                       if ($block_id)
                        {
!                               $block = 
$this->bo->getblock($block_id,$this->worklanguage);
!                               if (!($block && 
$GLOBALS['Common_BO']->acl->can_write_category($block->cat_id)))
                                {
!                                       echo '<p><center><b>'.lang('Attempt to 
edit non-editable block').'</b></center>';
!                                       
$GLOBALS['phpgw']->common->phpgw_exit(True);
                                }
+                               $this->t->set_file('Blocks', 'edit_block.tpl');
+                               $this->t->set_block('Blocks','Block');
+                               
$this->t->set_block('Block','Moduleeditor','MeBlock');
+                               
$this->t->set_block('Block','Moduleview','MvBlock');
+                               
$this->t->set_block('Moduleeditor','Version','EvBlock');
+                               
$this->t->set_block('Blocks','EditorElement','EeBlock');
+                               
$this->t->set_block('Moduleview','ViewElement','VeBlock');
+ 
+                               $this->t->set_var(array(
+                                       'savebutton' => lang('Save block'),
+                                       'deletebutton' => lang('Delete block'),
+                                       'contentarea' => lang('Contentarea'),
+                                       'createbutton' => lang('Create new 
version'),
+                                       'standalone' => 
"<html><head></head><body>",
+                                       'donebutton' => '<input type="submit" 
onclick="opener.location.reload();self.close()" value="' . lang('Done') . '"  
/>'
+                               ));
+                               $this->showblock($block,True,True);
+                               $this->t->pfp('out','Block');
+                               return;
                        }
  
+                       $this->common_ui->DisplayHeader();
+ 
+                       $this->t->set_file('Managecontent', 
'manage_content.tpl');
+                       $this->t->set_file('Blocks','edit_block.tpl');
+                       
$this->t->set_block('Managecontent','Contentarea','CBlock');
+                       $this->t->set_block('Blocks','Block');
+                       $this->t->set_block('Block','Moduleeditor','MeBlock');
+                       $this->t->set_block('Block','Moduleview','MvBlock');
+                       $this->t->set_block('Moduleeditor','Version','EvBlock');
+                       $this->t->set_block('Blocks','EditorElement','EeBlock');
+                       
$this->t->set_block('Moduleview','ViewElement','VeBlock');
+                       $this->t->set_var(Array(
+                               'content_manager' => lang('%1 content manager', 
$scopename),
+                               'page_or_cat_name' => ($page_or_cat_name ? (' - 
' . $page_or_cat_name) : ''),
+                               'managelink' => ($managelink ? ('<a href="' . 
$managelink . '">&lt; ' . lang('Go to') . ' ' . $goto . ' &gt;</a>') : '')
+                               ));
+ 
+ 
                        $contentareas = $this->bo->getContentAreas();
                        if (is_array($contentareas))
                        {
!                               $this->t->set_var(array(
!                                       'help' => lang('You can override each 
content blocks default title. Be aware that not in all content areas the block 
title will be visible.'),
!                                       'savebutton' => lang('Save block'),
!                                       'deletebutton' => lang('Delete block'),
!                                       'contentarea' => lang('Contentarea'),
!                                       'createbutton' => lang('Create new 
version'),
!                               ));
  
                                foreach ($contentareas as $contentarea)
***************
*** 155,160 ****
                                                'addblockform' => 
                                                        ($permittedmodules ?
!                                                               ('<form 
method="POST"><input type="hidden" value="' . $contentarea . '" name="area" />' 
.
!                                                                       
'<select style="vertical-align:middle" size="10" name="module_id">' .
                                                                        
$this->inputmoduleselect($permittedmodules) .
                                                                        
'</select><input type="submit" name="btnAddBlock" value="' .
--- 231,236 ----
                                                'addblockform' => 
                                                        ($permittedmodules ?
!                                                               ('<form 
method="POST"><input type="hidden" value="' . $contentarea . '" 
name="inputarea" />' .
!                                                                       
'<select style="vertical-align:middle" size="10" name="inputmoduleid">' .
                                                                        
$this->inputmoduleselect($permittedmodules) .
                                                                        
'</select><input type="submit" name="btnAddBlock" value="' .
***************
*** 163,167 ****
                                                                lang('No 
modules permitted for this content area/category')
                                                        ),
!                                               'error' => ($contentarea == 
$area && $this->errormsg) ? join('<br>',$this->errormsg) : '',
                                        ));
  
--- 239,243 ----
                                                                lang('No 
modules permitted for this content area/category')
                                                        ),
!                                               'error' => (($contentarea == 
$inputarea) && $this->errormsg) ? join('<br>',$this->errormsg) : '',
                                        ));
  
***************
*** 171,305 ****
                                        $blocks = 
$this->bo->getallblocksforarea($contentarea,$cat_id,$page_id,$this->worklanguage);
  
!                                       $this->t->set_var('MBlock','');
  
                                        if ($blocks)
                                        {
!                                               if (count($this->sitelanguages) 
> 1)
!                                               {
!                                                       $select = lang('as') . 
' <select name="savelanguage">';
! 
!                                                       foreach 
($this->sitelanguages as $lang)
!                                                       {
!                                                               $selected= '';
!                                                               if ($lang == 
$this->worklanguage)
!                                                               {
!                                                                       
$selected = 'selected="selected" ';
!                                                               }
!                                                                       $select 
.= '<option ' . $selected .'value="' . $lang . '">'. 
$GLOBALS['Common_BO']->getlangname($lang) . '</option>';
!                                                               }
!                                                               $select .= 
'</select> ';
!                                                               
$this->t->set_var('savelang',$select);
!                                               }
!                                               while (list($id,$block) = 
each($blocks))
                                                {
-                                                       //TODO: wrap a module 
storage around createmodule as in template3, 
-                                                       //TODO: so that we do 
not create the same module object twice
-                                                       $moduleobject = 
$this->modulebo->createmodule($block->module_name);
-                                                       $this->t->set_var(array(
-                                                               'moduleinfo' => 
($block->module_name),
-                                                               'description' 
=> $moduleobject->description,
-                                                       ));
- 
                                                        //if the block is in 
our scope and we are entitled we edit it
!                                                       if ($block->page_id == 
$page_id && 
!                                                               $block->cat_id 
== $cat_id)
!                                                       {
!                                                               
$editorstandardelements = array(
!                                                                       
array('label' => lang('Title'),
!                                                                               
  'form' => ('<input type="text" name="blocktitle" value="' . 
!                                                                               
        ($block->title ? $block->title : $moduleobject->title) . '" />')
!                                                                       ),
!                                                                       
array('label' => lang('Actif'),
!                                                                               
  'form' => ('<input type="checkbox" name="blockactif"' .
!                                                                               
         ($block->actif ? 'checked="checked"' : '') . '">')
!                                                                       ),
!                                                                       
array('label' => lang('Seen by'),
!                                                                               
  'form' => ('<select name="blockview">' .
!                                                                               
        $this->inputviewselect((int)$block->view) . '</select>')
!                                                                       ),
!                                                                       
array('label' => lang('Sort order'),
!                                                                               
  'form' => ('<input type="text" name="blocksort" size="2" value="' .
!                                                                               
        (int)$block->sort_order . '">')
!                                                                       )
!                                                               );
!                                                               
$moduleobject->set_block($block);
!                                                               
$editormoduleelements = $moduleobject->get_user_interface();
!                                                               $interface = 
array_merge($editorstandardelements,$editormoduleelements);
!                                                               
$this->t->set_var(Array(
!                                                                       
'blockid' => $id,
!                                                                       
'savebutton' => lang('Save'),
!                                                                       
'deletebutton' => lang('Delete'),
!                                                                       
'contentarea' => lang('Contentarea'),
!                                                                       
'validationerror' => ($id == $blockid && $this->errormsg) ? 
join('<br>',$this->errormsg) : '',
!                                                               ));
!                                                               
$this->t->set_var('EeBlock','');
!                                                               while 
(list(,$element) = each($interface))
!                                                               {
!                                                                       
$this->t->set_var(Array(
!                                                                               
'label' => $element['label'],
!                                                                               
'form' => $element['form']
!                                                                       ));
!                                                                       
$this->t->parse('EeBlock','EditorElement', true);
!                                                               }
!                                                               
$this->t->parse('MeBlock','Moduleeditor');
!                                                               
$this->t->set_var('MvBlock','');
!                                                       }
!                                                       //otherwise we only 
show it
!                                                       else
!                                                       {
!                                                               if 
($block->page_id)
!                                                               {
!                                                                       
$blockscope = lang('Page');
!                                                               }
!                                                               elseif 
($block->cat_id)
!                                                               {
!                                                                       $cat = 
$GLOBALS['Common_BO']->cats->getCategory($block->cat_id);
!                                                                       
$blockscope =  lang('Category') . ' - ' . $cat->name;
!                                                               }
!                                                               else
!                                                               {
!                                                                       
$blockscope =  lang('Site');
!                                                               }
! 
!                                                               
$viewstandardelements = array(
!                                                                       
array('label' => lang('Scope'),
!                                                                               
  'value' => $blockscope
!                                                                       ),
!                                                                       
array('label' => lang('Title'),
!                                                                               
  'value' => ($block->title ? $block->title : $moduleobject->title)
!                                                                       ),
!                                                                       
array('label' => lang('Actif'),
!                                                                               
  'value' => ($block->actif ? lang('Yes') : lang('No'))
!                                                                       ),
!                                                                       
array('label' => lang('Seen by'),
!                                                                               
  'value' => $this->viewable[(int)$block->view]
!                                                                       ),
!                                                                       
array('label' => lang('Sort order'),
!                                                                               
  'value' => (int)$block->sort_order
!                                                                       )
!                                                               );
!                                                               
$viewmoduleelements = array();
!                                                               while 
(list($argument,$argdef) = @each($moduleobject->arguments))
!                                                               {
!                                                                       $value 
= $block->arguments[$argument];
!                                                                       
$viewmoduleelements[] = array(
!                                                                               
'label' => $argdef['label'],
!                                                                               
'value' => $GLOBALS['phpgw']->strip_html($value)
!                                                                       );
!                                                               }
!                                                               $interface = 
array_merge($viewstandardelements,$viewmoduleelements);
!                                                               
$this->t->set_var('VeBlock','');
!                                                               while 
(list(,$element) = each($interface))
!                                                               {
!                                                                       
$this->t->set_var(Array(
!                                                                               
'label' => $element['label'],
!                                                                               
'value' => $element['value'])
!                                                                       );
!                                                                       
$this->t->parse('VeBlock','ViewElement', true);
!                                                               }
!                                                               
$this->t->parse('MvBlock','Moduleview');
!                                                               
$this->t->set_var('MeBlock','');
!                                                       }
!                                               
$this->t->parse('MBlock','Module', true);
                                                }
                                        }
--- 247,260 ----
                                        $blocks = 
$this->bo->getallblocksforarea($contentarea,$cat_id,$page_id,$this->worklanguage);
  
!                                       $this->t->set_var('blocks','');
  
                                        if ($blocks)
                                        {
!                                               while (list(,$block) = 
each($blocks))
                                                {
                                                        //if the block is in 
our scope and we are entitled we edit it
!                                                       $editable = 
($block->page_id == $page_id && $block->cat_id == $cat_id);
!                                                       
$this->showblock($block,$editable);
!                                                       
$this->t->parse('blocks','Block', true);
                                                }
                                        }
***************
*** 312,316 ****
                        }
                        $this->t->pfp('out', 'Managecontent');
!                       $this->common_ui->DisplayFooter();      
                }
  
--- 267,446 ----
                        }
                        $this->t->pfp('out', 'Managecontent');
!                       $this->common_ui->DisplayFooter();
!               }
! 
!               function commit()
!               {
!                       if ($_POST['btnCommit'])
!                       {
!                               while(list($cat_id,) = @each($_POST['cat']))
!                               {
!                                       
$GLOBALS['Common_BO']->cats->commit($cat_id);
!                               }
!                               while(list($page_id,) = @each($_POST['page']))
!                               {
!                                       
$GLOBALS['Common_BO']->pages->commit($page_id);
!                               }
!                               while(list($block_id,) = @each($_POST['block']))
!                               {
!                                       $this->bo->commit($block_id);
!                               }
!                       }
!                       $this->common_ui->DisplayHeader();
! 
!                       $this->t->set_file('Commit','commit.tpl');
!                       $this->t->set_block('Commit','Category','Cblock');
!                       $this->t->set_block('Commit','Page','Pblock');
!                       $this->t->set_block('Commit','Block','Bblock');
!                       $this->t->set_var(array(
!                               'commit_manager' => lang('Commit changes'),
!                               'lang_categories' => lang('Categories'),
!                               'lang_pages' => lang('Pages'),
!                               'lang_blocks' => lang('Content blocks'),
!                               'lang_commit' => lang('Commit changes')
!                       ));
! 
!                       //Categories
!                       $cats = 
$GLOBALS['Common_BO']->cats->getpermittedcatsCommitable();
!                       while (list(,$cat_id) = @each($cats))
!                       {
!                               $cat = 
$GLOBALS['Common_BO']->cats->getCategory($cat_id,$this->sitelanguages[0]);
!                               $this->t->set_var(array(
!                                       'category' => $cat->name,
!                                       'catid' => $cat_id,
!                                       'addedorremoved' => ($cat->state == 
SITEMGR_STATE_PREPUBLISH) ? 'added' : 'removed',
!                                       'edit' => 
$GLOBALS['phpgw']->link('/index.php',array(
!                                               'cat_id' => $cat_id,
!                                               'menuaction' => 
'sitemgr.Categories_UI.edit'
!                                       ))
!                               ));
!                               $this->t->parse('Cblock','Category',True);
!                       }
! 
!                       //Pages
!                       $pages = 
$GLOBALS['Common_BO']->pages->getpageIDListCommitable();
! 
!                       while (list(,$page_id) = @each($pages))
!                       {
!                               $page = 
$GLOBALS['Common_BO']->pages->getPage($page_id);
!                               $this->t->set_var(array(
!                                       'page' => $page->name,
!                                       'pageid' => $page_id,
!                                       'addedorremoved' => ($page->state == 
SITEMGR_STATE_PREPUBLISH) ? 'added' : 'removed',
!                                       'edit' => 
$GLOBALS['phpgw']->link('/index.php',array(
!                                               'page_id' => $page_id,
!                                               'menuaction' => 
'sitemgr.Pages_UI.edit'
!                                       ))
!                               ));
!                               $this->t->parse('Pblock','Page',True);
!                       }
! 
!                       //Content Blocks
!                       $blocks = $this->bo->getcommitableblocks();
!                       while (list($block_id,$block) = @each($blocks))
!                       {
!                               $this->t->set_var(array(
!                                       'block' => 
$this->bo->getlangblocktitle($block_id,$this->sitelanguages[0]),
!                                       'blockid' => $block_id,
!                                       'scope' => 
$this->blockscope($block->cat_id,$block->page_id),
!                                       'addedorremovedorreplaced' => 
($block->cnt == 2) ? 'replaced' : 
!                                               (($block->state == 
SITEMGR_STATE_PREPUBLISH) ? 'added' : 'removed'),
!                                       'edit' =>  
$GLOBALS['phpgw']->link('/index.php',array(
!                                               'block_id' => $block_id,
!                                               'menuaction' => 
'sitemgr.Content_UI.manage'
!                                       ))
!                               ));
!                               $this->t->parse('Bblock','Block',True);
!                       }
! 
!                       $this->t->pfp('out', 'Commit');
!                       $this->common_ui->DisplayFooter();
!               }
! 
!               function archive()
!               {
!                       if ($_POST['btnReactivate'])
!                       {
!                               while(list($cat_id,) = @each($_POST['cat']))
!                               {
!                                       
$GLOBALS['Common_BO']->cats->reactivate($cat_id);
!                               }
!                               while(list($page_id,) = @each($_POST['page']))
!                               {
!                                       
$GLOBALS['Common_BO']->pages->reactivate($page_id);
!                               }
!                               while(list($block_id,) = @each($_POST['block']))
!                               {
!                                       $this->bo->reactivate($block_id);
!                               }
!                       }
! 
!                       $this->common_ui->DisplayHeader();
! 
!                       $this->t->set_file('Commit','archive.tpl');
!                       $this->t->set_block('Commit','Category','Cblock');
!                       $this->t->set_block('Commit','Page','Pblock');
!                       $this->t->set_block('Commit','Block','Bblock');
!                       $this->t->set_var(array(
!                               'commit_manager' => lang('Archived content'),
!                               'lang_categories' => lang('Categories'),
!                               'lang_pages' => lang('Pages'),
!                               'lang_blocks' => lang('Content blocks'),
!                               'lang_reactivate' => lang('Reactivate content')
!                       ));
! 
!                       //Categories
!                       $cats = 
$GLOBALS['Common_BO']->cats->getpermittedcatsArchived();
!                       //we have to append the archived cats to the 
currentcats, in order to be able to access them later
!                       $GLOBALS['Common_BO']->cats->currentcats = 
array_merge($GLOBALS['Common_BO']->cats->currentcats,$cats);
!                       while (list(,$cat_id) = @each($cats))
!                       {
!                               $cat = 
$GLOBALS['Common_BO']->cats->getCategory($cat_id,$this->sitelanguages[0]);
!                               $this->t->set_var(array(
!                                       'category' => $cat->name,
!                                       'catid' => $cat_id,
!                                       'edit' => 
$GLOBALS['phpgw']->link('/index.php',array(
!                                               'cat_id' => $cat_id,
!                                               'menuaction' => 
'sitemgr.Categories_UI.edit'
!                                       ))
!                               ));
!                               $this->t->parse('Cblock','Category',True);
!                       }
! 
!                       //Pages
!                       $pages = 
$GLOBALS['Common_BO']->pages->getpageIDListArchived();
! 
!                       while (list(,$page_id) = @each($pages))
!                       {
!                               $page = 
$GLOBALS['Common_BO']->pages->getPage($page_id);
!                               $this->t->set_var(array(
!                                       'page' => $page->name,
!                                       'pageid' => $page_id,
!                                       'edit' => 
$GLOBALS['phpgw']->link('/index.php',array(
!                                               'page_id' => $page_id,
!                                               'menuaction' => 
'sitemgr.Pages_UI.edit'
!                                       ))
!                               ));
!                               $this->t->parse('Pblock','Page',True);
!                       }
! 
!                       //Content Blocks
!                       $blocks = $this->bo->getarchivedblocks();
!                       while (list($block_id,$block) = @each($blocks))
!                       {
!                               $this->t->set_var(array(
!                                       'block' => 
$this->bo->getlangblocktitle($block_id,$this->sitelanguages[0]),
!                                       'blockid' => $block_id,
!                                       'scope' => 
$this->blockscope($block->cat_id,$block->page_id),
!                                       'edit' =>  
$GLOBALS['phpgw']->link('/index.php',array(
!                                               'block_id' => $block_id,
!                                               'menuaction' => 
'sitemgr.Content_UI.manage'
!                                       ))
!                               ));
!                               $this->t->parse('Bblock','Block',True);
!                       }
! 
!                       $this->t->pfp('out', 'Commit');
!                       $this->common_ui->DisplayFooter();
                }
  
***************
*** 336,339 ****
--- 466,626 ----
                        }
                        return $returnValue;
+               }
+ 
+               function blockscope($cat_id,$page_id)
+               {
+                       if ($cat_id == CURRENT_SITE_ID)
+                       {
+                               $scope = lang('Site wide');
+                       }
+                       else
+                       {
+                               $cat = 
$GLOBALS['Common_BO']->cats->getCategory($cat_id);
+                               $scope = lang('Category') . ' ' . $cat->name;
+                               if ($page_id)
+                               {
+                                       $page = 
$GLOBALS['Common_BO']->pages->getPage($page_id);
+                                       $scope .= ' - ' . lang('Page') . ' ' . 
$page->name;
+                               }
+                       }
+                       return $scope;
+               }
+ 
+               //if the block is shown on its own ($standalone), we add 
information about its,scope 
+               function showblock($block,$editable,$standalone=False)
+               {
+                       global $page_id,$cat_id, $inputblockid;
+                       //TODO: wrap a module storage around createmodule as in 
template3, 
+                       //TODO: so that we do not create the same module object 
twice
+                       $moduleobject = 
$this->modulebo->createmodule($block->module_name);
+                       $this->t->set_var(array(
+                               'moduleinfo' => ($block->module_name),
+                               'description' => $moduleobject->description,
+                               'savelang' => $this->langselect
+                       ));
+ 
+                       //if the block is in our scope and we are entitled we 
edit it
+                       if ($editable)
+                       {
+                               $editorstandardelements = array(
+                                       array('label' => lang('Title'),
+                                                 'form' => ('<input 
type="text" name="inputblocktitle" value="' . 
+                                                       ($block->title ? 
$block->title : $moduleobject->title) . '" />')
+                                       ),
+                                       array('label' => lang('Seen by'),
+                                                 'form' => ('<select 
name="inputblockview">' .
+                                                       
$this->inputviewselect((int)$block->view) . '</select>')
+                                       ),
+                                       array('label' => lang('Sort order'),
+                                                 'form' => ('<input 
type="text" name="inputblocksort" size="2" value="' .
+                                                       (int)$block->sort_order 
. '">')
+                                       )
+                               );
+                               if ($standalone)
+                               {
+                                       $editorstandardelements[] = array(
+                                               'label' => lang('Scope'),
+                                               'form' => 
$this->blockscope($block->cat_id,$block->page_id)
+                                       );
+                               }
+ 
+                               $moduleobject->set_block($block);
+ 
+                               $this->t->set_var(Array(
+                                       'blockid' => $block->id,
+                                       'validationerror' => (($block->id == 
$inputblockid) && $this->errormsg) ? join('<br>',$this->errormsg) : '',
+                               ));
+                               $this->t->set_var('standardelements','');
+                               while (list(,$element) = 
each($editorstandardelements))
+                               {
+                                       $this->t->set_var(Array(
+                                               'label' => $element['label'],
+                                               'form' => $element['form']
+                                       ));
+                                       
$this->t->parse('standardelements','EditorElement', true);
+                               }
+ 
+                               $versions = 
$this->bo->getallversionsforblock($block->id,$this->worklanguage);
+                               $this->t->set_var('EvBlock','');
+                               while (list($version_id,$version) = 
each($versions))
+                               {
+                                       //set the version of the block which is 
referenced by the moduleobject, 
+                                       //so that we retrieve a interface with 
the current version's arguments 
+                                       $block->set_version($version);
+                                       $editormoduleelements = 
$moduleobject->get_user_interface();
+                                       $this->t->set_var(array(
+                                               'version_id' => $version_id,
+                                               'state' => 
$GLOBALS['Common_BO']->inputstateselect($version['state']),
+                                               'deleteversion' => lang('Delete 
Version'),
+                                               'versionelements' => ''
+                                       ));
+                                       while (list(,$element) = 
each($editormoduleelements))
+                                       {
+                                               $this->t->set_var(Array(
+                                                       'label' => 
$element['label'],
+                                                       'form' => 
$element['form']
+                                               ));
+                                               
$this->t->parse('versionelements','EditorElement', true);
+                                       }
+                                       $this->t->parse('EvBlock','Version', 
true);
+                               }
+ 
+                               $this->t->parse('MeBlock','Moduleeditor');
+                               $this->t->set_var('MvBlock','');
+                       }
+                       //otherwise we only show it
+                       else
+                       {
+                               if ($block->page_id)
+                               {
+                                       $blockscope = lang('Page');
+                               }
+                               elseif ($block->cat_id != CURRENT_SITE_ID)
+                               {
+                                       $cat = 
$GLOBALS['Common_BO']->cats->getCategory($block->cat_id);
+                                       $blockscope =  lang('Category') . ' - ' 
. $cat->name;
+                               }
+                               else
+                               {
+                                       $blockscope =  lang('Site');
+                               }
+ 
+                               $viewstandardelements = array(
+                                       array('label' => lang('Scope'),
+                                                 'value' => $blockscope
+                                       ),
+                                       array('label' => lang('Title'),
+                                                 'value' => ($block->title ? 
$block->title : $moduleobject->title)
+                                       ),
+                                       array('label' => lang('Seen by'),
+                                                 'value' => 
$this->viewable[(int)$block->view]
+                                       ),
+                                       array('label' => lang('Sort order'),
+                                                 'value' => 
(int)$block->sort_order
+                                       )
+                               );
+ //                                                            
$viewmoduleelements = array();
+ //                                                            while 
(list($argument,$argdef) = @each($moduleobject->arguments))
+ //                                                            {
+ //                                                                    $value 
= $block->arguments[$argument];
+ //                                                                    
$viewmoduleelements[] = array(
+ //                                                                            
'label' => $argdef['label'],
+ //                                                                            
'value' => $GLOBALS['phpgw']->strip_html($value)
+ //                                                                    );
+ //                                                            }
+ //                                                            $interface = 
array_merge($viewstandardelements,$viewmoduleelements);
+ $interface = $viewstandardelements;
+                               $this->t->set_var('VeBlock','');
+                               while (list(,$element) = each($interface))
+                               {
+                                       $this->t->set_var(Array(
+                                               'label' => $element['label'],
+                                               'value' => $element['value'])
+                                       );
+                                       
$this->t->parse('VeBlock','ViewElement', true);
+                               }
+                               $this->t->parse('MvBlock','Moduleview');
+                               $this->t->set_var('MeBlock','');
+                       }
                }
        }

Index: class.Modules_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Modules_BO.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Modules_BO.inc.php    23 May 2003 03:37:25 -0000      1.3
--- class.Modules_BO.inc.php    30 May 2003 04:01:43 -0000      1.4
***************
*** 145,149 ****
                function getcascadingmodulepermissions($contentarea,$cat_id)
                {
!                       $cat_ancestorlist = 
$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id);
                        $cat_ancestorlist[] = CURRENT_SITE_ID;
  
--- 145,149 ----
                function getcascadingmodulepermissions($contentarea,$cat_id)
                {
!                       $cat_ancestorlist = ($cat_id !=  CURRENT_SITE_ID) ? 
$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id) : array();
                        $cat_ancestorlist[] = CURRENT_SITE_ID;
  
***************
*** 173,177 ****
                function 
getcascadingmoduleproperties($module_id,$contentarea,$cat_id,$modulename=False)
                {
!                       $cat_ancestorlist = 
$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id);
                        $cat_ancestorlist[] = CURRENT_SITE_ID;
  
--- 173,177 ----
                function 
getcascadingmoduleproperties($module_id,$contentarea,$cat_id,$modulename=False)
                {
!                       $cat_ancestorlist = ($cat_id !=  CURRENT_SITE_ID) ? 
$GLOBALS['Common_BO']->cats->getCategoryancestorids($cat_id) : array();
                        $cat_ancestorlist[] = CURRENT_SITE_ID;
  

Index: class.Modules_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Modules_UI.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.Modules_UI.inc.php    23 May 2003 03:37:25 -0000      1.5
--- class.Modules_UI.inc.php    30 May 2003 04:01:43 -0000      1.6
***************
*** 12,18 ****
                var $public_functions = array
                (
!                       '_manageModules' => True,
                        'findmodules' => True,
!                       '_configureModule' => True
                );
  
--- 12,18 ----
                var $public_functions = array
                (
!                       'manage' => True,
                        'findmodules' => True,
!                       'configure' => True
                );
  
***************
*** 26,30 ****
                }
  
!               function _manageModules()
                {
                        $this->common_ui->DisplayHeader();
--- 26,30 ----
                }
  
!               function manage()
                {
                        $this->common_ui->DisplayHeader();
***************
*** 42,46 ****
                                                $cat = 
$this->catbo->getCategory($cat_id);
                                                $cat_name = $cat->name;
!                                               $managelink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Categories_UI._manageCategories');
                                                $goto = lang('Category 
manager');
                                                $scopename = lang('Category');
--- 42,46 ----
                                                $cat = 
$this->catbo->getCategory($cat_id);
                                                $cat_name = $cat->name;
!                                               $managelink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Categories_UI.manage');
                                                $goto = lang('Category 
manager');
                                                $scopename = lang('Category');
***************
*** 65,69 ****
                                $link_data['menuaction'] = 
"sitemgr.Modules_UI.findmodules";
                                $this->t->set_var('findmodules', 
$GLOBALS['phpgw']->link('/index.php',$link_data));
!                               $link_data['menuaction'] = 
"sitemgr.Modules_UI._configureModule";
                                $this->t->set_var('configureurl', 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                                $contentareas = 
$GLOBALS['Common_BO']->content->getContentAreas();
--- 65,69 ----
                                $link_data['menuaction'] = 
"sitemgr.Modules_UI.findmodules";
                                $this->t->set_var('findmodules', 
$GLOBALS['phpgw']->link('/index.php',$link_data));
!                               $link_data['menuaction'] = 
"sitemgr.Modules_UI.configure";
                                $this->t->set_var('configureurl', 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                                $contentareas = 
$GLOBALS['Common_BO']->content->getContentAreas();
***************
*** 107,114 ****
                {
                        $this->bo->findmodules();
!                       $this->_manageModules();
                }
  
!               function _configureModule()
                {
                        if ($this->acl->is_admin())
--- 107,114 ----
                {
                        $this->bo->findmodules();
!                       $this->manage();
                }
  
!               function configure()
                {
                        if ($this->acl->is_admin())
***************
*** 120,124 ****
                                {
                                        $this->errormsg = lang("You did not 
choose a module.");
!                                       $this->_manageModules();
                                        return;
                                }
--- 120,124 ----
                                {
                                        $this->errormsg = lang("You did not 
choose a module.");
!                                       $this->manage();
                                        return;
                                }
***************
*** 130,134 ****
                                {
                                        
$this->bo->savemoduleproperties($inputmodule_id,$element,$inputarea,$cat_id);
!                                       $this->_manageModules();
                                        return;
                                }
--- 130,134 ----
                                {
                                        
$this->bo->savemoduleproperties($inputmodule_id,$element,$inputarea,$cat_id);
!                                       $this->manage();
                                        return;
                                }
***************
*** 136,140 ****
                                {
                                        
$this->bo->deletemoduleproperties($inputmodule_id,$inputarea,$cat_id);
!                                       $this->_manageModules();
                                        return;
                                }
--- 136,140 ----
                                {
                                        
$this->bo->deletemoduleproperties($inputmodule_id,$inputarea,$cat_id);
!                                       $this->manage();
                                        return;
                                }
***************
*** 191,195 ****
                                );
                                $link_data['cat_id'] = $cat_id;
!                               $link_data['menuaction'] = 
"sitemgr.Modules_UI._manageModules";
                                $this->t->set_var('backlink',
                                        '<a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . 
--- 191,195 ----
                                );
                                $link_data['cat_id'] = $cat_id;
!                               $link_data['menuaction'] = 
"sitemgr.Modules_UI.manage";
                                $this->t->set_var('backlink',
                                        '<a href="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . 

Index: class.Page_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Page_SO.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.Page_SO.inc.php       17 Jan 2003 03:37:52 -0000      1.5
--- class.Page_SO.inc.php       30 May 2003 04:01:43 -0000      1.6
***************
*** 11,15 ****
                var $lang;
                var $block;
!               
                function Page_SO()
                {
--- 11,16 ----
                var $lang;
                var $block;
!               var $state;
! 
                function Page_SO()
                {

Index: class.Pages_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_BO.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.Pages_BO.inc.php      23 May 2003 03:37:25 -0000      1.7
--- class.Pages_BO.inc.php      30 May 2003 04:01:43 -0000      1.8
***************
*** 2,19 ****
        class Pages_BO
        {
!               var $pageso;
  
                function Pages_BO()
                {
!                       $this->pageso = CreateObject('sitemgr.Pages_SO',True);
                }
  
                function getPageOptionList()
                {
!                       $pagelist = $this->pageso->getPageIDList();
                        $retval[]=array('value'=>0,'display'=>'[' .lang('Show 
Site Index') . ']');
                        foreach($pagelist as $page_id)
                        {
!                               $page = $this->pageso->getPage($page_id);
                                
$retval[]=array('value'=>$page_id,'display'=>$page->name);
                        }
--- 2,19 ----
        class Pages_BO
        {
!               var $so;
  
                function Pages_BO()
                {
!                       $this->so = CreateObject('sitemgr.Pages_SO',True);
                }
  
                function getPageOptionList()
                {
!                       $pagelist = 
$this->so->getPageIDList(0,$GLOBALS['Common_BO']->getstates('Production'));
                        $retval[]=array('value'=>0,'display'=>'[' .lang('Show 
Site Index') . ']');
                        foreach($pagelist as $page_id)
                        {
!                               $page = $this->so->getPage($page_id);
                                
$retval[]=array('value'=>$page_id,'display'=>$page->name);
                        }
***************
*** 21,29 ****
                }
  
!               function getPageIDList($cat_id=0)
                {
!                       if 
($GLOBALS['Common_BO']->acl->can_read_category($cat_id))
                        {
!                               return $this->pageso->getPageIDList($cat_id);   
                        }
                        else
--- 21,41 ----
                }
  
!               function getpageIDListCommitable()
                {
!                       //only retrieve commitable pages from writeable 
categories
!                       return 
$this->so->getPageIDList($GLOBALS['Common_BO']->cats->getpermittedcatsWrite(),$GLOBALS['Common_BO']->getstates('Commit'));
!               }
! 
!               function getpageIDListArchived()
!               {
!                       //only retrieve archived pages from writeable categories
!                       return 
$this->so->getPageIDList($GLOBALS['Common_BO']->cats->getpermittedcatsWrite(),$GLOBALS['Common_BO']->getstates('Archive'));
!               }
! 
!               function getPageIDList($cat_id=0,$states=false)
!               {
!                       if (!$cat_id || 
$GLOBALS['Common_BO']->acl->can_read_category($cat_id))
                        {
!                               return 
$this->so->getPageIDList($cat_id,$states);       
                        }
                        else
***************
*** 37,41 ****
                        if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
                        {
!                               return $this->pageso->addPage($cat_id);
                        }
                        else
--- 49,53 ----
                        if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
                        {
!                               return $this->so->addPage($cat_id);
                        }
                        else
***************
*** 47,73 ****
                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);
!                               
$GLOBALS['Common_BO']->content->removeBlocksInPageOrCat($cat_id,$page_id);
!                       }
!                       else
                        {
!                               return false;
                        }
                }
  
                function getPage($page_id,$lang=False)
                {
!                       $page = $this->pageso->getPage($page_id,$lang);
                        if(
                                $page && 
--- 59,91 ----
                function removePagesInCat($cat_id,$force=False)
                {
!                       if (!($force || 
$GLOBALS['Common_BO']->acl->can_write_category($cat_id)))
!                       {
!                               return false;
!                       }
!                       $pages = $this->so->getPageIDList($cat_id);
                        while(list(,$page_id) = each($pages))
                        {
!                               $this->removePage($page_id,True);
                        }
                }
  
!               function removePage($page_id,$force=False)
                {
!                       $cat_id = $this->so->getcatidforpage($page_id);
!                       if (!$force)
                        {
!                               if 
(!$GLOBALS['Common_BO']->acl->can_write_category($cat_id))
!                               {
!                                       return false;
!                               }
                        }
+                       $this->so->removePage($page_id);
+                       //since we already did the ACL we force
+                       
$GLOBALS['Common_BO']->content->removeBlocksInPageOrCat($cat_id,$page_id,True);
                }
  
                function getPage($page_id,$lang=False)
                {
!                       $page = $this->so->getPage($page_id,$lang);
                        if(
                                $page && 
***************
*** 76,79 ****
--- 94,105 ----
                        )
                        {
+                               //if the page is not in published status we 
maintain its name so that switching from edit to prodcution mode works
+                               if 
(!in_array($page->state,$GLOBALS['Common_BO']->visiblestates))
+                               {
+                                       $page->title = lang('Error accessing 
page');
+                                       $page->subtitle = '';
+                                       $page->id = 0;
+                                       $page->cat_id = 0;
+                               }
                                return $page;
                        }
***************
*** 91,100 ****
                function getlangarrayforpage($page_id)
                {
!                       return $this->pageso->getlangarrayforpage($page_id);
                }
  
                function savePageInfo($page_Info,$lang)
                {
!                       if 
(!$GLOBALS['Common_BO']->acl->can_write_category($page_Info->cat_id))
                        {
                                return lang("You don't have permission to write 
to that category.");
--- 117,131 ----
                function getlangarrayforpage($page_id)
                {
!                       return $this->so->getlangarrayforpage($page_id);
                }
  
                function savePageInfo($page_Info,$lang)
                {
!                       $oldpage = $this->getpage($page_Info->id);
! 
!                       if(
!                               
!($GLOBALS['Common_BO']->acl->can_write_category($page_Info->cat_id) && 
!                               
$GLOBALS['Common_BO']->acl->can_write_category($oldpage->cat_id))
!                       )
                        {
                                return lang("You don't have permission to write 
to that category.");
***************
*** 104,161 ****
                        if ($fixed_name != $page_Info->name)
                        {
-                               $fixed_name = strtr($page_Info->name, 
'address@hidden&*()-_=+   /?><,.\\\'":;|`~{}[]','                       ');
-                               $fixed_name = str_replace(' ', '', $fixed_name);
-                               if ($fixed_name != $page_Info->name)
-                               {
-                                       $page_Info->name = $fixed_name;
-                                       $this->pageso->savePageInfo($page_Info);
-                                       
$this->pageso->savePageLang($page_Info,$lang);
-                                       return lang('The Name field cannot 
contain punctuation or spaces (field modified).');
-                               }
-                               if ($this->pageso->savePageInfo($page_Info))
-                               {
-                                       
$this->pageso->savePageLang($page_Info,$lang);
-                                       return lang('The page was successfully 
saved.');
-                               }
-                               else
-                               {
-                                       return lang('There was an error writing 
to the database.');
-                               }
-                               //MT: are the following three lines ever 
executed?
                                $page_Info->name = $fixed_name;
!                               $this->pageso->savePageInfo($page_Info);
                                return lang('The Name field cannot contain 
punctuation or spaces (field modified).');
                        }
!                       if 
($this->pageso->pageExists($page_Info->name,$page_Info->id))
                        {
                                $page_Info->name .= '--FIX-DUPLICATE-NAME';
!                               $this->pageso->savePageInfo($page_Info);
!                               $this->pageso->savePageLang($page_Info,$lang);
                                return lang('The page name must be unique.');
                        }
!                       if ($this->pageso->savePageInfo($page_Info))
!                       {
!                               $this->pageso->savePageLang($page_Info,$lang);
!                               return True;
!                       } 
!                       else
!                       {
!                               return lang('There was an error writing to the 
database.');
!                       }
                }
  
                function savePageLang($page_Info,$lang)
!                 {
!                   $this->pageso->savePageLang($page_Info,$lang);
!                 }
  
                function removealllang($lang)
                {
!                       $this->pageso->removealllang($lang);
                }
  
                function migratealllang($oldlang,$newlang)
                {
!                       $this->pageso->migratealllang($oldlang,$newlang);
                }
        }
--- 135,186 ----
                        if ($fixed_name != $page_Info->name)
                        {
                                $page_Info->name = $fixed_name;
!                               $this->so->savePageInfo($page_Info);
!                               $this->so->savePageLang($page_Info,$lang);
                                return lang('The Name field cannot contain 
punctuation or spaces (field modified).');
                        }
!                       if 
($this->so->pageExists($page_Info->name,$page_Info->id))
                        {
                                $page_Info->name .= '--FIX-DUPLICATE-NAME';
!                               $this->so->savePageInfo($page_Info);
!                               $this->so->savePageLang($page_Info,$lang);
                                return lang('The page name must be unique.');
                        }
!                       $this->so->savePageInfo($page_Info);
!                       $this->so->savePageLang($page_Info,$lang);
!                       return True;
                }
  
                function savePageLang($page_Info,$lang)
!               {
!                   $this->so->savePageLang($page_Info,$lang);
!               }
  
                function removealllang($lang)
                {
!                       $this->so->removealllang($lang);
                }
  
                function migratealllang($oldlang,$newlang)
                {
!                       $this->so->migratealllang($oldlang,$newlang);
!               }
! 
!               function commit($page_id)
!               {
!                       $cat_id = $this->so->getcatidforpage($page_id);
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
!                       {
!                               $this->so->commit($page_id);
!                       }
!               }
! 
!               function reactivate($page_id)
!               {
!                       $cat_id = $this->so->getcatidforpage($page_id);
!                       if 
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
!                       {
!                               $this->so->reactivate($page_id);
!                       }
                }
        }

Index: class.Pages_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_SO.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** class.Pages_SO.inc.php      23 May 2003 03:37:25 -0000      1.13
--- class.Pages_SO.inc.php      30 May 2003 04:01:43 -0000      1.14
***************
*** 9,38 ****
                }
  
!               function getPageIDList($cat_id=False)
                {
                        $page_id_list = array();
!                       if (!$cat_id)
                        {
!                               $cat_list = 
$GLOBALS['Common_BO']->cats->allcatidsforsite;
!                               if ($cat_list)
                                {
!                                       $sql = 'SELECT page_id FROM 
phpgw_sitemgr_pages WHERE cat_id IN (' . 
!                                               implode(',',$cat_list) .  
!                                               ')ORDER BY cat_id, sort_order 
ASC';
                                }
!                               else
                                {
!                                       return $page_id_list;
                                }
                        }
-                       else
-                       {
-                               $sql = 'SELECT page_id FROM phpgw_sitemgr_pages 
WHERE cat_id=\'' . $cat_id . '\' ORDER BY sort_order';
-                       }
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $page_id_list[] = $this->db->f('page_id');
-                       }
                        return $page_id_list;
                }
--- 9,42 ----
                }
  
!               
!               //if $cats is an array, pages from this list are retrieved,
!               //is $cats is an int, pages from this cat are retrieved,
!               //if $cats is 0 or false, pages from currentcats are retrieved
!               function getPageIDList($cats=False,$states=false)
                {
+                       if (!$states)
+                       {
+                               $states = $GLOBALS['Common_BO']->visiblestates;
+                       }
+ 
                        $page_id_list = array();
!                       $cat_list = is_array($cats) ? implode(',',$cats) :
!                               ($cats ? $cats : 
!                                       
($GLOBALS['Common_BO']->cats->currentcats ? 
implode(',',$GLOBALS['Common_BO']->cats->currentcats) : false)
!                               );
!                       if ($cat_list)
                        {
!                               $sql = "SELECT page_id FROM phpgw_sitemgr_pages 
WHERE cat_id IN ($cat_list) ";
!                               if ($states)
                                {
!                                       $sql .= 'AND state in ('. 
implode(',',$states)  . ')';
                                }
!                               $sql .=' ORDER BY cat_id, sort_order ASC'; 
!                               $this->db->query($sql,__LINE__,__FILE__);
!                               while ($this->db->next_record())
                                {
!                                       $page_id_list[] = 
$this->db->f('page_id');
                                }
                        }
                        return $page_id_list;
                }
***************
*** 97,103 ****
                }
  
                function getPage($page_id,$lang=False)
                {
!                       $sql = 'SELECT * FROM phpgw_sitemgr_pages WHERE 
page_id=\'' . $page_id . '\'';
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
--- 101,121 ----
                }
  
+               function getcatidforpage($page_id)
+               {
+                       $sql = "SELECT cat_id FROM phpgw_sitemgr_pages WHERE 
page_id = $page_id";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ($this->db->next_record())
+                       {
+                               return $this->db->f('cat_id');
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+ 
                function getPage($page_id,$lang=False)
                {
!                       $sql = "SELECT * FROM phpgw_sitemgr_pages WHERE 
page_id= $page_id";
                        $this->db->query($sql,__LINE__,__FILE__);
                        if ($this->db->next_record())
***************
*** 109,116 ****
                                $page->name = 
stripslashes($this->db->f('name'));
                                $page->hidden = $this->db->f('hide_page');
                                
                                if ($lang)
                                {
!                                       $sql = "SELECT * FROM 
phpgw_sitemgr_pages_lang WHERE page_id='$page_id' and lang='$lang'";
                                        
$this->db->query($sql,__LINE__,__FILE__);
                                
--- 127,135 ----
                                $page->name = 
stripslashes($this->db->f('name'));
                                $page->hidden = $this->db->f('hide_page');
+                               $page->state = $this->db->f('state');
                                
                                if ($lang)
                                {
!                                       $sql = "SELECT * FROM 
phpgw_sitemgr_pages_lang WHERE page_id=$page_id AND lang='$lang'";
                                        
$this->db->query($sql,__LINE__,__FILE__);
                                
***************
*** 159,163 ****
                                'name=\'' . 
$this->db->db_addslashes($pageInfo->name) . '\',' .
                                'sort_order=\'' . (int) $pageInfo->sort_order . 
'\',' .
!                               'hide_page=\'' . $pageInfo->hidden . '\' ' .
                                'WHERE page_id=\'' . $pageInfo->id . '\'';
                        $this->db->query($sql, __LINE__,__FILE__);
--- 178,183 ----
                                'name=\'' . 
$this->db->db_addslashes($pageInfo->name) . '\',' .
                                'sort_order=\'' . (int) $pageInfo->sort_order . 
'\',' .
!                               'hide_page=\'' . $pageInfo->hidden . '\',' .
!                               'state=\'' . $pageInfo->state . '\' ' .
                                'WHERE page_id=\'' . $pageInfo->id . '\'';
                        $this->db->query($sql, __LINE__,__FILE__);
***************
*** 196,199 ****
--- 216,233 ----
                {
                        $sql = "UPDATE phpgw_sitemgr_pages_lang SET 
lang='$newlang' WHERE lang='$oldlang'";
+                       $this->db->query($sql, __LINE__,__FILE__);
+               }
+ 
+               function commit($page_id)
+               {
+                       $sql = "UPDATE phpgw_sitemgr_pages SET state = " . 
SITEMGR_STATE_PUBLISH . " WHERE state = " . SITEMGR_STATE_PREPUBLISH . " AND 
page_id = $page_id";
+                       $this->db->query($sql, __LINE__,__FILE__);
+                       $sql = "UPDATE phpgw_sitemgr_pages SET state = " . 
SITEMGR_STATE_ARCHIVE . " WHERE state = " . SITEMGR_STATE_PREUNPUBLISH . " AND 
page_id = $page_id";;
+                       $this->db->query($sql, __LINE__,__FILE__);
+               }
+ 
+               function reactivate($page_id)
+               {
+                       $sql = "UPDATE phpgw_sitemgr_pages SET state = " . 
SITEMGR_STATE_DRAFT . " WHERE state = " . SITEMGR_STATE_ARCHIVE . " AND page_id 
= $page_id";
                        $this->db->query($sql, __LINE__,__FILE__);
                }

Index: class.Pages_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_UI.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.Pages_UI.inc.php      22 May 2003 06:19:23 -0000      1.3
--- class.Pages_UI.inc.php      30 May 2003 04:01:43 -0000      1.4
***************
*** 13,30 ****
        {
                var $common_ui;
-               var $cat_id;
-               var $page_id;
                var $t;
                var $pagebo;
                var $categorybo;
                var $pageso; // page class
-               var $category;
-               var $cat_list;
-               var $page_list;
                var $sitelanguages;
                
                var $public_functions=array
                (
!                       '_managePage' => True
                );
                
--- 13,27 ----
        {
                var $common_ui;
                var $t;
                var $pagebo;
                var $categorybo;
                var $pageso; // page class
                var $sitelanguages;
                
                var $public_functions=array
                (
!                       'manage' => True,
!                       'edit' => True,
!                       'delete' => True
                );
                
***************
*** 37,131 ****
                        $this->sitelanguages = 
$GLOBALS['Common_BO']->sites->current_site['sitelanguages'];
                }
-               
-               function _addPage($category_id)
-               {
-                       $this->_editPage($category_id, 0);
-               }
        
!               function _deletePage($category_id, $page_id)
                {
!                       $this->pagebo->removePage($category_id, $page_id);
                }
  
!               function _editPage($category_id, 
$page_id,$cname='',$ctitle='',$csubtitle='')
                {
!                       
$GLOBALS['Common_BO']->globalize(array('title','name','subtitle','sort_order','parent','hidden','btnEditPage','savelanguage'));
!                       global $title;
!                       global $name;
!                       global $subtitle;
!                       global $sort_order;
!                       global $parent;
!                       global $hidden;
!                       global $btnEditPage;
                        global $savelanguage;
!               
                        $this->t->set_file('EditPage', 'page_editor.tpl');
!                       if($page_id)
                        {
!                               $this->page = 
$this->pagebo->getPage($page_id,$this->sitelanguages[0]);
!                               if ($cname)
                                {
!                                       $this->page->name=$cname;
                                }
!                               if ($ctitle)
                                {
!                                       $this->page->title=$ctitle;
                                }
!                               if ($csubtitle)
                                {
!                                       $this->page->subtitle=$csubtitle;
                                }
                                $this->t->set_var('add_edit',lang('Edit Page'));
!                               
$this->t->set_var('move_to',$this->getParentOptions($this->page->cat_id));
                        }
                        else
                        {
-                               $this->page->title = $title;
-                               $this->page->subtitle = $subtitle;
-                               $this->page->name = $name;
-                               $this->page->sort_order = $sort_order;
-                               $this->page->cat_id = $category_id;
                                $this->t->set_var('add_edit',lang('Add Page'));
                                $move_msg = lang('Cannot move page until it has 
been saved.');
-                               $move_msg .= '<INPUT TYPE="hidden" 
name="parent" value="'.
-                                       $category_id.'">';
                                $this->t->set_var('move_to',$move_msg);
                        }
!                       
!                       $trans = array('{' => '&#123;', '}' => '&#125;');
!                       if($this->page->hidden)
!                         {
!                                 $this->t->set_var('hidden', 'CHECKED');
!                         }
!                         else
!                         {   
!                                 $this->t->set_var('hidden', '');
!                         }
!                       
                        if (count($this->sitelanguages) > 1)
!                         {
!                           $select = lang('as') . ' <select 
name="savelanguage">';
!                           
!                           foreach ($this->sitelanguages as $lang)
!                             {
!                               $selected= '';
!                               if ($lang == $page->lang)
!                                 {
!                                   $selected = 'selected="selected" ';
!                                 }
!                               $select .= '<option ' . $selected .'value="' . 
$lang . '">'. $GLOBALS['Common_BO']->getlangname($lang) . '</option>';
!                             }
!                           $select .= '</select> ';
!                           $this->t->set_var('savelang',$select);
!                         }
                        
                        $this->t->set_var(array(
!                               'title' =>$this->page->title,
!                               'subtitle' => $this->page->subtitle,
! //                            
'main'=>strtr($GLOBALS['phpgw']->strip_html($this->page->content),$trans),
!                               'name'=>$this->page->name,
!                               'sort_order'=>$this->page->sort_order,
!                               'pageid'=>$page_id,
!                               'category_id' => $category_id,
                                'lang_name' => lang('Name'),
                                'lang_title' => lang('Title'),
--- 34,144 ----
                        $this->sitelanguages = 
$GLOBALS['Common_BO']->sites->current_site['sitelanguages'];
                }
        
!               function delete()
                {
!                       $page_id = $_GET['page_id'];
!                       $this->pagebo->removePage($page_id);
!                       $this->manage();
!                       return;
                }
  
!               function edit()
                {
!                       $GLOBALS['Common_BO']->globalize(array(
!                               
'inputhidden','btnAddPage','btnDelete','btnEditPage','btnSave','inputsort','inputstate',
!                               
'inputtitle','inputname','inputsubtitle','savelanguage','inputpageid','inputcategoryid'));
! 
!                       global $inputpageid,$inputcategoryid, $inputhidden, 
$inputstate;
!                       global $btnAddPage, $btnDelete, $btnEditPage, $btnSave;
!                       global $inputsort,$inputtitle, $inputname, 
$inputsubtitle;
                        global $savelanguage;
!                       $page_id = $inputpageid ? $inputpageid : 
$_GET['page_id'];
!                       $category_id = $inputcategoryid ? $inputcategoryid : 
$_GET['category_id'];
! 
                        $this->t->set_file('EditPage', 'page_editor.tpl');
! 
!                       if($btnSave)
                        {
!                               if ($inputname == '' || $inputtitle == '')
                                {
!                                       $error = lang('You failed to fill in 
one or more required fields.');
!                               }
!                               if(!$page_id)
!                               {               
!                                       $page_id = 
$this->pagebo->addPage($inputcategoryid);
!                                       if(!$page_id)
!                                       {
!                                               echo lang("You don't have 
permission to write in the category");
!                                               $this->manage();
!                                               return;
!                                       }
                                }
!                               if (!$error)
                                {
!                                       $page->id = $page_id;
!                                       $page->title = $inputtitle;
!                                       $page->name = $inputname;
!                                       $page->subtitle = $inputsubtitle;
!                                       $page->sort_order = $inputsort;
!                                       $page->cat_id = $category_id;
!                                       $page->hidden = $inputhidden ? 1: 0;
!                                       $page->state = $inputstate;
!                                       $savelanguage = $savelanguage ? 
$savelanguage : $this->sitelanguages[0];
!                                       $save_msg = 
$this->pagebo->savePageInfo($page,$savelanguage);
!                                       if (!is_string($save_msg))
!                                       {
!                                               $this->manage();
!                                               return;
!                                       }
!                                       $this->t->set_var('message',$save_msg);
                                }
!                               else
                                {
!                                       $this->t->set_var('message',$error);
                                }
+                       }
+ 
+                       $this->common_ui->DisplayHeader();
+ 
+                       if($page_id)
+                       {
+                               $page = 
$this->pagebo->getPage($page_id,$this->sitelanguages[0]);
                                $this->t->set_var('add_edit',lang('Edit Page'));
!                               
$this->t->set_var('move_to',$this->getParentOptions($page->cat_id));
                        }
                        else
                        {
                                $this->t->set_var('add_edit',lang('Add Page'));
                                $move_msg = lang('Cannot move page until it has 
been saved.');
                                $this->t->set_var('move_to',$move_msg);
                        }
! 
                        if (count($this->sitelanguages) > 1)
!                       {
!                               $select = lang('as') . ' <select 
name="savelanguage">';
                        
+                               foreach ($this->sitelanguages as $lang)
+                               {
+                                       $selected= '';
+                                       if ($lang == $page->lang)
+                                       {
+                                               $selected = 
'selected="selected" ';
+                                       }
+                                       $select .= '<option ' . $selected 
.'value="' . $lang . '">'. $GLOBALS['Common_BO']->getlangname($lang) . 
'</option>';
+                               }
+                               $select .= '</select> ';
+                               $this->t->set_var('savelang',$select);
+                       }
+ 
+                       $link_data['page_id'] = $page_id;
+                       $link_data['category_id'] = $inputcategoryid;
                        $this->t->set_var(array(
!                               'title' =>$page->title,
!                               'subtitle' => $page->subtitle,
!                               'name'=>$page->name,
!                               'sort_order'=>$page->sort_order,
!                               'page_id'=>$page_id,
!                               'hidden' => $page->hidden ? 'CHECKED' : '',
!                               'stateselect' => 
$GLOBALS['Common_BO']->inputstateselect($page->state),
                                'lang_name' => lang('Name'),
                                'lang_title' => lang('Title'),
***************
*** 137,335 ****
                                'lang_goback' => lang('Go back to Page 
Manager'),
                                'lang_reset' => lang('Reset'),
!                               'lang_save' => lang('Save')
                        ));
- 
                        
-                       
-                       $this->t->set_var('actionurl', 
$GLOBALS['phpgw']->link('/index.php',
-                               'menuaction=sitemgr.Pages_UI._managePage'));
-                       $this->t->set_var('goback', 
$GLOBALS['phpgw']->link('/index.php',
-                                 'menuaction=sitemgr.Pages_UI._managePage'));
                        $this->t->pfp('out','EditPage');
!               
                }
-               
-               function _managePage()
-               {
-                       
$GLOBALS['Common_BO']->globalize(array('hidden','btnAddPage','btnDelete','btnEditPage','btnPrev','pageid','btnSave','category_id','sort_order','parent','title','name','subtitle','error','savelanguage'));
-                       global $hidden;
-                       global $btnAddPage, $btnDelete, $btnEditPage;
-                       global $btnPrev;
-                       global $btnSave;
-                       global $pageid;
-                       global $category_id;
-                       global $sort_order;
-                       global $parent;
-                       global $title;
-                       global $name;
-                       global $subtitle;
-                       global $error;
-                       global $savelanguage;
  
                        $this->common_ui->DisplayHeader();
-                       
-                       if($btnSave && !$error)
-                       {
-                               if ($name == '' || $title == '')
-                               {
-                                       $this->t->set_var('message',lang('You 
failed to fill in one or more required fields.'));
-                                       
$this->_editPage($category_id,$pageid,$name,$title,$subtitle);
-                                       exit;
-                               }
-                               if($pageid)
-                               {
-                                       $this->page->id = $pageid;
-                               }
-                               else
-                               {               
-                                       $this->page->id = 
$this->pagebo->addPage($category_id);
-                                       $pageid = $this->page->id;
-                                       if(!$this->page->id)
-                                       {
-                                               $save_msg = lang("You don't 
have permission to write in the category");
-                                       }
-                               }
- 
-                               if (!$save_msg)
-                               {
-                                       $this->page->title = $title;
-                                       $this->page->name = $name;
-                                       $this->page->subtitle = $subtitle;
-                                       $this->page->sort_order = $sort_order;
-                                       $this->page->cat_id = $parent;
  
!                                       if($hidden)
!                                       {
!                                               $this->page->hidden = 1;
!                                       }
!                                       else
!                                       {
!                                               $this->page->hidden = 0;
!                                       }
!                                       $savelanguage = $savelanguage ? 
$savelanguage : $this->sitelanguages[0];
!                                       $save_msg = 
$this->pagebo->savePageInfo($this->page,$savelanguage);
!                               }
!                               if (!is_string($save_msg))
!                               {
!                                       echo('<p><b><font color="red">' . 
lang('Page saved.') . '</font></b></p>');
!                               }
!                               else
!                               {
!                                       $this->t->set_var('message',$save_msg);
!                                       
$this->_editPage($category_id,$this->page->id); 
//,$name,$title,$subtitle,$main);
!                                       exit;
!                               }
!                               $btnEditPage = False;
!                               $btnSave = False;
!                       }
!                       if($btnPrev)
!                       {
!                               echo lang('Go back to the category manager.');
!                               $btnEditPage = False;
!                               $btnPrev = False;
!                       }
!                       if($btnAddPage)
!                       {
!                               $this->_addPage($category_id);
!                       }
!                       else if($btnEditPage)
!                       {
!                               $this->_editPage($category_id, $pageid);
!                       }
!                       else
!                       {
!                               if($btnDelete)
!                               {
!                                       $this->_deletePage($category_id, 
$pageid);
!                               }
!                               
!                               
$this->t->set_file('ManagePage','page_manager.tpl');
!                               $this->t->set_block('ManagePage', 'PageBlock', 
'PBlock');
!                               $this->t->set_block('ManagePage', 
'CategoryBlock', 'CBlock');
!                               $this->t->set_var('page_manager', lang('Page 
Manager'));
!                               $this->cat_list = 
$this->categorybo->getPermittedCatWriteNested();
! 
!                               if($this->cat_list)
!                               {
!                                       for ($i=0; $i<sizeof($this->cat_list); 
$i++)
!                                       {
!                                               $this->category = 
$this->categorybo->getCategory($this->cat_list[$i]);                            
      
!                                               $this->t->set_var('PBlock', '');
!                                               $this->page_list = 
$this->pagebo->getPageIDList($this->cat_list[$i]);
!                                               $this->cat_id = 
$this->cat_list[$i];
!                                               if($this->page_list && 
sizeof($this->page_list)>0)
!                                               {
!                                                       for($j = 0; $j < 
sizeof($this->page_list); $j++)
!                                                       {
!                                                               $this->page_id 
=$this->page_list[$j];
!                                                               $this->page = 
$this->pagebo->getPage($this->page_id,$this->sitelanguages[0]);
!                                                               
$page_description = sprintf(
!                                                                       
'<b>%s</b>: %s &nbsp;&nbsp;<b>ID</b>: %s<br><b>%s</b>: %s',
!                                                                       
lang('Name'),
!                                                                       
$this->page->name,
!                                                                       
$this->page_id,
!                                                                       
lang('Title'),
!                                                                       
$this->page->title
!                                                               );
!                                                               
$this->t->set_var('page', $page_description);
!                                                               
$this->t->set_var('edit',
!                                                                       '<form 
action="'.
!                                                                       
$GLOBALS['phpgw']->link('/index.php',
!                                                                               
'menuaction=sitemgr.Pages_UI._managePage').
!                                                                               
'" method="POST">
!                                                                       <input 
type="submit" name="btnEditPage" value="' . lang('Edit') .'">
!                                                                       <input 
type="hidden" name="category_id" value="'.
!                                                                               
$this->cat_id.'">
!                                                                       <input 
type="hidden" name="parent" value="'.
!                                                                               
$this->cat_id.'">
!                                                                       <input 
type="hidden" name="pageid" value="'. 
!                                                                               
$this->page_id .'">
!                                                                       
</form>');
!                                                               
$this->t->set_var('msg','');
!                                                               
$link_data['menuaction'] = "sitemgr.Content_UI._manageContent";
!                                                               
$link_data['page_id'] = $this->page_id;
!                                                               
$this->t->set_var('manage',
!                                                                       '<form 
action="'.
!                                                                       
$GLOBALS['phpgw']->link('/index.php',$link_data).
!                                                                       '" 
method="POST">
!                                                                       <input 
type="submit" value="' . lang('Manage Content') .'"></form>');
!                                                               
$this->t->set_var('remove', 
!                                                                       '<form 
action="'.$GLOBALS['phpgw']->link('/index.php',
!                                                                       
'menuaction=sitemgr.Pages_UI._managePage').
!                                                                               
'" method="POST">
!                                                                       <input 
type="submit" name="btnDelete" value="' . lang('Delete') .'">
!                                                                       <input 
type="hidden" name="pageid" value="'.$this->page_id.'">
!                                                                       <input 
type="hidden" name="category_id" value="'.
!                                                                               
$this->cat_id.'">
!                                                                       <input 
type="hidden" name="parent" value="'.
!                                                                               
$this->cat_id.'">
!                                                                       
</form>');
!                                                               
$this->t->parse('PBlock', 'PageBlock', true);
!                                                       }
!                                               }
!                                               else
!                                               {
!                                                       $this->t->set_var('msg' 
, lang('This category has no pages.'));
!                                               }
!                                               $this->t->set_var('indent', 
$this->category->depth * 5);
!                                               
$this->t->set_var('category',$this->category->name); 
!                                               $this->t->set_var('add', 
!                                                       '<form action="'.
!                                                       
$GLOBALS['phpgw']->link('/index.php',
!                                                       
'menuaction=sitemgr.Pages_UI._managePage').
!                                                       '" method="POST">
!                                                       <input type=submit 
name="btnAddPage" value="' . lang('Add new page to this category') . '">
!                                                       <input type=hidden 
name="category_id" value ="'.$this->cat_id .'">
!                                                       </form>');
!                                       
!                                               $this->t->parse('CBlock', 
'CategoryBlock', true); 
!                                       }
!                                       $this->t->pfp('out','ManagePage');
!                               }
!                               else
!                               {
!                                       echo lang("I'm sorry, you do not have 
write permissions for any site categories.") . '<br><br>';
!                               }
                        }
                        $this->common_ui->DisplayFooter();
                }
--- 150,223 ----
                                'lang_goback' => lang('Go back to Page 
Manager'),
                                'lang_reset' => lang('Reset'),
!                               'lang_save' => lang('Save'),
!                               'lang_state' => lang('State'),
!                               'goback' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Pages_UI.manage'),
                        ));
                        
                        $this->t->pfp('out','EditPage');
!                       $this->common_ui->DisplayFooter();
                }
  
+               function manage()
+               {
                        $this->common_ui->DisplayHeader();
  
!                       $this->t->set_file('ManagePage','page_manager.tpl');
!                       $this->t->set_block('ManagePage', 'PageBlock', 
'PBlock');
!                       $this->t->set_block('ManagePage', 'CategoryBlock', 
'CBlock');
!                       $this->t->set_var('page_manager', lang('Page Manager'));
! 
!                       $cat_list = $this->categorybo->getpermittedcatsWrite();
! 
!                       if (!$cat_list)
!                       {
!                                echo lang("You do not have write permissions 
for any site categories.") . '<br><br>';
!                       }
! 
!                       while (list(,$cat_id) = @each($cat_list))
!                       {
!                               $category = 
$this->categorybo->getCategory($cat_id);
!                               $this->t->set_var('PBlock', '');
!                               $page_list = 
$this->pagebo->getPageIDList($cat_id);
! 
!                               while (list(,$page_id) = @each($page_list))
!                               {
!                                       $page = 
$this->pagebo->getPage($page_id,$this->sitelanguages[0]);
!                                       $page_description = sprintf(
!                                               '<b>%s</b>: %s 
&nbsp;&nbsp;<b>ID</b>: %s<br><b>%s</b>: %s',
!                                               lang('Name'),
!                                               $page->name,
!                                               $page_id,
!                                               lang('Title'),
!                                               $page->title
!                                       );
!                                       $this->t->set_var('page', 
$page_description);
!                                       $link_data['page_id'] = $page_id;
!                                       $link_data['menuaction'] = 
"sitemgr.Pages_UI.edit";
!                                       $this->t->set_var('edit','<form 
action="'. $GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                               '" method="POST"><input 
type="submit" name="btnEditPage" value="' . lang('Edit') .'"></form>'
!                                       );
!                                       $link_data['menuaction'] = 
"sitemgr.Content_UI.manage";
!                                       $this->t->set_var('content','<form 
action="' . $GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                               '" method="POST"><input 
type="submit" value="' . lang('Manage Content') .'"></form>'
!                                       );
!                                       $link_data['menuaction'] = 
"sitemgr.Pages_UI.delete";
!                                       $this->t->set_var('remove','<form 
action="'.$GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                               '" method="POST"><input 
type="submit" name="btnDelete" value="' . lang('Delete') .'"></form>'
!                                       );
!                                       $this->t->parse('PBlock', 'PageBlock', 
true);
!                               }
! 
!                               $link_data = array('menuaction' => 
"sitemgr.Pages_UI.edit",'category_id' => $cat_id);
!                               $this->t->set_var(array(
!                                       'indent' => $category->depth * 5,
!                                       'category' => $category->name,
!                                       'add' => '<form action="'. 
$GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                               '" method="POST"><input 
type=submit name="btnAddPage" value="' . 
!                                               lang('Add new page to this 
category') . '"></form>'
!                               ));
!                               $this->t->parse('CBlock', 'CategoryBlock', 
true); 
                        }
+                       $this->t->pfp('out','ManagePage');
                        $this->common_ui->DisplayFooter();
                }
***************
*** 341,348 ****
                        {
                                $selected=' SELECTED'; 
!                       }       
!                       $retval="\n".'<SELECT NAME="parent">'."\n";
                        foreach($option_list as $option)
!                       {   
                                if ((int) $option['value']!=0)
                                {
--- 229,236 ----
                        {
                                $selected=' SELECTED'; 
!                       }
!                       $retval="\n".'<SELECT NAME="inputcategoryid">'."\n";
                        foreach($option_list as $option)
!                       {
                                if ((int) $option['value']!=0)
                                {
***************
*** 355,359 ****
                                        $option['display'].'</OPTION>'."\n";
                                }
!                       }       
                        $retval.='</SELECT>';
                        return $retval;
--- 243,247 ----
                                        $option['display'].'</OPTION>'."\n";
                                }
!                       }
                        $retval.='</SELECT>';
                        return $retval;

Index: class.Sites_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Sites_BO.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.Sites_BO.inc.php      23 May 2003 03:37:25 -0000      1.4
--- class.Sites_BO.inc.php      30 May 2003 04:01:43 -0000      1.5
***************
*** 114,119 ****
                function add($site)
                {
!                       $site_id = 
$GLOBALS['Common_BO']->cats->so->addCategory($site['name'],'',0);
!                       $this->so->add($site_id,$site);
                        
//$GLOBALS['Common_BO']->cats->saveCategoryLang($site_id, 
$site['name'],$site['description'],$site['savelang']);
                        
$GLOBALS['Common_BO']->acl->set_adminlist($site_id,$site['adminlist']);
--- 114,118 ----
                function add($site)
                {
!                       $site_id = $this->so->add($site);
                        
//$GLOBALS['Common_BO']->cats->saveCategoryLang($site_id, 
$site['name'],$site['description'],$site['savelang']);
                        
$GLOBALS['Common_BO']->acl->set_adminlist($site_id,$site['adminlist']);
***************
*** 148,153 ****
                function delete($id)
                {
!                       $this->so->delete($id);
                        
$GLOBALS['Common_BO']->cats->removeCategory($id,True,True);
                        return True;
                }
--- 147,156 ----
                function delete($id)
                {
!                       if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
!                       {
!                               return False;
!                       }
                        
$GLOBALS['Common_BO']->cats->removeCategory($id,True,True);
+                       $this->so->delete($id);
                        return True;
                }
***************
*** 159,163 ****
  
  
!               function set_currentsite($site_url)
                {
                        if ($site_url)
--- 162,166 ----
  
  
!               function set_currentsite($site_url,$mode)
                {
                        if ($site_url)
***************
*** 197,203 ****
                                }
                        }
                        
define('CURRENT_SITE_ID',$this->current_site['site_id']);
!                       $GLOBALS['Common_BO']->cats->setcurrentcats();
                        return True;
                }
  
--- 200,214 ----
                                }
                        }
+                       
                        
define('CURRENT_SITE_ID',$this->current_site['site_id']);
!                       $this->setmode($mode);
                        return True;
+               }
+ 
+               function setmode($mode)
+               {
+                       $this->current_site['mode'] = $mode;
+                       $GLOBALS['Common_BO']->setvisiblestates($mode);
+                       $GLOBALS['Common_BO']->cats->setcurrentcats();
                }
  

Index: class.Sites_SO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Sites_SO.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.Sites_SO.inc.php      22 May 2003 02:36:53 -0000      1.1
--- class.Sites_SO.inc.php      30 May 2003 04:01:43 -0000      1.2
***************
*** 125,134 ****
                }
  
!               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__);
                }
  
--- 125,145 ----
                }
  
!               function add($site)
                {
!                       $cats = 
CreateObject('phpgwapi.categories',-1,'sitemgr');
!                               $data = array
!                       (
!                               'name'          => $site['name'],
!                               'descr'         => '',
!                               'access'        => 'public',
!                               'parent'        => 0,
!                               'old_parent' => 0
!                       );
!                       $site_id =  $cats->add($data);
!                       $sql = "INSERT INTO phpgw_sitemgr_sites 
(site_id,site_name,site_url,site_dir,anonymous_user,anonymous_passwd) VALUES 
($site_id,'" . 
                                $site['name'] . "','" . $site['url'] . "','" . 
$site['dir'] . "','" . $site['anonuser'] . "','" . $site['anonpasswd'] .
                                "')";
                        $this->db->query($sql,__LINE__,__FILE__);
+                       return $site_id;
                }
  

Index: class.Translations_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Translations_UI.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.Translations_UI.inc.php       22 May 2003 06:19:23 -0000      1.5
--- class.Translations_UI.inc.php       30 May 2003 04:01:43 -0000      1.6
***************
*** 23,30 ****
                var $public_functions = array
                (
!                       '_manageTranslations' => True,
!                       '_translateCategory' => True,
!                       '_translatePage' => True,
!                       '_translateSitecontent' => True,
                );
  
--- 23,30 ----
                var $public_functions = array
                (
!                       'manage' => True,
!                       'translateCategory' => True,
!                       'translatePage' => True,
!                       'translateSitecontent' => True,
                );
  
***************
*** 41,45 ****
                }
  
!               function _manageTranslations()
                {
                        $this->common_ui->DisplayHeader();
--- 41,45 ----
                }
  
!               function manage()
                {
                        $this->common_ui->DisplayHeader();
***************
*** 57,76 ****
                                $this->t->parse('slBlock', 'sitelanguages', 
true);
                        }
! 
                        $this->t->set_var(Array(
                                'translation_manager' => lang('Translation 
Manager'),
                                'lang_catname' => lang('Category Name'),
!                               'translate_site_content' => 
$GLOBALS['phpgw']->link('/index.php', 
'menuaction=sitemgr.Translations_UI._translateSitecontent'),
                                'lang_site_content' => lang('Translate 
site-wide content blocks'),
                                'colspan' => (count($this->sitelanguages) + 2)
                        ));
!                       $this->cat_list = 
$this->cat_bo->getPermittedCatWriteNested();
!                       if($this->cat_list)
                        {
!                               for($i = 0; $i < sizeof($this->cat_list); $i++)
                                {                       
                                        //setup entry in categorblock for 
translations of categories
!                                       $this->cat = 
$this->cat_bo->getCategory($this->cat_list[$i]);
!                                       if ($this->cat->depth)
                                        {
                                                $buffer = '-';
--- 57,76 ----
                                $this->t->parse('slBlock', 'sitelanguages', 
true);
                        }
!                       $link_data['menuaction'] = 
"sitemgr.Translations_UI.translateSitecontent";
                        $this->t->set_var(Array(
                                'translation_manager' => lang('Translation 
Manager'),
                                'lang_catname' => lang('Category Name'),
!                               'translate_site_content' => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
                                'lang_site_content' => lang('Translate 
site-wide content blocks'),
                                'colspan' => (count($this->sitelanguages) + 2)
                        ));
!                       $cat_list = $this->cat_bo->getpermittedcatsWrite();
!                       if($cat_list)
                        {
!                               for($i = 0; $i < sizeof($cat_list); $i++)
                                {                       
                                        //setup entry in categorblock for 
translations of categories
!                                       $cat = 
$this->cat_bo->getCategory($cat_list[$i]);
!                                       if ($cat->depth)
                                        {
                                                $buffer = '-';
***************
*** 80,90 ****
                                                $buffer = '';
                                        }
!                                       $buffer = 
str_pad('',$this->cat->depth*18,
                                                '&nbsp;',STR_PAD_LEFT).$buffer;
                                        $this->t->set_var('buffer', $buffer);
!                                       $this->t->set_var('category', 
$this->cat->name);
!                                       $category_id = $this->cat_list[$i];
  
!                                       $availablelangsforcat = 
$this->cat_bo->getlangarrayforcategory($category_id);
                                        $this->t->set_var('langcatBlock','');
                                        foreach ($this->sitelanguages as $lang)
--- 80,90 ----
                                                $buffer = '';
                                        }
!                                       $buffer = str_pad('',$cat->depth*18,
                                                '&nbsp;',STR_PAD_LEFT).$buffer;
                                        $this->t->set_var('buffer', $buffer);
!                                       $this->t->set_var('category', 
$cat->name);
!                                       $category_id = $cat_list[$i];
  
!                                       $availablelangsforcat = 
$this->cat_bo->getlangarrayforcategory($cat_list[$i]);
                                        $this->t->set_var('langcatBlock','');
                                        foreach ($this->sitelanguages as $lang)
***************
*** 93,116 ****
                                                $this->t->parse('langcatBlock', 
'langexistcat', true);
                                        }
!                               
                                        $this->t->set_var('translatecat', 
!                                               '<form action="'.
!                                               
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Translations_UI._translateCategory').
!                                               '" method="POST"><input 
type="submit" name="btnTranslateCategory" value="' . lang('Translate') .'">'.
!                                               '<input type="hidden" 
name="category_id" value="'.$category_id.'"></form>');
  
                                        //setup page list
                                        $this->t->set_var('PBlock', '');
!                                       $this->page_list = 
$this->pagebo->getPageIDList($this->cat_list[$i]);
!                                       if($this->page_list && 
sizeof($this->page_list)>0)
                                        {
!                                               for($j = 0; $j < 
sizeof($this->page_list); $j++)
                                                {
!                                                       $this->page_id 
=$this->page_list[$j];
!                                                       $this->page = 
$this->pagebo->getPage($this->page_id,$this->sitelanguages[0]);
!                                                       $page_description = 
'<i>' . lang('Page') . ': </i>'.$this->page->name.'<br><i>' . lang('Title') . 
': </i>'.$this->page->title;
                                                        
$this->t->set_var('page', $page_description);
  
!                                                       $availablelangsforpage 
= $this->pagebo->getlangarrayforpage($this->page_id);
                                                        
$this->t->set_var('langpageBlock','');
                                                        foreach 
($this->sitelanguages as $lang)
--- 93,115 ----
                                                $this->t->parse('langcatBlock', 
'langexistcat', true);
                                        }
! 
!                                       $link_data['menuaction'] = 
'sitemgr.Translations_UI.translateCategory';
!                                       $link_data['category_id'] = 
$cat_list[$i];
                                        $this->t->set_var('translatecat', 
!                                               '<form action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                               '" method="POST"><input 
type="submit" name="btnTranslateCategory" value="' . lang('Translate') 
.'"></form>');
  
                                        //setup page list
                                        $this->t->set_var('PBlock', '');
!                                       $page_list = 
$this->pagebo->getPageIDList($cat_list[$i]);
!                                       if($page_list && sizeof($page_list)>0)
                                        {
!                                               for($j = 0; $j < 
sizeof($page_list); $j++)
                                                {
!                                                       $page = 
$this->pagebo->getPage($page_list[$j],$this->sitelanguages[0]);
!                                                       $page_description = 
'<i>' . lang('Page') . ': </i>'.$page->name.'<br><i>' . lang('Title') . ': 
</i>'.$page->title;
                                                        
$this->t->set_var('page', $page_description);
  
!                                                       $availablelangsforpage 
= $this->pagebo->getlangarrayforpage($page_list[$j]);
                                                        
$this->t->set_var('langpageBlock','');
                                                        foreach 
($this->sitelanguages as $lang)
***************
*** 120,128 ****
                                                        }
  
                                                        
$this->t->set_var('translatepage', 
!                                                               '<form 
action="'.
!                                                               
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Translations_UI._translatePage').
!                                                               '" 
method="POST"><input type="submit" name="btnTranslatePage" value="' . 
lang('Translate') .'">'.
!                                                               '<input 
type="hidden" name="page_id" value="'.$this->page_id.'"></form>');
                                                        
$this->t->parse('PBlock', 'PageBlock', true);
                                                }
--- 119,127 ----
                                                        }
  
+                                                       $link_data['page_id'] = 
$page_list[$j];
+                                                       
$link_data['menuaction'] = 'sitemgr.Translations_UI.translatePage';
                                                        
$this->t->set_var('translatepage', 
!                                                               '<form 
action="' . $GLOBALS['phpgw']->link('/index.php',$link_data) .
!                                                               '" 
method="POST"><input type="submit" name="btnTranslatePage" value="' . 
lang('Translate') .'"></form>');
                                                        
$this->t->parse('PBlock', 'PageBlock', true);
                                                }
***************
*** 141,154 ****
                }
  
!               function _translateCategory()
                {
!                       
$GLOBALS['Common_BO']->globalize(array('category_id','changelanguage','showlanguage','savelanguage','btnSaveCategory','savecatname','savecatdesc','btnSaveBlock','element','blockid','blocktitle'));
!                       global $category_id, $changelanguage, $showlanguage, 
$savelanguage, $btnSaveCategory, $savecatname, $savecatdesc,$btnSaveBlock;
  
                        if ($btnSaveCategory)
                        {
                                $this->cat_bo->saveCategoryLang($category_id, 
$savecatname, $savecatdesc, $savelanguage);
-                               $this->_manageTranslations();
-                               return;
                        }
                        elseif ($btnSaveBlock)
--- 140,152 ----
                }
  
!               function translateCategory()
                {
!                       
$GLOBALS['Common_BO']->globalize(array('changelanguage','showlanguage','savelanguage','btnSaveCategory','savecatname','savecatdesc','btnSaveBlock','element','blockid','blocktitle'));
!                       global $changelanguage, $showlanguage, $savelanguage, 
$btnSaveCategory, $savecatname, $savecatdesc,$btnSaveBlock;
!                       $category_id = $_GET['category_id'];
  
                        if ($btnSaveCategory)
                        {
                                $this->cat_bo->saveCategoryLang($category_id, 
$savecatname, $savecatdesc, $savelanguage);
                        }
                        elseif ($btnSaveBlock)
***************
*** 159,174 ****
                        $this->common_ui->DisplayHeader();
                        $this->t->set_file('TranslateCategory', 
'translate_category.tpl');
!                       
$this->t->set_block('TranslateCategory','Blocktranslator','Tblock');
!                       
$this->t->set_block('Blocktranslator','EditorElement','Eblock');
                        
                        if($error)
                        {
                                $this->t->set_var('error_msg',lang('You failed 
to fill in one or more required fields.'));
!                               $this->cat->name = $savecatname;
!                               $this->cat->description = $savecatdesc;
                        }
                        else
                        {
!                               $this->cat = 
$this->cat_bo->getCategory($category_id);
                                $showlanguage = $showlanguage ? $showlanguage : 
$this->sitelanguages[0];
                                $showlangdata = 
$this->cat_bo->getCategory($category_id,$showlanguage);
--- 157,174 ----
                        $this->common_ui->DisplayHeader();
                        $this->t->set_file('TranslateCategory', 
'translate_category.tpl');
!                       $this->t->set_file('Blocks','translate_block.tpl');
!                       $this->t->set_block('Blocks','Blocktranslator');
!                       
$this->t->set_block('Blocktranslator','Version','Vblock');
!                       $this->t->set_block('Blocks','EditorElement','Eblock');
                        
                        if($error)
                        {
                                $this->t->set_var('error_msg',lang('You failed 
to fill in one or more required fields.'));
!                               $cat->name = $savecatname;
!                               $cat->description = $savecatdesc;
                        }
                        else
                        {
!                               $cat = $this->cat_bo->getCategory($category_id);
                                $showlanguage = $showlanguage ? $showlanguage : 
$this->sitelanguages[0];
                                $showlangdata = 
$this->cat_bo->getCategory($category_id,$showlanguage);
***************
*** 195,211 ****
                }
  
!               function _translatePage()
                {
!                       
$GLOBALS['Common_BO']->globalize(array('page_id','changelanguage','showlanguage','savelanguage','btnSavePage','savepagetitle','savepagesubtitle','btnSaveBlock','element','blockid','blocktitle'));
!                       global $page_id, $changelanguage, $showlanguage, 
$savelanguage, $btnSavePage, $savepagetitle, $savepagesubtitle,$btnSaveBlock;
                        
                        if ($btnSavePage)
                        {
!                               $this->page->id = $page_id;
!                               $this->page->title = $savepagetitle;
!                               $this->page->subtitle = $savepagesubtitle;
!                               $this->pagebo->savePageLang($this->page, 
$savelanguage);
!                               $this->_manageTranslations();
!                               return;
                        }
                        elseif ($btnSaveBlock)
--- 195,210 ----
                }
  
!               function translatePage()
                {
!                       
$GLOBALS['Common_BO']->globalize(array('changelanguage','showlanguage','savelanguage','btnSavePage','savepagetitle','savepagesubtitle','btnSaveBlock','element','blockid','blocktitle'));
!                       global $changelanguage, $showlanguage, $savelanguage, 
$btnSavePage, $savepagetitle, $savepagesubtitle,$btnSaveBlock;
!                       $page_id = $_GET['page_id'];
                        
                        if ($btnSavePage)
                        {
!                               $page->id = $page_id;
!                               $page->title = $savepagetitle;
!                               $page->subtitle = $savepagesubtitle;
!                               $this->pagebo->savePageLang($page, 
$savelanguage);
                        }
                        elseif ($btnSaveBlock)
***************
*** 216,221 ****
  
                        $this->t->set_file('TranslatePage', 
'translate_page.tpl');
!                       
$this->t->set_block('TranslatePage','Blocktranslator','Tblock');
!                       
$this->t->set_block('Blocktranslator','EditorElement','Eblock');
  
                        //TODO: error handling seems not correct
--- 215,222 ----
  
                        $this->t->set_file('TranslatePage', 
'translate_page.tpl');
!                       $this->t->set_file('Blocks','translate_block.tpl');
!                       $this->t->set_block('Blocks','Blocktranslator');
!                       
$this->t->set_block('Blocktranslator','Version','Vblock');
!                       $this->t->set_block('Blocks','EditorElement','Eblock');
  
                        //TODO: error handling seems not correct
***************
*** 223,232 ****
                        {
                                $this->t->set_var('error_msg',lang('You failed 
to fill in one or more required fields.'));
!                               $this->page->title = $savepagetitle;
!                               $this->page->subtitle = $savepagesubtitle;
                        }
                        else
                        {
!                               $this->page = $this->pagebo->getPage($page_id);
                                $showlanguage = $showlanguage ? $showlanguage : 
$this->sitelanguages[0];
                                $showlangdata = 
$this->pagebo->getPage($page_id,$showlanguage);
--- 224,233 ----
                        {
                                $this->t->set_var('error_msg',lang('You failed 
to fill in one or more required fields.'));
!                               $page->title = $savepagetitle;
!                               $page->subtitle = $savepagesubtitle;
                        }
                        else
                        {
!                               $page = $this->pagebo->getPage($page_id);
                                $showlanguage = $showlanguage ? $showlanguage : 
$this->sitelanguages[0];
                                $showlangdata = 
$this->pagebo->getPage($page_id,$showlanguage);
***************
*** 239,243 ****
                                        'pageid' => $page_id,
                                        'lang_pagename' => lang('Page Name'),
!                                       'pagename' => $this->page->name,
                                        'lang_pagetitle' => lang('Page Title'),
                                        'showpagetitle' => $showlangdata->title,
--- 240,244 ----
                                        'pageid' => $page_id,
                                        'lang_pagename' => lang('Page Name'),
!                                       'pagename' => $page->name,
                                        'lang_pagetitle' => lang('Page Title'),
                                        'showpagetitle' => $showlangdata->title,
***************
*** 249,253 ****
  
                                //Content blocks
!                               
$this->process_blocks($this->contentbo->getblocksforscope($this->page->cat_id,$page_id));
                                $this->t->pfp('out','TranslatePage');
                        }
--- 250,254 ----
  
                                //Content blocks
!                               
$this->process_blocks($this->contentbo->getblocksforscope($page->cat_id,$page_id));
                                $this->t->pfp('out','TranslatePage');
                        }
***************
*** 255,259 ****
                }
  
!               function _translateSitecontent()
                {
                        
$GLOBALS['Common_BO']->globalize(array('changelanguage','showlanguage','savelanguage','btnSaveBlock','element','blockid','blocktitle'));
--- 256,260 ----
                }
  
!               function translateSitecontent()
                {
                        
$GLOBALS['Common_BO']->globalize(array('changelanguage','showlanguage','savelanguage','btnSaveBlock','element','blockid','blocktitle'));
***************
*** 267,272 ****
                        $this->common_ui->DisplayHeader();
                        $this->t->set_file('TranslateSitecontent', 
'translate_sitecontent.tpl');
!                       
$this->t->set_block('TranslateSitecontent','Blocktranslator','Tblock');
!                       
$this->t->set_block('Blocktranslator','EditorElement','Eblock');
  
                        $showlanguage = $showlanguage ? $showlanguage : 
$this->sitelanguages[0];
--- 268,275 ----
                        $this->common_ui->DisplayHeader();
                        $this->t->set_file('TranslateSitecontent', 
'translate_sitecontent.tpl');
!                       $this->t->set_file('Blocks','translate_block.tpl');
!                       $this->t->set_block('Blocks','Blocktranslator');
!                       
$this->t->set_block('Blocktranslator','Version','Vblock');
!                       $this->t->set_block('Blocks','EditorElement','Eblock');
  
                        $showlanguage = $showlanguage ? $showlanguage : 
$this->sitelanguages[0];
***************
*** 288,310 ****
                                
$this->t->set_var('moduleinfo',($block->module_name));
  
!                               $savelangdata = 
$this->contentbo->getlangblockdata($id,$savelanguage);
!                               $showlangdata = 
$this->contentbo->getlangblockdata($id,$showlanguage);
                                $translatorstandardelements = array(
                                        array('label' => lang('Title'),
!                                                 'value' => 
($showlangdata->title ? $showlangdata->title : $moduleobject->title),
                                                  'form' => ('<input 
type="text" name="blocktitle" value="' . 
!                                                       ($savelangdata->title ? 
$savelangdata->title : $moduleobject->title) . '" />')
                                        )
                                );
-                               $block->arguments = $showlangdata->arguments;
                                $moduleobject->set_block($block);
                                $saveblock = $block;
!                               $saveblock->arguments = 
$savelangdata->arguments;
!                               $translatormoduleelements = 
$moduleobject->get_translation_interface($block,$saveblock);
  
!                               $interface = 
array_merge($translatorstandardelements,$translatormoduleelements);
  
!                               $this->t->set_var('Eblock','');
!                               while (list(,$element) = each($interface))
                                {
                                        $this->t->set_var(Array(
--- 291,313 ----
                                
$this->t->set_var('moduleinfo',($block->module_name));
  
!                               $savelangtitle = 
$this->contentbo->getlangblocktitle($id,$savelanguage);
!                               $showlangtitle = 
$this->contentbo->getlangblocktitle($id,$showlanguage);
!                               $savelangversions = 
$this->contentbo->getallversionsforblock($id,$savelanguage);
!                               $showlangversions = 
$this->contentbo->getallversionsforblock($id,$showlanguage);
                                $translatorstandardelements = array(
                                        array('label' => lang('Title'),
!                                                 'value' => ($showlangtitle ? 
$showlangtitle : $moduleobject->title),
                                                  'form' => ('<input 
type="text" name="blocktitle" value="' . 
!                                                       ($savelangtitle ? 
$savelangtitle : $moduleobject->title) . '" />')
                                        )
                                );
                                $moduleobject->set_block($block);
                                $saveblock = $block;
! //                            $translatormoduleelements = 
$moduleobject->get_translation_interface($block,$saveblock);
  
! //                            $interface = 
array_merge($translatorstandardelements,$translatormoduleelements);
  
!                               $this->t->set_var('standardelements','');
!                               while (list(,$element) = 
each($translatorstandardelements))
                                {
                                        $this->t->set_var(Array(
***************
*** 313,322 ****
                                                'form' => $element['form']
                                        ));
!                                       
$this->t->parse('Eblock','EditorElement', true);
                                }
                                $this->t->set_var(Array(
                                        'blockid' => $id,
                                ));
!                               $this->t->parse('Tblock','Blocktranslator', 
true);
                        }
                }
--- 316,349 ----
                                                'form' => $element['form']
                                        ));
!                                       
$this->t->parse('standardelements','EditorElement', true);
!                               }
!                               $this->t->set_var('Vblock','');
!                               while (list($version_id,$version) = 
each($showlangversions))
!                               {
!                                       //set the version of the block which is 
referenced by the moduleobject, 
!                                       //so that we retrieve a interface with 
the current version's arguments 
!                                       $block->set_version($version);
!                                       
$saveblock->set_version($savelangversions[$version_id]);
!                                       $translatormoduleelements = 
$moduleobject->get_translation_interface($block,$saveblock);
!                                               $this->t->set_var(array(
!                                               'version_id' => $version_id,
!                                               'version_state' => 
$GLOBALS['Common_BO']->state[$version['state']],
!                                               'versionelements' => ''
!                                       ));
!                                       while (list(,$element) = 
each($translatormoduleelements))
!                                       {
!                                               $this->t->set_var(Array(
!                                                       'label' => 
$element['label'],
!                                                       'value' => 
$element['value'],
!                                                       'form' => 
$element['form']
!                                               ));
!                                               
$this->t->parse('versionelements','EditorElement', true);
!                                       }
!                                       $this->t->parse('Vblock','Version', 
true);
                                }
                                $this->t->set_var(Array(
                                        'blockid' => $id,
                                ));
!                               $this->t->parse('blocks','Blocktranslator', 
true);
                        }
                }
***************
*** 326,344 ****
                        global $blockid, $element,$blocktitle,$savelanguage;
  
!                       $moduleobject = 
$this->contentbo->getblockmodule($blockid);
! 
!                       if ($moduleobject->validate($element))
!                       {
!                               $block = CreateObject('sitemgr.Block_SO',True);
!                               $block->id = $blockid;
!                               $block->title = $blocktitle;
!                               if 
(!$this->contentbo->saveblockdatalang($block,$element,$savelanguage))
!                               {
!                                       $this->t->set_var('validationerror', 
lang("You are not entitled to edit block %1",$blockid));;
!                               }
!                       }
!                       else
                        {
!                               $this->t->set_var('validationerror', 
$module->get_validationerror());
                        }
                }
--- 353,363 ----
                        global $blockid, $element,$blocktitle,$savelanguage;
  
!                       $block = CreateObject('sitemgr.Block_SO',True);
!                       $block->id = $blockid;
!                       $block->title = $blocktitle;
!                       $result = 
$this->contentbo->saveblockdatalang($block,$element,$savelanguage);
!                       if ($result !== True)
                        {
!                               $this->t->set_var('validationerror', $result);
                        }
                }

Index: class.module.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.module.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.module.inc.php        10 Mar 2003 07:02:06 -0000      1.8
--- class.module.inc.php        30 May 2003 04:01:43 -0000      1.9
***************
*** 35,41 ****
        }
  
!       function add_transformer($transformer)
        {
!               $this->transformer_chain[] = $transformer;
        }
  
--- 35,41 ----
        }
  
!       function add_transformer(&$transformer)
        {
!               $this->transformer_chain[] =& $transformer;
        }
  
***************
*** 46,50 ****
        //that depends on the blocks arguments
        //the produce argument is set when content is generated, so we can do 
some stuff we do not need when editing the block
!       function set_block($block,$produce=False)
        {
                if ($produce)
--- 46,50 ----
        //that depends on the blocks arguments
        //the produce argument is set when content is generated, so we can do 
some stuff we do not need when editing the block
!       function set_block(&$block,$produce=False)
        {
                if ($produce)
***************
*** 85,89 ****
                        }
                }
!               $this->block = $block;
        }
  
--- 85,89 ----
                        }
                }
!               $this->block =& $block;
        }
  
***************
*** 129,148 ****
        function get_properties($cascading=True)
        {
!               if ($cascading)
                {
!                       return 
$GLOBALS['Common_BO']->modules->getcascadingmoduleproperties(
!                               $this->block->module_id,
!                               $this->block->area,
!                               $this->block->cat_id,
!                               $this->block->module_name
!                       );
                }
                else
                {
!                       return 
$GLOBALS['Common_BO']->modules->getmoduleproperties(
!                               $this->block->module_id,
!                               $this->block->area,
!                               $this->block->cat_id
!                       );
                }
        }
--- 129,155 ----
        function get_properties($cascading=True)
        {
!               if ($this->properties)
                {
!                       if ($cascading)
!                       {
!                               return 
$GLOBALS['Common_BO']->modules->getcascadingmoduleproperties(
!                                       $this->block->module_id,
!                                       $this->block->area,
!                                       $this->block->cat_id,
!                                       $this->block->module_name
!                               );
!                       }
!                       else
!                       {
!                               return 
$GLOBALS['Common_BO']->modules->getmoduleproperties(
!                                       $this->block->module_id,
!                                       $this->block->area,
!                                       $this->block->cat_id
!                               );
!                       }
                }
                else
                {
!                       return False;
                }
        }
***************
*** 156,160 ****
                while (list($key,$input) = @each($this->arguments))
                {
!                       $elementname = ($input['i18n'] ? ('element[i18n][' 
.$key . ']') : ('element[' .$key . ']'));
                        //arrays of input elements are only implemented for the 
user interface
                        if ($input['type'] == 'array')
--- 163,168 ----
                while (list($key,$input) = @each($this->arguments))
                {
!                       $elementname = 'element[' . $this->block->version . ']';
!                       $elementname .= ($input['i18n'] ? ('[i18n][' .$key . 
']') : ('[' .$key . ']'));
                        //arrays of input elements are only implemented for the 
user interface
                        if ($input['type'] == 'array')
***************
*** 190,194 ****
                        if ($input['i18n'])
                        {
!                               $elementname = 'element[i18n][' .$key . ']';
                                //arrays of input elements are only implemented 
for the user interface
                                if ($input['type'] == 'array')
--- 198,202 ----
                        if ($input['i18n'])
                        {
!                               $elementname = 'element[' . 
$this->block->version . '][i18n][' .$key . ']';
                                //arrays of input elements are only implemented 
for the user interface
                                if ($input['type'] == 'array')
***************
*** 327,336 ****
                else
                {
!                       if ($this->transformer_chain)
                        {
!                               foreach ($this->transformer_chain as 
$transformer)
!                               {
!                                       $content = 
$transformer->apply_transform($this->block->title,$content);
!                               }
                        }
                        //store session variables
--- 335,341 ----
                else
                {
!                       for ( $i = 0; $i < count( $this->transformer_chain ); 
++$i )
                        {
!                               $content = 
$this->transformer_chain[$i]->apply_transform($this->block->title,$content);
                        }
                        //store session variables

Index: hook_preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/hook_preferences.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** hook_preferences.inc.php    17 Jan 2003 03:37:52 -0000      1.2
--- hook_preferences.inc.php    30 May 2003 04:01:43 -0000      1.3
***************
*** 17,22 ****
                $file = Array
                (
!                       'Manage Categories'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Categories_UI._manageCategories'),
!                       'Manage Pages' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Pages_UI._managePage')
                );
  
--- 17,22 ----
                $file = Array
                (
!                       'Manage Categories'    => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Categories_UI.manage'),
!                       'Manage Pages' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Pages_UI.manage')
                );
  





reply via email to

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