[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/inc class.blocks_bo.inc.ph
From: |
Patrick Walsh <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/inc class.blocks_bo.inc.php,NONE,1.1.2.1 class.Template2.inc.php,1.1,1.1.2.1 class.bo.inc.php,1.6.2.2,1.6.2.3 class.ui.inc.php,1.7.2.3,1.7.2.4 |
Date: |
Fri, 22 Nov 2002 01:05:32 -0500 |
Update of /cvsroot/phpgroupware//sitemgr/sitemgr-site/inc
In directory subversions:/tmp/cvs-serv24108
Modified Files:
Tag: Version-0_9_14-branch
class.Template2.inc.php class.bo.inc.php class.ui.inc.php
Added Files:
Tag: Version-0_9_14-branch
class.blocks_bo.inc.php
Log Message:
Added center blocks and multilanguage support
***** Error reading new file: [Errno 2] No such file or directory:
'class.blocks_bo.inc.php'
Index: class.Template2.inc.php
===================================================================
RCS file:
/cvsroot/phpgroupware//sitemgr/sitemgr-site/inc/class.Template2.inc.php,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** class.Template2.inc.php 2 Sep 2002 23:08:13 -0000 1.1
--- class.Template2.inc.php 22 Nov 2002 06:05:28 -0000 1.1.2.1
***************
*** 459,468 ****
}
! function replace_var($vars)
{
! $var = $vars[1];
! if (substr($var,0,9)=='?sitemgr:')
{
! $params=explode(',',substr($var,9));
switch(count($params))
{
--- 459,467 ----
}
! function make_link($linkcode)
{
! if (substr($linkcode,0,9)=='?sitemgr:')
{
! $params=explode(',',substr($linkcode,9));
switch(count($params))
{
***************
*** 477,486 ****
break;
default:
! $val = $var;
}
}
! elseif (substr($var,0,7)=='?phpgw:')
{
! $params=explode(',',substr($var,7));
switch(count($params))
{
--- 476,485 ----
break;
default:
! $val = $linkcode;
}
}
! elseif (substr($linkcode,0,7)=='?phpgw:')
{
! $params=explode(',',substr($linkcode,7));
switch(count($params))
{
***************
*** 495,510 ****
break;
default:
! $val = $var;
}
}
! elseif (substr($var,0,1)=='?')
{
! $val =
sitemgr_link2('/index.php',substr($var,1));
}
else
{
! $val = '{'.$var.'}';
}
return $val;
}
}
--- 494,568 ----
break;
default:
! $val = $linkcode;
}
}
! elseif (substr($linkcode,0,1)=='?')
! {
! $val =
sitemgr_link2('/index.php',substr($linkcode,1));
! }
!
! return $val;
! }
!
! function replace_var($vars)
! {
! $var = $vars[1];
! if (substr($var,0,1)=='?')
! {
! $val = $this->make_link($var);
! }
! elseif (substr($var,0,6)=='block:')
{
! $blockname = substr($var,6);
! $themesel =
$GLOBALS['sitemgr_info']['themesel'];
! $sitemgr_path =
$GLOBALS['sitemgr_info']['sitemgr-site_path'];
! if (file_exists($sitemgr_path .
'/blocks/block-' .
! $blockname . '.php'))
! {
! require_once($sitemgr_path .
! '/inc/class.blocks_bo.inc.php');
! $blocks_bo = new blocks_bo;
!
! $block =
$blocks_bo->find_block($blockname);
! if ($block && !
$blocks_bo->block_allowed($block))
! {
! // If the block is specified
and this user can't view it
! $val = '';
! }
! else
! {
! // block not specified or block
specified and viewable
!
! $t = new Template2;
! $t->set_file('centerblocks',
$sitemgr_path .
! '/templates/' .
$themesel . '/centerblock.tpl');
!
$t->set_block('centerblocks','SideBlock','SBlock');
! $t->set_var('block_title',
!
$blocks_bo->get_blocktitle($block));
! $t->set_var('block_content',
!
$blocks_bo->get_blockcontent($block));
! $val =
$t->parse('SBlock','SideBlock',false);
! unset($t);
! }
! }
! else
! {
! $val = '<h4>CONTRIBUTOR SPECIFIED
BLOCK, '. $blockname .
! ', NOT FOUND</h4>';
! }
}
else
{
! switch($var)
! {
! case 'xyz':
! $val = 'test';
! break;
! default:
! $val = '{'.$var.'}';
! }
}
return $val;
}
}
+ ?>
\ No newline at end of file
Index: class.bo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//sitemgr/sitemgr-site/inc/class.bo.inc.php,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -C2 -r1.6.2.2 -r1.6.2.3
*** class.bo.inc.php 1 Nov 2002 06:25:14 -0000 1.6.2.2
--- class.bo.inc.php 22 Nov 2002 06:05:28 -0000 1.6.2.3
***************
*** 24,28 ****
$this->catbo = CreateObject('sitemgr.Categories_BO');
$this->pages_bo = CreateObject('sitemgr.Pages_BO');
! $this->pages_so = CreateObject('sitemgr.Pages_SO');
$this->headerfooter_bo =
CreateObject('sitemgr.headerFooter_BO');
$this->page = CreateObject('sitemgr.Page_SO');
--- 24,28 ----
$this->catbo = CreateObject('sitemgr.Categories_BO');
$this->pages_bo = CreateObject('sitemgr.Pages_BO');
! //$this->pages_so = CreateObject('sitemgr.Pages_SO');
$this->headerfooter_bo =
CreateObject('sitemgr.headerFooter_BO');
$this->page = CreateObject('sitemgr.Page_SO');
***************
*** 30,36 ****
}
function loadPage($page_id)
{
! $this->page = $this->pages_bo->GetPage($page_id);
}
--- 30,73 ----
}
+ function getcatwrapper($cat_id)
+ {
+ $availablelangsforcat =
$this->catbo->getlangarrayforcategory($cat_id);
+ if
(in_array($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],$availablelangsforcat))
+ {
+ return
$this->catbo->getCategory($cat_id,$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
+ }
+ else
+ {
+ foreach
($GLOBALS['sitemgr_info']['sitelanguages'] as $lang)
+ {
+ if
(in_array($lang,$availablelangsforcat))
+ {
+ return
$this->catbo->getCategory($cat_id,$lang);
+ }
+ }
+ }
+ }
+
+ function getpagewrapper($page_id)
+ {
+ $availablelangsforpage =
$this->pages_bo->getlangarrayforpage($page_id);
+ if
(in_array($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],$availablelangsforpage))
+ {
+ return
$this->pages_bo->GetPage($page_id,$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
+ }
+ else
+ {
+ foreach
($GLOBALS['sitemgr_info']['sitelanguages'] as $lang)
+ {
+ if
(in_array($lang,$availablelangsforpage))
+ return
$this->pages_bo->GetPage($page_id,$lang);
+ }
+ }
+ }
+
+
function loadPage($page_id)
{
! $this->page = $this->getpagewrapper($page_id);
}
***************
*** 130,134 ****
{
$links =
$this->getPageLinks($category_id,true);
! $cat =
$this->catbo->getCategory($category_id);
$content = '';
if ($cat)
--- 167,171 ----
{
$links =
$this->getPageLinks($category_id,true);
! $cat =
$this->getcatwrapper($category_id);
$content = '';
if ($cat)
***************
*** 220,224 ****
foreach($pages as $page_id)
{
! $page=$this->pages_bo->getPage($page_id);
if ($showhidden || !$page->hidden)
{
--- 257,261 ----
foreach($pages as $page_id)
{
! $page=$this->getpagewrapper($page_id);
if ($showhidden || !$page->hidden)
{
***************
*** 260,264 ****
foreach($cat_list as $cat_id)
{
! $category = $this->catbo->getCategory($cat_id);
$catlinks[$cat_id] = array(
'name'=>$category->name,
--- 297,301 ----
foreach($cat_list as $cat_id)
{
! $category = $this->getcatwrapper($cat_id);
$catlinks[$cat_id] = array(
'name'=>$category->name,
***************
*** 274,278 ****
function get_header()
{
! return $this->headerfooter_bo->getsiteheader();
}
--- 311,315 ----
function get_header()
{
! return
$this->headerfooter_bo->getsiteheader($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
}
***************
*** 280,284 ****
{
$prefs = CreateObject('sitemgr.sitePreference_SO');
! return $prefs->getPreference('sitemgr-site-name');
}
--- 317,321 ----
{
$prefs = CreateObject('sitemgr.sitePreference_SO');
! return $prefs->getPreference('sitemgr-site-name-' .
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
}
***************
*** 300,304 ****
function get_footer()
{
! return $this->headerfooter_bo->getsitefooter();
}
--- 337,341 ----
function get_footer()
{
! return
$this->headerfooter_bo->getsitefooter($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
}
Index: class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//sitemgr/sitemgr-site/inc/class.ui.inc.php,v
retrieving revision 1.7.2.3
retrieving revision 1.7.2.4
diff -C2 -r1.7.2.3 -r1.7.2.4
*** class.ui.inc.php 1 Nov 2002 06:25:14 -0000 1.7.2.3
--- class.ui.inc.php 22 Nov 2002 06:05:28 -0000 1.7.2.4
***************
*** 15,19 ****
var $bo;
var $t;
!
function ui()
{
--- 15,20 ----
var $bo;
var $t;
! var $blocks_bo;
!
function ui()
{
***************
*** 21,24 ****
--- 22,29 ----
$this->t = new Template2;
+
require_once($GLOBALS['sitemgr_info']['sitemgr-site_path'] .
+ '/inc/class.blocks_bo.inc.php');
+ $this->blocks_bo = new blocks_bo;
+
$this->bo->setsitemgrPreferredLanguage();
}
***************
*** 27,31 ****
{
$pages_so = CreateObject('sitemgr.Pages_SO');
! $page = $pages_so->getPageByName($page_name);
$this->bo->loadPage($page->id);
$this->generatePage();
--- 32,36 ----
{
$pages_so = CreateObject('sitemgr.Pages_SO');
! $page =
$pages_so->getPageByName($page_name,$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
$this->bo->loadPage($page->id);
$this->generatePage();
***************
*** 112,116 ****
echo '</head>' . "\n";
themeheader();
! blocks('c');
echo OpenTable();
echo "<h1>" . $this->bo->get_title() . "</h1>";
--- 117,121 ----
echo '</head>' . "\n";
themeheader();
! $this->blocks_bo->blocks('c',$this->t);
echo OpenTable();
echo "<h1>" . $this->bo->get_title() . "</h1>";
***************
*** 142,146 ****
$this->t->set_var('opencurly','{');
$this->t->set_var('closecurly','}');
! $this->t->set_var('user',
$GLOBALS['phpgw_info']['user']['account_lid']);
$this->t->set_var('site_name',$this->bo->get_siteName());
$this->t->set_var('site_header',
$this->bo->get_header());
--- 147,152 ----
$this->t->set_var('opencurly','{');
$this->t->set_var('closecurly','}');
! $this->t->set_var('user',
! $GLOBALS['phpgw_info']['user']['account_lid']);
$this->t->set_var('site_name',$this->bo->get_siteName());
$this->t->set_var('site_header',
$this->bo->get_header());
***************
*** 152,230 ****
$this->t->set_file('sideblocks',$themesel.'/sideblock.tpl');
$this->t->set_block('sideblocks','SideBlock','SBlock');
! $this->blocks('l');
$this->t->set_var('left_blocks',$this->t->get_var('SBlock'));
$this->t->set_var('SBlock','');
! $this->blocks('r');
$this->t->set_var('right_blocks',$this->t->get_var('SBlock'));
$this->t->set_var('SBlock','');
$this->t->pfp('out','body');
}
- function block_allowed($block)
- {
- switch($block['view'])
- {
- case 0:
- return true;
- case 1:
- return $this->bo->is_user();
- case 2:
- return $this->bo->is_admin();
- case 3:
- return (! $this->bo->is_user());
- }
- return false;
- }
-
- function get_blocktitle($block)
- {
- return $block['title'];
- }
-
- function get_blockcontent($block)
- {
- $content='';
- if (file_exists('blocks/'.$block['blockfile']) &&
trim($block['blockfile']))
- {
- include('blocks/'.$block['blockfile']);
- if (!$content)
- {
- $content = lang('No content found');
- }
- }
- elseif ($block['content'])
- {
- $content = $block['content'];
- }
- else
- {
- $content = lang('Block not found');
- }
- return $content;
- }
-
- function blocks($side)
- {
- global $blocks;
- //echo "<pre>";
- //print_r($blocks);
- //echo "</pre>";
- foreach($blocks as $block)
- {
- if($block['position']==$side)
- {
- if ($this->block_allowed($block))
- {
- $title =
$this->get_blocktitle($block);
- $content =
$this->get_blockcontent($block);
-
$this->t->set_var('block_title',$title);
-
$this->t->set_var('block_content',$content);
-
$this->t->parse('SBlock','SideBlock',true);
- }
- }
- }
- }
}
?>
--- 158,177 ----
$this->t->set_file('sideblocks',$themesel.'/sideblock.tpl');
$this->t->set_block('sideblocks','SideBlock','SBlock');
! $this->blocks_bo->blocks('l',$this->t);
$this->t->set_var('left_blocks',$this->t->get_var('SBlock'));
$this->t->set_var('SBlock','');
! $this->blocks_bo->blocks('r',$this->t);
$this->t->set_var('right_blocks',$this->t->get_var('SBlock'));
$this->t->set_var('SBlock','');
+
$this->t->set_file('centerblocks',$themesel.'/centerblock.tpl');
+
$this->t->set_block('centerblocks','SideBlock','SBlock');
+ $this->blocks_bo->blocks('c',$this->t);
+
$this->t->set_var('center_blocks',$this->t->get_var('SBlock'));
+ $this->t->set_var('SBlock','');
$this->t->pfp('out','body');
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/inc class.blocks_bo.inc.php,NONE,1.1.2.1 class.Template2.inc.php,1.1,1.1.2.1 class.bo.inc.php,1.6.2.2,1.6.2.3 class.ui.inc.php,1.7.2.3,1.7.2.4,
Patrick Walsh <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/blocks block-Choose_lang.php,NONE,1.1.2.1
- Next by Date:
[Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/templates/phpgroupware centerblock.tpl,1.2,1.2.2.1 main.tpl,1.2.2.1,1.2.2.2
- Previous by thread:
[Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/blocks block-Choose_lang.php,NONE,1.1.2.1
- Next by thread:
[Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/templates/phpgroupware centerblock.tpl,1.2,1.2.2.1 main.tpl,1.2.2.1,1.2.2.2
- Index(es):