phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: sitemgr/inc class.Common_BO.inc.php,1.4,1.5 clas


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/inc class.Common_BO.inc.php,1.4,1.5 class.Common_UI.inc.php,1.15,1.16 class.Content_UI.inc.php,1.10,1.11 class.Sites_BO.inc.php,1.6,1.7 class.Sites_UI.inc.php,1.5,1.6
Date: Thu, 05 Jun 2003 22:14:58 -0400

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

Modified Files:
        class.Common_BO.inc.php class.Common_UI.inc.php 
        class.Content_UI.inc.php class.Sites_BO.inc.php 
        class.Sites_UI.inc.php 
Log Message:
simplify application header and integrate menus into idots template


Index: class.Common_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_BO.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.Common_BO.inc.php     30 May 2003 04:01:43 -0000      1.4
--- class.Common_BO.inc.php     6 Jun 2003 02:14:55 -0000       1.5
***************
*** 5,8 ****
--- 5,9 ----
                var $sites,$acl,$theme,$pages,$cats,$content,$modules;
                var $state,$visiblestates;
+               var $sitemenu,$othermenu;
                function Common_BO()
                {
***************
*** 80,83 ****
--- 81,143 ----
                }
  
+               function set_menus()
+               {
+                       $this->sitemenu = $this->get_sitemenu();
+                       $this->othermenu = $this->get_othermenu();
+               }
+ 
+               function get_sitemenu()
+               {
+                       if ($GLOBALS['Common_BO']->acl->is_admin())
+                       {
+                               $file['Configure Website'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs');
+                               $link_data['cat_id'] = CURRENT_SITE_ID;
+                               $link_data['menuaction'] = 
"sitemgr.Modules_UI.manage";
+                               $file['Manage site-wide module properties'] = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
+                               $link_data['page_id'] = 0;
+                               $link_data['menuaction'] = 
"sitemgr.Content_UI.manage";
+                               $file['Manage site-wide content'] = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
+                       }
+                       $file['Manage Categories and pages'] = 
$GLOBALS['phpgw']->link('/index.php', 'menuaction=sitemgr.Outline_UI.manage');
+                       $file['Manage Translations'] = 
$GLOBALS['phpgw']->link('/index.php', 
'menuaction=sitemgr.Translations_UI.manage');
+                       $file['Commit Changes'] = 
$GLOBALS['phpgw']->link('/index.php', 'menuaction=sitemgr.Content_UI.commit');
+                       $file['Manage archived content'] = 
$GLOBALS['phpgw']->link('/index.php', 'menuaction=sitemgr.Content_UI.archive');
+                       $file['_NewLine_'] ='';
+                       $file['View Generated Site'] = 
$GLOBALS['phpgw']->link('/sitemgr-link/');
+                       return $file;
+               }
+ 
+               function get_othermenu()
+               {
+                       $numberofsites = 
$GLOBALS['Common_BO']->sites->getnumberofsites();
+                       $isadmin = 
$GLOBALS['phpgw']->acl->check('run',1,'admin');
+                       if ($numberofsites < 2 && !$isadmin)
+                       {
+                               return false;
+                       }
+                       $menu_title = lang('Other websites');
+                       if ($numberofsites > 1)
+                       {
+                               $link_data['menuaction'] = 
'sitemgr.Common_UI.DisplayMenu';
+                               $sites = 
$GLOBALS['Common_BO']->sites->list_sites(False);
+                               while(list($site_id,$site) = @each($sites))
+                               {
+                                       if ($site_id != CURRENT_SITE_ID)
+                                       {
+                                               $link_data['siteswitch'] = 
$site_id;
+                                               $file[$site['site_name']] = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
+                                       }
+                               }
+                       }
+                       if ($numberofsites > 1 && $isadmin)
+                       {
+                               $file['_NewLine_'] ='';
+                       }
+                       if ($isadmin)
+                       {
+                               $file['Define websites'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.list_sites');
+                       }
+                       return $file;
+               }                       
        }
  ?>

Index: class.Common_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_UI.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.Common_UI.inc.php     30 May 2003 18:49:13 -0000      1.15
--- class.Common_UI.inc.php     6 Jun 2003 02:14:55 -0000       1.16
***************
*** 29,68 ****
                        $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-wide 
content')
!                               );
!                       }
!                       $this->menu[] = array(
!                               'value' => 
$GLOBALS['phpgw']->link('/index.php', 'menuaction=sitemgr.Outline_UI.manage'),
!                               'display' => lang('Manage Categories and 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')
!                       );
                }
  
--- 29,33 ----
                        $this->pages_bo = &$Common_BO->pages;
                        $this->cat_bo = &$Common_BO->cats;
!                       $Common_BO->set_menus();
                }
  
***************
*** 70,83 ****
                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');
--- 35,71 ----
                function DisplayMenu()
                {
                        $this->DisplayHeader();
                        $this->t->set_file('MainMenu','mainmenu.tpl');
!                       $this->t->set_block('MainMenu','switch','switchhandle');
!                       $this->t->set_block('MainMenu','menuentry','entry');
!                       $this->t->set_var('lang_sitemenu',lang('Website') . ' ' 
. $GLOBALS['Common_BO']->sites->current_site['site_name']);
!                       reset($GLOBALS['Common_BO']->sitemenu);
!                       while (list($display,$value) = 
@each($GLOBALS['Common_BO']->sitemenu))
!                       {
!                               if ($display == '_NewLine_')
!                               {
!                                       continue;
!                               }
!                               
$this->t->set_var(array('value'=>$value,'display'=>lang($display)));
!                               $this->t->parse('sitemenu','menuentry', true);
!                       }
!                       if ($GLOBALS['Common_BO']->othermenu)
                        {
!                               $this->t->set_var('lang_othermenu',lang('Other 
websites'));
!                               reset($GLOBALS['Common_BO']->othermenu);
!                               while (list($display,$value) = 
@each($GLOBALS['Common_BO']->othermenu))
!                               {
!                                       if ($display == '_NewLine_')
!                                       {
!                                               continue;
!                                       }
!                                       
$this->t->set_var(array('value'=>$value,'display'=>lang($display)));
!                                       
$this->t->parse('othermenu','menuentry', true);
!                               }
!                               $this->t->parse('switchhandle','switch');
!                       }
!                       else
!                       {
!                               
$this->t->set_var('switchhandle','testtesttest');
                        }
                        $this->t->pfp('out','MainMenu');
***************
*** 335,355 ****
                function DisplayHeader()
                {
!                       $GLOBALS['phpgw']->common->phpgw_header();
!                       echo parse_navbar();
!                       
$this->t->set_file('sitemgr_header','sitemgr_header.tpl');
!                       
$this->t->set_block('sitemgr_header','switch','switchhandle');
!                       
$this->t->set_block('sitemgr_header','admin','adminhandle');
                        if ($this->do_sites_exist)
                        {
!                               $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)
                                {
                                        
$this->t->set_var('sitelist',$this->siteselectlist());
--- 323,340 ----
                function DisplayHeader()
                {
!                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
$GLOBALS['phpgw_info']['apps']['sitemgr']['title'];
! 
                        if ($this->do_sites_exist)
                        {
!                               if 
($GLOBALS['phpgw_info']['server']['template_set'] == 'idots')
!                               {
!                                       
$GLOBALS['phpgw']->common->phpgw_header();
!                                       echo parse_navbar();
!                                       return;
!                               }
!                               
$this->t->set_file('sitemgr_header','sitemgr_header.tpl');
!                               
$this->t->set_block('sitemgr_header','switch','switchhandle');
!                               
$this->t->set_var('menulist',$this->menuselectlist());
!                               if ($GLOBALS['Common_BO']->othermenu)
                                {
                                        
$this->t->set_var('sitelist',$this->siteselectlist());
***************
*** 360,379 ****
                                        $this->t->set_var('switchhandle','');
                                }
!                               if 
($GLOBALS['phpgw']->acl->check('run',1,'admin'))
!                               {
!                                       $this->t->set_var(array(
!                                               'sitesadmin' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Sites_UI.list_sites'),
!                                               'view_admin' => lang('Define 
Websites')
!                                       ));
!                                       $this->t->parse('adminhandle','admin');
!                               }
!                               else
!                               {
!                                       $this->t->set_var('adminhandle','');
!                               }
!                               $this->t->pparse('out','sitemgr_header');
                        }
                        else
                        {
                                echo lang('No websites defined');
                                $GLOBALS['phpgw']->common->phpgw_exit(True);
--- 345,355 ----
                                        $this->t->set_var('switchhandle','');
                                }
!                               $GLOBALS['phpgw_info']['flags']['app_header'] 
.= $this->t->parse('out','sitemgr_header');
!                               $GLOBALS['phpgw']->common->phpgw_header();
!                               echo parse_navbar();
                        }
                        else
                        {
+                               $GLOBALS['phpgw']->common->phpgw_header();
                                echo lang('No websites defined');
                                $GLOBALS['phpgw']->common->phpgw_exit(True);
***************
*** 389,397 ****
                function siteselectlist()
                {
!                       $sites = 
$GLOBALS['Common_BO']->sites->list_sites(False);
!                       $selectlist= '<option>' . lang('Switch website') . 
'</option>';
!                       while(list($site_id,$site) = @each($sites))
                        {
!                               $selectlist .= '<option value="' . $site_id . 
'">' . $site['site_name'] . '</option>' . "\n";
                        }
                        return $selectlist;
--- 365,379 ----
                function siteselectlist()
                {
!                       $selectlist= '<option>' . lang('Other websites') . 
'</option>';
!                       while(list($display,$value) = 
@each($GLOBALS['Common_BO']->othermenu))
                        {
!                               if ($display == '_NewLine_')
!                               {
!                                       continue;
!                               }
!                               else
!                               {
!                                       $selectlist .= '<option 
onClick="location.href=this.value" value="' . $value . '">' . lang($display) . 
'</option>' . "\n";
!                               }
                        }
                        return $selectlist;
***************
*** 400,408 ****
                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;
--- 382,394 ----
                function menuselectlist()
                {
!                       reset($GLOBALS['Common_BO']->sitemenu);
!                       $selectlist= '<option>' . lang('Website') . ' ' . 
$GLOBALS['Common_BO']->sites->current_site['site_name'] . '</option>';
!                       while(list($display,$value) = 
@each($GLOBALS['Common_BO']->sitemenu))
                        {
!                               if ($display == '_NewLine_')
!                               {
!                                       continue;
!                               }
!                               $selectlist .= '<option 
onClick="location.href=this.value" value="' . $value . '">' . lang($display) . 
'</option>' . "\n";
                        }
                        return $selectlist;

Index: class.Content_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Content_UI.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.Content_UI.inc.php    31 May 2003 03:53:51 -0000      1.10
--- class.Content_UI.inc.php    6 Jun 2003 02:14:55 -0000       1.11
***************
*** 94,98 ****
                                $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');
--- 94,97 ----
***************
*** 108,112 ****
                                $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');
--- 107,110 ----
***************
*** 223,228 ****
                        $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>') : '')
                                ));
  
--- 221,225 ----
                        $this->t->set_var(Array(
                                'content_manager' => lang('%1 content manager', 
$scopename),
!                               'page_or_cat_name' => ($page_or_cat_name ? (' - 
' . $page_or_cat_name) : '')
                                ));
  

Index: class.Sites_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Sites_BO.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.Sites_BO.inc.php      3 Jun 2003 02:44:44 -0000       1.6
--- class.Sites_BO.inc.php      6 Jun 2003 02:14:55 -0000       1.7
***************
*** 170,177 ****
                        {
                                
$GLOBALS['phpgw']->preferences->read_repository();
!                               if ($_POST['siteswitch'])
                                {
!                                       $this->current_site = 
$this->read($_POST['siteswitch']);
!                                       
$GLOBALS['phpgw']->preferences->change('sitemgr','currentsite',$_POST['siteswitch']);
                                        
$GLOBALS['phpgw']->preferences->save_repository(True);
                                }
--- 170,178 ----
                        {
                                
$GLOBALS['phpgw']->preferences->read_repository();
!                               $siteswitch = get_var('siteswitch');
!                               if ($siteswitch)
                                {
!                                       $this->current_site = 
$this->read($siteswitch);
!                                       
$GLOBALS['phpgw']->preferences->change('sitemgr','currentsite',$siteswitch);
                                        
$GLOBALS['phpgw']->preferences->save_repository(True);
                                }

Index: class.Sites_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Sites_UI.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.Sites_UI.inc.php      30 May 2003 23:17:46 -0000      1.5
--- class.Sites_UI.inc.php      6 Jun 2003 02:14:55 -0000       1.6
***************
*** 15,18 ****
--- 15,19 ----
        class Sites_UI
        {
+               var $common_ui;
                var $public_functions = array(
                        'list_sites' => True,
***************
*** 33,39 ****
                function Sites_UI()
                {
!                       global $Common_BO;
!                       $Common_BO = CreateObject('sitemgr.Common_BO');
!                       $this->bo = &$Common_BO->sites;
                        $this->nextmatchs = createobject('phpgwapi.nextmatchs');
  
--- 34,39 ----
                function Sites_UI()
                {
!                       $this->common_ui = 
CreateObject('sitemgr.Common_UI',True);
!                       $this->bo = &$GLOBALS['Common_BO']->sites;
                        $this->nextmatchs = createobject('phpgwapi.nextmatchs');
  
***************
*** 71,76 ****
                function list_sites()
                {
!                       $GLOBALS['phpgw']->common->phpgw_header();
!                       echo parse_navbar();
  
                        if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
--- 71,75 ----
                function list_sites()
                {
!                       $this->common_ui->DisplayHeader();
  
                        if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
***************
*** 134,137 ****
--- 133,137 ----
                        
$GLOBALS['phpgw']->template->parse('out','site_list_t',True);
                        $GLOBALS['phpgw']->template->p('out');
+                       $this->common_ui->DisplayFooter();
                }
  
***************
*** 143,148 ****
                                return $this->list_sites();
                        }
!                       $GLOBALS['phpgw']->common->phpgw_header();
!                       echo parse_navbar();
  
                        if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
--- 143,147 ----
                                return $this->list_sites();
                        }
!                       $this->common_ui->DisplayHeader();
  
                        if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
***************
*** 239,242 ****
--- 238,243 ----
                        }
                        
$GLOBALS['phpgw']->template->pparse('phpgw_body','form');
+                       $this->common_ui->DisplayFooter();
+ 
                }
  





reply via email to

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