[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sitemgr/inc class.Pages_BO.inc.php, 1.5.2.3.4.1 class
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] sitemgr/inc class.Pages_BO.inc.php, 1.5.2.3.4.1 class.Categories_SO.inc.php, 1.13.2.5.4.1 class.Categories_UI.inc.php, 1.1.2.1.4.1 class.Categories_BO.inc.php, 1.6.2.2.4.1 class.Category_SO.inc.php, 1.4.10.1 |
Date: |
Sat, 12 Nov 2005 14:15:00 +0100 |
Update of sitemgr/inc
Modified Files:
Branch: skwashd-16-compat
class.Pages_BO.inc.php lines: +2 -2
class.Categories_SO.inc.php lines: +12 -4
class.Categories_UI.inc.php lines: +67 -48
class.Categories_BO.inc.php lines: +2 -1
Branch:
class.Category_SO.inc.php lines: +1 -0
Log Message:
added default page per cat
====================================================
Index: sitemgr/inc/class.Pages_BO.inc.php
diff -u sitemgr/inc/class.Pages_BO.inc.php:1.5
sitemgr/inc/class.Pages_BO.inc.php:1.5.2.3.4.1
--- sitemgr/inc/class.Pages_BO.inc.php:1.5 Sat Jan 18 04:30:34 2003
+++ sitemgr/inc/class.Pages_BO.inc.php Sat Nov 12 13:15:37 2005
@@ -1,42 +1,47 @@
<?php
class Pages_BO
{
- var $pageso;
+ var $so;
function Pages_BO()
{
- $this->pageso = CreateObject('sitemgr.Pages_SO',True);
+ $this->so = CreateObject('sitemgr.Pages_SO',True);
}
- function getPageOptionList()
+ function getPageOptionList($cat_id = 0 )
{
- $pagelist = $this->pageso->getPageIDList();
- $retval[]=array('value'=>'','display'=>'[' .lang('Show
Site Index') . ']');
+ $pagelist = $this->so->getPageIDList($cat_id
,$GLOBALS['Common_BO']->getstates('Production'));
+ $retval[]=array('value'=>0,'display'=>'[' .lang('Show
Site Index') . ']');
foreach($pagelist as $page_id)
{
- $page = $this->pageso->getPage($page_id);
+ $page = $this->so->getPage($page_id);
$retval[]=array('value'=>$page_id,'display'=>$page->name);
}
return $retval;
}
- function getPageIDList($cat_id=0)
+ function getpageIDListCommitable()
{
- if
($GLOBALS['Common_BO']->acl->can_read_category($cat_id))
- {
- return $this->pageso->getPageIDList($cat_id);
- }
- else
- {
- return false;
- }
+ //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)
+ {
+ return $this->so->getPageIDList($cat_id,$states);
}
function addPage($cat_id)
{
if
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
{
- return $this->pageso->addPage($cat_id);
+ return $this->so->addPage($cat_id);
}
else
{
@@ -44,33 +49,48 @@
}
}
- function removePagesInCat($cat_id)
+ function removePagesInCat($cat_id,$force=False)
{
- $pages = $this->pageso->getPageIDList($cat_id);
+ 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($cat_id,$page_id);
+ $this->removePage($page_id,True);
}
}
- function removePage($cat_id, $page_id)
+ function removePage($page_id,$force=False)
{
- if
($GLOBALS['Common_BO']->acl->can_write_category($cat_id))
+ $cat_id = $this->so->getcatidforpage($page_id);
+ if (!$force)
{
- $this->pageso->removePage($page_id);
-
$GLOBALS['Common_BO']->content->removeBlocksInPageOrCat($cat_id,$page_id);
- }
- else
- {
- return false;
+ 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)
{
- if ($GLOBALS['Common_BO']->acl->can_read_page($page_id))
+ $page = $this->so->getPage($page_id,$lang);
+ if ($page &&
in_array($page->cat_id,$GLOBALS['Common_BO']->cats->readablecats))
{
- return $this->pageso->getPage($page_id,$lang);
+ //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;
}
else
{
@@ -85,73 +105,72 @@
function getlangarrayforpage($page_id)
{
- return $this->pageso->getlangarrayforpage($page_id);
+ return $this->so->getlangarrayforpage($page_id);
}
function savePageInfo($page_Info,$lang)
{
- if
(!$GLOBALS['Common_BO']->acl->can_write_category($page_Info->cat_id))
+ $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.");
}
- $fixed_name = strtr($page_Info->name,
'address@hidden&*()-_=+ /?><,.\\\'":;|`~{}[]','
');
+
+ $fixed_name = strtr($page_Info->name,
'address@hidden&*()=+ /?><,.\\\'":;|`~{}[]','
');
$fixed_name = str_replace(' ', '', $fixed_name);
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);
+ $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->pageso->pageExists($page_Info->name,$page_Info->id))
+
+ if
($this->so->pageExists($page_Info->name,$page_Info->id))
{
$page_Info->name .= '--FIX-DUPLICATE-NAME';
- $this->pageso->savePageInfo($page_Info);
- $this->pageso->savePageLang($page_Info,$lang);
+ $this->so->savePageInfo($page_Info);
+ $this->so->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.');
- }
+ $this->so->savePageInfo($page_Info);
+ $this->so->savePageLang($page_Info,$lang);
+ return True;
}
function savePageLang($page_Info,$lang)
- {
- $this->pageso->savePageLang($page_Info,$lang);
- }
+ {
+ $this->so->savePageLang($page_Info,$lang);
+ }
function removealllang($lang)
{
- $this->pageso->removealllang($lang);
+ $this->so->removealllang($lang);
}
function migratealllang($oldlang,$newlang)
{
- $this->pageso->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: sitemgr/inc/class.Categories_SO.inc.php
diff -u sitemgr/inc/class.Categories_SO.inc.php:1.13
sitemgr/inc/class.Categories_SO.inc.php:1.13.2.5.4.1
--- sitemgr/inc/class.Categories_SO.inc.php:1.13 Tue Jan 28 20:00:00 2003
+++ sitemgr/inc/class.Categories_SO.inc.php Sat Nov 12 13:15:37 2005
@@ -3,45 +3,43 @@
{
var $cats;
var $db;
+ var $site_id;
function Categories_SO()
{
$this->cats =
CreateObject('phpgwapi.categories',-1,'sitemgr');
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db =& $GLOBALS['phpgw']->db;
}
- function getChildrenIDList($parent=0)
+ function isactive($cat_id,$states=false)
{
- if ($parent)
+ if (!$states)
{
- $cats =
$this->cats->return_array('all','',False,'','','',False,$parent);
+ $states = $GLOBALS['Common_BO']->visiblestates;
}
- else
- {
- $cats =
$this->cats->return_array('mains','',False,'','','',False, 0);
- }
- while (list(,$subs) = @each($cats))
- {
- if ($subs['parent']==$parent)
- {
- $subs_id_list[] = $subs['id'];
- }
- }
- return $subs_id_list;
+ $this->db->query('SELECT cat_id from
phpgw_sitemgr_categories_state '
+ . ' WHERE cat_id = ' . intval($cat_id)
+ . ' AND state IN ( ' . implode(',',$states) .
')', __LINE__, __FILE__);
+
+ return $this->db->next_record();
}
- function getFullCategoryIDList()
+ function getChildrenIDList($parent)
{
- $cats =
$this->cats->return_array('all','',False,'','','',False);
+ $cats =
$this->cats->return_array('all','',False,'','','cat_data',False,$parent,-1,'id');
+ $result = array();
- while (list(,$cat) = @each($cats))
+ if(is_array($cats))
{
- $cat_id_list[] = $cat['id'];
+ foreach($cats as $ign => $subs)
+ {
+ $result[] = $subs['id'];
+ }
}
- return $cat_id_list;
+ return $result;
}
- function addCategory($name, $description, $parent = '')
+ function addCategory($name, $description, $parent = False)
{
$data = array
(
@@ -51,13 +49,21 @@
'parent' => $parent,
'old_parent' => $parent
);
-
- return $this->cats->add($data);
+ $cat_id = $this->cats->add($data);
+ $this->db->query('INSERT INTO
phpgw_sitemgr_categories_state (cat_id)'
+ . ' VALUES (' . intval($cat_id) . ')',
__LINE__, __FILE__);
+ return $cat_id;
}
function removeCategory($cat_id)
{
+ $cat_id = intval($cat_id);
$this->cats->delete($cat_id,False,True);
+ $this->db->query('DELETE FROM
phpgw_sitemgr_categories_lang'
+ . " WHERE cat_id = $cat_id", __LINE__,
__FILE__);
+
+ $this->db->query('DELETE FROM
phpgw_sitemgr_categories_state'
+ . " WHERE cat_id = $cat_id", __LINE__,
__FILE__);
return True;
}
@@ -67,33 +73,48 @@
(
'name' => $cat_info->name,
'descr' => $cat_info->description,
- 'data' => (int) $cat_info->sort_order,
+ 'data' =>
intval($cat_info->sort_order),
'access' => 'public',
'id' => $cat_info->id,
'parent' => $cat_info->parent,
- 'old_parent' => $cat_info->old_parent
+ 'old_parent' => $cat_info->old_parent
);
-
$this->cats->edit($data);
+ $this->db->query('UPDATE phpgw_sitemgr_categories_state'
+ . ' SET state = ' .
intval($cat_info->state) . ','
+ . ' def_page = ' .
intval($cat_info->def_page)
+ . ' WHERE cat_id = ' .
intval($cat_info->id), __LINE__,__FILE__);
}
function saveCategoryLang($cat_id, $cat_name, $cat_description,
$lang)
- {
- $this->db->query("SELECT * FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'",
__LINE__,__FILE__);
- if ($this->db->next_record())
- {
- $this->db->query("UPDATE phpgw_sitemgr_categories_lang
SET name='$cat_name', description='$cat_description' WHERE cat_id='$cat_id' and
lang='$lang'", __LINE__,__FILE__);
- }
- else
- {
- $this->db->query("INSERT INTO
phpgw_sitemgr_categories_lang (cat_id,lang,name,description) VALUES
('$cat_id','$lang','$cat_name','$cat_description')", __LINE__,__FILE__);
- }
- }
+ {
+ $this->db->query('SELECT * FROM
phpgw_sitemgr_categories_lang '
+ . 'WHERE cat_id=' . intval($cat_id)
+ ." AND lang='" .
$this->db->db_addslashes($lang) . "'", __LINE__,__FILE__);
+ if ($this->db->next_record())
+ {
+ $this->db->query('UPDATE
phpgw_sitemgr_categories_lang '
+ . "SET name='" .
$this->db->db_addslashes($cat_name) . "', "
+ . " description='" .
$this->db->db_addslashes($cat_description) . "' "
+ . 'WHERE cat_id=' .
intval($cat_id)
+ . " AND lang='" .
$this->db->db_addslashes($lang) . "'", __LINE__,__FILE__);
+ }
+ else
+ {
+ $this->db->query('INSERT INTO
phpgw_sitemgr_categories_lang (cat_id,lang,name,description) '
+ . 'VALUES (' . intval($cat_id)
. ','
+ . "'" .
$this->db->db_addslashes($lang) . "',"
+ . "'" .
$this->db->db_addslashes($cat_name) . "',"
+ . "'" .
$this->db->db_addslashes($cat_description)
+ . "')", __LINE__,__FILE__);
+ }
+ }
function getlangarrayforcategory($cat_id)
{
$retval = array();
- $this->db->query("SELECT lang FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id'");
+ $this->db->query('SELECT lang FROM
phpgw_sitemgr_categories_lang'
+ . ' WHERE cat_id=' . intval($cat_id),
__LINE__, __FILE__);
while ($this->db->next_record())
{
$retval[] = $this->db->f('lang');
@@ -107,45 +128,61 @@
if (is_array($cat))
{
- $cat_info =
CreateObject('sitemgr.Category_SO', True);
- $cat_info->id = $cat[0]['id'];
- //$cat_info->name =
stripslashes($cat[0]['name']);
+ $cat_info =
CreateObject('sitemgr.Category_SO', True);
+ $cat_info->id = $cat[0]['id'];
+ //$cat_info->name =
stripslashes($cat[0]['name']);
$cat_info->sort_order = $cat[0]['data'];
- //$cat_info->description =
stripslashes($cat[0]['description']);
- $cat_info->parent =
$cat[0]['parent'];
- $cat_info->depth =
$cat[0]['level'];
- $cat_info->root =
$cat[0]['main'];
-
+ //$cat_info->description=
stripslashes($cat[0]['description']);
+ $cat_info->parent = $cat[0]['parent'];
+ $cat_info->depth = $cat[0]['level'];
+ $cat_info->root = $cat[0]['main'];
+ $cat_info->state = 0;
+ $cat_info->def_page = 0;
+
+ $this->db->query('SELECT state, def_page FROM
phpgw_sitemgr_categories_state'
+ . ' WHERE cat_id=' .
intval($cat_id), __LINE__, __FILE__);
+
+ if ( $this->db->next_record() )
+ {
+ $cat_info->state =
$this->db->f('state');
+ $cat_info->def_page =
$this->db->f('def_page');
+ }
+
if ($lang)
- {
- $this->db->query("SELECT * FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id' and lang='$lang'");
- if ($this->db->next_record())
- {
- $cat_info->name =
$this->db->f('name');
- $cat_info->description =
$this->db->f('description');
- }
- else
- {
- //return False;
- $cat_info->name = lang("not yet
translated");
- }
- }
+ {
+ $this->db->query('SELECT * FROM
phpgw_sitemgr_categories_lang'
+ . ' WHERE cat_id=' .
intval($cat_id)
+ . " AND lang='" .
$this->db->db_addslashes($lang)
+ . "'", __LINE__,
__FILE__);
+
+ if ($this->db->next_record())
+ {
+ $cat_info->name =
$this->db->f('name');
+ $cat_info->description =
$this->db->f('description');
+ }
+// else
+// {
+// //return False;
+// $cat_info->name = lang("not yet
translated");
+// }
+ }
//if there is no lang argument we return the
content in whatever languages turns up first
else
- {
- $this->db->query("SELECT * FROM
phpgw_sitemgr_categories_lang WHERE cat_id='$cat_id'");
- if ($this->db->next_record())
- {
- $cat_info->name =
$this->db->f('name');
- $cat_info->description =
$this->db->f('description');
- $cat_info->lang = $this->db->f('lang');
- }
- else
- {
- $cat_info->name = "This category has no
data in any langugage: this should not happen";
- }
- }
+ {
+ $this->db->query('SELECT * FROM
phpgw_sitemgr_categories_lang'
+ . ' WHERE cat_id=' .
intval($cat_id), __LINE__, __FILE__);
+ if ($this->db->next_record())
+ {
+ $cat_info->name =
$this->db->f('name');
+ $cat_info->description =
$this->db->f('description');
+ $cat_info->lang =
$this->db->f('lang');
+ }
+ else
+ {
+ $cat_info->name = "This
category has no data in any langugage: this should not happen";
+ }
+ }
return $cat_info;
}
@@ -157,14 +194,35 @@
function removealllang($lang)
{
- $sql = "DELETE FROM phpgw_sitemgr_categories_lang WHERE
lang='$lang'";
- $this->db->query($sql, __LINE__,__FILE__);
+ $this->db->query('DELETE FROM
phpgw_sitemgr_categories_lang '
+ . "WHERE lang='" .
$this->db->db_addslashes($lang), __LINE__, __FILE__);
}
function migratealllang($oldlang,$newlang)
{
- $sql = "UPDATE phpgw_sitemgr_categories_lang SET
lang='$newlang' WHERE lang='$oldlang'";
- $this->db->query($sql, __LINE__,__FILE__);
+ $this->db->query('UPDATE phpgw_sitemgr_categories_lang'
+ . " SET lang='" .
$this->db->db_addslashes($newlang) . "'"
+ . " WHERE lang='" .
$this->db->db_addslashes($oldlang) . "'", __LINE__,__FILE__);
+ }
+
+ function commit($cat_id)
+ {
+ $this->db->query('UPDATE phpgw_sitemgr_categories_state'
+ . ' SET state = ' .
SITEMGR_STATE_PUBLISH
+ . ' WHERE state = ' .
SITEMGR_STATE_PREPUBLISH
+ . ' AND cat_id = ' . intval($cat_id),
__LINE__, __FILE__);
+ $this->db->query('UPDATE phpgw_sitemgr_categories_state
'
+ . ' SET state = ' .
SITEMGR_STATE_ARCHIVE
+ . ' WHERE state = ' .
SITEMGR_STATE_PREUNPUBLISH
+ . ' AND cat_id = ' . intval($cat_id),
__LINE__, __FILE__);
+ }
+
+ function reactivate($cat_id)
+ {
+ $this->db->query('UPDATE phpgw_sitemgr_categories_state'
+ . ' SET state = ' . SITEMGR_STATE_DRAFT
+ . ' WHERE state = ' .
SITEMGR_STATE_ARCHIVE
+ . ' AND cat_id = ' . intval($cat_id),
__LINE__, __FILE__);
}
}
?>
====================================================
Index: sitemgr/inc/class.Categories_UI.inc.php
diff -u sitemgr/inc/class.Categories_UI.inc.php:1.1
sitemgr/inc/class.Categories_UI.inc.php:1.1.2.1.4.1
--- sitemgr/inc/class.Categories_UI.inc.php:1.1 Fri Jan 17 03:37:52 2003
+++ sitemgr/inc/class.Categories_UI.inc.php Sat Nov 12 13:15:37 2005
@@ -12,8 +12,6 @@
class Categories_UI
{
var $common_ui;
- var $cat;
- var $cat_list;
var $cat_bo;
var $acl;
var $isadmin;
@@ -22,9 +20,8 @@
var $public_functions = array
(
- '_manageCategories' => True,
- '_editCategory' => True,
- '_deleteCategory' => True
+ 'edit' => True,
+ 'delete' => True
);
function Categories_UI()
@@ -35,154 +32,68 @@
$this->cat = CreateObject('sitemgr.Category_SO', True);
$this->acl = $GLOBALS['Common_BO']->acl;
$this->isadmin = $this->acl->is_admin();
- $preferenceso =
CreateObject('sitemgr.sitePreference_SO', true);
- $this->sitelanguages =
explode(',',$preferenceso->getPreference('sitelanguages'));
+ $this->sitelanguages =
$GLOBALS['Common_BO']->sites->current_site['sitelanguages'];
}
- function _manageCategories()
- {
- $this->common_ui->DisplayHeader();
-
- $this->t->set_var(Array('category_manager' =>
lang('Category Manager'),
- 'lang_catname' => lang('Category Name'),
- 'lang_goto' => lang('Go to Page Manager')));
- $this->t->set_file('ManageCategories',
'manage_categories.tpl');
- $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)
- {
- $buffer = '-';
- }
- else
- {
- $buffer = '';
- }
- $buffer =
str_pad('',$this->cat->depth*18,
- ' ',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));
-
-
- $link_data['page_id'] = 0;
- $link_data['cat_id'] = $cat_id;
- 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);
- }
- }
- else
- {
- $this->t->set_var('category','No category is
available');
- }
-
- $this->t->set_var('add',
- '<form action="'.
- $GLOBALS['phpgw']->link('/index.php',
-
'menuaction=sitemgr.Categories_UI._editCategory').
- '" method="POST">
- <input type=submit value = "' . lang('Add a
category') .'">
- </form>'
- );
-
$this->t->set_var('managepageslink',$GLOBALS['phpgw']->link(
- '/index.php',
- 'menuaction=sitemgr.Pages_UI._managePage')
- );
- $this->t->pfp('out', 'ManageCategories');
-
- $this->common_ui->DisplayFooter();
- }
-
- function _editCategory()
+ function edit()
{
if (!$this->isadmin)
{
- $this->_manageCategories();
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
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;
+ $cat_id = isset($_REQUEST['cat_id']) &&
$_REQUEST['cat_id'] ? $_REQUEST['cat_id'] : 0;
+ $cat_id = isset($_REQUEST['inputcatid']) &&
$_REQUEST['inputcatid'] ? $_REQUEST['inputcatid'] : $cat_id;
- if ($btnSave && $catname && $catdesc)
+ if (isset($_POST['btnSave']) && $_POST['btnSave']
+ && isset($_POST['inputcatname']) &&
$_POST['inputcatname']
+ && isset($_POST['inputcatdesc']) &&
$_POST['inputcatdesc'] )
{
- if (!$cat_id)
+ if ( $_POST['inputcatname'] == '' ||
$_POST['inputcatdesc'] == '')
{
-
$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)
- {
-
$this->cat_bo->saveCategoryPermsfromparent($cat_id);
+ $error = lang('You failed to fill in
one or more required fields.');
+ $this->t->set_var('message', $error);
}
else
{
-
$this->cat_bo->saveCategoryPerms($cat_id, $groupaccess, $individualaccess);
- }
- if ($inputapplypermissionstosubs)
- {
-
$this->cat_bo->applyCategoryPermstosubs($cat_id);
- }
- $this->_manageCategories();
- return;
- }
+ $cat_id = $cat_id ? $cat_id :
$this->cat_bo->addCategory('','');
- $this->common_ui->DisplayHeader();
+ $groupaccess =
array_merge_recursive($_POST['inputgroupaccessread'],
$_POST['inputgroupaccesswrite']);
+ $individualaccess =
array_merge_recursive($_POST['inputindividualaccessread'],
$_POST['inputindividualaccesswrite']);
+ $savelanguage =
isset($_POST['savelanguage']) && $_POST['savelanguage'] ?
$_POST['savelanguage'] : $this->sitelanguages[0];
+ $this->cat_bo->saveCategoryInfo($cat_id,
+
$_POST['inputcatname'],
+
$_POST['inputcatdesc'],
+
$savelanguage,
+
$_POST['inputsortorder'],
+
$_POST['inputstate'],
+
$_POST['inputparent'],
+
$_POST['inputparentold'],
+
$_POST['def_page']
+ );
- if ($cat_id)
- {
- $this->cat =
$this->cat_bo->getCategory($cat_id,$this->sitelanguages[0]);
+ if (
isset($_POST['inputgetparentpermissions']) &&
$_POST['inputgetparentpermissions'] )
+ {
+
$this->cat_bo->saveCategoryPermsfromparent($cat_id);
+ }
+ else
+ {
+
$this->cat_bo->saveCategoryPerms($cat_id, $groupaccess, $individualaccess);
+ }
+
+ if (
isset($_POST['inputapplypermissionstosubs']) &&
$_POST['inputapplypermissionstosubs'] )
+ {
+
$this->cat_bo->applyCategoryPermstosubs($cat_id);
+ }
+
$this->t->set_var('message',lang('Category saved'));
+ }
}
- //if the user tried to save, but catname or catdesc
were empty, we remember the modified values
- if ($btnSave)
+ if ( $cat_id )
{
- $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;
+ //we use force here since we might edit an
archive category
+ $cat =
$this->cat_bo->getCategory($cat_id,$this->sitelanguages[0],True);
}
$this->t->set_file('EditCategory', 'edit_category.tpl');
@@ -199,30 +110,48 @@
$this->t->set_var('savelang',$select);
}
- $this->t->set_var(array(
- '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'),
- 'lang_catsort' => lang('Sort Order'),
- 'lang_catparent' => lang('Parent'),
- 'lang_catdesc' => lang('Category Description'),
- 'lang_groupaccess' => lang('Group Access
Permissions'),
- 'lang_groupname' => lang('Group Name'),
- 'lang_readperm' => lang('Read Permission'),
- 'lang_writeperm' => lang('Write Permission'),
- 'lang_useraccess' => lang('Individual Access
Permission'),
- 'lang_username' => lang('User Name'),
- 'lang_reset' => lang('Reset'),
- 'lang_save' => lang('Save'),
- '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?')
- ));
+ $def_page_list = '';
+ $pages4cat =
$GLOBALS['Common_BO']->pages->getPageOptionList($cat_id);
+ if ( is_array($pages4cat) && count($pages4cat) )
+ {
+ foreach ( $pages4cat as $page )
+ {
+ $def_page_list .= "<option
value=\"{$page['value']}\" " . ($page['value'] == $cat->def_page ? '
selected="selected" ' : '' ). ">"
+ .
"{$page['display']}</option>\n";
+ }
+ }
+
+ $this->t->set_var(array
+ (
+ '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,
+ 'def_page' =>
$def_page_list,
+ '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'),
+ 'lang_catsort' => lang('Sort
Order'),
+ 'lang_catparent' =>
lang('Parent'),
+ 'lang_catdesc' =>
lang('Category Description'),
+ 'lang_default_page' =>
lang('default page'),
+ 'lang_groupaccess' => lang('Group
Access Permissions'),
+ 'lang_groupname' => lang('Group
Name'),
+ 'lang_readperm' => lang('Read
Permission'),
+ 'lang_writeperm' => lang('Write
Permission'),
+ 'lang_implies' =>
lang('implies read permission'),
+ 'lang_useraccess' =>
lang('Individual Access Permissions'),
+ 'lang_username' => lang('User
Name'),
+ 'lang_reset' =>
lang('Reset'),
+ 'lang_save' => lang('Save'),
+ 'lang_state' =>
lang('State'),
+ 'lang_done' => lang('Done'),
+ '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?'),
+ ));
$acct = CreateObject('phpgwapi.accounts');
$grouplist = $this->acl->get_group_list();
@@ -234,10 +163,11 @@
//$account_name =
$acct->id2name($permissionlist[$i]['account_id']);
//$this->t->set_var('group_id',$permissionlist[$i]['account_id']);
$account_name =
$grouplist[$i]['account_lid'];
-
$this->t->set_var('group_id',$grouplist[$i]['account_id']);
+ $account_id =
$grouplist[$i]['account_id'];
+
$this->t->set_var('group_id',$account_id);
if ($cat_id)
{
- $permission_id =
$permissionlist[$i]['rights'];
+ $permission_id =
$permissionlist[$account_id];
}
else
{
@@ -245,10 +175,6 @@
}
$this->t->set_var('groupname',
$account_name);
- if ($permission_id == PHPGW_ACL_ADD)
- {
- $permission_id = PHPGW_ACL_ADD
| PHPGW_ACL_READ;
- }
if ($permission_id & PHPGW_ACL_READ)
{
$this->t->set_var('checkedgroupread','CHECKED');
@@ -283,21 +209,18 @@
for($i = 0; $i < count($userlist); $i++ )
{
$user_name =
$userlist[$i]['account_lid'];
+ $user_id = $userlist[$i]['account_id'];
if ($cat_id)
{
- $user_permission_id =
$userpermissionlist[$i]['rights'];
+ $user_permission_id =
$userpermissionlist[$user_id];
}
else
{
$user_permission_id = 0;
}
- $this->t->set_var('user_id',
$userlist[$i]['account_id']);
+ $this->t->set_var('user_id', $user_id);
$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 )
{
$this->t->set_var('checkeduserread','CHECKED');
@@ -338,7 +261,7 @@
{
$skip_id = -1;
}
- $retval="\n".'<SELECT NAME="parent">'."\n";
+ $retval="\n".'<SELECT NAME="inputparent">'."\n";
foreach($option_list as $option)
{
if ($option['value']!=$skip_id)
@@ -356,25 +279,27 @@
return $retval;
}
- function _deleteCategory()
+ function delete()
{
if (!$this->isadmin)
{
- $this->_manageCategories();
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
return;
}
-
$GLOBALS['Common_BO']->globalize(array('cat_id','btnDelete','btnCancel'));
- global $cat_id,$btnDelete,$btnCancel;
+
$GLOBALS['Common_BO']->globalize(array('btnDelete','btnCancel'));
+ global $btnDelete,$btnCancel;
+ $cat_id = $_GET['cat_id'];
+
if ($btnDelete)
{
$this->cat_bo->removeCategory($cat_id);
- $this->_manageCategories();
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
return;
}
if ($btnCancel)
{
- $this->_manageCategories();
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
return;
}
@@ -387,8 +312,6 @@
$this->t->set_var('lang_yes',lang('Yes, please delete
it'));
$this->t->set_var('lang_no',lang('Cancel the delete'));
$this->t->pfp('out','ConfirmDelete');
-
- $this->common_ui->DisplayFooter();
}
}
?>
====================================================
Index: sitemgr/inc/class.Categories_BO.inc.php
diff -u sitemgr/inc/class.Categories_BO.inc.php:1.6
sitemgr/inc/class.Categories_BO.inc.php:1.6.2.2.4.1
--- sitemgr/inc/class.Categories_BO.inc.php:1.6 Fri Jan 17 03:37:52 2003
+++ sitemgr/inc/class.Categories_BO.inc.php Sat Nov 12 13:15:37 2005
@@ -2,123 +2,133 @@
class Categories_BO
{
var $so;
-
+ var $currentcats;
+
function Categories_BO()
{
//all sitemgr BOs should be instantiated via a
globalized Common_BO object,
$this->so = CreateObject('sitemgr.Categories_SO', True);
}
+ //since we need this information several times we store it once,
+ //this function is called by Sites_BO after the current site is
defined
+ function setcurrentcats()
+ {
+ $this->currentcats =
$this->getpermittedcats(CURRENT_SITE_ID,'active',True);
+ $this->readablecats = $this->getpermittedcatsRead();
+ }
+
function getCategoryOptionList()
{
$retval[] = array('value'=>0,'display'=>'[No Parent]');
- $list = $this->getPermittedCatWriteNested();
+ $list = $this->getpermittedcatsWrite();
foreach($list as $cat_id)
{
$cat = $this->getCategory($cat_id);
- $padding = str_pad('',12*$cat->depth,' ');
+ $padding =
str_pad('',12*($cat->depth-1),' ');
$retval[] = array('value'=>$cat->id,
'display'=>$padding.$cat->name);
}
return $retval;
}
- function getPermittedCatReadNested($cat_id=0)
+ function getpermittedcatsRead($cat_id=False,$recurse=true)
{
- return $this->getPermittedCatNested($cat_id,'read');
+ if (!$cat_id)
+ {
+ $cat_id = CURRENT_SITE_ID;
+ }
+ if ($cat_id != CURRENT_SITE_ID)
+ {
+ $this->check($cat_id);
+ }
+ return $this->getpermittedcats($cat_id,'read',$recurse);
}
- function getPermittedCatWriteNested($cat_id=0)
+ function getpermittedcatsWrite($cat_id=False,$recurse=true)
{
- return $this->getPermittedCatNested($cat_id,'write');
+ if (!$cat_id)
+ {
+ $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);
}
- // Don't call this function directly. Use above funcs.
- function getPermittedCatNested($cat_id=0,$check='')
+ function getpermittedcatsArchived()
{
- if (!$check)
- {
- // You should use the getPermittedCatReadNested
and WriteNested funcs
- die("Whatcha doin callin this function,
Willis?");
- }
+ return
$this->getpermittedcats(CURRENT_SITE_ID,'archived',true);
+ }
+ function getpermittedcats($cat_id,$check,$recurse)
+ {
$root_list = $this->so->getChildrenIDList($cat_id);
$permitted_list=array();
- if (is_array($root_list))
+ while(list(,$root_cat) = @each($root_list))
{
- foreach($root_list as $root_cat)
+ switch ($check)
{
- 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("What'd I tell you about
calling this function?");
- }
-
- 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);
- }
+ 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));
}
- }
-//print_r($permitted_list);
- return $permitted_list;
- }
-
- //the next two functions do not recurse!
- function getPermittedCategoryIDWriteList($cat_id=0)
- {
- $full_list = $this->so->getChildrenIDList($cat_id);
- $permitted_list=array();
- if (is_array($full_list))
- {
- foreach($full_list as $item)
+ 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')
{
- if
($GLOBALS['Common_BO']->acl->can_write_category($item))
+ continue;
+ }
+ if ($recurse)
+ {
+ $sub_list =
$this->getpermittedcats($root_cat,$check,true);
+ if (count($sub_list)>0)
{
- $permitted_list[]=$item;
+ //array_push($permitted_list,
$sub_list);
+
$permitted_list=array_merge($permitted_list, $sub_list);
}
}
}
return $permitted_list;
}
- function getPermittedCategoryIDReadList($cat_id=0)
+ function addCategory($name, $description, $parent=False)
{
- $full_list = $this->so->getChildrenIDList($cat_id);
-
- $permitted_list=array();
- if (is_array($full_list))
+ if (!$parent)
{
- reset($full_list);
- foreach($full_list as $item)
- {
- if
($GLOBALS['Common_BO']->acl->can_read_category($item))
- {
- $permitted_list[]=$item;
- }
- }
+ $parent = CURRENT_SITE_ID;
}
- return $permitted_list;
- }
- function addCategory($name, $description, $parent=0)
- {
if ($GLOBALS['Common_BO']->acl->is_admin())
{
- return $this->so->addCategory($name,
$description, $parent);
+ $cat_id = $this->so->addCategory($name,
$description, $parent);
+ $this->currentcats[] = $cat_id;
+ return $cat_id;
}
else
{
@@ -126,70 +136,85 @@
}
}
- function removeCategory($cat_id)
+ //$force for use by Sites_BO, since when we are editing the
files list, the concept of admin of a current site does not apply
+ //$frecurse also removes subcats
+ function removeCategory($cat_id,$force=False,$recurse=False)
{
- if ($GLOBALS['Common_BO']->acl->is_admin())
+ if (!$force)
{
- /********************************************\
- * 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);
-
$GLOBALS['Common_BO']->content->removeBlocksInPageOrCat($cat_id,0);
- return True;
+ $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, $parent=0, $old_parent=0)
+ function saveCategoryInfo($cat_id, $cat_name, $cat_description,
$lang, $sort_order, $state, $parent=False, $old_parent=False, $def_page = 0)
{
+ if (!$parent)
+ {
+ $parent = CURRENT_SITE_ID;
+ }
$cat_info = CreateObject('sitemgr.Category_SO', True);
$cat_info->id = $cat_id;
$cat_info->name = $cat_name;
$cat_info->description = $cat_description;
$cat_info->sort_order = $sort_order;
+ $cat_info->state = $state;
$cat_info->parent = $parent;
- if ($old_parent!='')
- {
- $cat_info->old_parent = $old_parent;
- }
- else
- {
- $cat_info->old_parent = $parent;
- }
+ $cat_info->old_parent = $old_parent ? $old_parent :
$parent;
+ $cat_info->def_page = $def_page;
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;
+ if ($this->so->saveCategory($cat_info));
+ {
+ if
($this->so->saveCategoryLang($cat_id, $cat_name, $cat_description, $lang))
+ {
+ //reflect changes
+ $this->setcurrentcats();
+ 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;
- }
+ {
+ if ($this->so->saveCategoryLang($cat_id, $cat_name,
$cat_description, $lang))
+ {
+ return true;
+ }
+ return false;
+ }
- function getCategory($cat_id,$lang=False)
+ //$force is for bypassing ACL when we called from Sites_UI for
building up the info for the currentsite
+ //and for getting at archived categories that are not listed in
current nor readablecats
+ function getCategory($cat_id,$lang=False,$force=False)
{
- if
($GLOBALS['Common_BO']->acl->can_read_category($cat_id))
+ if ($force || ($this->check($cat_id) &&
in_array($cat_id,$this->readablecats)))
{
return $this->so->getCategory($cat_id,$lang);
}
@@ -201,10 +226,18 @@
function getCategoryancestorids($cat_id,$permittedonly=False)
{
+ if (!$cat_id)
+ {
+ $cat_id = CURRENT_SITE_ID;
+ }
+ if ($cat_id != CURRENT_SITE_ID)
+ {
+ $this->check($cat_id);
+ }
$result = array();
- while ($cat_id != 0)
+ while ($cat_id != CURRENT_SITE_ID)
{
- if (!$permittedonly ||
$GLOBALS['Common_BO']->acl->can_read_category($cat_id))
+ if (!$permittedonly ||
in_array($cat_id,$this->readablecats))
{
$result[] = $cat_id;
}
@@ -215,9 +248,9 @@
}
function getlangarrayforcategory($cat_id)
- {
- return $this->so->getlangarrayforcategory($cat_id);
- }
+ {
+ return $this->so->getlangarrayforcategory($cat_id);
+ }
function saveCategoryPerms($cat_id, $group_access, $user_access)
{
@@ -259,6 +292,8 @@
$can_read = true;
break;
case 'write':
+ //write
access implies read access, otherwise editing blocks would not work
+
$can_read = true;
$can_write = true;
break;
default:
@@ -287,7 +322,7 @@
function applyCategoryPermstosubs($cat_id)
{
- $sublist = $this->getPermittedCatWriteNested($cat_id);
+ $sublist = $this->getpermittedcatsWrite($cat_id);
while (list(,$sub) = @each($sublist))
{
@@ -303,6 +338,38 @@
function migratealllang($oldlang,$newlang)
{
$this->so->migratealllang($oldlang,$newlang);
+ }
+
+ //make sure cat_id belongs to current site
+ function check($cat_id)
+ {
+ if (in_array($cat_id,$this->currentcats))
+ {
+ return True;
+ }
+ 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: sitemgr/inc/class.Category_SO.inc.php
diff -u sitemgr/inc/class.Category_SO.inc.php:1.4
sitemgr/inc/class.Category_SO.inc.php:1.4.10.1
--- sitemgr/inc/class.Category_SO.inc.php:1.4 Thu Sep 5 09:06:03 2002
+++ sitemgr/inc/class.Category_SO.inc.php Sat Nov 12 13:15:37 2005
@@ -8,6 +8,7 @@
var $parent;
var $depth;
var $root;
+ var $def_page;
function Category_SO()
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sitemgr/inc class.Pages_BO.inc.php, 1.5.2.3.4.1 class.Categories_SO.inc.php, 1.13.2.5.4.1 class.Categories_UI.inc.php, 1.1.2.1.4.1 class.Categories_BO.inc.php, 1.6.2.2.4.1 class.Category_SO.inc.php, 1.4.10.1,
skwashd <=