phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: sitemgr/inc class.Categories_BO.inc.php,1.10,1.1


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/inc class.Categories_BO.inc.php,1.10,1.11 class.Categories_UI.inc.php,1.6,1.7 class.Common_UI.inc.php,1.14,1.15 class.Pages_UI.inc.php,1.4,1.5
Date: Fri, 30 May 2003 14:49:15 -0400

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

Modified Files:
        class.Categories_BO.inc.php class.Categories_UI.inc.php 
        class.Common_UI.inc.php class.Pages_UI.inc.php 
Log Message:
merge page manager and category manager in one common interface


Index: class.Categories_BO.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_BO.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** class.Categories_BO.inc.php 30 May 2003 04:01:42 -0000      1.10
--- class.Categories_BO.inc.php 30 May 2003 18:49:13 -0000      1.11
***************
*** 25,29 ****
                        {
                                $cat = $this->getCategory($cat_id);
!                               $padding = str_pad('',12*$cat->depth,'&nbsp;');
                                $retval[] = array('value'=>$cat->id, 
'display'=>$padding.$cat->name);
                        }
--- 25,29 ----
                        {
                                $cat = $this->getCategory($cat_id);
!                               $padding = 
str_pad('',12*($cat->depth-1),'&nbsp;');
                                $retval[] = array('value'=>$cat->id, 
'display'=>$padding.$cat->name);
                        }

Index: class.Categories_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Categories_UI.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.Categories_UI.inc.php 30 May 2003 04:01:43 -0000      1.6
--- class.Categories_UI.inc.php 30 May 2003 18:49:13 -0000      1.7
***************
*** 21,25 ****
                var $public_functions = array
                (
-                       'manage' => True,
                        'edit' => True,
                        'delete' => True
--- 21,24 ----
***************
*** 37,125 ****
                }
  
-               function manage()
-               {
-                       $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');
- 
-                       $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 = '-';
-                                       }
-                                       else
-                                       {
-                                               $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));
- 
- 
-                                       $link_data['page_id'] = 0;
-                                       $link_data['cat_id'] = $cat_id;
-                                       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);
-                               }
-                       }
-                       else
-                       {
-                               $this->t->set_var('category','No category is 
available');
-                       }
- 
-                       if ($this->isadmin)
-                       {
-                               $this->t->set_var('add', 
-                                       '<form action="'.
-                                       $GLOBALS['phpgw']->link('/index.php',
-                                       
'menuaction=sitemgr.Categories_UI.edit').
-                                       '" 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.manage')
-                       );
-                       $this->t->pfp('out', 'ManageCategories');       
- 
-                       $this->common_ui->DisplayFooter();
-               }
- 
                function edit()
                {
                        if (!$this->isadmin)
                        {
!                               $this->manage();
                                return False;
                        }
--- 36,44 ----
                }
  
                function edit()
                {
                        if (!$this->isadmin)
                        {
!                               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
                                return False;
                        }
***************
*** 138,161 ****
                        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)
                                {
!                                       
$this->cat_bo->saveCategoryPermsfromparent($cat_id);
                                }
                                else
                                {
!                                       
$this->cat_bo->saveCategoryPerms($cat_id, $groupaccess, $individualaccess);
!                               }
!                               if ($inputapplypermissionstosubs)
!                               {
!                                       
$this->cat_bo->applyCategoryPermstosubs($cat_id);
                                }
-                               $this->manage();
-                               return;
                        }
  
--- 57,87 ----
                        if ($btnSave && $inputcatname && $inputcatdesc)
                        {
!                               if ($inputcatname == '' || $inputcatdesc == '')
                                {
!                                       $error = lang('You failed to fill in 
one or more required fields.');
!                                       $this->t->set_var('message',$error);
                                }
                                else
                                {
!                                       $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)
!                                       {
!                                               
$this->cat_bo->saveCategoryPermsfromparent($cat_id);
!                                       }
!                                       else
!                                       {
!                                               
$this->cat_bo->saveCategoryPerms($cat_id, $groupaccess, $individualaccess);
!                                       }
!                                       if ($inputapplypermissionstosubs)
!                                       {
!                                               
$this->cat_bo->applyCategoryPermstosubs($cat_id);
!                                       }
!                                       
$this->t->set_var('message',lang('Category saved'));
                                }
                        }
  
***************
*** 167,178 ****
                        }
  
-                       //if the user tried to save, but catname or catdesc 
were empty, we remember the modified values
-                       if ($btnSave)
-                       {
-                               $this->t->set_var('error_msg',lang('You failed 
to fill in one or more required fields.'));
-                               $cat->name = $inputcatname;
-                               $cat->description = $inputcatdesc;
-                       }
- 
                        $this->t->set_file('EditCategory', 'edit_category.tpl');
                        $this->t->set_block('EditCategory','GroupBlock', 
'GBlock');
--- 93,96 ----
***************
*** 213,218 ****
                                '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?')
                        ));
                
--- 131,138 ----
                                'lang_save' => lang('Save'),
                                'lang_state' => lang('State'),
+                               'lang_goback' => 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?'),
!                               'goback' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'),
                        ));
                
***************
*** 347,351 ****
                        if (!$this->isadmin)
                        {
!                               $this->manage();
                                return;
                        }
--- 267,271 ----
                        if (!$this->isadmin)
                        {
!                               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
                                return;
                        }
***************
*** 358,367 ****
                        {
                                $this->cat_bo->removeCategory($cat_id);
!                               $this->manage();
                                return;
                        }
                        if ($btnCancel)
                        {
!                               $this->manage();
                                return;
                        }
--- 278,287 ----
                        {
                                $this->cat_bo->removeCategory($cat_id);
!                               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
                                return;
                        }
                        if ($btnCancel)
                        {
!                               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
                                return;
                        }

Index: class.Common_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Common_UI.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.Common_UI.inc.php     30 May 2003 04:01:43 -0000      1.14
--- class.Common_UI.inc.php     30 May 2003 18:49:13 -0000      1.15
***************
*** 46,59 ****
                                $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(
--- 46,55 ----
                                $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(

Index: class.Pages_UI.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/inc/class.Pages_UI.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.Pages_UI.inc.php      30 May 2003 04:01:43 -0000      1.4
--- class.Pages_UI.inc.php      30 May 2003 18:49:13 -0000      1.5
***************
*** 21,25 ****
                var $public_functions=array
                (
-                       'manage' => True,
                        'edit' => True,
                        'delete' => True
--- 21,24 ----
***************
*** 39,43 ****
                        $page_id = $_GET['page_id'];
                        $this->pagebo->removePage($page_id);
!                       $this->manage();
                        return;
                }
--- 38,42 ----
                        $page_id = $_GET['page_id'];
                        $this->pagebo->removePage($page_id);
!                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
                        return;
                }
***************
*** 54,60 ****
                        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)
--- 53,59 ----
                        global $savelanguage;
                        $page_id = $inputpageid ? $inputpageid : 
$_GET['page_id'];
!                       $category_id = $inputcategoryid ? $inputcategoryid : 
$_GET['cat_id'];
  
!                       $this->t->set_file('EditPage', 'edit_page.tpl');
  
                        if($btnSave)
***************
*** 63,79 ****
                                {
                                        $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;
--- 62,76 ----
                                {
                                        $error = lang('You failed to fill in 
one or more required fields.');
+                                       $this->t->set_var('message',$error);
                                }
!                               elseif(!$page_id)
                                {               
                                        $page_id = 
$this->pagebo->addPage($inputcategoryid);
                                        if(!$page_id)
                                        {
! //                                            echo lang("You don't have 
permission to write in the category");
!                                               
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'));
                                                return;
                                        }
                                        $page->id = $page_id;
                                        $page->title = $inputtitle;
***************
*** 88,99 ****
                                        if (!is_string($save_msg))
                                        {
!                                               $this->manage();
!                                               return;
                                        }
-                                       $this->t->set_var('message',$save_msg);
-                               }
-                               else
-                               {
-                                       $this->t->set_var('message',$error);
                                }
                        }
--- 85,94 ----
                                        if (!is_string($save_msg))
                                        {
!                                               
$this->t->set_var('message',lang('Page saved'));
!                                       }
!                                       else
!                                       {
!                                               
$this->t->set_var('message',$save_msg);
                                        }
                                }
                        }
***************
*** 104,115 ****
                        {
                                $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);
                        }
  
--- 99,113 ----
                        {
                                $page = 
$this->pagebo->getPage($page_id,$this->sitelanguages[0]);
!                               $this->t->set_var(array(
!                                       'add_edit' => lang('Edit Page'),
!                                       'catselect' => 
$this->getParentOptions($page->cat_id)
!                       ));
                        }
                        else
                        {
!                               $this->t->set_var(array(
!                                       'add_edit' => lang('Add Page'),
!                                       'catselect' => 
$this->getParentOptions($category_id)
!                               ));
                        }
  
***************
*** 145,223 ****
                                'lang_subtitle' => lang('Subtitle'),
                                'lang_sort' => lang('Sort order'),
!                               'lang_move' => lang('Move to'),
                                'lang_hide' => lang('Check to hide from 
condensed site index.'),
                                'lang_required' => lang('Required Fields'),
!                               '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();
                }
--- 143,157 ----
                                'lang_subtitle' => lang('Subtitle'),
                                'lang_sort' => lang('Sort order'),
!                               'lang_category' => lang('Category'),
                                'lang_hide' => lang('Check to hide from 
condensed site index.'),
                                'lang_required' => lang('Required Fields'),
!                               'lang_goback' => lang('Done'),
                                'lang_reset' => lang('Reset'),
                                'lang_save' => lang('Save'),
                                'lang_state' => lang('State'),
!                               'goback' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=sitemgr.Outline_UI.manage'),
                        ));
                        
                        $this->t->pfp('out','EditPage');
                        $this->common_ui->DisplayFooter();
                }





reply via email to

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