phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpbrain/inc class.bokb.inc.php,1.3,1.4 class.so


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpbrain/inc class.bokb.inc.php,1.3,1.4 class.sokb.inc.php,1.3,1.4 class.uikb.inc.php,1.4,1.5 hook_admin.inc.php,1.1.1.1,1.2
Date: Sun, 16 Mar 2003 23:30:44 -0500

Update of /cvsroot/phpgroupware/phpbrain/inc
In directory subversions:/tmp/cvs-serv21569/inc

Modified Files:
        class.bokb.inc.php class.sokb.inc.php class.uikb.inc.php 
        hook_admin.inc.php 
Log Message:
Admin functions should now work

Index: class.bokb.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpbrain/inc/class.bokb.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.bokb.inc.php  17 Mar 2003 02:30:31 -0000      1.3
--- class.bokb.inc.php  17 Mar 2003 04:30:38 -0000      1.4
***************
*** 197,204 ****
                }//end set active answer
                
                function set_question($question)
                {
                        return $this->so->set_question($question, 
$this->is_admin());
!               }
                
                function set_rating($faq_id, $rating)
--- 197,209 ----
                }//end set active answer
                
+               function set_active_question($question_ids)
+               {
+                       return $this->so->set_active_question($question_ids);
+               }//end set active question
+ 
                function set_question($question)
                {
                        return $this->so->set_question($question, 
$this->is_admin());
!               }//end set question
                
                function set_rating($faq_id, $rating)

Index: class.sokb.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpbrain/inc/class.sokb.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.sokb.inc.php  17 Mar 2003 03:11:54 -0000      1.3
--- class.sokb.inc.php  17 Mar 2003 04:30:38 -0000      1.4
***************
*** 25,36 ****
                function delete_answer($faq_ids)
                {
!                       $i=0;
!                       foreach($faq_ids as $key => $val)
                        {
!                               $this->db->query("DELETE FROM phpgw_kb_faq 
WHERE faq_id = $key");
!                               $i++;
                        }
                        return $i;
!               }//end set_active_answer
  
                function delete_question($question_ids)
--- 25,44 ----
                function delete_answer($faq_ids)
                {
!                       if(is_array($faq_ids))
                        {
!                               $i=0;
!                       foreach($faq_ids as $key => $val)
!                       {
!                               $this->db->query("DELETE FROM phpgw_kb_faq 
WHERE faq_id = $key");
!                               $i++;
!                       }//end foreach(q_id)
                        }
+                       elseif(is_int($faq_ids))
+                       {
+                               $this->db->query("DELETE FROM phpgw_kb_faq 
WHERE faq_id = $faq_ids");
+                               $i = 1;
+                       }//end is_type
                        return $i;
!               }//end delete_answer
  
                function delete_question($question_ids)
***************
*** 51,55 ****
                        }//end is_type
                        return $i;
!               }//end set_active_answer
  
                function get_stats()
--- 59,63 ----
                        }//end is_type
                        return $i;
!               }//end delete question
  
                function get_stats()
***************
*** 254,257 ****
--- 262,277 ----
                        return $i;
                }//end set_active_answer
+ 
+               function set_active_question($question_ids)
+               {
+                       $i=0;
+                       foreach($question_ids as $key => $val)
+                       {
+                               $this->db->query("UPDATE phpgw_kb_questions SET 
pending = 0 WHERE question_id = $key", __LINE__, __FILE__);
+                               $i++;
+                       }
+                       return $i;
+               }//end set_active_question
+ 
                
                //generic 

Index: class.uikb.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpbrain/inc/class.uikb.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.uikb.inc.php  17 Mar 2003 03:11:54 -0000      1.4
--- class.uikb.inc.php  17 Mar 2003 04:30:38 -0000      1.5
***************
*** 346,350 ****
                                foreach($faqs as $key => $vals)
                                {
!                                       $this->t->set_var(array('faq_id'        
=> $key,
                                                                                
        'text'          => $vals['text'],
                                                                                
                'row_bg'        => (($row%2) ? $this->theme['row_on'] : 
$this->theme['row_off']),
--- 346,350 ----
                                foreach($faqs as $key => $vals)
                                {
!                                       $this->t->set_var(array('id'            
=> "faq_id[$key]",
                                                                                
        'text'          => $vals['text'],
                                                                                
                'row_bg'        => (($row%2) ? $this->theme['row_on'] : 
$this->theme['row_off']),
***************
*** 375,378 ****
--- 375,435 ----
                }//end maint answers
                
+               function maint_question()
+               {
+                       if(!$this->bo->is_admin())
+                       {
+                               header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php', 'menuaction=phpbrain.uikb.index'));
+                               $GLOBALS['phpgw']->common->exit();
+                       }
+                       else//must be admin
+                       {
+                               $msg = '';
+                               if($_POST['activate'] && 
(count($_POST['question_id']) != 0))
+                               {
+                                       $msg = lang('%1 questions_activated', 
$this->bo->set_active_question($_POST['question_id']));
+                               }
+                               if($_POST['delete'] && 
(count($_POST['question_id']) != 0))
+                               {
+                                       $msg = lang('%1 questions_deleted', 
$this->bo->delete_answer($_POST['question_id']));
+                               }
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       echo parse_navbar();
+                       $this->t->set_file('admin_maint', 'admin_maint.tpl');
+                       $this->t->set_block('admin_maint', 'pending_list', 
'pending_items');
+                       $this->t->set_block('admin_maint', 'pending_block', 
'p_block');
+                       $this->t->set_var('admin_url', 
$GLOBALS['phpgw']->link('/admin/index.php'));
+                       $this->t->set_var('lang_return_to_admin', 
lang('return_to_admin'));
+                               $this->t->set_var('msg', ((strlen($msg) !=0) ? 
$msg : '&nbsp;'));
+ 
+                               $questions = $this->bo->get_questions(true);    
                        
+                       if(is_array($questions))
+                       {
+                               foreach($questions as $key => $val)
+                               {
+                                       $this->t->set_var(array('id'            
=> "question_id[$key]",
+                                                                               
        'text'          => $val,
+                                                                               
                'row_bg'        => (($row%2) ? $this->theme['row_on'] : 
$this->theme['row_off']),
+                                                                               
        )
+                                                                       );
+                                       $this->t->parse('pending_items', 
'pending_list', true);
+                                       $row++;
+                               }//end foreach(pending)
+                                       $lang = array('lang_explain_function'   
=> lang('explain_questions_admin'),
+                                                               
'lang_admin_section'            => lang('section_maintain_questions'),
+                                                               'lang_enable'   
                        => lang('enable'),
+                                                               'lang_delete'   
                        => lang('delete'),
+                                                               'form_action'   
                        => $GLOBALS['phpgw']->link('/index.php', 
'menuaction=phpbrain.uikb.maint_question')
+                                                               );
+                                       $this->t->set_var($lang);
+                               $this->t->parse('p_block', 'pending_block');
+                       }
+                       else//no pending faqs
+                       {
+                               $this->t->set_var('p_block', 
lang('none_pending'));
+                       }//end if is_array(open)
+                       $this->t->pfp('out', 'admin_maint');
+                       }//end is admin
+               }//end maint question
+ 
                function preview()
                {

Index: hook_admin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpbrain/inc/hook_admin.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** hook_admin.inc.php  16 Mar 2003 15:25:18 -0000      1.1.1.1
--- hook_admin.inc.php  17 Mar 2003 04:30:38 -0000      1.2
***************
*** 20,25 ****
                        'Global Categories' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname='
 . $appname),
                        'Maintain Answers' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=phpbrain.uikb.maint_answer'),
! //                    'Maintain Questions' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=phpbrain.uikb.maint_question'),
!                       'Reports - yet to be implemented' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=phpbrain.uikb.index')
                );
  
--- 20,25 ----
                        'Global Categories' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname='
 . $appname),
                        'Maintain Answers' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=phpbrain.uikb.maint_answer'),
!                       'Maintain Questions' => 
$GLOBALS['phpgw']->link('/index.php','menuaction=phpbrain.uikb.maint_question'),
!                       'Reports - Not implemented' => '' 
//$GLOBALS['phpgw']->link('/index.php','menuaction=phpbrain.uikb.index')
                );
  





reply via email to

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