[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpbrain ./index.php inc/class.bokb.inc.php inc...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpbrain ./index.php inc/class.bokb.inc.php inc... |
Date: |
Tue, 09 May 2006 05:14:07 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: phpbrain
Branch:
Changes by: Dave Hall <address@hidden> 06/05/09 05:14:07
Modified files:
. : index.php
inc : class.bokb.inc.php class.sokb.inc.php
class.uikb.inc.php hook_admin.inc.php
hook_config.inc.php hook_manual.inc.php
setup : phpgw_de.lang phpgw_en.lang phpgw_fr.lang
phpgw_sv.lang setup.inc.php
tables_baseline.inc.php tables_current.inc.php
templates/idots/images: navbar.png
Log message:
new version of phpbrain with the correct headers, not that different to
the current 16 version - sourced from ego, considered legit as the dumb fuck
dev unlawfully editted the headers
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/index.php.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/inc/class.bokb.inc.php.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/inc/class.sokb.inc.php.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/inc/class.uikb.inc.php.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/inc/hook_admin.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/inc/hook_config.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/inc/hook_manual.inc.php.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/setup/phpgw_de.lang.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/setup/phpgw_en.lang.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/setup/phpgw_fr.lang.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/setup/phpgw_sv.lang.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/setup/setup.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/setup/tables_baseline.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/setup/tables_current.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/phpbrain/templates/idots/images/navbar.png.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: phpbrain/inc/class.bokb.inc.php
diff -u phpbrain/inc/class.bokb.inc.php:1.18
phpbrain/inc/class.bokb.inc.php:1.19
--- phpbrain/inc/class.bokb.inc.php:1.18 Sun May 15 12:43:37 2005
+++ phpbrain/inc/class.bokb.inc.php Tue May 9 05:14:07 2006
@@ -1,294 +1,1310 @@
<?php
- /**********************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org *
- * This program is part of the GNU project, see http://www.gnu.org/ *
- * *
- * Copyright 2003 Free Software Foundation, Inc. *
- * *
- * Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
- * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * at your option) any later version. *
- \**********************************************************************/
- /* $Id: class.bokb.inc.php,v 1.18 2005/05/15 12:43:37 skwashd Exp $ */
+/**************************************************************************\
+* phpGroupWare - KnowledgeBase *
+* http://www.phpgroupware.org *
+* *
+* Copyright (c) 2003-2006 Free Sofware Foundation Inc *
+* Written by Dave Hall skwashd at phpgropware.org *
+* Written by Alejandro Pedraza <address@hidden> *
+* Headers unlawfuly removed by Alejandro Pedraza *
+* ------------------------------------------------------------------------ *
+* Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/ *
+* but quickly became a full rewrite
*
+* ------------------------------------------------------------------------ *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 2 of the License, or (at your *
+* option) any later version. *
+\**************************************************************************/
+ /* $Id: class.bokb.inc.php,v 1.19 2006/05/09 05:14:07 skwashd Exp $ */
+
+ /**
+ * Business logic layer of the Knowledge Base
+ *
+ * Last Editor: $Author: skwashd $
+ * @author Dave Hall & Alejandro Pedraza
+ * @package phpbrain
+ * @version $Revision: 1.19 $
+ * @license GPL
+ **/
class bokb
{
- var $cats;
- var $rated;
+ /**
+ * Data manipulation object
+ *
+ * @access private
+ * @var object so
+ */
var $so;
- var $viewed;
-
- function bokb()
- {
- $this->cats = createObject('phpgwapi.categories');
- $this->rated =
$GLOBALS['phpgw']->session->appsession('rated','phpbrain');
- $this->so = createObject('phpbrain.sokb');
- $this->viewed =
$GLOBALS['phpgw']->session->appsession('viewed','phpbrain');
-
$GLOBALS['phpgw_info']['apps']['phpkb']['config'] = $this->get_config();
- }
-
- function get_cat_data($cat_id)
+
+ /**
+ * Categories object
+ *
+ * @access public
+ * @var object categories
+ */
+ var $categories_obj;
+
+ /**
+ * Array of all categories accesible by the current user
+ *
+ * @access public
+ * @var array
+ */
+ var $all_categories;
+
+ /**
+ * Variable holding categories to show
+ *
+ * @access public
+ * @var array
+ */
+ var $categories;
+
+ /**
+ * Array of current user's grants on other users or groups
+ *
+ * @access public
+ * @var array
+ */
+ var $grants;
+
+ /**
+ * Preferences for this application
+ *
+ * @access public
+ * @var array
+ */
+ var $preferences;
+
+ /**
+ * For pagination
+ *
+ * @access public
+ * @var int
+ */
+ var $start;
+
+ /**
+ * Sorting order
+ *
+ * @access public
+ * @var string ASC | DESC
+ */
+ var $sort;
+
+ /**
+ * Sorting field
+ *
+ * @access public
+ * @var string
+ */
+ var $order;
+
+ /**
+ * Administration options for this app
+ *
+ * @access public
+ * @var array
+ */
+ var $admin_config;
+
+ /**
+ * Number of entries returned by a query
+ *
+ * @access public
+ * @var int
+ */
+ var $num_rows;
+
+ /**
+ * Number of questions returned by a query
+ *
+ * @access public
+ * @var int
+ */
+ var $num_questions;
+
+ /**
+ * Number of comments returned by a query
+ *
+ * @access public
+ * @var int
+ */
+ var $num_comments;
+
+ /**
+ * Error messages produced by methods
+ *
+ * @access public
+ * @var string
+ */
+ var $error_msg;
+
+ /**
+ * Filter by publication status
+ *
+ * @access public
+ * @var string
+ */
+ var $publish_filter;
+
+ /**
+ * Search string
+ *
+ * @access public
+ * @var string
+ */
+ var $query;
+
+ /**
+ * Current article owner's id
+ *
+ * @access public
+ * @var int
+ */
+ var $article_owner;
+
+ /**
+ * Current article id
+ *
+ * @access public
+ * @var int
+ */
+ var $article_id;
+
+ /**
+ * Success or error messages returned by methods
+ *
+ * @access public
+ * @var array
+ */
+ var $messages_array = array(
+ 'no_perm' => 'You have
not the proper permissions to do that',
+ 'add_ok_cont' => 'Article added to
database, you can now attach files or links, or relate to other articles',
+ 'comm_submited' => 'Comment has been
submited for revision',
+ 'comm_ok' => 'Comment has
been published',
+ 'rate_ok' => 'Rating has
been submited',
+ 'comm_rate_ok' => 'Comment and rating
have been published',
+ 'comm_rate_submited' => 'Comment has been submited
for revision and rating will be published',
+ 'no_basedir' => 'Base directory does
not exist, please ask adminstrator to check the global configuration',
+ 'no_kbdir' => '/kb
directory does not exist and could not be created, please ask adminstrator to
check the global configuration',
+ 'overwrite' => 'That file
already exists',
+ 'no_file_serv' => 'The file was
already missing in the server',
+ 'failure_delete' => 'Failure trying to
delete the file',
+ 'file_del_ok' => 'File was deleted
successfully',
+ 'file_db_del_err' => 'File could be
deleted from server but not from database',
+ 'file_noserv_db_ok' => "File was already
missing from server, and was deleted from the database",
+ 'file_noserv_db_err' => "File wasn't in server and
it couldn't be deleted from the database",
+ 'del_rel_ok' => 'Relation with
article was removed successfully',
+ 'link_del_err' => 'Error deleting
link',
+ 'link_del_ok' => 'Link deleted
successfully',
+ 'error_cd' => 'Error
locating files directory',
+ 'nothing_uploaded' => 'Nothing was
uploaded!',
+ 'error_cp' => 'Error
moving file to directory',
+ 'upload_ok' => 'File has
been successfully uploaded',
+ 'articles_added' => 'Articles added',
+ 'articles_not_added' => 'Problem relating articles',
+ 'link_ok' => 'Link has
been added',
+ 'link_prob' => 'Link could
not be added',
+ 'err_del_art' => 'Error deleting
article from database',
+ 'err_del_q' => 'Error
trying to delete question',
+ 'del_art_ok' => 'Article deleted
successfully',
+ 'del_arts_ok' => 'Articles deleted
successfully',
+ 'del_q_ok' => 'Question
deleted successfully',
+ 'del_qs_ok' => 'Questions
deleted successfully',
+ 'del_comm_err' => 'Error trying to
delete comment',
+ 'del_comm_ok' => 'Comment has been
deleted',
+ 'edit_err' => 'Error
trying to edit article',
+ 'publish_err' => 'Error trying to
publish article',
+ 'publish_comm_err' => 'Error publishing
comment',
+ 'publish_ok' => 'Article has been
published',
+ 'publish_comm_ok' => 'Comment has been
pusblished',
+ 'publishs_ok' => 'Articles have been
published',
+ 'mail_ok' => 'e-mail has
been sent',
+ 'mail_err' => 'Error in
e-mail address'
+ );
+
+
+ /**
+ * Class constructor
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ **/
+ function bokb()
{
- if($cat_id)
+ // version check
+ if
($GLOBALS['phpgw_info']['apps']['phpbrain']['version'] != '0.9.17.505')
{
- $level = 'subs';
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ die("Please upgrade this application to be able
to use it");
+ }
+
+ $this->so
= CreateObject('phpbrain.sokb');
+ $this->categories_obj =
CreateObject('phpgwapi.categories', '', 'phpbrain'); // force phpbrain cause
it might be running from sitemgr...
+ $GLOBALS['phpgw']->config =
CreateObject('phpgwapi.config');
+ $GLOBALS['phpgw']->vfs =
CreateObject('phpgwapi.vfs');
+ $GLOBALS['phpgw']->historylog =
CreateObject('phpgwapi.historylog','phpbrain');
+
+ $this->grants =
$GLOBALS['phpgw']->acl->get_grants('phpbrain');
+ //echo "grants: <pre>";print_r($this->grants);echo
"</pre>";
+ // full grants for admin on user 0 (anonymous questions
on previous phpbrain version)
+ if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
$this->grants[0] = -1;
+ $this->preferences =
$GLOBALS['phpgw']->preferences->data['phpbrain'];
+
+ $this->read_right =
PHPGW_ACL_READ;
+ $this->edit_right =
PHPGW_ACL_EDIT;
+ $this->publish_right = PHPGW_ACL_CUSTOM_1;
+
+ // acl grants puts all rights (-1) on current the user
itself. That has to be modified here since the user doesn't have necessarily
publish rights
+ // Here I have to accumulate the rights the user has on
every group it belongs to
+ $grants_user = $this->read_right | $this->edit_right;
// The user can always read and edit his own articles
+ $user_groups =
$GLOBALS['phpgw']->accounts->membership($GLOBALS['phpgw_info']['user']['account_id']);
+ foreach ($user_groups as $group)
+ {
+ $grants_user |=
$this->grants[$group['account_id']];
+ //echo "for the group: ";echo
$group['account_id'];echo " the right: ";echo
$this->grants[$group['account_id']];echo "<br>";
+ }
+ //echo "grants_user: $grants_user<br>";
+
$this->grants[$GLOBALS['phpgw_info']['user']['account_id']] = $grants_user;
+
+ $this->admin_config =
$GLOBALS['phpgw']->config->read_repository();
+
+ if (!$this->all_categories =
$this->categories_obj->return_sorted_array('', False, '', '', '', True, 0))
$this->all_categories = array();
+
+ // default preferences and admin config
+ if (!$this->preferences['num_lines'])
$this->preferences['num_lines'] = 3;
+ if (!$this->preferences['show_tree'])
$this->preferences['show_tree'] = 'all';
+ if (!$this->preferences['num_comments'])
$this->preferences['num_comments'] = '5';
+ if (!$this->admin_config['publish_comments'])
$this->admin_config['publish_comments'] = 'True';
+ if (!$this->admin_config['publish_articles'])
$this->admin_config['publish_articles'] = 'True';
+ if (!$this->admin_config['publish_questions'])
$this->admin_config['publish_questions'] = 'True';
+
+ $this->start = get_var('start',
'any', 0);
+ $this->query =
urldecode(get_var('query', 'any', ''));
+ $this->sort =
get_var('sort', 'any', '');
+ $this->order = get_var('order',
'any', '');
+ $this->publish_filter = get_var('publish_filter',
'any', 'all');
+
+ // advanced search parameters
+ $this->all_words = get_var('all_words', 'any',
'');
+ $this->phrase = get_var('phrase', 'any', '');
+ $this->one_word = get_var('one_word', 'any',
'');
+ $this->without_words= get_var('without_words', 'any',
'');
+ $this->cat = get_var('cat', 'any',
0);
+ $this->include_subs = get_var('include_subs',
'any', '');
+ $this->pub_date = get_var('pub_date', 'any',
'');
+ $this->ocurrences = get_var('ocurrences', 'any',
0);
+ $this->num_res = get_var('num_res', 'any', '');
+ }
+
+ /**
+ * Returns a single category
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $cat_id Category id
+ * @return array Category infoA
+ */
+ function return_single_category($cat_id)
+ {
+ return $this->categories_obj->return_single($cat_id);
+ }
+
+ /**
+ * Loads in object $this->categories, an array of the descendant
categories of $parent_cat_id
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $parent_cat_id id of the parent
category
+ * @return void
+ */
+ function load_categories($parent_cat_id)
+ {
+ if (!$this->categories =
$this->categories_obj->return_sorted_array('', False, '', '', '', True,
$parent_cat_id)) $this->categories = array();
+ }
+
+ /**
+ * Return html code for drop-down select box with categories
accessible by user
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $category_selected id of
category to show selected
+ * @return string
Html code
+ */
+ function select_category($category_selected = '')
+ {
+ return $this->categories_obj->formated_list('select',
'all', $category_selected , True);
+ }
+
+ /**
+ * Returns list of user ids to which the current user has
permissions
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param int $permissions Permissions
bitmask. If not given, uses $this->read_right
+ * @return array User ids
+ */
+ function accessible_owners($permissions = 0)
+ {
+ $owners =
array($GLOBALS['phpgw_info']['user']['account_id']);
+ if (!$permissions) $permissions = $this->read_right;
+ foreach ($this->grants as $user=>$right)
+ {
+ if ($right & $permissions)
+ {
+ $owners[] = $user;
+ }
+ }
+
+ return $owners;
+ }
+
+ /**
+ * Checks for rights on article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $check_rights bitmask ACL
right (use $this->read_right or $this->edit_right)
+ * @param int $article_owner if not set,
checks rights against current article
+ * @return bool True if
has rights, False if not
+ */
+ function check_permission($check_rights, $article_owner = 0)
+ {
+ if (!$article_owner) $article_owner =
$this->article_owner;
+ if ($this->grants[$article_owner])
+ {
+ $rights_on_owner =
$this->grants[$article_owner];
}
else
{
- $level = 'mains';
+ return False;
}
- $cats = $this->cats->return_array($level, 0, False, '',
'', '', False, $cat_id);
+ return ($rights_on_owner & $check_rights);
+ }
+
+ /**
+ * Returns array of articles
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $category_id Category under
which articles are to be retrieved
+ * @param mixed $publish_filter To filter pusblished or
unpublished entries
+ * @param int $permissions Specific
permissions on article owners
+ * @param bool $questions Whether looking
for questions or articles
+ * @return array Articles
+ **/
+ function search_articles($category_id, $publish_filter = False,
$permissions=0, $questions=False)
+ {
+ $search = $questions? 'unanswered_questions' :
'search_articles';
+ if (!$permissions) $permissions = $this->read_right;
+
+ $owners = $this->accessible_owners($permissions);
+ // admins can also see questions asked by user_id=0
(questions that were passed from previous phpbrain version were the user_id
wasn't recorded)
+ if ($questions &&
$GLOBALS['phpgw']->acl->check('run',1,'admin')) $owners[0] = 0;
- if( count($cats) )
+ if ($this->preferences['show_tree'] == 'all')
{
- foreach ($cats as $c_key => $c_vals)
- {
- $id = $c_vals['id'];
- $return_cats[$id] = array('name'
=> $c_vals['name'],
- 'num_entries'
=> $this->so->get_count($id)
- );
-
- $sub_cats =
$this->cats->return_array('subs', 0, False, '', '', '', False, $id);
- if( count($sub_cats) )
- {
- foreach($sub_cats as $sub_key
=> $sub_vals)
- {
- $sub_id =
$sub_vals['id'];
-
$return_cats[$id]['subs'][$sub_id]
- = array('name'
=> $sub_vals['name'],
-
'num_entries' => $this->so->get_count($sub_id)
- );
- }
- unset($sub_cats);
- }
+ // show all articles under present category and
descendant categories
+ $cats_ids = array();
+ foreach ($this->categories as $cat)
+ {
+ $cats_ids[] = $cat['id'];
}
- return $return_cats;
+ $cats_ids[] = $category_id;
+
+ $articles = $this->so->$search($owners,
$cats_ids, $this->start, '', $this->sort, $this->order, $publish_filter,
$this->query);
+ }
+ elseif ($category_id == 0)
+ {
+ // show only articles that are not categorized
+ $articles = $this->so->$search($owners, 0,
$this->start, '', $this->sort, $this->order, $publish_filter, $this->query);
}
- else //no cats
+ else
{
- return array();
+ // show only articles in present category
+ $articles = $this->so->$search($owners,
array($category_id), $this->start, '', $this->sort, $this->order,
$publish_filter, $this->query);
}
+ $this->num_rows = $this->so->num_rows;
+ return $articles;
}
-
- function delete_comment($comment_id)
+
+ /**
+ * Returns results of advanced search
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return array Articles
+ */
+ function adv_search_articles()
{
- $comment_id = (int) $comment_id;
- if($comment_id)
+ $owners = $this->accessible_owners();
+
+ $cats_ids = array();
+ if ($this->cat && !$this->include_subs)
{
- return $this->so->delete_comment($comment_id);
+ // only search in one category
+ $cats_ids[] = $this->cat;
}
- return false;
+ elseif ($this->cat)
+ {
+ // search in category passed and all its
descendency
+ foreach ($this->categories as $cat)
+ {
+ $cats_ids[] = $cat['id'];
+ }
+ $cats_ids[] = $this->cat;
+ }
+
+ $articles = $this->so->adv_search_articles($owners,
$cats_ids, $this->ocurrences, $this->pub_date, $this->start, $this->num_res,
$this->all_words, $this->phrase, $this->one_word, $this->without_words,
$this->cat, $this->include_subs);
+ $this->num_rows = $this->so->num_rows;
+ return $articles;
}
- function delete_answer($answers)
+ /**
+ * Returns unanswered questions
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $category_id Category in
which to look for
+ * @return array
Questions
+ */
+ function unanswered_questions($category_id)
{
- return $this->so->delete_answer($answers);
+ $owners = $this->accessible_owners();
+
+ // admins can also see questions asked by user_id=0
(questions that were passed from previous phpbrain version were the user_id
wasn't recorded)
+ if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
$owners[0] = 0;
+
+ $cats_ids = array();
+ foreach ($this->categories as $cat)
+ {
+ $cats_ids[] = $cat['id'];
+ }
+ $cats_ids[] = $category_id;
+
+ $questions = $this->so->unanswered_questions($owners,
$cats_ids, 0, $this->preferences['num_lines'], 'DESC', 'creation', 'published',
'');
+ $this->num_questions = $this->so->num_questions;
+ return $questions;
}
-
- function get_comments($faq_id)
+ /**
+ * Returns article's history
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return array
Articles's history
+ */
+ function return_history()
{
- $comments = $this->so->get_comments($faq_id);
- if(is_array($comments))
+ $history =
$GLOBALS['phpgw']->historylog->return_array('', '', 'history_timestamp',
'DESC', $this->article_id);
+ // echo "history: <pre>";print_r($history);echo
"</pre>";
+ for ($i = 0; $i<sizeof($history); $i++)
{
- foreach($comments as $key => $vals)
+ $history[$i]['datetime'] =
$GLOBALS['phpgw']->common->show_date($history[$i]['datetime'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+
$GLOBALS['phpgw']->accounts->get_account_name($history[$i]['owner'], $lid,
$fname, $lname);
+ $history[$i]['owner'] = $fname . ' ' . $lname;
+
+ switch ($history[$i]['status'])
{
- $comments[$key]['comment_date'] =
date('d-M-Y', $vals['entered']);
- $comments[$key]['comment_user'] =
$GLOBALS['phpgw']->common->grab_owner_name($vals['user_id']);
- }//end foreach(comment)
- }//end is_array(comments)
- return $comments;
- }//end get_comments
+ case 'AF':
+ $history[$i]['action'] = lang
('Added file %1', $history[$i]['new_value']);
+ break;
+ case 'RF':
+ $history[$i]['action'] = lang
('Removed file %1', $history[$i]['new_value']);
+ break;
+ case 'AL':
+ $history[$i]['action'] = lang
('Added link %1', $history[$i]['new_value']);
+ break;
+ case 'RL':
+ $history[$i]['action'] = lang
('Removed link %1', $history[$i]['new_value']);
+ break;
+ case 'AR':
+ $history[$i]['action'] = lang
('Added related articles %1', $history[$i]['new_value']);
+ break;
+ case 'DR':
+ $history[$i]['action'] = lang
('Deleted relation to article %1', $history[$i]['new_value']);
+ break;
+ case 'EA':
+ $history[$i]['action'] = lang
('Article edited');
+ break;
+ case 'NA':
+ $history[$i]['action'] = lang
('Article created');
+ break;
+ case 'AD':
+ $history[$i]['action'] = lang
('Article deleted');
+ break;
+ }
+ }
+ return $history;
+ }
- function get_config()
+ /**
+ * Returns latest or most viewed articles
+ *
+ * @author Alejandro Pedraza
+ * @param int $category_id articles must
belong to the descendancy of this category
+ * @param string $order Field by which
the query is ordered, determines whether latest or most viewed articles are
returned
+ * @return array array
of articles
+ */
+ function return_latest_mostviewed($category_id = 0, $order = '')
{
- if(!is_object($GLOBALS['phpgw']->config))
+ $owners = $this->accessible_owners();
+
+ $cats_ids = array($category_id);
+ foreach ($this->categories as $cat)
{
- $config = createObject('phpgwapi.config');
+ $cats_ids[] = $cat['id'];
}
- else
+
+ return $this->so->search_articles($owners, $cats_ids,
0, $this->preferences['num_lines'], 'DESC', $order, 'published', '');
+ }
+
+ /**
+ * Saves a new or edited article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $content Article contents.
Extracted from $_POST if empty
+ * @return bool True on
success, False on failure
+ **/
+ function save_article($content = '')
+ {
+ if (!$content) {
+ $content = array();
+ $content['exec'] = get_var('exec', 'POST');
+ $content['editing_article_id'] =
(int)get_var('editing_article_id', 'POST', 0);
+ $content['articleID'] = get_var('articleID',
'POST');
+ $content['answering_question'] =
(int)get_var('answering_question', 'POST', 0);
+ $content['title'] = get_var('title', 'POST');
+ $content['topic'] = get_var('topic', 'POST');
+ $content['cat_id'] = (int)get_var('cat_id',
'POST', 0);
+ $content['keywords'] = get_var('keywords',
'POST');
+ }
+
+ $content['text'] = $content['exec']['text'];
+
+ // if editing an article, check it has the right to do
so
+ if ($content['editing_article_id'] &&
!($this->check_permission($this->edit_right)))
{
- $config = $GLOBALS['phpgw']->config;
+ $this->error_msg = lang('You have not the
proper permissions to do that');
+ return False;
}
-
- $config->read_repository();
- return $config->config_data;
-
- }//end get_config
-
- function get_faq_list($cat_id = '', $unpublished = false)
- {
- if(!$this->is_admin() && $unpublished)
+ elseif ($content['editing_article_id'])
{
- $unpublished = false;
+ if(!$art_id = $this->so->save_article($content,
False))
+ {
+ $this->error_msg = 'edit_err';
+ return False;
+ }
+ $GLOBALS['phpgw']->historylog->add('EA',
$this->article_id, 'article edited', '');
+ return $art_id;
}
- $faqs = $this->so->get_faq_list($cat_id, $unpublished);
- if(is_array($faqs))
+ // if given, articleID must be a number
+ if ($content['articleID']!='' &&
!is_numeric($content['articleID']))
{
- foreach($faqs as $faq_id => $faq_vals)
- {
- $faqs[$faq_id]['vote_avg'] =
(($faq_vals['total'] && $faq_vals['votes'])
-
? round(($faq_vals['total'] / $faq_vals['votes']),2) : 0);
- $faqs[$faq_id]['last_mod'] = date('d-M-Y',
$faqs[$faq_id]['modified']);
- $faqs[$faq_id]['score'] = '1.00';
- $faqs[$faq_id]['title'] =
($item['is_faq']
-
? lang('question') . ': '. $faqs[$faq_id]['title']
-
: lang('tutorial') . ': '. $faqs[$faq_id]['title']);
+ $this->error_msg = lang('The article ID must be
a number');
+ return False;
+ }
- }
+ // if adding a new article, check that the articleID
doesn't already exist if it was given
+ if ($content['articleID'] &&
$this->so->exist_articleID($content['articleID']))
+ {
+ $this->error_msg = "Article ID already exists";
+ return False;
}
- return $faqs;
- }//end get_faq_list
- function get_item($faq_id, $show_type = True)
+ $publish = False;
+ if ($this->admin_config['publish_articles'] == 'True')
$publish = True;
+
+ $art_id = $this->so->save_article($content, True,
$publish);
+ if ($art_id) $GLOBALS['phpgw']->historylog->add('NA',
$art_id, 'article created', '');
+ return $art_id;
+ }
+
+ /**
+ * Deletes article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array Article's files
+ * @param int $art_id Article id. If
not given, $this->article_id is used
+ * @param int $owner Article's owner
id. -1 to avoid checking permissions (when admin is deleting all user's
articles)
+ * @return string Success or
failure message
+ */
+ function delete_article($files, $art_id = 0, $owner = 0)
{
- $item = $this->so->get_item($faq_id,
address@hidden>viewed[$faq_id]);
- if(is_array($item))
+ if (!$art_id) $art_id = $this->article_id;
+ // check user has edit rights
+ if ($owner != -1 &&
!$this->check_permission($this->edit_right, $owner)) return 'no_perm';
+ // delete files
+ if ($files)
{
- $item['last_mod'] = date('d-M-Y',
$item['modified']);
- $item['username'] =
$GLOBALS['phpgw']->common->grab_owner_name($item['user_id']);
- $item['rating'] = ($item['votes']
- ?
round(($item['total']/$item['votes']),2) : 0);
- $item['comments'] =
$this->get_comments($faq_id);
- if($show_type)
+ foreach ($files as $file)
{
- $item['title'] = ($item['is_faq']
- ? lang('faq') .
': '. $item['title']
- :
lang('tutorial') . ': '. $item['title']);
+ // verify the file exists in the server
+ $test =
$GLOBALS['phpgw']->vfs->ls(array(
+ 'string' =>
'/kb/' . $file['file'],
+ 'relatives' =>
array(RELATIVE_NONE),
+ 'checksubdirs' => False,
+ 'nofiles' => False
+ ));
+ if ($test[0]['name'])
+ {
+ // the file is in the server,
proceed to rm it
+ $remove =
$GLOBALS['phpgw']->vfs->rm(array(
+ 'string' =>
'/kb/' . $file['file'],
+ 'relatives' =>
array(RELATIVE_NONE)
+ ));
+ }
}
- $this->viewed[$faq_id] = True;
-
$GLOBALS['phpgw']->session->appsession('viewed','phpbrain', $this->viewed);
+ }
+ // delete comments
+ $this->so->delete_comments($art_id);
+ // delete ratings
+ $this->so->delete_ratings($art_id);
+ // delete related articles
+ $this->so->delete_related($art_id, $art_id, True);
+ // delete search index
+ $this->so->delete_search($art_id);
+ // delete files entries in phpgw_kb_files
+ $this->so->delete_files($art_id);
+ // delete urls
+ $this->so->delete_urls($art_id);
+ // delete article
+ if (!$this->so->delete_article($art_id)) return
'err_del_art';
+ if ($art_id) $GLOBALS['phpgw']->historylog->add('AD',
$art_id, 'article deleted', '');
+ return 'del_art_ok';
+ }
- }//end if is_array(item)
+ /**
+ * Deletes owners articles (called by hook_deleteaccount)
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $owner Article's owner
id
+ * @return void
+ */
+ function delete_owner_articles($owner)
+ {
+ // check if user calling deletion is an admin with user
deletion privileges
+ if
($GLOBALS['phpgw']->acl->check('account_access',32,'admin'))
+ {
+ $this->list_users();
+ die('invalid rights');
+ }
- return $item;
+ // fetch articles from user
+ $GLOBALS['phpgw']->vfs->override_acl = 1;
+ $owner = (int)$owner;
+ $articles_ids = $this->so->get_articles_ids($owner);
+ foreach ($articles_ids as $article_id)
+ {
+ $article = $this->so->get_article($article_id);
+ $this->delete_article($article['files'],
$article_id, -1);
+ }
+ }
- }//end get_item
-
- function get_latest()
- {
- return $this->so->get_latest();
- }// end get_latest
-
- function get_questions($pending = false)
+ /**
+ * changes articles owner (called by hook_deleteaccount)
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $owner Article's owner
id
+ * @param int $owner Article's new
owner id
+ * @return void
+ */
+ function change_articles_owner($owner, $new_owner)
{
- if(!$this->is_admin() && $pending)
+ // check if user calling deletion is an admin with user
deletion privileges
+ if
($GLOBALS['phpgw']->acl->check('account_access',32,'admin'))
{
- return null;
+ $this->list_users();
+ die('invalid rights');
}
- else
+
+ $owner = (int)$owner;
+ $new_owner = (int)$new_owner;
+
+ // first change file owners in vfs
+ $articles_ids = $this->so->get_articles_ids($owner);
+ foreach ($articles_ids as $article_id)
{
- return $this->so->get_questions($pending);
+ $article = $this->so->get_article($article_id);
+ $GLOBALS['phpgw']->vfs->override_acl = 1;
+ if (is_array($article['files']))
+ {
+ foreach ($article['files'] as $file)
+ {
+
$GLOBALS['phpgw']->vfs->set_attributes(array(
+ 'string'
=> '/kb/' . $file['file'],
+ 'relatives'
=> array(RELATIVE_NONE),
+ 'attributes' =>
array('owner_id' => $new_owner),
+ ));
+ }
+ }
}
- }//end questions
- function get_search_results($search, $show)
+ // now change articles owners
+ $this->so->change_articles_owner($owner, $new_owner);
+ }
+
+ /**
+ * Deletes question
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $q_id Question id
+ * @param int $owner Article's owner
id
+ * @return string Success or
failure message
+ **/
+ function delete_question($q_id, $owner)
{
- $results = $this->so->get_search_results($search,
$show);
- if(is_array($results))
+ // check user has edit rights on owner
+ $this->article_owner = $owner;
+ if (!$this->check_permission($this->edit_right,
$owner)) return 'no_perm';
+
+ if (!$this->so->delete_question($q_id)) return
'err_del_q';
+ return 'del_q_ok';
+ }
+
+ /**
+ * Returns article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return array Article
+ **/
+ function get_article($art_id)
+ {
+ if (!$article = $this->so->get_article($art_id)) return
False;
+ $this->article_id = $article['art_id'];
+
+ // check permissions
+ $this->article_owner = $article['user_id'];
+ if (!$this->check_permission($this->read_right |
$this->publish_right)) $this->die_peacefully('You have not the proper
permissions to do that');
+
+
$GLOBALS['phpgw']->accounts->get_account_name($article['user_id'], $lid,
$fname, $lname);
+ $article['username'] = $fname . ' ' . $lname;
+ $fname = ''; $lname = '';
+
$GLOBALS['phpgw']->accounts->get_account_name($article['modified_user_id'],
$lid, $fname, $lname);
+ $article['modified_username'] = $fname . ' ' .$lname;
+
+ // register article view if it has been published (one
hit per session)
+ if (!$data =
$GLOBALS['phpgw']->session->appsession('views', 'phpbrain')) $data = array();
+ if ($article['published'] &&
!in_array($this->article_id, $data))
+ {
+ $data[] = $this->article_id;
+ $GLOBALS['phpgw']->session->appsession('views',
'phpbrain', $data);
+ $this->so->register_view($this->article_id,
$article['views']);
+ }
+
+ // process search_feedback (can do this only once per
session per article)
+ if (!$data =
$GLOBALS['phpgw']->session->appsession('feedback', 'phpbrain')) $data = array();
+ if ($_POST['feedback_query'] &&
!in_array($this->article_id, $data))
{
- foreach($results as $id => $vals)
- {
- $results[$id]['vote_avg'] = (($vals['total'] &&
$vals['votes'])
-
? round(($vals['total'] / $vals['votes']),2) : 0);
- $results[$id]['last_mod'] = date('d-M-Y',
$vals['modified']);
+ $data[] = $this->article_id;
+
$GLOBALS['phpgw']->session->appsession('feedback', 'phpbrain', $data);
+ $upgrade_key = $_POST['yes_easy']? True : False;
+ $words = explode(' ', $_POST['feedback_query']);
+ foreach ($words as $word)
+ {
+
$this->so->update_keywords($this->article_id, $word, $upgrade_key);
+ }
+ }
- $results[$id]['title'] =
($results[$id]['is_faq']
-
? lang('question') . ': '. $results[$id]['title']
-
: lang('tutorial') . ': '. $results[$id]['title']);
- }
+ return $article;
+ }
+
+ /**
+ * Previous checks before downloading a file
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article id
+ * @param string $filename filename
+ * @return void
+ */
+ function download_file_checks($art_id, $filename)
+ {
+ if (!$article = $this->get_article($art_id))
$this->die_peacefully('Error downloading file');
+ if (!$this->check_permission($this->read_right))
$this->die_peacefully('You have not the proper permissions to do that');
+ $found_file = False;
+ foreach ($article['files'] as $article_file)
+ {
+ if ($article_file['file'] == $filename)
$found_file = True;
}
- return $results;
- }//end get search results
-
- function get_stats()
+ if (!$found_file) $this->die_peacefully("Error: file
doesn't exist in the database");
+ }
+
+ /**
+ * Returns article's comments
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @param int $limit Number of
comments to return
+ * @return array Comments
+ */
+ function get_comments($art_id, $limit = False)
{
- return $this->so->get_stats();
- }//end get_stats
+ if ($limit) $limit = $this->preferences['num_comments'];
+ $comments = $this->so->get_comments($art_id, $limit);
+ $this->num_comments = $this->so->num_comments;
+ return $comments;
+ }
- function is_admin()
+ /**
+ * Returns an article related comments
+ *
+ * @author Alejandro Pedraza
+ * @acces public
+ * @param int $art_id Article id
+ * @return array IDs and titles of
articles
+ */
+ function get_related_articles($art_id)
{
- return
isset($GLOBALS['phpgw_info']['user']['apps']['admin']);
- }//end is_admin
-
- function is_anon()
+ $owners = $this->accessible_owners();
+ return $this->so->get_related_articles($art_id,
$owners);
+ }
+
+ /**
+ * Tells if the current user has already rated the article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @returns bool 1 if he has, 0
if not
+ **/
+ function user_has_voted()
{
- return
($GLOBALS['phpgw_info']['apps']['phpkb']['config']['anon_user']
- ==
$GLOBALS['phpgw_info']['user']['account_id']);
- }//end is_anon
+ return $this->so->user_has_voted($this->article_id);
+ }
- function save($faq_id, $faq, $question_id)
+ /**
+ * Registers user's vote. When accessing through egroupware
users can only vote once. When accessign through sitemgr, they can vote as many
times they wish, but only once per session on an individual article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $current_rating Current number
of votes in the level $rating (this saves me a trip to the db)
+ * @param bool $sitemgr Whether user is
accessing through sitemgr
+ * @return bool 1 on
success, 0 on failure
+ */
+ function add_rating($current_rating, $sitemgr=False)
{
-
if(!$GLOBALS['phpgw_info']['apps']['phpkb']['config']['alow_tags'])
+ if(!$this->so->add_vote($this->article_id,
$_POST['Rate'], $current_rating)) return 0;
+ if (!$sitemgr)
{
- $faq['title'] = strip_tags($faq['title']);
- $faq['keywords'] = strip_tags($faq['keywords']);
- $faq['text'] = strip_tags($faq['text']);
+ if
(!$this->so->add_rating_user($this->article_id)) return 0;
}
-
- if($faq['published'] && !$this->is_admin())
+ // register vote in session
+ if (!$data =
$GLOBALS['phpgw']->session->appsession('ratings', 'phpbrain')) $data = array();
+ $data[] = $this->article_id;
+ $GLOBALS['phpgw']->session->appsession('ratings',
'phpbrain', $data);
+
+ return 1;
+ }
+
+ /**
+ * Stores new comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return mixed Success message or 0 if failure
+ */
+ function add_comment()
+ {
+ $comment = get_var('comment_box', 'POST');
+ if ($this->admin_config['publish_comments'] == 'True')
{
- $faq['published'] = False;
+ $publish = True;
+ $message = 'comm_ok';
}
- elseif($this->is_admin() && !$faq_id)
+ else
+ {
+ $publish = False;
+ $message = 'comm_submited';
+ }
+ if (!$this->so->add_comment($comment,
$this->article_id, $publish)) return 0;
+ return $message;
+ }
+
+ /**
+ * Adds link to article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return string Success or failure message
+ */
+ function add_link()
+ {
+ // first check permission
+ if (!$this->check_permission($this->edit_right)) return
'no_perm';
+
+ if(!$this->so->add_link(get_var('url', 'POST'),
get_var('url_title', 'POST'), $this->article_id)) return 'link_prob';
+
+ $GLOBALS['phpgw']->historylog->add('AL',
$this->article_id, get_var('url', 'POST'), '');
+ return 'link_ok';
+ }
+
+ /**
+ * Publishes article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @params int $art_id Article ID. If not
given uses current article
+ * @params int $owner Article's owner ID. If
not given uses owner of current article
+ * @return string Success or error message
+ **/
+ function publish_article($art_id=0, $owner=0)
+ {
+ if (!$art_id) $art_id = $this->article_id;
+
+ // first check permission
+ if (!$this->check_permission($this->publish_right,
$owner)) return 'no_perm';
+
+ if (!$this->so->publish_article($art_id)) return
'publish_err';
+ return 'publish_ok';
+ }
+
+ /**
+ * Publishes question
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @params int $q_id Question ID.
+ * @params int $owner Article's owner ID
+ * @return string Success or error message
+ **/
+ function publish_question($q_id, $owner)
+ {
+ // first check permission
+ if (!$this->check_permission($this->publish_right,
$owner)) return 'no_perm';
+
+ if (!$this->so->publish_question($q_id)) return
'publish_err';
+ return 'publish_ok';
+ }
+
+ /**
+ * Publishes article comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return string Success or error message
+ */
+ function publish_comment()
+ {
+ $comment_id = (int)$_GET['pub_com'];
+ // first check permission
+ if (!$this->check_permission($this->edit_right)) return
'no_perm';
+
+ if (!$this->so->publish_comment($this->article_id,
$comment_id)) return 'publish_comm_err';
+ return 'publish_comm_ok';
+ }
+
+ /**
+ * Deletes article comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return string Success or error message
+ */
+ function delete_comment()
+ {
+ $comment_id = (int)$_GET['del_comm'];
+
+ // check permission
+ if (!$this->check_permission($this->edit_right)) return
'no_perm';
+
+ if (!$this->so->delete_comment($this->article_id,
$comment_id)) return 'del_comm_err';
+ return 'del_comm_ok';
+ }
+
+ /**
+ * Deletes article comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return string Success or error message
+ */
+ function delete_link()
+ {
+ $link = urldecode($_GET['delete_link']);
+ // first check permission
+ if (!$this->check_permission($this->edit_right)) return
'no_perm';
+
+ if (!$this->so->delete_link($this->article_id, $link))
return 'link_del_err';
+
+ $GLOBALS['phpgw']->historylog->add('RL',
$this->article_id, $delete_link, '');
+ return 'link_del_ok';
+ }
+
+ /**
+ * @function process_upload
+ *
+ * @abstract Uploads file to system
+ * @author Alejandro Pedraza
+ * @return string: error or confirmation message
+ */
+ function process_upload()
+ {
+ // check permissions
+ if (!$this->check_permission($this->edit_right)) return
'no_perm';
+ // check something was indeed uploaded
+ if ($_FILES['new_file']['error'] == 4) return
'nothing_uploaded';
+
+ // TODO: check filename for invalid characters
+
+ // check if basedir exists
+
$test=$GLOBALS['phpgw']->vfs->get_real_info(array('string' => '/', 'relatives'
=> array(RELATIVE_NONE), 'relative' => False));
+ if($test[mime_type]!='Directory')
{
- $faq['published'] = True;
+ return 'no_basedir';
}
- $faq['user_id'] = (isset($faq['user_id']) ?
$faq['user_id'] : $GLOBALS['phpgw_info']['user']['account_id']);
- $new_faq_id = $this->so->save($faq_id, $faq,
$this->is_admin());
- if($new_faq_id && $question_id && !$faq_id)
+ // check if /kb exists
+ $test =
@$GLOBALS['phpgw']->vfs->get_real_info(array('string' => '/kb', 'relatives' =>
array(RELATIVE_NONE), 'relative' => False));
+ if($test[mime_type]!='Directory')
{
- $this->so->delete_question($question_id);
+ // if not, create it
+ $GLOBALS['phpgw']->vfs->override_acl = 1;
+ $GLOBALS['phpgw']->vfs->mkdir(array(
+ 'string' => '/kb',
+ 'relatives' => array(RELATIVE_NONE)
+ ));
+ $GLOBALS['phpgw']->vfs->override_acl = 0;
+
+ // test one more time
+ $test =
$GLOBALS['phpgw']->vfs->get_real_info(array('string' => '/kb', 'relatives' =>
array(RELATIVE_NONE), 'relative' => False));
+ if($test[mime_type]!='Directory')
+ {
+ return 'no_kbdir';
+ }
}
- return $new_faq_id;
+ // prefix with article number
+ $filename = stripslashes('kb' . $this->article_id . '-'
. $_FILES['new_file']['name']); // strip slashes eventually generated if
magic_quotes_gpc is set on
- }//end save
-
- function set_active_answer($faq_ids)
+ // check the file doesn't already exist (happens when
double POSTing)
+ $test = $GLOBALS['phpgw']->vfs->ls(array(
+ 'string' => '/kb/' . $filename,
+ 'relatives' => array(RELATIVE_NONE),
+ 'checksubdirs' => False,
+ 'nofiles' => False
+ ));
+ if ($test[0]['name']) return 'overwrite';
+
+ // at last, copy the file from /tmp to /kb
+ $cd_args = array('string' => '/kb', 'relative' =>
False, 'relatives' => RELATIVE_NONE);
+ if (!$GLOBALS['phpgw']->vfs->cd($cd_args)) return
'error_cd';
+
+ $cp_args = array(
+ 'from' =>
$_FILES['new_file']['tmp_name'],
+ 'to' => $filename,
+ 'relatives' =>
array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
+ );
+ $GLOBALS['phpgw']->vfs->override_acl = 1; // should I
implement ACL on this folder? Don't think so :>
+ if (!$GLOBALS['phpgw']->vfs->cp($cp_args)) return
'error_cp';
+ $GLOBALS['phpgw']->vfs->override_acl = 0;
+
+ $this->so->add_file($this->article_id, $filename);
+
+ $GLOBALS['phpgw']->historylog->add('AF',
$this->article_id, $_FILES['new_file']['name'], '');
+ return 'upload_ok';
+ }
+
+ /**
+ * Deletes file
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param string $current_files Forgot why this
+ * @param string $file File name
+ * @return string Success
or error message
+ * @todo see what's the deal with $current_files
+ */
+ function delete_file($current_files, $file = '')
{
- return $this->so->set_active_answer($faq_ids);
- }//end set active answer
-
- function set_active_question($question_ids)
+ if (!$file) $file = urldecode($_GET['delete_file']);
+
+ // check permissions
+ if (!$this->check_permission($this->edit_right)) return
'no_perm';
+
+ // verify the file exists in the server
+ $test = $GLOBALS['phpgw']->vfs->ls(array(
+ 'string' => '/kb/' . $file,
+ 'relatives' => array(RELATIVE_NONE),
+ 'checksubdirs' => False,
+ 'nofiles' => False
+ ));
+ if ($test[0]['name'])
+ {
+ // the file is in the server, proceed to rm it
+ $remove = $GLOBALS['phpgw']->vfs->rm(array(
+ 'string' => '/kb/' . $file,
+ 'relatives' => array(RELATIVE_NONE)
+ ));
+ if (!$remove) return 'failure_delete';
+ $in_server = True;
+
+ }
+ else
+ {
+ // the file was already missing
+ $in_server = False;
+ }
+
+ // now delete it from the database
+ ereg('^kb[0-9]*-(.*)', $file, $new_filename);
+ if ($success =
$this->so->delete_files($this->article_id, $file))
+ $GLOBALS['phpgw']->historylog->add('RF',
$this->article_id, $new_filename[1], '');
+ if ($in_server && $success) return 'file_del_ok';
+ if ($in_server && !$success) return 'file_db_del_err';
+ if (!$in_server && $success) return 'file_noserv_db_ok';
+ return 'file_noserv_db_err';
+ }
+
+ /**
+ * Adds related article to article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return string Success or error message
+ */
+ function add_related()
+ {
+ $parsed_list = array();
+ $final_list = array();
+
+ // validate list
+ $list = explode(', ', $_POST['related_articles']);
+ for ($i=0; $i<sizeof($list); $i++)
+ {
+ if ((int)$list[$i])
+ {
+ $parsed_list[] = (int)$list[$i];
+ }
+ }
+
+ // check permissions on those articles
+ $owners_list = $this->so->owners_list($parsed_list);
+ foreach ($owners_list as $owner)
+ {
+ if ($this->check_permission($this->edit_right,
$owner['user_id'])) $final_list[] = $owner['art_id'];
+ }
+
+ // update database
+ if (!$this->so->add_related($this->article_id,
$final_list)) return 'articles_not_added';
+
+ $final_list = implode(', ', $final_list);
+ $GLOBALS['phpgw']->historylog->add('AR',
$this->article_id, $final_list, '');
+ return 'articles_added';
+ }
+
+ /**
+ * Deletes related article to article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return void
+ */
+ function delete_related()
{
- return $this->so->set_active_question($question_ids);
- }//end set active question
+ $related_article = urldecode($_GET['delete_related']);
+ $this->so->delete_related($this->article_id,
$related_article);
+ $GLOBALS['phpgw']->historylog->add('DR',
$this->article_id, $related_article, '');
+ }
- function set_comment($comment_id, $comment_data)
+ /**
+ * Adds question to database
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return int Numbers of
lines affected (should be 1, if not there's an error)
+ */
+ function add_question()
{
- $comment_id = (int) $comment_id;
- $comment_data['faq_id'] = (int) $comment_data['faq_id'];
- $comment_data['user_id'] =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->so->set_comment($comment_id, $comment_data);
- }//end set comment
+ $data = array();
+ $data['summary'] = get_var('summary', 'POST');
+ $data['details'] = get_var('details', 'POST');
+ $data['cat_id'] = (int)get_var('cat_id', 'POST', 0);
+ $publish = ($this->admin_config['publish_questions'] ==
'True')? True : False;
+ return $this->so->add_question($data, $publish);
+ }
- function set_question($question)
+ /**
+ * Returns question
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $q_id Question id
+ * @return array Question
+ */
+ function get_question($q_id)
{
- return $this->so->set_question($question,
$this->is_admin());
- }//end set question
-
- function set_rating($faq_id, $rating)
+ $question = $this->so->get_question($q_id);
+ $username =
$GLOBALS['phpgw']->accounts->get_account_name($question['user_id'], $lid,
$fname, $lname);
+ $question['username'] = $fname . ' ' . $lname;
+ $question['creation'] =
$GLOBALS['phpgw']->common->show_date($question['creation'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ return $question;
+ }
+
+ /**
+ * Mails article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $article_contents
+ * @return string Success or error message
+ */
+ function mail_article($article_contents)
{
- if(address@hidden>rated[$faq_id])//only rate if not
already done so
+ // check address syntaxis
+ $recipient = get_var('recipient', 'POST');
+ $reply_to = get_var('reply', 'POST', 0);
+ $theresults = ereg("^[^@ address@hidden@ ]+\.[^@
\.]+$", $recipient, $trashed);
+ if (!$theresults) return 'mail_err';
+
+ $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
+ $GLOBALS['phpgw']->send->From =
$GLOBALS['phpgw_info']['user']['email'];
+ $GLOBALS['phpgw']->send->FromName =
$GLOBALS['phpgw_info']['user']['fullname'];
+ if ($reply_to)
$GLOBALS['phpgw']->send->AddReplyTo($reply_to);
+ $GLOBALS['phpgw']->send->AddAddress($recipient);
+ $GLOBALS['phpgw']->send->Subject = get_var('subject',
'POST');
+ $GLOBALS['phpgw']->send->Body = get_var('txt_message',
'POST', lang('E-GroupWare Knowledge Base article attached'));
+
$GLOBALS['phpgw']->send->AddStringAttachment($article_contents,
lang('article').'.html', 'base64', 'text/html');
+ $message = '';
+ if (!$GLOBALS['phpgw']->send->Send())
{
- //make sure values are within a valid range
- $rating = ($rating < 1 ? 1 : $rating);
- $rating = ($rating > 5 ? 5 : $rating);
+ $message = lang('Your message could not be
sent!') . '<br>' . lang('The mail server returned:') .
htmlspecialchars($GLOBALS['phpgw']->send->ErrorInfo);
+ }
+ if ($message) return $message;
+ return 'mail_ok';
+ }
- $this->so->set_rating($faq_id, $rating);
- $this->rated[$faq_id] = True;
-
$GLOBALS['phpgw']->session->appsession('rated','phpbrain', $this->rated);
+ /**
+ * Stop execution and show error message
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param string $error_msg Error message to
translate and show
+ * @return void
+ */
+ function die_peacefully($error_msg)
+ {
+ if (!$this->navbar_shown)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
}
- }//end set_rating
-
- }//end class bokb
-
-
+ echo "<div style='text-align:center;
font-weight:bold'>" . lang($error_msg) . "</div>";
+ $GLOBALS['phpgw']->common->phpgw_footer();
+ die();
+ }
+ }
+?>
Index: phpbrain/inc/class.sokb.inc.php
diff -u phpbrain/inc/class.sokb.inc.php:1.18
phpbrain/inc/class.sokb.inc.php:1.19
--- phpbrain/inc/class.sokb.inc.php:1.18 Sun May 15 12:43:37 2005
+++ phpbrain/inc/class.sokb.inc.php Tue May 9 05:14:07 2006
@@ -1,404 +1,1185 @@
<?php
-
/**************************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org
*
- * Written by Dave Hall [skwashd AT phpgroupware DOT org]
*
- *
------------------------------------------------------------------------ *
- * Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/
*
- * but quickly became a full rewrite
*
- *
------------------------------------------------------------------------ *
- * This program is free software; you can redistribute it and/or modify
it *
- * under the terms of the GNU General Public License as published by
the *
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\**************************************************************************/
-
+/**************************************************************************\
+* phpGroupWare - KnowledgeBase *
+* http://www.phpgroupware.org *
+* *
+* Copyright (c) 2003-2006 Free Sofware Foundation Inc *
+* Written by Dave Hall skwashd at phpgropware.org *
+* Written by Alejandro Pedraza <address@hidden> *
+* Headers unlawfuly removed by Alejandro Pedraza *
+* ------------------------------------------------------------------------ *
+* Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/ *
+* but quickly became a full rewrite
*
+* ------------------------------------------------------------------------ *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 2 of the License, or (at your *
+* option) any later version. *
+\**************************************************************************/
+
+ /* $Id: class.sokb.inc.php,v 1.19 2006/05/09 05:14:07 skwashd Exp $ */
+
+ /**
+ * Storage logic layer of the Knowledge Base
+ *
+ * Last Editor: $Author: skwashd $
+ * @author Dave Hall & Alejandro Pedraza
+ * @package phpbrain
+ * @version $Revision: 1.19 $
+ * @license GPL
+ **/
class sokb
{
+ /**
+ * Database object
+ *
+ * @access private
+ * @var object db
+ */
var $db;
-
+
+ /**
+ * Number of rows in result set
+ *
+ * @access public
+ * @var int
+ */
+ var $num_rows;
+
+ /**
+ * Number of unanswered questions in result set
+ *
+ * @access public
+ * @var int
+ */
+ var $num_questions;
+
+ /**
+ * Number of comments in result set
+ *
+ * @access public
+ * @var int
+ */
+ var $num_comments;
+
+ /**
+ * Type of LIKE SQL operator to use
+ *
+ * @access private
+ * @var string
+ */
+ var $like;
+
+ /**
+ * Class constructor
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ **/
function sokb()
{
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db = clone($GLOBALS['phpgw']->db);
+
+ // postgresql is case sensite by default, so make it case
insensitive
+ if ($this->db->Type == 'pgsql')
+ {
+ $this->like = 'ILIKE';
+ }
+ else
+ {
+ $this->like = 'LIKE';
+ }
}
- function delete_answer($faq_ids)
+ /**
+ * Returns array of articles
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $owners Users ids
accessible by current user
+ * @param array $categories Categories ids
+ * @param int $start For
pagination
+ * @param int $upper_limit For pagination
+ * @param srting $sort Sorting
direction: ASC | DESC
+ * @param string $order Sorting field
name
+ * @param mixed $publish_filter To filter pusblished or
unpublished entries
+ * @param string $query Search string
+ * @return array Articles
+ */
+ function search_articles($owners, $categories, $start,
$upper_limit = '', $sort, $order, $publish_filter = False, $query)
{
- if(is_array($faq_ids))
+ $order = $this->db->db_addslashes($order);
+ if ($sort != 'DESC') $sort = 'ASC';
+
+ // We use COALESCE (VALUE in case of maxdb) to turn
NULLs into zeros, to avoid some databases (postgres and maxdb, don't know about
mssql)
+ // to sort records with score NULL before records with
a score > 0.
+ $score = (($this->db->Type == 'maxdb')?
'VALUE(SUM(phpgw_kb_search.score), 0)' :
'SUM(COALESCE(phpgw_kb_search.score))') . ' AS pertinence';
+ // have to figure out later if maxdb is broken here...
+ $files_field = (($this->db->Type == 'maxdb')?
'VALUE(art_file)' : 'COUNT(COALESCE(art_file))') . ' AS files';
+
+ $fields = array('phpgw_kb_articles.art_id', 'title',
'topic', 'views', 'cat_id', 'published', 'user_id', 'created', 'modified',
'votes_1', 'votes_2', 'votes_3', 'votes_4', 'votes_5', $score, $files_field);
+ $fields_str = implode(', ', $fields);
+ $owners = implode(', ', $owners);
+
+ $sql = "SELECT $fields_str FROM phpgw_kb_articles LEFT
JOIN phpgw_kb_search ON phpgw_kb_articles.art_id=phpgw_kb_search.art_id ";
+ $sql .= "LEFT JOIN phpgw_kb_files ON
phpgw_kb_articles.art_id=phpgw_kb_files.art_id ";
+ $sql .= "WHERE user_id IN ($owners)";
+ if ($publish_filter && $publish_filter!='all')
{
- $i=0;
- foreach($faq_ids as $key => $val)
- {
- $this->db->query('DELETE FROM phpgw_kb_faq
WHERE faq_id=' . intval($key), __LINE__, __FILE__);
- $i++;
- }//end foreach(q_id)
+ ($publish_filter == 'published')?
$publish_filter = 1 : $publish_filter = 0;
+ $sql .= " AND published=$publish_filter";
+ }
+ if (!$categories)
+ {
+ $sql .= " AND cat_id = 0";
}
else
{
- $this->db->query('DELETE FROM phpgw_kb_faq
WHERE faq_id=' . intval($key), __LINE__, __FILE__);
- $i = 1;
- }//end is_type
- return $i;
- }//end delete_answer
-
- function delete_comment($comment_id)
- {
- $this->db->query('DELETE FROM phpgw_kb_comment WHERE
comment_id=' . intval($comment_id));
- //this really should only return true if rows affected
== 1
- return true;
- }
-
- function delete_question($question_ids)
- {
- if(is_array($question_ids))
- {
- $i=0;
- foreach($question_ids as $key => $val)
- {
- $this->db->query('DELETE FROM
phpgw_kb_questions WHERE question_id=' . intval($key), __LINE__, __FILE__);
- $i++;
- }//end foreach(q_id)
- }
- elseif(is_int($question_ids))
- {
- $this->db->query('DELETE FROM
phpgw_kb_questions WHERE question_id =' . intval($question_ids), __LINE__,
__FILE__);
- $i = 1;
- }//end is_type
- return $i;
- }//end delete question
-
- function get_stats()
- {
- $stats = array();
- /* how many faqs*/
- $this->db->query('SELECT COUNT(*) FROM phpgw_kb_faq
WHERE published = 1 AND is_faq = 0', __LINE__, __FILE__);
- $this->db->next_record();
- $stats['num_faqs'] = $this->db->f(0);
-
- /* how many tutorials? */
- $this->db->query('SELECT COUNT(*) FROM phpgw_kb_faq
WHERE published = 1 AND is_faq = 1', __LINE__, __FILE__);
- $this->db->next_record();
- $stats['num_tutes'] = $this->db->f(0);
-
- /* how many open questions? */
- $this->db->query('SELECT COUNT(*) FROM
phpgw_kb_questions WHERE pending = 0', __LINE__, __FILE__);
- $this->db->next_record();
- $stats['num_open'] = $this->db->f(0);
+ $categories = implode(",", $categories);
+ $sql .= " AND cat_id IN(" . $categories . ")";
+ }
+
+ if ($query)
+ {
+ $words_init = explode(' ', $query);
+ $words = array();
+ foreach ($words_init as $word_init)
+ {
+ $words[] =
$this->db->db_addslashes($word_init);
+ }
+ $likes = array();
+ foreach ($words as $word)
+ {
+ if ((int)$word)
+ {
+ $likes[] =
"phpgw_kb_articles.art_id='$word'";
+ break;
+ }
+ $likes[] = "title {$this->like}
'%$word%' OR topic {$this->like} '%$word%' OR text {$this->like} '%$word%'";
+ }
+ $likes = implode(' OR ', $likes);
- return $stats;
- }
-
- function get_latest()
- {
- /* latest questions */
- $this->db->limit_query('SELECT * FROM
phpgw_kb_questions WHERE pending = 0 ORDER BY question_id DESC', 0, __LINE__,
__FILE__, 3);
+ if ($likes)
+ {
+ // build query for results matching
keywords (these are the most relevant results, and so appear first)
+ $sql_keywords = $sql . " AND
(keyword='" . implode("' OR keyword='", $words) . "')";
- $questions = array();
- while($this->db->next_record())
+ // build query for the rest of results
(looking in title, topic and text only). These appear after the previous ones
are shown.
+ // I must use the negation of the
previous conditions to avoid shown repeated records
+ $sql_rest = $sql . " AND (keyword!='" .
implode("' AND keyword!='", $words) . "' AND $likes)";
+ }
+ }
+
+ // Group by on all fields to return unique records and
calculate pertinence scores
+ $groupby = " GROUP BY phpgw_kb_articles.art_id, title,
topic, views, cat_id, published, user_id, created, modified, votes_1, votes_2,
votes_3, votes_4, votes_5";
+ $order_sql = array();
+ if ($order)
{
- $questions[$this->db->f('question_id')] =
$this->db->f('question', true);
- }
- return $questions;
- }//end get latest
-
- function get_faq_list($cat_id = '', $unpublished = false)
- {
- $where = ((strlen($cat_id) != 0) ? 'cat_id=' .
intval($cat_id) . ' ' : '');
- $where .= ((strlen($where) > 0) ? 'AND ' : '');
- $where .= ($unpublished ? 'published = 0' : 'published
= 1');
- $this->db->query("SELECT * FROM phpgw_kb_faq WHERE
$where", __LINE__, __FILE__);
- while($this->db->next_record())
- {
- $faqs[$this->db->f('faq_id')] = array('title'
=> $this->db->f('title', true),
- 'text'
=> substr($this->db->f('text', true),0,50) . ' ...',
- 'modified'
=> $this->db->f('modified'),
- 'views'
=> $this->db->f('views'),
- 'votes'
=> $this->db->f('votes'),
- 'total'
=> $this->db->f('total')
- );
- }
- return $faqs;
- }
-
- function get_item($faq_id, $count_view)
- {
- $this->db->query('SELECT * FROM phpgw_kb_faq WHERE
faq_id=' . intval($faq_id), __LINE__, __FILE__);
- if($this->db->next_record())
- {
- $item = array('faq_id' =>
$this->db->f('faq_id'),
- 'title' =>
$this->db->f('title', true),
- 'text' =>
$this->db->f('text', true),
- 'cat_id' => (int)
$this->db->f('cat_id', true),
- 'published' =>
$this->db->f('published'),
- 'keywords' =>
$this->db->f('keywords', true),
- 'user_id' => (int)
$this->db->f('user_id'),
- 'views' => (int)
$this->db->f('views'),
- 'modified' => (int)
$this->db->f('modified'),
- 'type' => (int)
$this->db->f('type'),
- 'url' =>
$this->db->f('url', true),
- 'votes' => (int)
$this->db->f('votes'),
- 'total' => (int)
$this->db->f('total')
- );
-
- if($count_view)
- {
- $this->set_view($this->db->f('faq_id'));
- }
- }
- return $item;
- }
-
- function get_comments($faq_id)
- {
- $this->db->query('SELECT * FROM phpgw_kb_comment WHERE
faq_id=' . intval($faq_id), __LINE__, __FILE__);
- while($this->db->next_record())
- {
- $comment[$this->db->f('comment_id')] =
array('user_id' => $this->db->f('user_id'),
-
'comment_text' => $this->db->f('comment', true),
-
'entered' => $this->db->f('entered')
- );
- }
- return $comment;
- }
-
- function get_count($cat_id)
- {
- $this->db->query("SELECT COUNT(*) FROM phpgw_kb_faq WHERE cat_id =
$cat_id AND published = 1", __LINE__, __FILE__);
- if($this->db->next_record())
+ $order_sql[] = "$order $sort";
+ }
+ if ($query)
+ {
+ $order_sql[] = "pertinence DESC";
+ }
+ if (!$order && !$query)
+ {
+ $order_sql[] = "modified DESC";
+ }
+ $order_sql = ' ORDER BY ' . implode(',', $order_sql);
// only PHP lets me write crap like this
+
+ if ($query)
{
- return $this->db->f(0);
+ $sqls[0] = $sql_keywords.$groupby.$order_sql;
+ $sqls[1] = $sql_rest.$groupby.$order_sql;
}
else
{
- return 0;
+ $sqls[0] = $sql.$groupby.$order_sql;
}
- }//end get count
-
- function get_pending()
- {
- $this->db->query('SELECT faq_id, text FROM phpgw_kb_faq
WHERE published = 0', __LINE__, __FILE__);
- while($this->db->next_record())
+
+ //echo "sqls: "._debug_array($sqls);
+ $articles = array();
+ $this->num_rows = 0;
+ foreach ($sqls as $sql)
{
- $faq[$this->db->f('faq_id')] =
$this->db->f('text', true);
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->num_rows += $this->db->num_rows();
+ $this->db->limit_query($sql, $start, __LINE__,
__FILE__, $upper_limit);
+ $start = $this->db->num_rows();
+ $articles = array_merge($articles,
$this->results_to_array($fields));
}
- return $faq;
- }//end get pending
-
- function get_search_results($search, $show = null)
+ return $articles;
+ }
+
+ /**
+ * Returns results of advanced search
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $owners User ids
accessible by current user
+ * @param array $cats_ids Categories
filtering
+ * @param string $ocurrences Field name
where to search
+ * @param string $pub_date Articles from
last 3 or 6 months, or last year
+ * @param int $start For
pagination
+ * @param int $num_res For
pagination
+ * @param string $all_words 'with all the
words' filtering
+ * @param string $phrase 'exact phrase'
filtering
+ * @param string $one_word 'with at least
one of the words' filtering
+ * @param string $without_words 'without the words'
filtering
+ * @param int $cat Don't
know
+ * @param bool $include_subs Include subcategories
when filtering by categories. Seems to not being working
+ * @return array Articles
+ * @todo use params $cat and $include_subs
+ */
+ function adv_search_articles($owners, $cats_ids, $ocurrences,
$pub_date, $start, $num_res, $all_words, $phrase, $one_word, $without_words,
$cat, $include_subs)
{
- switch
(trim($GLOBALS['phpgw_info']['server']['db_type']))
+ $fields= array('phpgw_kb_articles.art_id', 'title',
'topic', 'views', 'cat_id', 'published', 'user_id', 'created', 'modified',
'votes_1', 'votes_2', 'votes_3', 'votes_4', 'votes_5');
+ $fields_str = implode(' , ', $fields);
+
+ // permissions filtering
+ $owners = implode(', ', $owners);
+ $sql = "SELECT DISTINCT $fields_str FROM
phpgw_kb_articles LEFT JOIN phpgw_kb_search ON
phpgw_kb_articles.art_id=phpgw_kb_search.art_id WHERE user_id IN ($owners)";
+
+ // categories filtering
+ $cats_ids = implode (',', $cats_ids);
+ if ($cats_ids) $sql .= " AND cat_id IN ($cats_ids)";
+
+ // date filtering
+ switch ($pub_date)
{
- /* This is not working - not sure why
- case 'mysql':
- $ver = explode('-',
mysql_get_server_info());
- $ver = $ver[0];
-
if($GLOBALS['phpgw']->common->cmp_version_long($ver, '3.23.23') <= 1)
- {
- return
$this->search_mysql($search, $show);
- }
- else
- {
- return
$this->search_ansisql($search, $show);
- }
+ case '3':
+ $sql .= " AND created>" . mktime(0, 0,
0, date('n')-3);
+ break;
+ case '6':
+ $sql .= " AND created>" . mktime(0, 0,
0, date('n')-6);
+ break;
+ case 'year':
+ $sql .= " AND created>" . mktime(0, 0,
0, date('n')-12);
+ break;
+ }
+
+ // ocurrences filtering
+ switch ($ocurrences)
+ {
+ case 'title':
+ $target_fields = array('title');
+ break;
+ case 'topic':
+ $target_fields = array('topic');
+ break;
+ case 'text':
+ $target_fields = array('text');
break;
- */
- //case 'pgsql': - //future use
- //case 'mssql': - //future use
default:
- return $this->search_ansisql($search,
$show);
- }//end case db
-
+ $target_fields = array('title',
'topic', 'keyword', 'text');
+ break;
+ }
+
+ // "with all the words" filtering
+ $all_words = $this->db->db_addslashes($all_words);
+ $all_words = strlen($all_words)? explode(' ',
$all_words) : False;
+ $each_field = array();
+ if ($all_words)
+ {
+ foreach ($all_words as $word)
+ {
+ $each_field[] = "(" . implode("
{$this->like} '%$word%' OR ", $target_fields) . " {$this->like} '%$word%')";
+ }
+ if ($each_field)
+ {
+ $sql .= " AND " . implode(" AND ",
$each_field);
+ }
+ }
+
+ // "with the exact phrase" filtering
+ $phrase = $this->db->db_addslashes($phrase);
+ if ($phrase)
+ {
+ $sql .= " AND (" . implode (" {$this->like}
'%$phrase%' OR ", $target_fields) . " {$this->like} '%$phrase%')";
+ }
+
+ // "With at least one of the words" filtering
+ $one_word = $this->db->db_addslashes($one_word);
+ $one_word = strlen($one_word)? explode(' ', $one_word)
: False;
+ if ($one_word)
+ {
+ $each_field = array();
+ foreach ($one_word as $word)
+ {
+ $each_field[] = "(" . implode("
{$this->like} '%$word' OR ", $target_fields) . " {$this->like} '%$word%')";
+ }
+ $sql .= " AND (". implode (" OR ", $each_field)
. ")";
+ }
+
+ // "Without the words" filtering
+ $without_words =
$this->db->db_addslashes($without_words);
+ $without_words = strlen($without_words)? explode(' ',
$without_words) : False;
+ $each_field = array();
+ if ($without_words)
+ {
+ foreach ($without_words as $word)
+ {
+ $each_field[] = "(" . implode(" NOT
{$this->like} '%word' AND ", $target_fields) . " NOT {$this->like} '%$word%')";
+ }
+ $sql .= " AND " . implode(" AND ", $each_field);
+ }
+
+ // do the query
+ //echo "query: $sql <br>";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->num_rows = $this->db->num_rows();
+ $this->db->limit_query($sql, $start, __LINE__,
__FILE__, $num_res);
+ return $this->results_to_array($fields);
+ }
+
+ /**
+ * Fetches results from database and returns array of articles
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param array $fields Which fields to fetch
+ * @return array Articles
+ */
+ function results_to_array($fields)
+ {
+ $articles = array();
+ for ($i=0; $this->db->next_record(); $i++)
+ {
+ foreach ($fields as $field)
+ {
+ if (preg_match('/.* AS (.*)/', $field, $matches)) {
+ $modified_field = $matches[1];
+ } else {
+ $modified_field = $field;
+ }
+ $articles[$i][$modified_field] =
$this->db->f($modified_field);
+ }
+ $articles[$i]['art_id'] =
$this->db->f('art_id');
+ $username =
$GLOBALS['phpgw']->accounts->get_account_name($articles[$i]['user_id'], $lid,
$fname, $lname);
+ $articles[$i]['username'] = $fname . ' ' .
$lname;
+ //$articles[$i]['files'] =
unserialize($articles[$i]['files']);
+ $articles[$i]['total_votes'] =
$articles[$i]['votes_1'] + $articles[$i]['votes_2'] + $articles[$i]['votes_3']
+ $articles[$i]['votes_4'] + $articles[$i]['votes_5'];
+ if ($articles[$i]['total_votes'])
+ {
+ $articles[$i]['average_votes'] =
(1*$articles[$i]['votes_1'] + 2*$articles[$i]['votes_2'] +
3*$articles[$i]['votes_3'] + 4*$articles[$i]['votes_4'] +
5*$articles[$i]['votes_5']) / ($articles[$i]['total_votes']);
+ }
+ else
+ {
+ $articles[$i]['average_votes'] = 0;
// avoid division by zero
+ }
+ }
+ return $articles;
}
- function get_questions($pending = false)
+ /**
+ * Upgrades phpgw_kb_search table given user input
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article ID
+ * @param string $word Keyword
+ * @param mixed $upgrade_key Whether to give more or
less score to $word
+ * @return void
+ */
+ function update_keywords($art_id, $word, $upgrade_key)
{
- $where = ($pending ? 'pending = 1' : 'pending = 0');
- $this->db->query("SELECT * FROM phpgw_kb_questions
WHERE $where", __LINE__, __FILE__);
- while($this->db->next_record())
+ $word = $this->db->db_addslashes(substr($word, 0, 30));
+
+ // retrieve current score
+ $sql = "SELECT score FROM phpgw_kb_search WHERE
keyword='$word' AND art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $keyword_exists = $this->db->next_record();
+ if ($keyword_exists && upgrade_key != 'same')
{
- $open_q[$this->db->f('question_id')] =
$this->db->f('question', true);
+ // upgrade score
+ $old_score = $this->db->f('score');
+ $new_score = $upgrade_key? $old_score + 1 :
$old_score - 1;
+ $sql = "UPDATE phpgw_kb_search SET
score=$new_score WHERE keyword='$word' AND art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
+ elseif (!$keyword_exists || $upgrade_key != 'same')
+ {
+ // create new entry for word
+ $sql = "INSERT INTO phpgw_kb_search (keyword,
art_id, score) VALUES('$word', $art_id, 1)";
+ $this->db->query($sql, __LINE__, __FILE__);
}
- return $open_q;
}
-
- function save($faq_id, $faq, $admin)
+
+ /**
+ * Returns unanswered questions
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $owners User ids
accessible by current user
+ * @param array $categories Categories ids
+ * @param int $start For
pagination
+ * @param int $upper_limit For pagination
+ * @param srting $sort Sorting
direction: ASC | DESC
+ * @param string $order Sorting field
name
+ * @param mixed $publish_filter To filter pusblished or
unpublished entries
+ * @param string $query Search string
+ * @return array
Questions
+ */
+ function unanswered_questions($owners, $categories, $start,
$upper_limit='', $sort, $order, $publish_filter=False, $query)
{
- if(is_int($faq_id) && is_array($faq))
+ $fields = array('question_id', 'user_id', 'summary',
'details', 'cat_id', 'creation', 'published');
+ $fields_str = implode(', ', $fields);
+ $owners = implode(', ', $owners);
+ $sql = "SELECT $fields_str FROM phpgw_kb_questions
WHERE user_id IN ($owners)";
+ if ($publish_filter && $publish_filter!='all')
+ {
+ ($publish_filter == 'published')?
$publish_filter = 1 : $publish_filter = 0;
+ $sql .= " AND published=$publish_filter";
+ }
+ if (!$categories)
+ {
+ $sql .= " AND cat_id = 0";
+ }
+ else
+ {
+ $categories = implode(",", $categories);
+ $sql .= " AND cat_id IN(" . $categories . ")";
+ }
+ if ($query)
+ {
+ $query = $this->db->db_addslashes($query);
+ $words = explode(' ', $query);
+ $sql .= " AND (summary {$this->like} '%" .
implode("%' OR summary {$this->like} '%", $words) . "%' OR details
{$this->like} '%" . implode("%' OR details {$this->like} '%", $words) . "%')";
+ }
+ if ($order)
{
- if($faq_id)//is new?
+ $sql .= " ORDER BY $order $sort";
+ }
+ //echo "sql: $sql <br><br>";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->num_rows = $this->db->num_rows();
+ $this->num_questions = $this->num_rows;
+ $this->db->limit_query($sql, $start, __LINE__,
__FILE__, $upper_limit);
+ $questions = array();
+ for ($i=0; $this->db->next_record(); $i++)
+ {
+ foreach ($fields as $field)
{
- $sql = 'UPDATE phpgw_kb_faq';
- $sql .= ' SET cat_id = ' .
intval($faq['cat_id']) . ',';
- $sql .= " title = '" .
$this->db->db_addslashes($faq['title']) . "',";
- $sql .= " keywords = '" .
$this->db->db_addslashes($faq['keywords']) . "',";
- $sql .= " text = '" .
$this->db->db_addslashes($faq['text']) . "',";
- $sql .= ' modified = ' . time() .',';
- $sql .= ' user_id = ' .
intval($faq['user_id']) .',';
- $sql .= ' published = ' .
($faq['published'] ? 1 : 0) . ', ';
- $sql .= ' is_faq = ' .
intval($faq['is_faq']) . ', ';
- $sql .= " url = '" .
$this->db->db_addslashes(urldecode($faq['url'])) ."'";
- $sql .= " WHERE faq_id = $faq_id";
- $this->db->query($sql, __LINE__,
__FILE__);
- if($this->db->affected_rows() == 1)
- {
- return $faq_id;
- }
- else//something went wrong
- {
- return false;
- }
+ $questions[$i][$field] =
$this->db->f($field);
}
- else//must be new
+ $username =
$GLOBALS['phpgw']->accounts->get_account_name($questions[$i]['user_id'], $lid,
$fname, $lname);
+ $questions[$i]['username'] = $fname . ' ' .
$lname;
+ }
+ return $questions;
+ }
+
+ /**
+ * Saves a new or edited article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $contents article contents
+ * @param bool $is_new True if it's a new
article, False if its an edition
+ * @param bool $publish True if the article is
to be published without revision
+ * @return mixed article id or
False if failure
+ **/
+ function save_article($contents, $is_new, $publish = False)
+ {
+ $current_time = time();
+ if ($is_new)
+ {
+ ($publish)? $publish = 1 : $publish = 0;
+ $q_id = $contents['answering_question']?
$contents['answering_question'] : 0;
+ $sql = "INSERT INTO phpgw_kb_articles (q_id,
title, topic, text, cat_id, published, user_id, created, modified,
modified_user_id, votes_1, votes_2, votes_3, votes_4, votes_5) VALUES ("
+ . "$q_id, '"
+ .
$this->db->db_addslashes($contents['title']) . "', '"
+ .
$this->db->db_addslashes($contents['topic']) . "', '"
+ .
$this->db->db_addslashes($contents['text']) . "', "
+ . (int) $contents['cat_id'] .
", "
+ . $publish . ", "
+ .
$GLOBALS['phpgw_info']['user']['account_id'] . ", "
+ . $current_time . ", " .
$current_time . ", "
+ .
$GLOBALS['phpgw_info']['user']['account_id'] . ", "
+ . " 0, 0, 0, 0, 0)";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $article_id =
$this->db->get_last_insert_id('phpgw_kb_articles', 'art_id');
+
+ // update table phpgw_kb_search with keywords.
Even if no keywords were introduced, generate an entry
+ $keywords = explode (' ',
$contents['keywords']);
+ foreach ($keywords as $keyword)
{
- $sql = 'INSERT INTO phpgw_kb_faq
(title, text, cat_id, published, keywords, user_id, views, modified, is_faq,
url) ';
- $sql .= "VALUES('" .
$this->db->db_addslashes($faq['title']) . "', ";
- $sql .= "'" .
$this->db->db_addslashes($faq['text']) . "', ";
- $sql .= intval($faq['cat_id']) . ", ";
- $sql .= ($faq['published'] ? 1 : 0) .
', ';
- $sql .= "'" .
$this->db->db_addslashes($faq['keywords']) . "',";
- $sql .= intval($faq['user_id']) . ', ';
- $sql .= '0, '; //views must be 0 for
new entries
- $sql .= time() . ', ';
- $sql .= $faq['is_faq'] . ', ';
- $sql .= "'" .
$this->db->db_addslashes(urldecode($faq['url'])) ."')";//url is decoded to make
sure it is not encoded already
+ $this->update_keywords($article_id,
$keyword, 'same');
+ }
+
+ // if publication is automatic and the article
answers a question, delete the question
+ if ($publish && $contents['answering_question'])
+ {
+ $sql = "DELETE FROM phpgw_kb_questions
WHERE question_id=$q_id";
$this->db->query($sql, __LINE__,
__FILE__);
- return
$this->db->get_last_insert_id('phpgw_kb_faq', 'faq_id');
- }//end is new
- }//end if is valid
- }//end save
-
- function set_active_answer($faq_ids)
+ }
+
+ return $article_id;
+ }
+ else
+ {
+ $sql = "UPDATE phpgw_kb_articles SET "
+ ." title='" .
$this->db->db_addslashes($contents['title'])
+ ."', topic='" .
$this->db->db_addslashes($contents['topic'])
+ ."', text='" .
$this->db->db_addslashes($contents['text'])
+ ."', cat_id='" .
(int)($contents['cat_id'])
+ ."', modified=" . $current_time
+ .", modified_user_id=" .
$GLOBALS['phpgw_info']['user']['account_id']
+ ." WHERE art_id=" .
$contents['editing_article_id'];
+ $this->db->query($sql, __LINE__, __FILE__);
+ $queries_ok = false;
+ if ($this->db->affected_rows()) $queries_ok =
true;
+
+ // update keywords
+ $keywords = explode (' ',
$contents['keywords']);
+ foreach ($keywords as $keyword)
+ {
+
$this->update_keywords($contents['editing_article_id'], $keyword, True, False);
+ }
+
+ if ($queries_ok)
+ {
+ return $contents['editing_article_id'];
+ }
+ else
+ {
+ return False;
+ }
+ }
+ }
+
+ /**
+ * Changes article owner when user is deleted
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $owner actual owner
+ * @param int $new_owner new owner
+ * @return void
+ **/
+ function change_articles_owner($owner, $new_owner)
+ {
+ $sql = "UPDATE phpgw_kb_articles SET
user_id='$new_owner' WHERE user_id='$owner'";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
+
+ /**
+ * Deletes article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return bool 1 on success, 0 on failure
+ **/
+ function delete_article($art_id)
+ {
+ $sql = "DELETE FROM phpgw_kb_articles WHERE
art_id=$art_id";
+ if (!$this->db->query($sql, __LINE__, __FILE__)) return
0;
+ return 1;
+ }
+
+ /**
+ * Deletes question
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $q_id Question id
+ * @return bool 1 on success, 0 on failure
+ **/
+ function delete_question($q_id)
{
- $i=0;
- foreach($faq_ids as $key => $val)
+ $sql = "DELETE FROM phpgw_kb_questions WHERE
question_id=$q_id";
+ if (!$this->db->query($sql, __LINE__, __FILE__)) return
0;
+ return 1;
+ }
+
+ /**
+ * Returns latest articles entered
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $parent_cat Category id
+ * @return array Articles
+ */
+ function get_latest_articles($parent_cat)
+ {
+ $sql = "SELECT art_id, title, topic, text, modified,
votes_1, votes_2, votes_3, votes_4, votes_5 FROM phpgw_kb_articles";
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $articles = array();
+ while ($this->db->next_record())
{
- $this->db->query('UPDATE phpgw_kb_faq SET
published = 1 WHERE faq_id=' . intval($key), __LINE__, __FILE__);
- $i++;
+ $rating = 1*$this->db->f('votes_1') +
2*$this->db->f('votes_2') + 3*$this->db->f('votes_3') +
4*$this->db->f('votes_4') + 5*$this->db->f('votes_5');
+ $articles[$this->db->f('art_id')] = array(
+ 'title' =>
$this->db->f('title'),
+ 'topic' =>
$this->db->f('topic'),
+ 'text' => $this->db->f('text'),
+ 'modified' =>
$this->db->f('modified'),
+ 'rating' => $rating
+ );
}
- return $i;
- }//end set_active_answer
- function set_active_question($question_ids)
+ return $articles;
+ }
+
+ /**
+ * Returns article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return array Article
+ **/
+ function get_article($art_id)
{
- $i=0;
- foreach($question_ids as $key => $val)
+ $fields = array('art_id', 'title', 'topic', 'text',
'views', 'cat_id', 'published', 'user_id', 'created', 'modified',
'modified_user_id', 'votes_1', 'votes_2', 'votes_3', 'votes_4', 'votes_5');
+ $fields_str = implode(", ", $fields);
+
+ $sql = "SELECT $fields_str FROM phpgw_kb_articles
WHERE art_id=$art_id";
+ //echo "sql: $sql <br>";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $article = array();
+ if (!$this->db->next_record()) return 0;
+ foreach ($fields as $field)
{
- $this->db->query('UPDATE phpgw_kb_questions SET
pending = 0 WHERE question_id=' .intval($key), __LINE__, __FILE__);
+ $article[$field] = $this->db->f($field);
+ }
+
+ // get article's attached files names
+ $this->db->query("SELECT art_file, art_file_comments
FROM phpgw_kb_files WHERE art_id=$art_id", __LINE__, __FILE__);
+ $article['files'] = array();
+ $i = 0;
+ while ($this->db->next_record())
+ {
+ $article['files'][$i]['file'] =
$this->db->f('art_file');
+ $article['files'][$i]['comment'] =
$this->db->f('art_file_comments');
$i++;
}
- return $i;
- }//end set_active_question
- function set_comment($comment_id, $comment_data)
- {
- if(!$comment_id)//must be new
+ // get article's attached urls
+ $this->db->query("SELECT art_url, art_url_title FROM
phpgw_kb_urls WHERE art_id=$art_id", __LINE__, __FILE__);
+ $article['urls'] = array();
+ $i = 0;
+ while ($this->db->next_record())
{
- $sql = 'INSERT INTO phpgw_kb_comment(user_id, comment,
entered, faq_id) ';
- $sql .= 'VALUES(' . intval($comment_data['user_id']) .
', ';
- $sql .=
"'".$this->db->db_addslashes($comment_data['comment']) . "'," . time() .','.
intval($comment_data['faq_id']) . ')';
+ $article['urls'][$i]['link'] =
$this->db->f('art_url');
+ $article['urls'][$i]['title'] =
$this->db->f('art_url_title');
+ $i++;
}
- else//must be an edit
+
+ // get article's keywords
+ $this->db->query("SELECT keyword FROM phpgw_kb_search
WHERE art_id=$art_id", __LINE__, __FILE__);
+ $article['keywords'] = array();
+ while ($this->db->next_record())
{
- $sql = 'UPDATE phpgw_kb_comment SET ';
- $sql .= "comment = '" .
$this->db->db_addslashes($comment_data['comment']) . "' ";
- $sql .= 'WHERE comment_id='.
intval($comment_id);
- }
- $this->db->query($sql, __LINE__, __FILE__);
+ $article['keywords'][] =
$this->db->f('keyword');
+ }
+ $article['keywords'] = implode(' ',
$article['keywords']);
+
+ // normalize vote frequence to the range 0 - 40
+ $votes = array();
+ $article['total_votes'] = $article['votes_1'] +
$article['votes_2'] + $article['votes_3'] + $article['votes_4'] +
$article['votes_5'];
+ if ($article['total_votes'])
+ {
+ $article['average_votes'] =
($article['votes_1'] + 2*$article['votes_2'] + 3*$article['votes_3'] +
4*$article['votes_4'] + 5*$article['votes_5']) / $article['total_votes'];
+ }
+ else
+ {
+ $article['average_votes'] = 0;
+ }
+
+ return $article;
+ }
+
+ /**
+ * Returns all articles ids from a given owner
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $owner owner id
+ * @return array Articles ids
+ **/
+ function get_articles_ids($owner)
+ {
+ $sql = "SELECT art_id FROM phpgw_kb_articles WHERE
user_id=$owner";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $articles_ids = array();
+ while ($this->db->next_record())
+ {
+ $articles_ids[] = $this->db->f('art_id');
+ }
+ return $articles_ids;
}
-
- //generic
- function search_ansisql($search, $show)
+ /**
+ * Increments the view count of a published article
+ *
+ * @author Alejandro Pedraza
+ * @param int $art_id article id
+ * @param int $current_count current view count
+ * @return void
+ **/
+ function register_view($art_id, $current_count)
{
- $select = 'SELECT * FROM phpgw_kb_faq ';
- $select .= 'WHERE published = 1 ';
- if(is_int($show))
+ $current_count ++;
+ $sql = "UPDATE phpgw_kb_articles SET
views=$current_count WHERE art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
+
+ /**
+ * Returns article's comments
+ *
+ * @author Alejandro Pedraza
+ * @param int $art_id article id
+ * @param int $limit Number of
comments to return
+ * @return array Comments
+ */
+ function get_comments($art_id, $limit)
+ {
+ $fields = array('comment_id', 'user_id', 'comment',
'entered', 'art_id', 'published');
+ $fields_str = implode(", ", $fields);
+ $sql = "SELECT " . $fields_str . " FROM
phpgw_kb_comment WHERE art_id=$art_id ORDER BY entered DESC";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $this->num_comments = $this->db->num_rows();
+ if ($limit)
{
- $select .= "AND is_faq = $show ";
+ $this->db->limit_query($sql, 0, __LINE__,
__FILE__, $limit);
}
- $search_words = explode(' ', $search);
- $cycle = 0;
- foreach($search_words as $id => $word)
+ $comments = array();
+ for ($i=0; $this->db->next_record(); $i++)
{
- if($cycle)
+ foreach ($fields as $field)
{
- $title .= "OR title LIKE '%" .
$this->db->db_addslashes($word) . "%' ";
- $keywords .= "OR keywords LIKE '%" .
$this->db->db_addslashes($word) . "%' ";
- $text .= "OR text LIKE '%" .
$this->db->db_addslashes($word) . "%' ";
- }
- else
- {
- $title .= "(title LIKE '%" .
$this->db->db_addslashes($word) . "%' ";
- $keywords .= "(keywords LIKE '%" .
$this->db->db_addslashes($word) . "%' ";
- $text .= "(text LIKE '%" .
$this->db->db_addslashes($word) . "%' ";
+ $comments[$i][$field] =
$this->db->f($field);
}
+
$GLOBALS['phpgw']->accounts->get_account_name($comments[$i]['user_id'], $lid,
$fname, $lname);
+ $comments[$i]['username'] = $fname . ' ' .
$lname;
}
- $title .= ") ";
- $keywords .= ") ";
- $text .= ") ";
-
- $sql = $select . 'AND' . $title . 'OR' . $keywords .
'OR' . $text;
+ return $comments;
+ }
+
+ /**
+ * Delete article's comments
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return void
+ */
+ function delete_comments($art_id)
+ {
+ $sql = "DELETE FROM phpgw_kb_comment WHERE
art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
+
+ /**
+ * Delete article's ratings
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return void
+ */
+ function delete_ratings($art_id)
+ {
+ $sql = "DELETE FROM phpgw_kb_ratings WHERE
art_id=$art_id";
$this->db->query($sql, __LINE__, __FILE__);
- while($this->db->next_record())
+ }
+
+ /**
+ * Delete article's file entries in phpgw_kb_files
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @param string $file_to_erase File name
+ * @return bool 1 on
success, 0 on failure
+ */
+ function delete_files($art_id, $file_to_erase = false)
+ {
+ $files = '';
+ if ($file_to_erase)
{
- $rows[$this->db->f('faq_id')] =
$this->db->Record;
- $rows[$this->db->f('faq_id')]['score'] = 0.00;
+ $file_to_erase =
$this->db->db_addslashes($file_to_erase);
+ $files = " AND art_file='$file_to_erase'";
}
- return $rows;
- }//end search ansisql
+ $sql = "DELETE FROM phpgw_kb_files WHERE
art_id=$art_id$files";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if ($this->db->affected_rows()) return True;
+ return False;
+ }
+
+ /**
+ * Delete article's urls
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return void
+ */
+ function delete_urls($art_id)
+ {
+ $sql = "DELETE FROM phpgw_kb_urls WHERE art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
- function search_mysql($search, $show)//broken
+ /**
+ * Returns an article related comments
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article id
+ * @param array $owners Accessible owners to current
user
+ * @return array IDs and titles of articles
+ */
+ function get_related_articles($art_id, $owners)
{
- $sql = 'SELECT *, ';
- $sql .= "MATCH text,keywords,title AGAINST('" .
$this->db->db_addslashes($search) ."') AS score ";
- $sql .= 'FROM phpgw_kb_faq ';
- $sql .= 'WHERE published = 1 ';
- if(is_int($show))
+ $owners = implode(', ', $owners);
+ $sql = "SELECT phpgw_kb_articles.art_id,
phpgw_kb_articles.title FROM phpgw_kb_related_art, phpgw_kb_articles WHERE
phpgw_kb_related_art.related_art_id=phpgw_kb_articles.art_id AND
phpgw_kb_related_art.art_id=$art_id AND phpgw_kb_articles.user_id IN ($owners)";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $related = array();
+ while ($this->db->next_record())
{
- $sql .= "AND is_faq = $show ";
+ $related[] = array('art_id' =>
$this->db->f('art_id'), 'title' => $this->db->f('title'));
}
- //$sql .= 'HAVING (score > 0.25) '; //- this isn't
working properly afaik
- $sql .= 'ORDER BY score DESC';
+ return $related;
+ }
+
+ /**
+ * Tells if the current user has already rated the article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return bool 1 if he has, 0
if not
+ **/
+ function user_has_voted($art_id)
+ {
+ $sql = "SELECT * FROM phpgw_kb_ratings WHERE user_id="
. $GLOBALS['phpgw_info']['user']['account_id'] . " AND art_id=$art_id";
$this->db->query($sql, __LINE__, __FILE__);
- while($this->db->next_record())
+ if ($this->db->next_record()) return 1;
+ return 0;
+ }
+
+ /**
+ * Stores new comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param string $comment comment text
+ * @param int $art_id article id
+ * @param bool $publish True if comment is to
be published, False if not
+ * @return bool 1 on success, 0
on failure
+ **/
+ function add_comment($comment, $art_id, $publish)
+ {
+ $comment = $this->db->db_addslashes($comment);
+ ($publish)? $publish = 1 : $publish = 0;
+ $sql = "INSERT INTO phpgw_kb_comment (user_id, comment,
entered, art_id, published) VALUES("
+ .
$GLOBALS['phpgw_info']['user']['account_id'] . ", '$comment', " . time() . ",
$art_id, $publish)";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if (!$this->db->affected_rows()) return 0;
+ return 1;
+ }
+
+ /**
+ * Adds link to article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param string $url Url
+ * @param string $title Url title
+ * @param int $art_id article id
+ * @return bool 1 on success, 0
on failure
+ */
+ function add_link($url, $title, $art_id)
+ {
+ $sql = "INSERT INTO phpgw_kb_urls (art_id, art_url,
art_url_title) VALUES ($art_id, '$url', '$title')";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if (!$this->db->affected_rows()) return 0;
+ return 1;
+ }
+
+ /**
+ * Publishes article, and resets creation and modification date
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return int Numbers
of lines affected (should be 1, if not there's an error)
+ **/
+ function publish_article($art_id)
+ {
+ $sql = "UPDATE phpgw_kb_articles SET published=1,
created=". time() . ", modified=" . time() . " WHERE art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ // check if the article answers a question, and if so,
delete it
+ $sql = "SELECT q_id FROM phpgw_kb_articles WHERE
art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if ($this->db->next_record())
{
- $rows[$this->db->f('faq_id')] =
$this->db->Record;
+ $sql = "DELETE FROM phpgw_kb_questions WHERE
question_id=".$this->db->f('q_id');
+ $this->db->query($sql, __LINE__, __FILE__);
}
- return $rows;
- }//end search mysql
-
- function set_rating($faq_id, $rating)
+
+ return True;
+ }
+
+ /**
+ * Publishes question
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $q_id Question id
+ * @return int Numbers
of lines affected (should be 1, if not there's an error)
+ **/
+ function publish_question($q_id)
+ {
+ $sql = "UPDATE phpgw_kb_questions SET published=1 WHERE
question_id=$q_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ return ($this->db->affected_rows());
+ }
+
+ /**
+ * Publishes article comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article ID
+ * @param int $comment_id Comment ID
+ * @return int Numbers of
lines affected (should be 1, if not there's an error)
+ */
+ function publish_comment($art_id, $comment_id)
+ {
+ $sql = "UPDATE phpgw_kb_comment SET published=1 WHERE
art_id=$art_id AND comment_id=$comment_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ return ($this->db->affected_rows());
+ }
+
+ /**
+ * Deletes article comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article ID
+ * @param int $comment_id Comment ID
+ * @return int Numbers of
lines affected (should be 1, if not there's an error)
+ */
+ function delete_comment($art_id, $comment_id)
+ {
+ $sql = "DELETE FROM phpgw_kb_comment WHERE
art_id=$art_id AND comment_id=$comment_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ return ($this->db->affected_rows());
+ }
+
+ /**
+ * Deletes article comment
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article ID
+ * @param int $delete_link Link ID
+ * @return bool 1 on success, 0
on failure
+ */
+ function delete_link($art_id, $delete_link)
{
- $this->db->query("UPDATE phpgw_kb_faq "
- .'SET votes=votes+1,
total=total+' . intval($rating) . ' '
- .'WHERE faq_id=' .
intval($faq_id),__LINE__, __FILE__
- );
- }//end set rating
-
- function set_question($question, $admin)
+ $delete_link = $this->db->db_addslashes($delete_link);
+ $sql = "DELETE FROM phpgw_kb_urls WHERE art_id=$art_id
AND art_url='$delete_link'";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if (!$this->db->affected_rows()) return 0;
+ return 1;
+ }
+
+ /**
+ * Increments vote_x in table
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article id
+ * @param int $rating Rating between
1 and 5
+ * @param int $current_rating Number of current votes
in that rating
+ * @return bool 1 on success, 0
on failure
+ **/
+ function add_vote($art_id, $rating, $current_rating)
{
- $sql = 'INSERT INTO phpgw_kb_questions(question,
pending) ';
- $sql .= "VALUES('" .
$this->db->db_addslashes($question) ."', ";
- $sql .= ($admin ? 0 : 1) .')';
+ $new_rating = $current_rating + 1;
+ $sql = "UPDATE phpgw_kb_articles SET votes_" . $rating
. "=$new_rating WHERE art_id=$art_id";
$this->db->query($sql, __LINE__, __FILE__);
- if($this->db->get_last_insert_id('phpgw_kb_questions',
' question_id'))//worked
+ if (!$this->db->affected_rows()) return 0;
+ return 1;
+ }
+
+ /**
+ * Registers that actual user has voted this article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return bool 1 on success, 0 on
failure
+ **/
+ function add_rating_user($art_id)
+ {
+ $sql = "INSERT INTO phpgw_kb_ratings (user_id, art_id)
VALUES(" . $GLOBALS['phpgw_info']['user']['account_id'] . ", $art_id)";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if (!$this->db->affected_rows()) return 0;
+ return 1;
+ }
+
+ /**
+ * Register file upload in the article's database record
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $article_id Article id
+ * @param string $file_name File name
+ * @return bool 1 on success, 0 on
failure
+ */
+ function add_file($article_id, $file_name)
+ {
+ $file_name = $this->db->db_addslashes($file_name);
+ $comment = $_POST['file_comment']?
$_POST['file_comment'] : '';
+ $comment = $this->db->db_addslashes($comment);
+
+ $sql = "INSERT INTO phpgw_kb_files (art_id, art_file,
art_file_comments) VALUES($article_id, '$file_name', '$comment')";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if (!$this->db->next_record()) return 0;
+ return 1;
+ }
+
+ /**
+ * Checks if there is already an article in the db with the
given ID
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id article id
+ * @return bool 1 if there is
one, 0 if not
+ **/
+ function exist_articleID($article_id)
+ {
+ $sql = "SELECT art_id FROM phpgw_kb_articles WHERE
art_id=" . $article_id;
+ $this->db->query($sql, __LINE__, __FILE__);
+ return $this->db->next_record();
+ }
+
+ /**
+ * Returns ids of owners of articles
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $articles Ids of articles
+ * @return array Article ids and
owners ids
+ */
+ function owners_list($articles)
+ {
+ $articles = implode(', ', $articles);
+ $sql = "SELECT art_id, user_id FROM phpgw_kb_articles
WHERE art_id IN($articles)";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $owners = array();
+ while ($this->db->next_record())
{
- return true;
+ $owners[] = array('art_id' =>
$this->db->f('art_id'), 'user_id' => $this->db->f('user_id'));
}
- else//must have failed
+ return $owners;
+ }
+
+ /**
+ * Adds related article to article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article id
+ * @param array $articles Articles id to relate
to $art_id
+ * @return bool 1 on success, 0
on failure
+ */
+ function add_related($art_id, $articles)
+ {
+ $added = False;
+ foreach ($articles as $article)
{
- return false;
- }//end if worked
- }//end set question
+ $sql = "INSERT INTO phpgw_kb_related_art
(art_id, related_art_id) VALUES($art_id, $article)";
+ $this->db->query($sql, __LINE__, __FILE__);
+ if ($this->db->affected_rows()) $added = True;
+ }
+ return $added;
+ }
- function set_view($faq_id)
+ /**
+ * Deletes related article to article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article id
+ * @param int $related_id Article id to
delete
+ * @return void
+ */
+ function delete_related($art_id, $related_id, $all = False)
{
- $this->db->query("UPDATE phpgw_kb_faq "
- ."SET views=views+1 "
- .'WHERE faq_id=' .
intval($faq_id),__LINE__, __FILE__
- );
+ $sql_operator = $all? 'OR' : 'AND';
+ $sql = "DELETE FROM phpgw_kb_related_art WHERE
art_id=$art_id $sql_operator related_art_id=$related_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
+
+ /**
+ * Deletes entry in keywords table
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $art_id Article id
+ * @return void
+ */
+ function delete_search($art_id)
+ {
+ $sql = "DELETE FROM phpgw_kb_search WHERE
art_id=$art_id";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
+
+ /**
+ * Adds question to database
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param array $data Question data
+ * @param bool $publish Whether to publish the
question or not
+ * @return int Numbers of
lines affected (should be 1, if not there's an error)
+ */
+ function add_question($data, $publish)
+ {
+ ($publish)? $publish = 1 : $publish = 0;
+ $sql = "INSERT INTO phpgw_kb_questions (user_id,
summary, details, cat_id, creation, published) VALUES ("
+ .
$GLOBALS['phpgw_info']['user']['account_id'] . ", '"
+ .
$this->db->db_addslashes($data['summary']) . "', '"
+ .
$this->db->db_addslashes($data['details']) . "', "
+ . (int)$data['cat_id'] . ", "
+ . time() . ", "
+ . $publish . ")";
+ $this->db->query($sql, __LINE__, __FILE__);
+ return $this->db->affected_rows();
+ }
+
+ /**
+ * Returns question
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param int $q_id Question id
+ * @return array Question
+ */
+ function get_question($q_id)
+ {
+ $fields = array('user_id', 'summary', 'details',
'cat_id', 'creation');
+ $fields_str = implode(", ", $fields);
+
+ $sql = "SELECT $fields_str FROM phpgw_kb_questions
WHERE question_id=$q_id AND published=1";
+ $this->db->query($sql, __LINE__, __FILE__);
+ $question = array();
+ while ($this->db->next_record())
+ {
+ foreach ($fields as $field)
+ {
+ $question[$field] =
$this->db->f($field);
+ }
+ }
+ return $question;
}
-
}
?>
Index: phpbrain/inc/class.uikb.inc.php
diff -u phpbrain/inc/class.uikb.inc.php:1.18
phpbrain/inc/class.uikb.inc.php:1.19
--- phpbrain/inc/class.uikb.inc.php:1.18 Sun May 15 12:43:37 2005
+++ phpbrain/inc/class.uikb.inc.php Tue May 9 05:14:07 2006
@@ -1,940 +1,2077 @@
<?php
- /**********************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org *
- * This program is part of the GNU project, see http://www.gnu.org/ *
- * *
- * Copyright 2003 Free Software Foundation, Inc. *
- * *
- * Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
- * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * --------------------------------------------
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * at your option) any later version. *
- \**********************************************************************/
- /* $Id: class.uikb.inc.php,v 1.18 2005/05/15 12:43:37 skwashd Exp $ */
-
+/**************************************************************************\
+* phpGroupWare - KnowledgeBase *
+* http://www.phpgroupware.org *
+* *
+* Copyright (c) 2003-2006 Free Sofware Foundation Inc *
+* Written by Dave Hall skwashd at phpgropware.org *
+* Written by Alejandro Pedraza <address@hidden> *
+* Headers unlawfuly removed by Alejandro Pedraza *
+* ------------------------------------------------------------------------ *
+* Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/ *
+* but quickly became a full rewrite
*
+* ------------------------------------------------------------------------ *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 2 of the License, or (at your *
+* option) any later version. *
+\**************************************************************************/
+
+ /* $Id: class.uikb.inc.php,v 1.19 2006/05/09 05:14:07 skwashd Exp $ */
+
+ /**
+ * User Interface layer of the Knowledge Base
+ *
+ * Last Editor: $Author: skwashd $
+ * @author Dave Hall & Alejandro Pedraza
+ * @package phpbrain
+ * @version $Revision: 1.19 $
+ * @license GPL
+ **/
class uikb
{
+ /**
+ * Array of public functions in this class
+ *
+ * @access public
+ * @var array
+ */
+ var $public_functions = array( 'index'
=> True,
+
'advsearch' => True,
+
'edit_article' => True,
+
'view_article' => True,
+
'mail_article' => True,
+
'pop_search' => True,
+
'download_file' => True,
+
'add_question' => True,
+
'maintain_articles' => True,
+
'maintain_questions' => True,
+ );
+
+ /**
+ * Success or error messages
+ *
+ * @access private
+ * @var string
+ */
+ var $message;
+
+ /**
+ * To keep track if the nav bar has already been shown
+ *
+ * @access private
+ * @var bool
+ */
+ var $navbar_shown = False;
+
+ /**
+ * Business Object
+ *
+ * @access private
+ * @var object bo
+ */
var $bo;
- var $edit_vals;
- var $cats;
+
+ /**
+ * Template Object
+ *
+ * @access private
+ * @var object template
+ */
var $t;
- var $theme;
- var $public_functions = array('index' => True,
- 'add' => True,
- 'add_comment' => True,
- 'add_question' => True,
- 'browse' => True,
- 'confirm_delete'=> True,
- 'css' => True,
- 'delete_comment'=> True,
- 'edit' => True,
- 'maint_answer' => True,
- 'maint_question'=> True,
- 'preview' => True,
- 'rate' => True,
- 'save' => True,
- 'search' => True,
- 'unanswered' => True,
- 'view' => True,
- 'help' => True,
- );
-
- function uikb()
+
+ /**
+ * Categories to show
+ *
+ * @access private
+ * @var array
+ */
+ var $categories;
+
+ /**
+ * All categories accessible by user
+ *
+ * @access private
+ * @var array
+ */
+ var $all_categories;
+
+ /**
+ * Categories path
+ *
+ * @access private
+ * @var string
+ */
+ var $path = '';
+
+ /**
+ * Whether using sitemgr or not
+ *
+ * @access private
+ * @var bool
+ */
+ var $sitemgr;
+
+ /**
+ * Link string
+ *
+ * @access private
+ * @var string
+ */
+ var $link;
+
+ /**
+ * If using sitemgr, whether to allow question posting or not
+ *
+ * @access private
+ * @var bool
+ */
+ var $allow_questions = False;
+
+ /**
+ * Class constructor, instanciates bo class and auxiliary API
classes, and reads confirmation messages
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @param bool $sitemgr True if accessed
through sitemgr
+ * @param string $link link prefix to use if
accessed through sitemgr
+ * @param array $arguments Arguments passed by
sitemgr
+ */
+ function uikb($sitemgr=False, $link=False, $arguments=False)
{
- $this->bo = createObject('phpbrain.bokb');
- $this->cats = CreateObject('phpgwapi.categories');
- $this->theme = $GLOBALS['phpgw_info']['theme'];
- $this->t = &$GLOBALS['phpgw']->template;
- $this->t->unknowns = 'remove';
+ $this->sitemgr =
$sitemgr;
+ if ($link)
+ {
+ $this->link
= $link;
+
$GLOBALS['phpgw']->translation->add_app('phpbrain');
+ }
+ else
+ {
+ $this->link
= '/index.php';
+ }
+ $this->bo
= CreateObject('phpbrain.bokb');
+ if ($sitemgr)
+ {
+ $this->t
= CreateObject('phpgwapi.Template', $this->sitemgr);
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs', True);
+ $this->nextmatchs->template =
createobject('phpgwapi.Template', $this->sitemgr);
+ $this->nextmatchs->template->set_file(array(
+ '_nextmatchs' => 'nextmatchs.tpl'
+ ));
+
$this->nextmatchs->template->set_block('_nextmatchs','nextmatchs');
+
$this->nextmatchs->template->set_block('_nextmatchs','filter');
+
$this->nextmatchs->template->set_block('_nextmatchs','form');
+
$this->nextmatchs->template->set_block('_nextmatchs','icon');
+
$this->nextmatchs->template->set_block('_nextmatchs','link');
+
$this->nextmatchs->template->set_block('_nextmatchs','search');
+
$this->nextmatchs->template->set_block('_nextmatchs','cats');
+
$this->nextmatchs->template->set_block('_nextmatchs','search_filter');
+
$this->nextmatchs->template->set_block('_nextmatchs','cats_search_filter');
+ }
+ else
+ {
+ $this->t
= $GLOBALS['phpgw']->template;
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ }
+ if (isset($arguments['post_questions']) &&
$arguments['post_questions'] == 'on')
+ {
+ $this->allow_questions = True;
+ }
+
+ $this->message =
get_var('message', 'any', '');
+ if ($this->bo->messages_array[$this->message])
+ {
+ $this->message =
lang($this->bo->messages_array[$this->message]);
+ }
}
-
+
+ /**
+ * Shows main screen
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return mixed Returns output string if accessed
through sitemgr
+ */
function index()
{
- $this->browse();
- }
+ $category_passed = (int) $_REQUEST['cat'];
- function add()
- {
- if(isset($_GET['question']) &&
isset($_GET['question_id']))
- {
- $this->edit_vals['title'] =
urldecode(trim($_GET['question']));
- $this->edit_vals['question_id'] =
trim($_GET['question_id']);
- }//end if question
- $this->edit_answer(True);
- }//end add
+ $this->t->set_file('main', 'main.tpl');
+ $this->t->set_block('main', 'articles_block',
'articles');
+ $this->t->set_block('main',
'articles_navigation_block', 'articles_navigation');
+ $this->t->set_block('main', 'articles_latest_block',
'articles_latest');
+ $this->t->set_block('main',
'articles_mostviewed_block', 'articles_mostviewed');
+ $this->t->set_block('main',
'unanswered_questions_block', 'unanswered_questions');
+ $this->t->set_var(array(
+ 'lang_last_modified' =>
lang('Last Modified'),
+ 'message' =>
$this->message,
+ 'search_tpl' =>
$this->show_basic_search(),
+ ));
+
+ if(!$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = True;
- function add_comment()
- {
- $comment_id = (isset($_POST['comment_id']) ?
trim($_POST['comment_id']) : 0);
- $comment_data['faq_id'] = (isset($_POST['faq_id']) ?
trim($_POST['faq_id']) : 0);
- $comment_data['comment'] = (isset($_POST['comment']) ?
trim($_POST['comment']) : '');
-
- if($comment_id)
+ $this->t->set_var('links_nav' ,'');
+ }
+ elseif($this->allow_questions)
{
- $link['menuaction'] =
'phpbrain.uikb.edit_comments';
+ $this->t->set_var('links_nav', "<a href='".
$this->link('menuaction=phpbrain.uikb.index') ."'>". lang('Main View',
'phpbrain') ."</a> | <a href='".
$this->link('menuaction=phpbrain.uikb.add_question') ."'>". lang('Add
Question') ."</a> |<br>");
}
else
{
- $link['menuaction'] = 'phpbrain.uikb.view';
+ $this->t->set_var('link_add_question', "<a
href='". $this->link('menuaction=phpbrain.uikb.index') ."'>". lang('Main View',
'phpbrain') ."</a> |<br><br>");
}
- if($comment_data['faq_id'] && $comment_data['comment'])
+ // *** SHOW CATEGORIES (not if searching) ***
+ if (!$this->bo->query && !$_POST['adv_search'])
{
- $this->bo->set_comment($comment_id,
$comment_data);
- $link['faq_id'] =
$comment_data['faq_id'];
- $link['msg'] = 'comment_added';
+ $parent_id = 0;
+ $show_path = '';
+ if ($category_passed)
+ {
+ $parent_cat =
$this->bo->return_single_category($category_passed);
+ list(,$parent_cat) = each($parent_cat);
+ $parent_id = $parent_cat['id'];
+ $this->path= '';
+ $show_path = lang ('You are in %1',
$this->category_path($category_passed, True));
+ }
+
+ $this->bo->load_categories($category_passed);
+ $num_main_categories = 0;
+ foreach ($this->bo->categories as $cat)
+ {
+ if ($cat['parent'] == $parent_id)
$num_main_categories ++;
+ }
+ $show_categories =
$this->build_categories($parent_id, $num_main_categories);
+ $tr_class = $this->sitemgr? 'divSideboxHeader'
: 'th';
+ if (!$show_categories)
+ {
+ if ($category_passed)
+ {
+ $browse_cats = '';
+ $show_categories = '';
+ }
+ elseif (!$this->sitemgr)
+ {
+ $browse_cats = "<tr
class='$tr_class'><td align=left><b>" . lang('Or browse the categories') .
"</b></td></tr>";
+ $show_categories = "<span
style='text-align:center'>" . lang("To create categories, press 'Edit
Categories' in the preferences menu") . "</span>";
+ }
+ else
+ {
+ $browse_cats = '';
+ }
+ }
+
+ if (!$category_passed &&
($this->bo->preferences['show_tree'] == 'only_cat'))
+ {
+ $lang_articles = lang('Articles not
classified under any category');
+ }
+ elseif (!$category_passed &&
($this->bo->preferences['show_tree'] == 'all'))
+ {
+ $lang_articles = lang('All articles');
+ }
+ elseif (($category_passed &&
($this->bo->preferences['show_tree'] == 'only_cat')) || !$this->bo->categories)
+ {
+ $lang_articles = lang('Articles in %1',
$parent_cat['name']);
+ }
+ else
+ {
+ $lang_articles = lang('Articles in %1
and all its subcategories', $parent_cat['name']);
+ }
}
else
{
- $link['msg'] = 'comment_invalid';
+ $browse_cats = '';
+ $show_categories = '';
+ $show_path = '';
+ $lang_articles = lang('Search results');
+ $this->bo->load_categories($this->bo->cat);
}
+
+ $this->t->set_var(array(
+ 'browse_cats' => $browse_cats,
+ 'categories' => $show_categories,
+ 'path' => $show_path
+ ));
+
+ // *** SHOW ARTICLES LIST ***
+ // results from advanced search
+ if ($_POST['adv_search'])
+ {
+ $articles_list =
$this->bo->adv_search_articles();
+ }
+ // normal browsing or basic search
+ else
+ {
+ $articles_list =
$this->bo->search_articles($category_passed, 'published');
+ }
+ // echo "articles list:
<pre>";print_r($articles_list);echo "</pre>";
+ if (!$articles_list)
+ {
+ $this->t->set_var(array(
+ 'articles_navigation' => "<br>----- "
. lang('There are no articles') . "-----",
+ 'articles'
=> ''
+ ));
+ }
+ else
+ {
+ if ($this->sitemgr)
$this->nextmatchs->template->set_var('action_sitemgr',
$this->link('menuaction=phpbrain.uikb.index'));
+ $this->t->set_var(array(
+ 'left' =>
$this->nextmatchs->left($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction=phpbrain.uikb.index&cat='.$category_passed),
+ 'right' =>
$this->nextmatchs->right($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction=phpbrain.uikb.index&cat='.$category_passed),
+ 'num_regs' =>
$this->nextmatchs->show_hits($this->bo->num_rows, $this->bo->start)
+ ));
+ $this->t->parse('articles_navigation',
'articles_navigation_block');
+
+ foreach ($articles_list as $article_preview)
+ {
+ if ($article_preview['total_votes'])
// only show stars if article has been rated
+ {
+ $img_stars = "<img src='" .
$GLOBALS['phpgw']->common->image('phpbrain',
round($article_preview['average_votes']) . 'stars') . "' width=50 height=10>";
+ }
+ else
+ {
+ $img_stars = '';
+ }
+ if ($article_preview['files'])
+ {
+ $attachment = "<img src='" .
$GLOBALS['phpgw']->common->image('phpbrain', 'attach') . "'>";
+ }
+ else
+ {
+ $attachment = '';
+ }
+
+ $query = $this->bo->query? '&query=' .
urlencode($this->bo->query) : '';
+ $this->path = ''; // have always to
reset this before calling category_path()
+ $category_path =
$this->category_path($article_preview['cat_id']);
+ $this->t->set_var(array(
+ 'art_num' =>
$article_preview['art_id'],
+ 'art_href' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' .
$article_preview['art_id'] . $query),
+ 'art_title' =>
$article_preview['title'],
+ 'art_date' =>
$GLOBALS['egw']->common->show_date($article_preview['modified'],
$GLOBALS['egw_info']['user']['preferences']['common']['dateformat'] . ' H:i'),
+ 'img_stars' =>
$img_stars,
+ 'attachment' => $attachment,
+ 'art_category' =>
$category_path? lang('in %1', $category_path) : '',
+ 'art_topic' =>
$article_preview['topic']
+ ));
+ $this->t->parse('articles',
'articles_block', True);
+ }
+ }
+ $this->t->set_var('lang_articles', $lang_articles);
+
+ // *** SHOW LATEST ARTICLES LIST ***
+ if (!$articles_latest =
$this->bo->return_latest_mostviewed($category_passed, 'created'))
+ {
+ $this->t->set_var('articles_latest', "<tr><td
colspan=2 align=center><br>----- " . lang('None') . " -----</td></tr>");
+ }
+
+ for ($i=0; $i<sizeof($articles_latest); $i++)
+ {
+ $unpublished =
$articles_latest[$i]['published']? '' : '(' . lang('unpublished') . ')';
+ $this->path = '';
+ $category_path =
$this->category_path($articles_latest[$i]['cat_id']);
+ $this->t->set_var(array(
+ 'line_num' => $i+1,
+ 'art_href' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' .
$articles_latest[$i]['art_id']),
+ 'art_title' =>
$articles_latest[$i]['title'],
+ 'unpublished' => $unpublished,
+ 'art_date' =>
$GLOBALS['phpgw']->common->show_date($articles_latest[$i]['created'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+ 'art_category' => $category_path?
lang('in %1', $category_path) : ''
+ ));
+ $this->t->parse('articles_latest',
'articles_latest_block', True);
+ }
+ $this->t->set_var('lang_latest', lang('Latest'));
+
+ // *** SHOW MOST POPULAR ARTICLES LIST ***
+ if (!$most_viewed=
$this->bo->return_latest_mostviewed($category_passed, 'views'))
+ {
+ $this->t->set_var('articles_mostviewed',
"<tr><td colspan=2 align=center><br>----- " . lang('None') . "
-----</td></tr>");
+ }
+
+ for ($i=0; $i<sizeof($most_viewed); $i++)
+ {
+ $unpublished = $most_viewed[$i]['published']?
'' : '(' . lang('unpublished') . ')';
+ $this->path = '';
+ $this->t->set_var(array(
+ 'line_num' => $i+1,
+ 'art_href' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' .
$most_viewed[$i]['art_id']),
+ 'art_title' =>
$most_viewed[$i]['title'],
+ 'unpublished' => $unpublished,
+ 'art_category' =>
$this->category_path($most_viewed[$i]['cat_id']),
+ 'art_views' =>
$most_viewed[$i]['views']
+ ));
+ $this->t->parse('articles_mostviewed',
'articles_mostviewed_block', True);
+ }
+ $this->t->set_var(array(
+ 'lang_most_viewed' => lang('Most viewed'),
+ 'lang_views' => lang('views')
+ ));
+
+ // *** SHOW UNANSWERED QUESTIONS ***
+ if (!$unanswered_questions =
$this->bo->unanswered_questions($category_passed))
+ {
+ $this->t->set_var('unanswered_questions',
"<tr><td colspan=2 align=center><br>----- " . lang('None') . "
-----</td></tr>");
+ }
+
+ foreach ($unanswered_questions as $unanswered)
+ {
+ $this->path = '';
+ $category_path =
$this->category_path($unanswered['cat_id']);
+ $this->t->set_var(array(
+ 'art_href'
=> $this->link(array('menuaction' => 'phpbrain.uikb.edit_article', 'q_id' =>
$unanswered['question_id'])),
+ 'art_title'
=> $unanswered['summary'],
+ 'who'
=> $unanswered['username'],
+ 'unanswered_category' =>
$category_path? lang('in %1', $category_path) : ''
+ ));
+ $this->t->parse('unanswered_questions',
'unanswered_questions_block', True);
+ }
+
+ $more_questions = '';
+ if ($this->bo->num_questions >
$this->bo->preferences['num_lines'])
+ {
+ $more_questions = "<div
style='text-align:right; padding-top:10px'><a href='" .
$this->link('menuaction=phpbrain.uikb.maintain_questions') . "'>" . lang('See
more questions...') . "</a></div>";
+ }
+ $this->t->set_var(array(
+ 'lang_unanswered' => lang('Unanswered
questions'),
+ 'more_questions' => $more_questions
+ ));
- header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link));
- }//end add comment
-
- function add_question()
- {
- $question = (isset($_POST['comment']) ?
trim($_POST['comment']) : '');
- $ok = false;
- if(strlen($question) && !$this->bo->is_anon())
+ if ($this->sitemgr)
+ {
+ return $this->t->parse('out', 'main');
+ }
+ else
{
- $ok = $this->bo->set_question($question);
- }//if valid question and user
+ $this->t->pparse('output', 'main');
+ }
+ }
+
+ /**
+ * Shows advanced search form, that is posted to function index
to handle the search
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return mixed Returns output string if accessed
through sitemgr
+ */
+ function advsearch()
+ {
+ if (!$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = True;
+ }
+ $this->t->set_file('search_form', 'adv_search.tpl');
- if($ok)
+ $this->t->set_var(array(
+ 'row_on' =>
$GLOBALS['phpgw_info']['theme']['row_on'],
+ 'row_off' =>
$GLOBALS['phpgw_info']['theme']['row_off'],
+ 'lang_advanced_search' => lang('Advanced
Search'),
+ 'lang_find' => lang('Find
results'),
+ 'lang_all_words' => lang('With all the
words'),
+ 'lang_phrase' => lang('With the exact
phrase'),
+ 'lang_one_word' => lang('With at least
one of the words'),
+ 'lang_without_word' => lang('Without the
words'),
+ 'lang_show_cats' => lang('Show messages
in category'),
+ 'lang_all' => lang('all'),
+ 'lang_include_subs' => lang('Include
subcategories'),
+ 'lang_pub_date' => lang('Publication
date'),
+ 'lang_anytime' => lang('anytime'),
+ 'lang_3_months' => lang('past %1
months', 3),
+ 'lang_6_months' => lang('past %1
months', 6),
+ 'lang_past_year' => lang('past year'),
+ 'lang_ocurrences' => lang('Ocurrences'),
+ 'lang_anywhere' => lang('Anywhere in
the article'),
+ 'lang_in_title' => lang('in the title'),
+ 'lang_in_topic' => lang('in the topic'),
+ 'lang_in_text' => lang('in the text'),
+ 'lang_num_res' => lang('Number of
results per page'),
+ 'lang_user_prefs' => lang('User
preferences'),
+ 'lang_order' => lang('Order results
by'),
+ 'lang_created' => lang('Creation
date'),
+ 'lang_artid' => lang('Article ID'),
+ 'lang_title' => lang('title'),
+ 'lang_user' => lang('user'),
+ 'lang_modified' => lang('Modification
date'),
+ 'lang_desc' =>
lang('Descendent'),
+ 'lang_asc' =>
lang('Ascendent'),
+ 'lang_search' => lang('search'),
+ 'form_action' =>
$this->link('menuaction=phpbrain.uikb.index'),
+ 'select_categories' =>
$this->bo->categories_obj->formated_list('select', 'all', '', True)
+ ));
+ if ($this->sitemgr)
{
- $msg = 'save ok';
+ return $this->t->parse('out', 'search_form');
}
else
{
- $msg = 'not added - error';
- }// if ok
- $this->unanswered($msg);
- }//end add question
+ $this->t->pparse('output', 'search_form');
+ }
+ }
- function browse()
- {
- $this->search_banner();
- $this->t->set_file('browse', 'browse.tpl');
- $cat_id = (int) ( (isset($_GET['cat_id']) &&
$_GET['cat_id'] != 0) ? trim($_GET['cat_id']) : 0);
- $cat_name = (isset($_GET['cat_name']) ?
trim($_GET['cat_name']) : '');
- if($cat_name)
+ /**
+ * Shows article details
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return mixed Returns output string if accessed
through sitemgr
+ */
+ function view_article()
+ {
+ $article_id = (int)get_var('art_id', 'GET',
0);
+ $more_comments = (int)get_var('more_comments', 'GET',
0);
+ if ($_GET['printer'] || $_GET['mail'])
{
- $cat_id = $this->cats->name2id($cat_name);
+ $print_view = True;
}
+ else
+ {
+ $print_view = False;
+ }
+ $article =
$this->bo->get_article($article_id);
+ //echo "article: <pre>";print_r($article);echo
"</pre>";
- $this->t->set_block('browse', 'cur_cat_name', 'ccname');
- $this->t->set_block('browse', 'cat_row', 'rows');
- $this->t->set_block('browse', 'table', 'tbl');
+ if (!$article_id || !$article)
$this->die_peacefully("Error retrieving article");
+ $can_edit =
$this->bo->check_permission($this->bo->edit_right)? True : False;
- if($cat_id)
+ // Process article deletion
+ if ($_POST['delete_article'])
{
- $cat_name = $this->cats->id2name($cat_id);
- $this->t->set_var('cur_category_name',
$cat_name);
-
- $this->t->set_var('up_category_url',
- $GLOBALS['phpgw']->link('/index.php',
- array('menuaction' =>
'phpbrain.uikb.browse',
- 'cat_id' =>
$this->cats->id2name($cat_id,'parent')
- )
- )
- );
-
- $this->t->set_var('lang_up', lang('up'));
- $this->t->parse('ccname', 'cur_cat_name');
+ $message =
$this->bo->delete_article($article['files']);
+ $GLOBALS['phpgw']->redirect_link($this->link,
'menuaction=phpbrain.uikb.index&message=' . $message);
+ die();
}
- else
+
+ // Process article publication
+ if ($_POST['publish_article'])
{
- $this->t->set_var('ccname', '');
+ $message = $this->bo->publish_article();
+ $this->reload_page($article_id, $message);
+ die();
}
- $cat_data = $this->bo->get_cat_data($cat_id);
- $cells = 0;//used for cell numbers to see if row is
needed
- if(is_array($cat_data))
+ // Process comment publication
+ if ($_GET['pub_com'])
{
- $this->t->set_file('cat_list', 'cat_list.tpl');
- $this->t->set_block('cat_list', 'sub_cat',
'subcats');
- $this->t->set_block('cat_list', 'cell',
'cells');
+ $message = $this->bo->publish_comment();
+ $this->reload_page($article_id, $message);
+ die();
+ }
+
+ // Process comment deletion
+ if ($_GET['del_comm'])
+ {
+ $message = $this->bo->delete_comment();
+ $this->reload_page($article_id, $message);
+ die();
+ }
- foreach( $cat_data as $cat_key => $cat_fields)
+ // Process comment and rating
+ if ($_POST['comment_box'] || $_POST['Rate'])
+ {
+ $message = '';
+ if ($_POST['comment_box'])
+ {
+ if (!$message =
$this->bo->add_comment()) $this->die_peacefully('Comment could not be inserted
in the database');
+ }
+ if ($_POST['Rate'])
{
- $this->t->set_var('sub_cats', '');
- if(is_array($cat_fields['subs']))
+ $valid_rates = array(1,2,3,4,5);
+ if (!$data =
$GLOBALS['phpgw']->session->appsession('ratings', 'phpbrain')) $data = array();
+ if (($this->bo->user_has_voted() &&
!$this->sitemgr) || in_array($article['art_id'], $data) ||
!in_array($_POST['Rate'], $valid_rates))
+ $this->die_peacefully('Rating
invalid');
+ if
(!$this->bo->add_rating($article['votes_' . $_POST['Rate']], $this->sitemgr))
$this->die_peacefully('Unable to add rating to database');
+ switch($message)
{
- foreach($cat_fields['subs'] as
$sub_id => $sub_vals)
- {
-
$this->t->set_var('sub_cat_link',$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' =>
'phpbrain.uikb.browse',
-
'cat_id'
=> $sub_id)
-
)
-
);
-
$this->t->set_var('sub_cat_name', $sub_vals['name']);
-
if($sub_vals['num_entries'])//count(entries)
- {
-
$this->t->set_var('sub_cat_count', ' (' . $sub_vals['num_entries'] . ')' );
- }
- else//count == 0
- {
-
$this->t->set_var('sub_cat_count', '');
- }//count(entries)
-
-
$this->t->parse('sub_cats','sub_cat', true);
- }//end foreach(subcats)
-
- }
- else //!is_array(subcats)
- {
- $this->t->set_var('subcats',
'');
- $this->t->set_var('sub_cats',
'');
- }//end is_array(subcats)
-
-
$this->t->set_var('cat_link',$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.browse',
-
'cat_id' => $cat_key)
-
)
- );
- $this->t->set_var('cat_name',
$cat_fields['name']);
-
if($cat_fields['num_entries'])//count(entries)
- {
- $this->t->set_var('cat_count',
' (' . $cat_fields['num_entries'] . ')' );
- }
- else//count == 0
- {
- $this->t->set_var('cat_count',
'');
- }//count(entries)
-
- $cells++;//increment cells - to track
if row needed
- if(!($cells % 2))//if even then new row
required
- {
- $this->t->parse('cells',
'cell', true);
- $this->t->parse('row',
'cells');//, true);
- $this->t->parse('rows',
'cat_row', true);
+ case 'comm_ok':
+ $message =
'comm_rate_ok';
+ break;
+ case 'comm_submited':
+ $message =
'comm_rate_submited';
+ break;
+ default:
+ $message = 'rate_ok';
+ break;
}
- else
+ }
+ $this->reload_page($article_id, $message);
+ die();
+ }
+
+ // Process file upload
+ if ($_FILES)
+ {
+ $message = $this->bo->process_upload();
+ $this->reload_page($article_id, $message);
+ die();
+ }
+ // Process file deletion
+ if ($_GET['delete_file'])
+ {
+ $message =
$this->bo->delete_file($article['files']);
+ $this->reload_page($article_id, $message);
+ die();
+ }
+
+ // Process related articles added
+ if ($_POST['update_related'] &&
!empty($_POST['related_articles']))
+ {
+ $message = $this->bo->add_related();
+ $this->reload_page($article_id, $message);
+ die();
+ }
+ // Process related articles deletion
+ if ($_GET['delete_related'])
+ {
+ $this->bo->delete_related();
+ $this->reload_page($article_id, 'del_rel_ok');
// I think there's no way of telling a deletion went wrong... (affected rows=0
always)
+ die();
+ }
+
+ // Process links added
+ if ($_POST['submit_link'])
+ {
+ $message = $this->bo->add_link();
+ $this->reload_page($article_id, $message);
+ die();
+ }
+ // Process links deletion
+ if ($_GET['delete_link'])
+ {
+ $message = $this->bo->delete_link();
+ $this->reload_page($article_id, $message);
+ die();
+ }
+
+ // *** SHOW ARTICLE ***
+ if ($print_view)
+ {
+ // add a content-type header to overwrite an
existing default charset in apache (AddDefaultCharset directiv)
+ header('Content-type: text/html;
charset='.$GLOBALS['egw']->translation->charset());
+ ob_end_flush();
+
+ $this->t->set_file('view_article',
'print_article.tpl');
+ $this->t->set_block('view_article',
'file_item_block', 'file_item');
+ $this->t->set_block('view_article',
'file_block', 'file');
+ $this->t->set_block('view_article',
'related_article_block', 'related_article');
+ $this->t->set_block('view_article',
'related_block', 'related');
+ $this->t->set_block('view_article',
'links_block', 'links');
+ $this->t->set_block('view_article',
'show_links_block', 'show_links');
+ }
+ else
+ {
+ $this->t->set_file('view_article',
'view_article.tpl');
+ $this->t->set_block('view_article',
'easy_question_block', 'easy_question');
+ $this->t->set_block('view_article',
'comment_block', 'comment');
+ $this->t->set_block('view_article',
'comment_form_block', 'comment_form');
+ $this->t->set_block('view_article',
'rating_graph_block', 'rating_graph');
+ $this->t->set_block('view_article',
'rating_form_block', 'rating_form');
+ $this->t->set_block('view_article',
'file_item_block', 'file_item');
+ $this->t->set_block('view_article',
'file_upload_block', 'file_upload');
+ $this->t->set_block('view_article',
'related_article_block', 'related_article');
+ $this->t->set_block('view_article',
'related_article_add_block', 'related_article_add');
+ $this->t->set_block('view_article',
'links_block', 'links');
+ $this->t->set_block('view_article',
'links_add_block', 'links_add');
+ $this->t->set_block('view_article',
'img_delete_block', 'img_delete');
+ $this->t->set_block('view_article',
'edit_del_block', 'edit_del');
+ $this->t->set_block('view_article',
'publish_btn_block', 'publish_btn');
+ $this->t->set_block('view_article',
'history_line_block', 'history_line');
+
+ if (!$this->sitemgr)
+ {
+ //
$GLOBALS['phpgw_info']['flags']['css'] = $this->tabs_css(); Don't use this
'cause incompatible with sitemgr
+
if(address@hidden($GLOBALS['phpgw']->js))
{
- $this->t->parse('cells',
'cell');
- }//end if is_even(cells)
-
- }//end foreach cats
-
- if($cells % 2)//do we need to create a blank cell and
close the row
- {
- $this->t->set_var('cell', '<td> </td>');
- $this->t->parse('cells', 'cell', true);
- $this->t->parse('row', 'cells');//,
true);
- $this->t->parse('rows', 'cat_row',
true);
- }//end if is_even(cells)
-
- $this->t->parse('tbl','table');
- }
- else //!is_array(cats)
- {
- $this->t->set_block('browse', 'table', 'tbl');
- $this->t->set_var('tbl','');
- }// end is_array(cats)
-
- $faqs = $this->bo->get_faq_list($cat_id);
- $this->t->set_block('browse', 'cat_count', 'count');
- if(is_array($faqs))
+ $GLOBALS['phpgw']->js =
CreateObject('phpgwapi.javascript');
+ }
+
$GLOBALS['phpgw']->js->validate_file('tabs','tabs');
+
$GLOBALS['phpgw']->js->set_onload('tab.init();');
+
$GLOBALS['phpgw_info']['flags']['java_script_thirst'] = "<script>function
openpopup() {window1=window.open('" .
$this->link('menuaction=phpbrain.uikb.pop_search') . "', 'Search',
'width=800,height=600,toolbar=no,scrollbars=yes,resizable=yes');}</script>";
+
+ $this->t->set_var('link_main_view', '');
+
+
$GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = True;
+ }
+ else
+ {
+ // Since cannot use js object with
sitemanager, I have to manually insert the javascript include:
+ $this->t->set_var('tabs_script',
$GLOBALS['phpgw']->link('/phpgwapi/js/tabs/tabs.js'));
+
+ $this->t->set_var('link_main_view', "<a
href='". $this->link('menuaction=phpbrain.uikb.index') ."'>". lang('Main View',
'phpbrain') ."</a> |<br>");
+ }
+ }
+
+ $this->t->set_var(array(
+ 'message' =>
"<div style='text-align:center; color:red'>".$this->message."</div>",
+ 'mail_message' => '',
+ 'search_tpl' =>
$this->show_basic_search(),
+ 'lang_article' =>
lang('Article'),
+ 'lang_linksfiles' => lang('Links
& Files'),
+ 'lang_history' =>
lang('History'),
+ 'lang_category' =>
lang('Category'),
+ 'lang_title' =>
lang('Title'),
+ 'lang_topic' =>
lang('Topic'),
+ 'lang_keywords' =>
lang('Keywords'),
+ 'lang_add_comments' => lang('If you
wish, you can comment this article here'),
+ 'lang_please_rate' => lang('Please
rate the pertinence and quality of this article'),
+ 'lang_poor' =>
lang('Poor'),
+ 'lang_excellent' =>
lang('Excellent'),
+ 'lang_attached_files' => lang('Attached
Files'),
+ 'lang_related_articles' => lang('Related
Articles in the Knowledge Base'),
+ 'lang_links' =>
lang('Links'),
+ 'lang_date' =>
lang('Date'),
+ 'lang_user' =>
lang('User'),
+ 'lang_action' =>
lang('Action'),
+ 'lang_upload' =>
lang('upload'),
+ 'lang_attach_file' => lang('Attach
file'),
+ 'lang_delete' =>
lang('delete'),
+ 'img_printer' =>
$GLOBALS['phpgw']->common->image('phpbrain', 'articleprint'),
+ 'href_printer' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id='. $article_id
.'&printer=1'),
+ 'img_mail' =>
$GLOBALS['phpgw']->common->image('phpbrain', 'mail'),
+ 'img_src_del' =>
$GLOBALS['phpgw']->common->image('phpbrain', 'delete'),
+ 'alt_printer' =>
lang('Printer view'),
+ 'alt_mail' =>
lang('Mail article'),
+ 'href_mail' =>
$this->link('menuaction=phpbrain.uikb.mail_article&art_id='. $article_id),
+ 'form_article_action' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id),
+ 'form_del_action' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id),
+ 'url_bluedot' =>
$GLOBALS['phpgw']->common->image('phpbrain', 'bluedot')
+ ));
+
+ $published = $article['published']? '' : lang("This
article hasn't yet been published in the Knowledge Base");
+ $lastmodif = '';
+ $img_stars = '';
+ if ($article['modified_username'])
+ {
+ $lastmodif = lang('Last modification by %1 on
%2', $article['modified_username'],
$GLOBALS['phpgw']->common->show_date($article['modified'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']));
+ }
+ // only show stars if article has been rated
+ if ($article['total_votes'])
+ {
+ $img_stars = "<img src='" .
$GLOBALS['phpgw']->common->image('phpbrain', round($article['average_votes']) .
'stars') . "' width=50 height=10>";
+ }
+
+ // show edit and delete button if user has edit rights
and he's not using sitemgr
+ if (!$print_view && $can_edit && !$this->sitemgr)
+ {
+ $this->t->set_var(array(
+ 'form_edit_art' =>
$this->link('menuaction=phpbrain.uikb.edit_article&art_id=' . $article_id),
+ 'form_del_art' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id),
+ 'lang_edit_art' =>
lang('Edit article'),
+ 'lang_delete_article' => lang('Delete
article')
+ ));
+ $this->t->parse('edit_del', 'edit_del_block');
+ }
+ else
{
- $this->t->set_var('lang_cat_contains' ,
lang('%1 contains %2 items', $cat_name, count($faqs)));
- $this->t->parse('count', 'cat_count');
- $this->t->set_var('faqs',
$this->summary($faqs));
+ $this->t->set_var('edit_del', '');
+ }
+
+ // show publish button if article is unpublish and user
has publish rights on owner
+ if (!$print_view && !$article['published'] &&
($this->bo->grants[$article['user_id']] & $this->bo->publish_right))
+ {
+ $this->t->set_var(array(
+ 'form_publish_art' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id='. $article_id),
+ 'lang_publish_article' =>
lang('publish')
+ ));
+ $this->t->parse('publish_btn',
'publish_btn_block');
}
else
{
- $this->t->set_var('count', '');
- $this->t->set_var('faqs', '');
+ $this->t->set_var('publish_btn', '');
}
+
+ $this->path = '';
+ $this->t->set_var(array(
+ 'art_id' =>
$article['art_id'],
+ 'lang_unpublished' => $published,
+ 'img_stars' => $img_stars,
+ 'links_cats' =>
$this->category_path($article['cat_id'], !$print_view),
+ 'title' =>
$article['title'],
+ 'topic' =>
$article['topic'],
+ 'keywords' =>
$article['keywords'],
+ 'createdby' =>
lang('Created by %1 on %2', $article['username'],
$GLOBALS['phpgw']->common->show_date($article['created'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])),
+ 'last_modif' => $lastmodif,
+ 'content' =>
$article['text']
+ ));
- $this->t->pfp('out', 'browse');
- }//end browse
+ $this->t->set_var(array(
+ 'easy_question' => '',
+ 'lang_comments' => '',
+ 'link_more_comments' => '',
+ 'comment' => '',
+ 'comment_form' => '',
+ 'rating_form' => '',
+ 'rating_graph' => '',
+ 'submit_comment' => '',
+ 'form_article_action' => ''
+ ));
+
+ if (!$print_view && $article['published'])
+ {
+ // show feedback question if article has been
published, a basic search was done and this article hasn't been given any
feedback on this session
+ if (!$data =
$GLOBALS['phpgw']->session->appsession('feedback', 'phpbrain')) $data = array();
+ if ($this->bo->query &&
!in_array($article['art_id'], $data))
+ {
+ $this->t->set_var(array(
+ 'tr_bgcolor'
=> $GLOBALS['phpgw_info']['theme']['row_off'],
+ 'query'
=> $this->bo->query,
+ 'form_easy_q_action' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id),
+ 'lang_question_easy' =>
lang('Was it easy to find this article using the above search string?'),
+ 'lang_yes'
=> lang('yes'),
+ 'lang_no'
=> lang('no'),
+ 'lang_please'
=> lang('By answering this question you will help to get the answer quicker the
next time')
+ ));
+ $this->t->parse('easy_question',
'easy_question_block');
+ }
- function build_form($form_target, $title, $input_descr,
$input_hidden=false, $allow_anon=false)
- {
+ // show comments if article has been published
+ $comments =
$this->bo->get_comments($article_id, !$more_comments);
+ foreach ($comments as $comment)
+ {
+ // only show unpublished comments is
user has edition rights on article owner
+ if (!$comment['published'] &&
!($this->bo->grants[$article['user_id']] & $this->bo->edit_right)) continue;
+ if ($comment['published'])
+ {
+ $link_publish = '';
+ }
+ else
+ {
+ $link_publish = "<a href='".
$this->link('menuaction=phpbrain.uikb.view_article&art_id='. $article_id
.'&pub_com='. $comment['comment_id']) ."'>" . lang('publish') . "</a>";
+ }
- $tpl = $this->t;
- $tpl->set_file('form', 'form.tpl');
-
- if(!$this->bo->is_anon())
- {
- $tpl->set_var(array('form_url' =>
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => "phpbrain.uikb.$form_target")),
- 'lang_title' => lang($title),
- 'lang_input_descr' =>
lang($input_descr),
- 'lang_submit_val' => lang('add')
- )
- );
-
- $tpl->set_block('form', 'hidden_var',
'hidden_vars');
- if(is_array($input_hidden[1]))//multiple
dimension array??
- {
- foreach($input_hidden as $ih_key =>
$ih_vals)
- {
- $tpl->set_var($ih_vals);
- $tpl->parse('hidden_vars',
'hidden_var',true);
- }
- }
- elseif(is_array($input_hidden))
- {
- $tpl->set_var($input_hidden);
- $tpl->parse('hidden_vars',
'hidden_var');
- }
- else//must be false
- {
- $tpl->set_var('hidden_vars', '');
- }//end if input_hidden
- return $tpl->subst('form');
- }
- else//must be anon user
- {
- $not_reg = '<a href="';
- $not_reg .= $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'phpbrain.uikb.redirect_anon_info'));
- $not_reg .='">' . lang('cant_post_must_register') .
'</a>';
- return $not_reg;
+ // user can delete comment if he has
edition rights and didn't enter through sitemgr
+ if (!$this->sitemgr &&
($this->bo->grants[$article['user_id']] & $this->bo->edit_right))
+ {
+ $link_delete = "<a href='".
$this->link('menuaction=phpbrain.uikb.view_article&art_id='. $article_id .
'&del_comm='. $comment['comment_id']) ."'>". lang('delete') ."</a>";
+ }
+ else
+ {
+ $Link_delete = '';
+ }
- }//end is_anon
- }//end build_form
-
- function edit()
- {
- $faq_id = (int) (isset($_GET['faq_id']) ?
trim($_GET['faq_id']) : 0);
- $this->edit_vals = $this->bo->get_item($faq_id, false);
- $this->edit_answer(False);
- }//end edit
-
- function edit_answer($new)
- {
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ $this->t->set_var(array(
+ 'comment_date' =>
$GLOBALS['phpgw']->common->show_date($comment['entered'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+ 'comment_user' =>
$comment['username'],
+ 'link_publish' =>
$link_publish,
+ 'link_delete' =>
$link_delete,
+ 'comment_content' =>
$comment['comment']
+ ));
+ $this->t->parse('comment',
'comment_block', True);
+ }
+ $lang_comments = lang('Comments');
+ if (!$more_comments &&
$this->preferences['num_comments'] != 'All' && $this->bo->num_comments >
$this->bo->preferences['num_comments'])
+ {
+ $link_more_comments = "<a href='" .
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id .
'&more_comments=1') . "'>" . lang('Show all comments') . "</a>";
+ $lang_comments = lang('Latest
comments');
+ }
+ $this->t->parse('comment_form',
'comment_form_block');
+ $this->t->set_var(array(
+ 'link_more_comments' =>
$link_more_comments,
+ 'lang_comments' =>
$lang_comments
+ ));
+
+ // setup voting form if article has been
published and (user has not voted already or accessed through sitemgr) and has
not voted this article in this session
+ if (!$data =
$GLOBALS['phpgw']->session->appsession('ratings', 'phpbrain')) $data = array();
+ if (($this->bo->user_has_voted($article_id) &&
!$this->sitemgr) || in_array($article['art_id'], $data))
+ {
+ $this->t->set_var(array(
+ 'rating_form'
=> lang('You have already qualified this article'),
+ 'submit_comment'
=> "<tr><td colspan=7 align=left><br><input type=submit name='comment'
value='". lang('Submit comment') . "'></td></tr>",
+ ));
+ }
+ else
+ {
+ $this->t->set_var('submit_comment',
"<tr><td colspan=7 align=left><br><input type=submit name='comment' value='".
lang('Submit comment and rating') . "'></td></tr>");
+ $this->t->parse('rating_form',
'rating_form_block');
+ }
- $this->t->set_file('edit_faq', 'edit_faq.tpl');
+ // setup voting graph if article has been
published
+ if ($article['votes_1'] != 0 ||
$article['votes_2'] != 0 || $article['votes_3'] != 0 || $article['votes_4'] !=
0 || $article['votes_5'] != 0)
+ {
+ // normalize vote frequency to range 0
- 40
+ $max_vote = max($article['votes_1'],
$article['votes_2'], $article['votes_3'], $article['votes_4'],
$article['votes_5']);
+ for ($i=1; $i<=5; $i++)
+ {
+ $this->t->set_var('bar_' . $i,
$article['votes_' . $i] / $max_vote *40);
+ }
+ $this->t->set_var(array(
+ 'lang_average' =>
lang('Average rating'),
+ 'average_rating'=>
sprintf("%01.1f", $article['average_votes']),
+ 'numpeople' =>
$article['total_votes'],
+ 'lang_people' => lang('people
have rated this article')
+ ));
+ $this->t->parse('rating_graph',
'rating_graph_block', True);
+ }
+ else
+ {
+ $this->t->set_var('rating',
lang('Nobody has rated this article so far'));
+ }
+ }
- $this->t->set_var('add_answer_link',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.save',
-
'question_id' => $this->edit_vals['question_id']
-
)
-
)
- );
-
- $this->t->set_var($this->edit_vals);
-
- $this->t->set_block('edit_faq', 'b_status', 'status');
- if($this->bo->is_admin() &&
isset($this->edit_vals['faq_id']))
- {
- $this->t->set_var(
- array('lang_status' =>
lang('status'),
- 'check' =>
($this->edit_vals['published'] ? 'checked' : ''),
- 'lang_active_when_checked' =>
lang('active_when_checked')
- )
- );
- $this->t->parse('status', 'b_status');
+ // show file list
+ if (!$article['files'])
+ {
+ $this->t->set_var($print_view? 'file' :
'file_item', '');
}
else
+ {
+ foreach ($article['files'] as $file)
+ {
+ ereg('^kb[0-9]*-(.*)', $file['file'],
$new_filename);
+ if (!$this->sitemgr && !$print_view &&
$can_edit)
+ {
+ $this->t->set_var(array(
+ 'href_del' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id .
'&delete_file=' . urlencode($file['file'])),
+ ));
+ $this->t->parse('img_delete',
'img_delete_block');
+ }
+ else
+ {
+ $this->t->set_var('img_delete',
'');
+ }
+ $this->t->set_var(array(
+ 'file_name' =>
$new_filename[1],
+ 'file_comment' =>
$file['comment'],
+ 'href_file' =>
$this->link('menuaction=phpbrain.uikb.download_file&art_id=' . $article_id .
'&file=' . urlencode($file['file']))
+ ));
+ $this->t->parse('file_item',
'file_item_block', True);
+ }
+ if ($print_view) $this->t->parse('file',
'file_block');
+ }
+ // show upload form if user has edition rights and is
not in sitemgr
+ if (!$this->sitemgr && !$print_view && $can_edit)
{
- $this->t->set_var('status', '');
- }
-
- $add_answer = ($new ? 'add_answer' : 'edit_answer');
- $lang = array('lang_add_answer' =>
lang($add_answer),
- 'lang_check_before_submit' =>
lang('check_before_submit'),
- 'lang_not_submit_qs_warn' =>
lang('not_submit_qs_warn'),
- 'lang_inspire_by_suggestions' =>
lang('inspire_by_suggestions'),
- 'lang_title' =>
lang('title'),
- 'lang_keywords' =>
lang('keywords'),
- 'lang_category' =>
lang('category'),
- 'lang_related_url' =>
lang('related_url'),
- 'lang_text'
=> lang('text'),
- 'lang_reset' =>
lang('reset'),
- 'lang_save'
=> lang('save'),
- 'lang_back'
=> lang('back'),
- 'lang_delete' =>
lang('delete')
- );
- $this->t->set_var($lang);
-
- $cat_options =
$this->cats->formatted_list('select','all',$this->edit_vals['cat_id']);
- $this->t->set_var('cats_options', $cat_options);
-
- $this->t->pfp('out', 'edit_faq');
- }//end edit question
-
- function help()
- {
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
- echo '<h2>Coming Soon!</h2>';
- echo 'This will link to the manual for this app when
completed';
- }//end help
-
- function maint_answer()
- {
- if(!$this->bo->is_admin())
+ $this->t->set_var(array(
+ 'form_file_action' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id),
+ 'lang_attach_file' =>
lang('Attach File'),
+ 'lang_comment' =>
lang('comment'),
+ 'lang_upload' =>
lang('Upload')
+ ));
+ $this->t->parse('file_upload',
'file_upload_block');
+ }
+ else
{
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
- echo '<h2 align="center">Coming Soon!</h2>';
- echo 'A proper manual will be added soon';
- }
- else//must be admin
- {
- $msg = '';
- if($_POST['activate'] &&
(count($_POST['faq_id']) != 0))
- {
- $msg = lang('%1 faqs_activated',
$this->bo->set_active_answer($_POST['faq_id']));
- }
- if($_POST['delete'] && (count($_POST['faq_id'])
!= 0))
- {
- $msg = lang('%1 faqs_deleted',
$this->bo->delete_answer($_POST['faq_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 : ' '));
-
- $faqs = $this->bo->get_faq_list('', true);
- if(is_array($faqs))
- {
- $this->t->set_var(array('lang_admin_section'
=> lang('maintain_answers'),
-
'lang_explain_function' => lang('explain_maintain_answers'),
-
'form_action' =>
$GLOBALS['phpgw']->link('/index.php',
'menuaction=phpbrain.uikb.maint_answer')));
-
- 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']),
-
'extra' => '<a
href="'.$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction'
=> 'phpbrain.uikb.preview',
-
'faq_id' => $key
-
)
-
). '"
target="_blank">'.lang('preview').'</a>'
-
)
- );
- $this->t->parse('pending_items',
'pending_list', true);
- $row++;
- }//end foreach(pending)
- $lang = array('lang_explain_function'
=> lang('explain_faq_admin'),
-
'lang_admin_section' => lang('section_maint_faqs'),
- 'lang_enable'
=> lang('enable'),
- 'lang_delete'
=> lang('delete')
- );
- $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 answers
-
- function maint_question()
- {
- if(!$this->bo->is_admin())
+ $this->t->set_var('file_upload', '');
+ }
+
+ // show related articles list
+ if (!$related_articles =
$this->bo->get_related_articles($article_id))
{
- header('Location: ' .
$GLOBALS['phpgw']->link('/index.php', 'menuaction=phpbrain.uikb.index'));
- $GLOBALS['phpgw']->common->exit();
+ $this->t->set_var($print_view? 'related' :
'related_article', '');
}
- else//must be admin
+ else
{
- $msg = '';
- if($_POST['activate'] &&
(count($_POST['question_id']) != 0))
+ foreach ($related_articles as $related)
{
- $msg = lang('%1 questions_activated',
$this->bo->set_active_question($_POST['question_id']));
+ if (!$this->sitemgr && !$print_view &&
$can_edit)
+ {
+ $this->t->set_var(array(
+ 'href_del' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id .
'&delete_related=' . urlencode($related['art_id'])),
+ ));
+ $this->t->parse('img_delete',
'img_delete_block');
+ }
+ else
+ {
+ $this->t->set_var('img_delete',
'');
+ }
+ $this->t->set_var(array(
+ 'related_id' =>
$related['art_id'],
+ 'href_related' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' .
$related['art_id']),
+ 'title_related' =>
$related['title']
+ ));
+ $this->t->parse('related_article',
'related_article_block', True);
}
- if($_POST['delete'] &&
(count($_POST['question_id']) != 0))
+ if ($print_view) $this->t->parse('related',
'related_block');
+ }
+ // show add new article if user has edition rights and
is not in sitemgr
+ if (!$this->sitemgr && !$print_view && $can_edit)
+ {
+ $this->t->set_var(array(
+ 'lang_add_related' =>
lang('Add articles'),
+ 'lang_select_articles' => lang('Select
articles'),
+ 'lang_clear' =>
lang('clear'),
+ 'lang_update' =>
lang('update'),
+ 'form_add_article_action' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id)
+ ));
+ $this->t->parse('related_article_add',
'related_article_add_block');
+ }
+ else
+ {
+ $this->t->set_var('related_article_add', '');
+ }
+
+ // show links
+ if (!$links = $article['urls'])
+ {
+ $this->t->set_var('links', '');
+ $this->t->set_var('show_links', '');
+ }
+ else
+ {
+ foreach ($article['urls'] as $link)
{
- $msg = lang('%1 questions_deleted',
$this->bo->delete_answer($_POST['question_id']));
+ if (!$this->sitemgr && !$print_view &&
$can_edit)
+ {
+ $this->t->set_var(array(
+ 'href_del' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id .
'&delete_link=' . urlencode($link['link'])),
+ ));
+ $this->t->parse('img_delete',
'img_delete_block');
+ }
+ else
+ {
+ $this->t->set_var('img_delete',
'');
+ }
+ // if protocol not set, add it
+ if (!ereg('://', $link['link']))
$link['link'] = 'http://' . $link['link'];
+
+ if (!$link['title']) $link['title'] =
$link['link'];
+ $this->t->set_var(array(
+ 'href_link' =>
$link['link'],
+ 'title_link' =>
$link['title']
+ ));
+ $this->t->parse('links', 'links_block',
True);
}
- $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 :
' '));
-
- $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()
- {
- $this->view(false);
- }
-
- function rate()
- {
- $faq_id = (int) (isset($_GET['faq_id']) ?
trim($_GET['faq_id']) : 0);
- $rating = (int) (isset($_GET['rating']) ?
trim($_GET['rating']) : 0);
- if( ($faq_id > 0) && ($rating > 0))
+ if ($print_view) $this->t->parse('show_links',
'show_links_block');
+ }
+ // show add new link if user has edition rights and is
not in sitemgr
+ if (!$this->sitemgr && !$print_view &&
$this->bo->check_permission($can_edit))
{
- $this->bo->set_rating($faq_id, $rating);
+ $this->t->set_var(array(
+ 'lang_add_link' => lang('Add
link'),
+ 'lang_title' =>
lang('title'),
+ 'lang_update' =>
lang('Update'),
+ 'form_add_link_action' =>
$this->link('menuaction=phpbrain.uikb.view_article&art_id=' . $article_id)
+ ));
+ $this->t->parse('links_add', 'links_add_block');
}
- $this->view();
- }//end rate
-
- function save()
- {
- $faq_id = (int) (isset($_POST['faq_id']) ?
trim($_POST['faq_id']) : 0);
- $question_id = (int) (isset($_GET['question_id']) ?
trim($_GET['question_id']) : 0);
- $faq['cat_id'] = (int) (isset($_POST['cat_id']) ?
trim($_POST['cat_id']) : 0);
- $faq['title'] = (isset($_POST['title']) ?
trim($_POST['title']) : '');
- $faq['keywords']= (isset($_POST['keywords']) ?
trim($_POST['keywords']) : '');
- $faq['text'] = (isset($_POST['text']) ?
trim($_POST['text']) : '');
- $faq['is_faq'] = (int) (isset($_POST['is_faq']) ?
trim($_POST['is_faq']) : 0);
- $faq['url'] = (isset($_POST['url']) ?
trim($_POST['url']) : '');
- $faq['published'] = (isset($_POST['published']) ? True
: False);
- $faq_id = $this->bo->save($faq_id, $faq, $question_id);
- if($faq_id)
- {
- header ('Location: ' .
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.view',
-
'faq_id' => $faq_id,
-
'msg' => 'faq_saved'
-
)
- )
- );
+ else
+ {
+ $this->t->set_var('links_add', '');
+ }
+
+ // Show history
+ if ($print_view || !$history =
$this->bo->return_history())
+ {
+ $this->t->set_var('history_line', '');
+ }
+ else
+ {
+ foreach ($history as $event)
+ {
+ $this->t->set_var(array(
+ 'tr_color'
=> $this->nextmatchs->alternate_row_color($tr_color),
+ 'history_date' =>
$event['datetime'],
+ 'history_user' =>
$event['owner'],
+ 'history_action' =>
$event['action']
+ ));
+ $this->t->parse('history_line',
'history_line_block', True);
+ }
+ }
+
+ $this->t->set_var('img_delete', '');
+ if ($_GET['mail'])
+ {
+ $this->t->set_var('mail_message',
$_POST['val_message']);
+ $this->t->parse('plain_html', 'view_article');
+ $message =
$this->bo->mail_article($this->t->get_var('plain_html'));
+ $this->reload_page($article_id, $message);
+ die();
+ }
+ elseif ($this->sitemgr && !$print_view)
+ {
+ return $this->t->parse('out', 'view_article');
}
else
{
- echo 'whoops!';
+ $this->t->pparse('output', 'view_article');
}
}
-
- function search()
- {
- $search = (isset($_GET['search']) ?
trim($_GET['search'])
- : (isset($_POST['search']) ?
trim($_POST['search']) : ''));
- if((isset($_POST['show']) &&
strlen(trim($_POST['show'])) > 0)
- || (isset($_GET['show']) &&
strlen(trim($_GET['show'])) > 0))
+ /**
+ * Mails article
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return mixed When showing form, returns string
output if acccess through sitemgr
+ */
+ function mail_article()
+ {
+ $article_id = (int)get_var('art_id', 'GET', 0);
+
+ $recipient = '';
+ $subject = lang('Knowledge Base article #%1',
$article_id);
+ $reply = '';
+ $message = '';
+
+ $this->t->set_file('mail_form', 'mail_article.tpl');
+ $this->t->set_var(array(
+ 'form_action' =>
$this->link('menuaction=phpbrain.uikb.view_article&mail=1&art_id='.
$article_id),
+ 'row_on' =>
$GLOBALS['phpgw_info']['theme']['row_on'],
+ 'row_off' =>
$GLOBALS['phpgw_info']['theme']['row_off'],
+ 'lang_recipient' => lang('Recipient'),
+ 'val_recipient' => $recipient,
+ 'lang_subject' => lang('Subject'),
+ 'val_subject' => $subject,
+ 'lang_reply' => lang('Reply-to'),
+ 'val_reply' => $reply,
+ 'lang_message' => lang('Message'),
+ 'val_message' => $message,
+ 'lang_send' => lang('send')
+ ));
+
+ if (!$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = True;
+ }
+
+ if ($this->sitemgr)
{
- $show = (int) (isset($_POST['show']) ?
trim($_POST['show']) : trim($_GET['show']));
+ return $this->t->parse('out', 'mail_form');
}
else
{
- $show = null;
+ $this->t->pparse('out', 'mail_form');
}
+ }
+
+ /**
+ * Shows popup windows with articles table
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return void
+ */
+ function pop_search()
+ {
+ $actual_category =
(int)get_var('cat', 'GET', 0);
+ $this->bo->sort =
get_var('sort', 'any', 'ASC');
+ $this->bo->order =
get_var('order', 'any', 'title');
+ $this->bo->query =
get_var('query', 'any', '');
+ $this->bo->load_categories(0);
+ $articles_list =
$this->bo->search_articles($actual_category);
+ $this->t->set_file('popup', 'popup_search.tpl');
+ $this->t->set_block('popup', 'table_row_block',
'table_row');
+ $this->t->set_var(array(
+ 'lang_category' => lang('Category'),
+ 'lang_all' => lang('All'),
+ 'lang_search' => lang('Search'),
+ 'lang_select' => lang('Select'),
+ 'th_color' =>
$GLOBALS['phpgw_info']['theme']['th_bg'],
+ 'value_query' => $this->bo->query,
+ 'form_select_articles_action' =>
$this->link('menuaction=phpbrain.uikb.pop_search'),
+ 'form_filters_action' =>
$this->link('menuaction=phpbrain.uikb.pop_search&start=' . $this->bo->start .
'&sort=' . $this->bo->sort),
+ 'head_number' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'art_id', $this->bo->order,
'', lang('Article ID')),
+ 'head_title' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'title', $this->bo->order,
'', lang('Title')),
+ 'left' =>
$this->nextmatchs->left($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction.phpbrain.uikb.pop_search&query=' . $this->bo->query),
+ 'right' =>
$this->nextmatchs->right($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction.phpbrain.uikb.pop_search&query=' . $this->bo->query),
+ 'num_regs' =>
$this->nextmatchs->show_hits($this->bo->num_rows, $this->bo->start),
+ 'select_categories' =>
$this->bo->categories_obj->formated_list('select', 'all', '', True)
+ ));
+
+ foreach ($articles_list as $article)
+ {
+ $tr_color =
$this->nextmatchs->alternate_row_color($tr_color);
+ $this->t->set_var(array(
+ 'tr_color' => $tr_color,
+ 'number' =>
$article['art_id'],
+ 'title' =>
$article['title'],
+
+ ));
+ $this->t->parse('table_row', 'table_row_block',
True);
+ }
+
+ $this->t->pparse('output', 'popup');
+ }
+
+ /**
+ * New articles (answering questions or just new) and edit
existing articles
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return void
+ */
+ function edit_article()
+ {
+ $this->t->set_file('edit_article', 'edit_article.tpl');
+ $this->t->set_block('edit_article',
'answer_question_block', 'answer_question');
+ $this->t->set_block('edit_article', 'article_id_block',
'article_id');
- if($search)
+ $this->t->set_var(array(
+ 'lang_articleID' =>
lang('Article ID'),
+ 'lang_category' =>
lang('Category'),
+ 'lang_none' =>
lang('None'),
+ 'lang_title' =>
lang('Title'),
+ 'lang_topic' =>
lang('Topic'),
+ 'lang_keywords' =>
lang('Keywords'),
+ ));
+
+ // These are the default values, that apply for
entering a new article
+ $article_id =
(int)get_var('art_id', 'any', 0);
+ $title = '';
+ $topic = '';
+ $keywords = '';
+ $content = '';
+ $category_selected = '';
+ $hidden_fields = '';
+ $btn_save = "<input type='submit'
value='". lang('Save') . "' name='save'> ";
+ $btn_cancel = "<input type='submit'
value='". lang('Cancel') . "' name='cancel'>";
+ $extra = '';
+ $this->t->set_var(array(
+ 'answer_question' => '',
+ 'article_id' => '',
+ ));
+
+ // saving either an edited or a new article (answering
a question or just a new article)
+ if ($_POST['save'])
{
- $results =
$this->bo->get_search_results($search, $show);
- if(is_array($results))
+ $article_id =
(int)get_var('editing_article_id', 'POST', 0);
+ $article = ($article_id)?
$this->bo->get_article($article_id) : false;
+
+ //data validation
+ if (!$_POST['title'])
+ {
+ $this->message .= lang('You must enter
a title') . '<br>';
+ }
+ if (!$_POST['topic'])
{
- $this->search_banner($search, lang('%1
matches found', count($results)));
- echo $this->summary($results);
-
+ $this->message .= lang('You must enter
a topic') . '<br>';
}
- else//nothing found
+ if (!$_POST['exec']['text'])
+ {
+ $this->message .= lang('The article is
empty') . '<br>';
+ }
+
+ if ($this->message)
+ {
+ $this->message .= '<br>' . lang('Please
try again');
+ }
+ elseif ($edited_art = $this->bo->save_article())
+ {
+ // if article is new tell to insert
files and stuff
+ $message = '';
+ if (!$article) $message =
'&message=add_ok_cont&tabpage=2';
+
$GLOBALS['phpgw']->redirect_link($this->link,
'menuaction=phpbrain.uikb.view_article&art_id=' . $edited_art . $message);
+ die();
+ }
+ else
{
- $this->search_banner($search,
lang('none found - revise or browse'));
+ $this->message = $this->bo->error_msg;
}
}
- else
+
+ // if an error ocurred fill fields with values
+ if ($this->message)
{
- $this->browse();
+ $category_selected =
(int)get_var('cat_id', 'POST', 0);
+ $title =
get_var('title', 'POST', '');
+ $topic =
get_var('topic', 'POST', '');
+ $keywords =
get_var('keywords', 'POST', '');
+ $temp = get_var('exec', 'POST', '');
+ $content = $temp['text'];
}
- }//end search
- function search_banner($search='', $msg='')
- {
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ // Edit existant article
+ if ((int)get_var('art_id', 'GET', 0))
+ {
+ // Process cancel button
+ if ($_POST['cancel'])
+ {
+
$GLOBALS['phpgw']->redirect_link($this->link,
'menuaction=phpbrain.uikb.view_article&art_id=' . $_GET['art_id']);
+ die();
+ }
+
+ if (!$this->message)
+ {
+ $article =
$this->bo->get_article($article_id);
- $this->t->set_file('search', 'search.tpl');
+ // Check edit rights
+ if
(!$this->bo->check_permission($this->bo->edit_right))
$this->die_peacefully('You have not the proper permissions to do that');
- $msg = (isset($_GET['msg']) ? trim($_GET['msg']) :
$msg);
- $search = (isset($_GET['search']) ?
trim($_GET['search']) : $search);
- $this->t->set_var('curent_search', $search);
- $this->t->set_var('message', $msg);
-
- $this->t->set_var('header_bgcolor',
$this->theme['navbar_bg']);
- $this->t->set_var('lang_kb_contains',
lang('kb_contains'));
- $stats = $this->bo->get_stats();
- $open = $stats['num_open'];
- foreach($stats as $stat_name => $stat_val)
- {
- $this->t->set_var('lang_' . $stat_name,
lang("$stat_name %1", $stat_val));
+ $title = $article['title'];
+ $topic = $article['topic'];
+ $keywords = $article['keywords'];
+ $content = $article['text'];
+ $category_selected = $article['cat_id'];
+ }
+
+ $this->t->set_var(array(
+ 'show_articleID' => $article_id
. "<input type=hidden name='editing_article_id' value=" . $article_id . ">",
+ ));
+ $this->t->parse('article_id',
'article_id_block');
}
- unset($stats);
- $this->t->set_block('search', 'current_questions',
'cqs');
- foreach($this->bo->get_latest() as $cq_key => $descr)
+ // answering a question
+ if ((int)get_var('q_id', 'GET', 0))
{
-
- $this->t->set_var('cq_url',
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'phpbrain.uikb.unanswered',
-
'question_id' => $cq_key
-
)
-
)
- );
-
- $this->t->set_var('cq_descr', $descr);
- $this->t->parse('cqs',
'current_questions',true);
- }
- $lang = array('lang_question' =>
lang('question'),
- 'lang_current_questions'=>
lang('current_questions'),
- 'lang_search'
=> lang('search'),
- 'lang_example'
=> lang('example'),
- 'lang_show'
=> lang('show'),
- 'lang_faqs_and_tutes' =>
lang('faqs_and_tutes'),
- 'lang_faqs'
=> lang('faqs'),
- 'lang_tutorials'
=> lang('tutorials'),
- 'lang_add_answer'
=> lang('add_answer'),
- 'lang_add_q'
=> lang('add_question (%1 open)', $open),
- 'lang_browse'
=> lang('browse'),
- 'lang_help'
=> lang('help')
- );
-
- $this->t->set_var($lang);
-
- $this->t->set_var('search_url',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.search')));
+ // Process cancel button
+ if ($_POST['cancel'])
+ {
+
$GLOBALS['phpgw']->redirect_link($this->link, 'menuaction=phpbrain.uikb.index');
+ die();
+ }
+ $q_id = (int)get_var('q_id', 'GET', 0);
+ $question = $this->bo->get_question($q_id);
+ $hidden_fields .= "<input type=hidden
name='answering_question' value='" . $q_id . "'>";
+ $this->t->set_var(array(
+ 'lang_summary' =>
lang('Summary'),
+ 'lang_details' =>
lang('Details'),
+ 'lang_category' =>
lang('Suggested category'),
+ 'lang_head_question' => lang('Create
a new article to answer the question asked by %1 in %2', $question['username'],
$question['creation']),
+ 'question_summary' =>
$question['summary'],
+ 'question_details' =>
$question['details']
+ ));
+ $this->t->parse('answer_question',
'answer_question_block');
- $this->t->set_var('link_add_answer',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.add')));
+ $title = $question['summary'];
+ $category_selected = $question['cat_id'];
+ }
+
+ if ( !isset($GLOBALS['phpgw']->richtext) ||
!is_object($GLOBALS['phpgw']->richtext) )
+ {
+ $GLOBALS['phpgw']->richtext =&
createObject('phpgwapi.richtext');
+ }
+
$GLOBALS['phpgw']->richtext->replace_element('exec_text');
+ $GLOBALS['phpgw']->richtext->generate_script();
- $this->t->set_var('link_browse',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.browse')));
+ // Finally, fill the input fields
+ if (!$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = true;
+ }
- $this->t->set_var('link_open_qs',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' =>
'phpbrain.uikb.unanswered')));
+ $select_category =
$this->bo->select_category($category_selected);
+ $this->t->set_var('select_category', $select_category);
- $this->t->set_var('link_help',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.help')));
-
- $this->t->set_block('search','admin', 'admins');
- if($this->bo->is_admin())
+ $link_params = array('menuaction' =>
'phpbrain.uikb.edit_article');
+ if ( isset($_GET['art_id']) && (int)$_GET['art_id'])
{
- $this->t->parse('admins','admin');
+ $link_params['art_id'] = $_GET['art_id'];
}
- else
+ if ( isset($_GET['q_id']) && (int)$_GET['q_id'])
{
- $this->t->set_var('admins', '');
+ $link_params['q_id'] = $_GET['q_id'];
}
-
- $this->t->pfp('out', 'search');
+
+ $this->t->set_var(array(
+ 'message' => "<tr><td
colspan=2 align=center style='color:red'>" . $this->message . "</td></tr>",
+ 'hidden_fields' => $hidden_fields,
+ 'form_action' =>
$this->link($link_params),
+ 'value_title' => $title,
+ 'value_topic' => $topic,
+ 'value_keywords' => $keywords,
+ 'value_text' => $content,
+ 'btn_save' => $btn_save,
+ 'btn_cancel' => $btn_cancel
+ ));
+
+ $this->t->pparse('output', 'edit_article');
}
- function summary($summaries)
+ /**
+ * Adds question to knowledge base.
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return mixed When showing form, returns string
output if acccess through sitemgr
+ **/
+ function add_question()
{
- if(is_array($summaries))
+ // if in sitemgr, check that questions can be added
+ if ($this->sitemgr && !$this->allow_questions)
$this->die_peacefully('You have not the proper permissions to do that');
+ if ($_POST['submit'])
+ {
+ $this->bo->add_question();
+
$GLOBALS['phpgw']->redirect($this->link('menuaction=phpbrain.uikb.index'));
// don't use redirect_link cause it ain't work in sitemgr
+ end;
+ }
+
+ $this->t->set_file('question_form', 'question.tpl');
+ $message = '';
+
+ if ($this->bo->admin_config['publish_questions'] ==
'True')
{
- $t = $this->t;
- $t->set_file('faq_sum', 'faq_sum.tpl');
- $t->set_block('faq_sum', 'summary',
'summaries');
- foreach($summaries as $faq_id => $faq_vals)
- {
- $t->set_var($faq_vals);
- $t->set_var('faq_url',
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'phpbrain.uikb.view',
-
'faq_id' => $faq_id
-
)
- ));
- $t->set_var('lang_score', lang('score
%1', $faq_vals['score']));
- $t->set_var('lang_last_mod',
lang('last_mod %1', $faq_vals['last_mod']));
- $t->set_var('lang_views', lang('views
%1', $faq_vals['views']));
- $t->set_var('lang_rating', lang('rating
%1', $faq_vals['vote_avg']));
- $t->set_var('lang_votes', lang('votes
%1', $faq_vals['votes']));
- $t->parse('summaries', 'summary', true);
- }//end foreach summary
- return $t->subst('faq_sum');
+ $lang_posting_process = 'Your question will be
published immediately';
}
else
{
- return '';
+ $lang_posting_process = 'Your question will be
posted, but will only be published after approval by a user with publishing
rights';
}
- }//end summaries
+ $this->t->set_var(array(
+ 'null' => '',
+ 'message' =>
$message,
+ 'lang_search_kb' => lang('Before
submiting a question, please search in the knowledge base first'),
+ 'lang_enter_words' => lang('Enter
one or two words describing the issue, or type the article number if you know
it'),
+ 'lang_search' =>
lang('Search'),
+ 'lang_advanced_search' => lang('Advanced
Search'),
+ 'lang_post_question' => lang("If you can't
find answers to your problem in the knowledge base, describe it below"),
+ 'lang_summary' =>
lang('Summary'),
+ 'lang_details' =>
lang('Details'),
+ 'lang_select_cat' =>
lang('category'),
+ 'lang_submit' =>
lang('Submit'),
+ 'lang_cancel' =>
lang('Cancel'),
+ 'lang_none' =>
lang('none'),
+ 'posting_process' =>
lang($lang_posting_process),
+ 'form_search_action' =>
$this->link('menuaction=phpbrain.uikb.index'),
+ 'form_question_action' =>
$this->link('menuaction=phpbrain.uikb.add_question'),
+ 'link_adv_search' =>
$this->link('menuaction=phpbrain.uikb.advsearch')
+ ));
+
+ if (!$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = True;
+ }
- function unanswered($msg = '')
- {
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
- $this->t->set_file('unanswered', 'unanswered.tpl');
- $this->t->set_block('unanswered', 'open_list',
'open_ones');
- $this->t->set_block('unanswered', 'open_block',
'o_block');
- $this->t->set_var('index_url',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.index')
-
)
- );
- $this->t->set_var('lang_return_to_index',
lang('return_to_index'));
- $this->t->set_var('msg', ((strlen($msg) !=0) ?
lang($msg) : ' '));
+ $select_category = $this->bo->select_category();
+ $this->t->set_var('select_category', $select_category);
- $open_qs = $this->bo->get_questions(false);
- if(is_array($open_qs))
+ if ($this->sitemgr)
{
- $this->t->set_var(array('lang_cur_open_qs'
=> lang('cur_open_qs'),
-
'lang_know_contrib' => lang('know_contrib')));
+ return $this->t->parse('out', 'question_form');
+ }
+ else
+ {
+ $this->t->pparse('output', 'question_form');
+ }
+ }
+
+ /**
+ * Article maintenance view
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return void
+ */
+ function maintain_articles()
+ {
+ $actual_category = (int)get_var('cat', 'any', 0);
- if($this->bo->is_anon())
+ if (!$this->bo->order) $this->bo->order = 'created';
+ if (!$this->bo->sort) $this->bo->sort = 'DESC';
+
+ $this->bo->load_categories($actual_category);
+
+ // obtain articles to which one has any kind of
permission
+ $articles_list =
$this->bo->search_articles($actual_category, $this->bo->publish_filter,
$this->bo->read_right | $this->bo->edit_right | $this->bo->publish_right);
+ //echo "articles_list:
<pre>";print_r($articles_list);echo "</pre>";
+
+ // Process article deletion
+ if ($_GET['delete'] || $_POST['delete_selected'])
+ {
+ if ($_GET['delete'])
{
- $lang_opt = lang('register');
- $link_opt =
$GLOBALS['phpgw']->link('/index.php',
- array('menuaction' =>
'phpbrain.uikb.redirect_anon_info'));
+ $selected = array($_GET['delete'] =>
'');
}
- else//must be registered
+ else
{
- $lang_opt = lang('answer');
- $link_opt =
$GLOBALS['phpgw']->link('/index.php',
- array('menuaction' =>
'phpbrain.uikb.add'));
- }//end is anon
-
- foreach($open_qs as $id => $question)
+ $selected = $_POST['select'];
+ }
+ $errors = False;
+ foreach ($selected as $art_id => $trash)
{
- $this->t->set_var(array('question_id'
=> $id,
-
'question_text' => $question,
-
'lang_option' => $lang_opt,
-
'link_option' => "$link_opt&question=" . urlencode($question) .
'&question_id=' . $id,
-
'row_bg' => (($row%2) ? $this->theme['row_on'] :
$this->theme['row_off'])
-
)
- );
- $this->t->parse('open_ones',
'open_list', true);
- $row++;
- }//end foreach(question)
- $this->t->parse('o_block', 'open_block');
+ $target_art = array();
+ foreach($articles_list as $article)
+ {
+ if ($article['art_id'] ==
$art_id)
+ {
+ $target_art = $article;
+ break;
+ }
+ }
+ $message =
$this->bo->delete_article($target_art['files'], $target_art['art_id'],
$target_art['user_id']);
+ if ($message != 'del_art_ok') $errors =
$message;
+ }
+ if (!$errors)
+ {
+ $message = $_GET['delete']?
'del_art_ok' : 'del_arts_ok';
+ }
+ $GLOBALS['phpgw']->redirect_link($this->link,
'menuaction=phpbrain.uikb.maintain_articles&message=' . $message);
+ die();
}
- else//no open questions
+
+ // Process article publication
+ if ($_GET['publish'] || $_POST['publish_selected'])
{
- $this->t->set_var('o_block',
lang('none_unanswered'));
- }//end if is_array(open)
- $this->t->set_var('question_form',
$this->build_form('add_question', 'add_question', 'question'));
+ if ($_GET['publish'])
+ {
+ $selected = array($_GET['publish'] =>
'');
+ }
+ else
+ {
+ $selected = $_POST['select'];
+ }
+ $errors = False;
+ foreach ($selected as $art_id => $trash)
+ {
+ $target_art = array();
+ foreach ($articles_list as $article)
+ {
+ if ($article['art_id'] ==
$art_id)
+ {
+ $target_art = $article;
+ break;
+ }
+ }
+ $message =
$this->bo->publish_article($target_art['art_id'], $target_art['user_id']);
+ if ($message != 'publish_ok') $errors =
$message;
+ }
+ if (!$errors)
+ {
+ $message = $_GET['publish']?
'publish_ok' : 'publishs_ok';
+ }
+ $GLOBALS['phpgw']->redirect_link($this->link,
'menuaction=phpbrain.uikb.maintain_articles&message=' . $message);
+ die();
+ }
- $this->t->pfp('out', 'unanswered');
- }//end show unanswered
+ // Show table
+ $this->t->set_file('maintain_articles',
'maintain_articles.tpl');
+ $this->t->set_block('maintain_articles',
'table_row_block', 'table_row');
+ $this->t->set_var('table_row', '');
- function view($header = true)
- {
- if($header)
+ if ($articles_list)
{
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ foreach ($articles_list as $article)
+ {
+ $actions = '';
+
+ // skip if article unpublished, user
has no publish right on owner and user!=owner
+ if (!$article['published'] &&
!($this->bo->grants[$article['user_id']] & $this->bo->publish_right) &&
$article['user_id']!=$GLOBALS['phpgw_info']['user']['account_id']) continue;
+
+ $actions = "<a href='".
$this->link('menuaction=phpbrain.uikb.view_article&art_id='.
$article['art_id']) ."'>
+ <img src='" .
$GLOBALS['phpgw']->common->image('phpbrain', 'view') . "' title='".
lang('view') ."'>
+ </a>";
+ if (!$article['published'] &&
($this->bo->grants[$article['user_id']] & $this->bo->publish_right))
+ {
+ $actions .= "<a href='".
$this->link('menuaction=phpbrain.uikb.maintain_articles&publish='.
$article['art_id'] .'&order='. $this->bo->order .'&sort='. $this->bo->sort
.'&query='. $this->bo->query) ."'>
+
<img src='" . $GLOBALS['phpgw']->common->image('phpbrain', 'new') . "'
title='". lang('publish') ."'>
+
</a>";
+ }
+ if
($this->bo->grants[$article['user_id']] & $this->bo->edit_right)
+ {
+ $actions .= "<a href='".
$this->link('menuaction=phpbrain.uikb.maintain_articles&delete='.
$article['art_id'] .'&order='. $this->bo->order .'&sort='. $this->bo->sort
.'&query='. $this->bo->query). "'>
+
<img src='" . $GLOBALS['phpgw']->common->image('phpbrain', 'delete') .
"' title='" . lang('delete') . "'>
+
</a>";
+ }
+ $this->t->set_var(array(
+ 'tr_color'
=> $this->nextmatchs->alternate_row_color($tr_color),
+ 'title'
=> $article['title'],
+ 'topic'
=> $article['topic'],
+ 'author'
=> $article['username'],
+ 'date'
=> $GLOBALS['phpgw']->common->show_date($article['modified'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+ 'actions'
=> $actions,
+ 'name_checkbox' =>
'select[' . $article['art_id'] . ']'
+ ));
+ $this->t->parse('table_row',
'table_row_block', True);
+ }
}
else
{
- echo "<html>\n<head>\n";
- echo "<title>\n\t";
- echo
$GLOBALS['phpgw_info']['server']['site_title'] .' ['. lang('phpbrain') . "]\n";
- echo "</title>\n";
- echo "<style type=\"text/css\">\n<!--";
- echo $this->css();
- echo "\n-->\n</style></head>\n<body>";
+ $this->t->set_var('table_row', '<tr bgcolor="'.
$this->nextmatchs->alternate_row_color($tr_color) .'"><td colspan="5"
align="center">'. lang('There are no articles available') .'</td></tr>');
}
-
- $faq_id = (isset($_GET['faq_id']) ?
trim($_GET['faq_id']) : 0);
- $search = (isset($_GET['search']) ?
trim($_GET['search']) : '');
- $msg = (isset($_GET['msg']) ? trim($_GET['msg']) : '');
-
- $item = $this->bo->get_item($faq_id);
- if(is_array($item) && $faq_id)
- {
- $this->t->set_file('showitem', 'showitem.tpl');
- $lang = array('msg' => ($msg ?
lang($msg) : ''),
- 'lang_submitted_by' =>
lang('submitted_by'),
- 'lang_views' =>
lang('views'),
- 'lang_rating' =>
lang('rating'),
- 'lang_title' =>
lang('title'),
- 'lang_related_url' =>
lang('related_url'),
- 'lang_text' => lang('text'),
- 'lang_poor' => lang('poor'),
- 'lang_excellent' =>
lang('excellent'),
- 'lang_rate_why_explain' =>
lang('improve_by_rate'),
- 'lang_comments' =>
lang('comments')
- );
-
- if($search)//was the user seaching?
- {
- $this->t->set_var('return_url',
$GLOBALS['phpgw']->link('/index.php',
- array('menuaction' =>
'phpbrain.uikb.search',
- 'search'
=> $search
- )
- )
- );
- $lang['return_msg'] =
lang('return_to_search %1', $search);
- }
- elseif(!$header)
- {
- $this->t->set_var('return_url',
'javascript:window.close();');
- $lang['return_msg'] = lang('close
window');
- }
- else//no - they used the cat navigation to get
here
- {
- $this->t->set_var('return_url',
$GLOBALS['phpgw']->link('/index.php',
- array('menuaction' =>
'phpbrain.uikb.browse',
- 'cat_id'
=> $item['cat_id']
- )
- )
- );
- $lang['return_msg'] =
lang('return_to_cats %1', $this->cats->id2name($item['cat_id']));
- }//end if search
-
- $item['text'] = nl2br($item['text']);
- if($item['url'])
+ $select_publish = "<option value='all'";
+ if ($this->bo->publish_filter == 'all') $select_publish
.= ' selected';
+ $select_publish .= ">" . lang('All') .
"</option><option value='unpublished'";
+ if ($this->bo->publish_filter == 'unpublished')
$select_publish .= ' selected';
+ $select_publish .= ">" . lang('unpublished') .
"</option><option value='published'";
+ if ($this->bo->publish_filter == 'published')
$select_publish .= ' selected';
+ $select_publish .= '>' . lang('Published') .
'</option>';
+
+ $GLOBALS['phpgw_info']['flags']['java_script_thirst'] =
$this->javascript_check_all();
+
+ $this->t->set_var(array(
+ 'message' =>
$this->message,
+ 'lang_actions' =>
lang('Actions'),
+ 'lang_search' =>
lang('Search'),
+ 'value_query' =>
$this->bo->query,
+ 'form_maintain_articles_action'=>
$this->link('menuaction=phpbrain.uikb.maintain_articles'),
+ 'form_filters_action' =>
$this->link(array('menuaction' => 'phpbrain.uikb.maintain_articles', 'start' =>
$this->bo->start, 'sort' => $this->bo->sort)),
+ 'img_src_checkall' =>
$GLOBALS['phpgw']->common->image('phpbrain', 'check'),
+ 'order' =>
$this->bo->order,
+ 'publish_filter' =>
$this->bo->publish_filter,
+ 'head_title' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'title', $this->bo->order,
'', lang('Title')),
+ 'head_topic' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'topic', $this->bo->order,
'', lang('Topic')),
+ 'head_author' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'user_id',
$this->bo->order, '', lang('Author')),
+ 'head_date' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'created',
$this->bo->order, '', lang('Date')),
+ 'left' =>
$this->nextmatchs->left($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction.phpbrain.uikb.maintain_articles&cat='. $actual_category .
'&publish_filter=' . $this->bo->publish_filter . '&query=' . $this->bo->query),
+ 'right' =>
$this->nextmatchs->right($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction.phpbrain.uikb.maintain_articles&cat='. $actual_category
.'&publish_filter=' . $this->bo->publish_filter . '&query=' . $this->bo->query),
+ 'num_regs' =>
$this->nextmatchs->show_hits($this->bo->num_rows, $this->bo->start),
+ 'select_categories' =>
$this->bo->categories_obj->formated_list('select', 'all', $actual_category,
True),
+ 'select_publish' =>
$select_publish,
+ 'lang_publish_selected' => lang('Publish
selected'),
+ 'lang_delete_selected' => lang('Delete
selected')
+ ));
+
+ if (!$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = True;
+ }
+
+ $this->t->pparse('output', 'maintain_articles');
+ }
+
+ /**
+ * Question maintenance view
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return mixed When showing form, returns string
output if acccess through sitemgr
+ */
+ function maintain_questions()
+ {
+ $actual_category = (int)get_var('cat', 'any', 0);
+
+ if (!$this->bo->order) $this->bo->order = 'creation';
+ if (!$this->bo->sort) $this->bo->sort = 'DESC';
+
+ $this->bo->load_categories($actual_category);
+
+ // obtain articles to which one has any kind of
permission
+ if ($this->sitemgr) $this->bo->publish_filter =
'published';
+ $questions_list =
$this->bo->search_articles($actual_category, $this->bo->publish_filter,
$this->bo->read_right | $this->bo->edit_right | $this->bo->publish_right, True);
+ //echo "questions_list:
<pre>";print_r($questions_list);echo "</pre>";
+
+ // Process question deletion
+ if ($_GET['delete'] || $_POST['delete_selected'])
+ {
+ if ($_GET['delete'])
{
- $item['rel_link'] = '<a href="' .
$item['url'] .'" target="_blank">' . $item['url'] . '</a>';
+ $selected = array($_GET['delete'] =>
'');
}
else
{
- $item['rel_link'] = lang('none');
+ $selected = $_POST['select'];
}
-
- $this->t->set_block('showitem', 'click_rating',
'click_ratings');
- $this->t->set_block('showitem', 'b_rate',
'b_rating');
- $this->t->set_block('showitem', 'b_no_rate',
'b_no_rating');
- if(address@hidden>bo->rated[$faq_id])
- {
- $rate_url =
$GLOBALS['phpgw']->link('/index.php',
- array('menuaction' =>
'phpbrain.uikb.rate',
- 'faq_id'
=> $faq_id
- )
- );
-
- for($i=1; $i<=5; $i++)
- {
- $this->t->set_var('rate_link',
"$rate_url&rating=$i");
- $this->t->set_var('rate_val',
$i);
-
$this->t->parse('click_ratings', 'click_rating',true);
- }
-
- $this->t->parse('b_rating', 'b_rate',
True);
- $this->t->set_var('b_no_rating', '');
- }
- elseif(isset($_GET['rating']))
- {
- $this->t->set_var('lang_rate_msg',
lang('thanks_4_rating'));
- $this->t->set_var('b_rating', '');
- $this->t->parse('b_no_rating',
'b_no_rate', True);
+ $errors = False;
+ foreach ($selected as $q_id => $trash)
+ {
+ $target_q = array();
+ foreach($questions_list as $question)
+ {
+ if ($question['question_id'] ==
$q_id)
+ {
+ $target_q = $question;
+ break;
+ }
+ }
+ $message =
$this->bo->delete_question($target_q['question_id'], $target_q['user_id']);
+ if ($message != 'del_q_ok') $errors =
$message;
+ }
+ if (!$errors)
+ {
+ $message = $_GET['delete']? 'del_q_ok'
: 'del_qs_ok';
+ }
+ $GLOBALS['phpgw']->redirect_link($this->link,
'menuaction=phpbrain.uikb.maintain_questions&message=' . $message);
+ die();
+ }
+
+ // Process question publication
+ if ($_GET['publish'] || $_POST['publish_selected'])
+ {
+ if ($_GET['publish'])
+ {
+ $selected = array($_GET['publish'] =>
'');
}
else
{
- $this->t->set_var('lang_rate_msg',
lang('already_rated'));
- $this->t->set_var('b_rating', '');
- $this->t->parse('b_no_rating',
'b_no_rate', True);
+ $selected = $_POST['select'];
}
-
- $this->t->set_block('showitem', 'cmnt',
'cmnts');
- if(is_array($item['comments']))
+ $errors = False;
+ foreach ($selected as $question_id => $trash)
{
- $row = 0;//row counter
- foreach($item['comments'] as
$comment_key => $comment_vals)
+ $target_question = array();
+ foreach ($questions_list as $question)
{
- if($row % 2)//is even?
+ if ($question['question_id'] ==
$question_id)
{
-
$comment_vals['comment_bg'] = $this->theme['row_on'];
+ $target_question =
$question;
+ break;
}
- else//must be odd
- {
-
$comment_vals['comment_bg'] = $this->theme['row_off'];
- }//end if row == even
-
- $comment_vals['comment_text'] =
nl2br($comment_vals['comment_text']);
-
-
$this->t->set_var($comment_vals);
- $this->t->parse('cmnts',
'cmnt',true);
- $row++; //increment row counter
-
- }//end foreach(comments)
- }
- else//no comments
- {
- $this->t->set_var('comment_bg',
$this->theme['row_on']);
- $this->t->set_var('comments', '<tr
align="center"><td>' . lang('no comments') . '</td></tr>');
- }//end if is_array(comments)
-
- $this->t->set_var('comment_form',
$this->build_form('add_comment', 'add_comments', 'comment',
-
array('hidden_name' =>'faq_id',
-
'hidden_val' => $faq_id
-
)
-
)
- );
- $this->t->set_block('showitem', 'admin_option',
'admin_options');
- if($this->bo->is_admin())
- {
- $this->t->set_var('admin_url',
$GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.edit',
-
'faq_id' => $item['faq_id']
-
)
- )
- );
- $this->t->set_var('lang_admin_text',
lang('edit_faq'));
- $this->t->parse('admin_options',
'admin_option', true);
+ }
+ $message =
$this->bo->publish_question($target_question['question_id'],
$target_question['user_id']);
+ if ($message != 'publish_ok') $errors =
$message;
+ }
+ if (!$errors)
+ {
+ $message = $_GET['publish']?
'publish_ok' : 'publishs_ok';
+ }
+ $GLOBALS['phpgw']->redirect_link($this->link,
'menuaction=phpbrain.uikb.maintain_questions&message=' . $message);
+ die();
+ }
+
+ // Show table
+ $this->t->set_file('maintain_questions',
'maintain_questions.tpl');
+ $this->t->set_block('maintain_questions',
'table_row_block', 'table_row');
+ $this->t->set_var('table_row', '');
+
+ foreach ($questions_list as $question)
+ {
+ $actions = '';
+ // skip if question unpublished and user has no
publish right on owner
+ if (!$question['published'] &&
!($this->bo->grants[$question['user_id']] & $this->bo->publish_right)) continue;
+
+ // can only attempt to answer a question if it
has been published
+ if ($question['published'])
+ {
+ $actions = "<a href='".
$this->link('menuaction=phpbrain.uikb.edit_article&q_id='.
$question['question_id']) ."'>
+ <img src='" .
$GLOBALS['phpgw']->common->image('phpbrain', 'answer') . "' title='".
lang('answer') ."'>
+ </a>";
+ }
+
+ // can only attempt to publish a question if it
is unpblished and user has publish rights on owner
+ if (!$question['published'] &&
($this->bo->grants[$question['user_id']] & $this->bo->publish_right))
+ {
+ $actions .= "<a href='".
$this->link('menuaction=phpbrain.uikb.maintain_questions&publish='.
$question['question_id'] .'&order='. $this->bo->order .'&sort='.
$this->bo->sort .'&query='. $this->bo->query) ."'>
+
<img src='" . $GLOBALS['phpgw']->common->image('phpbrain', 'new') . "'
title='". lang('publish') ."'>
+
</a>";
+ }
+
+ // can only delete question if user has edit
rights on owner
+ if ($this->bo->grants[$question['user_id']] &
$this->bo->edit_right)
+ {
+ $actions .= "<a href='".
$this->link('menuaction=phpbrain.uikb.maintain_questions&delete='.
$question['question_id'] .'&order='. $this->bo->order .'&sort='.
$this->bo->sort .'&query='. $this->bo->query). "'>
+
<img src='" . $GLOBALS['phpgw']->common->image('phpbrain', 'delete') . "'
title='" . lang('delete') . "'>
+
</a>";
+ }
+ $this->t->set_var(array(
+ 'tr_color' =>
$this->nextmatchs->alternate_row_color($tr_color),
+ 'summary' =>
$question['summary'],
+ 'details' =>
$question['details'],
+ 'date' =>
$GLOBALS['phpgw']->common->show_date($question['creation'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+ 'author' =>
$question['username'],
+ 'actions' =>
$actions,
+ 'name_checkbox' => 'select[' .
$question['question_id'] . ']'
+ ));
+ $this->t->parse('table_row', 'table_row_block',
True);
+ }
+
+ if ($this->sitemgr)
+ {
+
$this->nextmatchs->template->set_var('action_sitemgr',
$this->link('menuaction=phpbrain.uikb.maintain_questions'));
+ $this->t->set_var(array(
+ 'lang_outstanding_q' =>
lang('Outstanding published questions'),
+ 'head_summary' =>
lang('Summary'),
+ 'head_details' =>
lang('Details'),
+ 'head_date'
=> lang('creation'),
+ 'head_author' =>
lang('Author')
+ ));
+ if ($this->allow_questions)
+ {
+ $this->t->set_var('links_nav', "<a
href='". $this->link('menuaction=phpbrain.uikb.index') ."'>". lang('Main View',
'phpbrain') ."</a> | <a href='".
$this->link('menuaction=phpbrain.uikb.add_question') ."'>". lang('Add
Question') ."</a> |<br>");
}
else
{
- $this->t->set_var('admin_options', '');
+ $this->t->set_var('links_nav', "<a href='".
$this->link('menuaction=phpbrain.uikb.index') ."'>". lang('Main View',
'phpbrain') ."</a> |<br>");
}
-
- $this->t->set_var($lang);
- $this->t->set_var($item);
-
- $this->t->pfp('out', 'showitem');
}
- else//invalid faq_id
+ else
+ {
+ $select_publish = "<option value='all'";
+ if ($this->bo->publish_filter == 'all')
$select_publish .= ' selected';
+ $select_publish .= ">" . lang('All') .
"</option><option value='unpublished'";
+ if ($this->bo->publish_filter == 'unpublished')
$select_publish .= ' selected';
+ $select_publish .= ">" . lang('unpublished') .
"</option><option value='published'";
+ if ($this->bo->publish_filter == 'published')
$select_publish .= ' selected';
+ $select_publish .= '>' . lang('Published') .
'</option>';
+
$GLOBALS['phpgw_info']['flags']['java_script_thirst'] =
$this->javascript_check_all();
+
+ $this->t->set_var(array(
+ 'head_summary' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'summary',
$this->bo->order, '', lang('Summary')),
+ 'head_details' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'details',
$this->bo->order, '', lang('Details')),
+ 'head_date'
=> $this->nextmatchs->show_sort_order($this->bo->sort, 'creation',
$this->bo->order, '', lang('creation')),
+ 'head_author' =>
$this->nextmatchs->show_sort_order($this->bo->sort, 'user_id',
$this->bo->order, '', lang('Author')),
+ 'select_publish' =>
$select_publish
+ ));
+ }
+ $this->t->set_var(array(
+ 'message' =>
$this->message,
+ 'lang_actions' =>
lang('Actions'),
+ 'lang_search' =>
lang('Search'),
+ 'value_query' =>
$this->bo->query,
+ 'form_maintain_questions_action'=>
$this->link('menuaction=phpbrain.uikb.maintain_questions'),
+ 'form_filters_action' =>
$this->link('menuaction=phpbrain.uikb.maintain_questions&start='.
$this->bo->start .'&sort='. $this->bo->sort),
+ 'img_src_checkall' =>
$GLOBALS['phpgw']->common->image('phpbrain', 'check'),
+ 'order' =>
$this->bo->order,
+ 'publish_filter' =>
$this->bo->publish_filter,
+ 'left' =>
$this->nextmatchs->left($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction.phpbrain.uikb.maintain_questions&cat='. $actual_category .
'&publish_filter=' . $this->bo->publish_filter . '&query=' . $this->bo->query),
+ 'right' =>
$this->nextmatchs->right($this->link, $this->bo->start, $this->bo->num_rows,
'menuaction.phpbrain.uikb.maintain_questions&cat='. $actual_category
.'&publish_filter=' . $this->bo->publish_filter . '&query=' . $this->bo->query),
+ 'num_regs' =>
$this->nextmatchs->show_hits($this->bo->num_rows, $this->bo->start),
+ 'select_categories' =>
$this->bo->categories_obj->formated_list('select', 'all', $actual_category,
True),
+ 'lang_publish_selected' => lang('Publish
selected'),
+ 'lang_delete_selected' => lang('Delete
selected')
+ ));
+
+ if (!$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ $this->navbar_shown = True;
+ }
+
+ if ($this->sitemgr)
+ {
+ return $this->t->parse('out',
'maintain_questions');
+ }
+ else
+ {
+ $this->t->pparse('output',
'maintain_questions');
+ }
+ }
+
+ /**
+ * Auxiliary function that reloads the article view showing a
confirmation message on top
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param int $article_id Id of article
to show
+ * @param string $message Message to show
+ * @return void
+ */
+ function reload_page($article_id, $message)
+ {
+
$GLOBALS['phpgw']->redirect($this->link("menuaction=phpbrain.uikb.view_article&art_id=$article_id&message=$message"));
+ }
+
+ /**
+ * Downloads file
+ *
+ * @author Alejandro Pedraza
+ * @access public
+ * @return void
+ */
+ function download_file()
+ {
+ $article_id = (int)get_var('art_id', 'GET');
+ $filename = urldecode(get_var('file',
'GET'));
+
+ $this->bo->download_file_checks($article_id, $filename);
+
+ // remove kb-# prefix
+ ereg('^kb[0-9]*-(.*)', $filename, $new_filename);
+
+ $download_browser = CreateObject('phpgwapi.browser');
+ $download_browser->content_header($new_filename[1]);
+ $cd_args = array('string' => '/kb', 'relative' =>
False, 'relatives' => RELATIVE_NONE);
+ if (!$GLOBALS['phpgw']->vfs->cd($cd_args)) die('could
not cd');
+ echo $GLOBALS['phpgw']->vfs->read(array('string' =>
$filename));
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ /**
+ * Returns HTML string of categories menu
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param int $parent_id
id of parent category
+ * @param int $num_main_categories Number
of main categories
+ * @return string
HTML string of categories menu
+ */
+ function build_categories($parent_id, $num_main_categories)
+ {
+ $categories_str = '';
+ $num_main_cat = 0;
+ foreach ($this->bo->categories as $cat)
+ {
+ $data = unserialize($cat['data']);
+ if ($data) $cat['icon'] = $data['icon'];
+ if ($cat['parent'] != $parent_id) continue;
+ $num_main_cat ++;
+ $categories_str .= "<tr><td valign=top>";
+ if ($cat['icon'])
+ $categories_str .= "<img src='"
. $GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'phpgwapi' . SEP .
'images' . SEP . $cat['icon'] . "'>";
+ $categories_str .= "</td><td><a
href='".$this->link('menuaction=phpbrain.uikb.index&cat='.$cat['id'])
+
."'><b>".$cat['name']."</b></a><br><div style='padding-left:10px'>";
+ $has_subcats = False;
+ foreach ($this->bo->categories as $subcat)
+ {
+ if ($subcat['parent'] != $cat['id'])
continue;
+ $has_subcats = True;
+ $categories_str .= "<a
href='".$this->link('menuaction=phpbrain.uikb.index&cat='.$subcat['id'])
+
."'>".$subcat['name']."</a>, ";
+ }
+ if ($has_subcats)
+ {
+ $categories_str =
substr($categories_str, 0, strlen($categories_str)-2); // remove the last comma
+ }
+ $categories_str .= "</div></td></tr>\n";
+ if ($num_main_cat ==
ceil($num_main_categories/2)) $categories_str .= "</table></td>\n<td width=50%
valign=top style='padding:10px 5px 10px 10px'><table>";
+ }
+ if ($categories_str) $categories_str = "<tr><td
width=50% valign=top style='padding:10px 5px 10px 10px'><table>" .
$categories_str . "</table></td></tr>";
+ return $categories_str;
+ }
+
+ /**
+ * Returns HTML string of categories from the topmost to the
actual one
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param int $category_id Id of current
category
+ * @param bool $links Whether to make
categories clickable or not
+ * @return string HTML
string
+ */
+ function category_path($category_id, $links = False)
+ {
+ $cat_data = $this->cat_data($category_id);
+ if ($cat_data)
{
- echo lang('invalid faq request - or something
is NQR');
- }//end is_array(item)
- }//end get_item
-
- //TODO clean up this mess
- function css()
- {
- return 'th { font-family: '.$this->theme['font'].';
font-size: 10pt; font-weight: bold; background-color: #D3DCE3;} '. "\n".
- 'td { font-family: '.$this->theme['font'].';
font-size: 10pt;} '. "\n".
- 'p { font-family: '.$this->theme['font'].';
font-size: 10pt} '. "\n".
- 'li { font-family: '.$this->theme['font'].';
font-size: 10pt} '. "\n".
- 'h1 { font-family: '.$this->theme['font'].';
font-size: 16pt; font-weight: bold} '. "\n".
- 'h2 { font-family: '.$this->theme['font'].';
font-size: 13pt; font-weight: bold} '. "\n".
- 'A:link { font-family:
'.$this->theme['font'].'; text-decoration: none; '.$this->theme['link'].'} '.
"\n".
- 'A:visited { font-family:
'.$this->theme['font'].'; text-decoration: none; color:
'.$this->theme['link'].' } '. "\n".
- 'A:hover { font-family:
'.$this->theme['font'].'; text-decoration: underline; color:
'.$this->theme['alink'].'} '. "\n".
- 'A.small:link { font-family:
'.$this->theme['font'].'; font-size: 8pt; text-decoration: none; color:
'.$this->theme['link'].'} '. "\n".
- 'A.small:visited { font-family:
'.$this->theme['font'].'; font-size: 8pt; text-decoration: none; color:
'.$this->theme['vlink'].'} '. "\n".
- 'A.small:hover { font-family:
'.$this->theme['font'].'; font-size: 8pt; text-decoration: underline; color:
'.$this->theme['alink'].'} '. "\n".
- '.nav { font-family: '.$this->theme['font'].';
background-color: ' . $this->theme['bg10'] . ';} ' . "\n".
- '.search { font-family:
'.$this->theme['font']. '; color: ' . $this->theme['navbar_text'] . ';
background-color: '.$this->theme['navbar_bg'] . '; font-size: 9pt; border: 1px
solid ' . $this->theme['bg_color'] . ';} '. "\n".
- '.navbg { font-family:
'.$this->theme['font'].'; color: '.$this->theme['navbar_text'] .';
background-color: '.$this->theme['navbar_bg'] . ';} '. "\n".
- 'a.contrlink { font-family:
'.$this->theme['font'].'; color: '.$this->theme['navbar_text'] .';
text-decoration: none;} '. "\n".
- 'a.contrlink:hover, a.stats:active {
font-family: '.$this->theme['font'].'; color: '.$this->theme['navbar_text'] .';
text-decoration: underline;}' . "\n".
- '.faq_info { font-family:
'.$this->theme['font'].'; color:' . $this->theme['navbar_bg'] . '; font-size:
8pt} ' . "\n" .
- 'hr {background-color: ' .
$this->theme['navbar_bg'] . '; border-width: 0px; heght: 2px;} ' . "\n" .
- 'input, textarea {color:' .
$this->theme['bg_text']. '; background-color:' . $this->theme['bg_color'] . ';
font-family: '.$this->theme['font']. '; font-size: 9pt; border: 1px solid ' .
$this->theme['bg_text'] . ';} '. "\n".
- '';
+ if (!$this->path)
+ {
+ if ($links)
+ {
+ $this->path = "<a href='" .
$this->link('menuaction=phpbrain.uikb.index&cat=' . $category_id) . "'>"
+
. $cat_data['name'] . "</a>";
+ }
+ else
+ {
+ $this->path = $cat_data['name'];
+ }
+ }
+ else
+ {
+ if ($links)
+ {
+ $this->path = "<a href='" .
$this->link('menuaction=phpbrain.uikb.index&cat=' . $category_id) . "'>"
+
. $cat_data['name'] . " >> " . $this->path;
+ }
+ else
+ {
+ $this->path = $cat_data['name']
. ' >> ' . $this->path;
+ }
+ }
+ return
$this->category_path($cat_data['parent_id'], $links);
+ }
+ return $this->path;
+ }
+
+ /**
+ * Auxiliary function to category_path function
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param int $category_id
+ * @return mixed Array or 0
+ */
+ function cat_data($category_id)
+ {
+ $cat_data = array();
+ foreach ($this->bo->all_categories as $cat)
+ {
+ if ($cat['id'] == $category_id)
+ {
+ $cat_data['name'] =
$cat['name'];
+ $cat_data['parent_id'] =
$cat['parent'];
+ return $cat_data;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Shows basic search form
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @return string Form to place inside other templatesA
+ */
+ function show_basic_search()
+ {
+ $this->t->set_file('basic_search', 'basic_search.tpl');
+ $this->t->set_var(array(
+ 'lang_search_kb' => lang('Search
in all the Knowledge Base'),
+ 'lang_enter_words' => lang('Enter
one or two words describing the issue, or type the article number if you know
it'),
+ 'lang_search' =>
lang('Search'),
+ 'lang_advanced_search' => lang('Advanced
Search'),
+ 'class_tr' => 'th',
+ 'query_value' =>
$this->bo->query? $this->bo->query : '',
+ 'link_adv_search' =>
$this->link('menuaction=phpbrain.uikb.advsearch'),
+ 'form_search_action' =>
$this->link('menuaction=phpbrain.uikb.index')
+ ));
+ return $this->t->parse('output', 'basic_search');
+
+ }
+
+ /**
+ * Shows link string. Necessary because might be different
depending if entered through sitemgr or not
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param string $args GET arguments to be appended to
link
+ * @return string Link string
+ */
+ function link($args)
+ {
+ if ($this->sitemgr)
+ {
+ return $this->link . '&' . $args;
+ }
+ else
+ {
+ return $GLOBALS['phpgw']->link($this->link,
$args);
+ }
+ }
+
+ /**
+ * Javascript code to check all check boxes in a table
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @return string Code
+ */
+ function javascript_check_all()
+ {
+ $javascript = "<script>
+ function check_all(which)
+ {
+ for (i=0; i<document.admin_articles.elements.length;
i++)
+ {
+ if (document.admin_articles.elements[i].type ==
'checkbox' &&
document.admin_articles.elements[i].name.substring(0,which.length) == which)
+ {
+ if (document.admin_articles.elements[i].checked)
+ {
+ document.admin_articles.elements[i].checked =
false;
+ }
+ else
+ {
+ document.admin_articles.elements[i].checked =
true;
+ }
+ }
+ }
+ }</script>";
+ return $javascript;
+ }
+
+ /**
+ * To stop execution showing error message
+ *
+ * @author Alejandro Pedraza
+ * @access private
+ * @param string $error_msg Error message to be
translated and shown
+ * @return void
+ */
+ function die_peacefully($error_msg)
+ {
+ if (!$this->navbar_shown && !$this->sitemgr)
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ }
+ echo "<div style='text-align:center;
font-weight:bold'>" . lang($error_msg) . "</div>";
+ $GLOBALS['phpgw']->common->phpgw_footer();
+ die();
}
}
+?>
Index: phpbrain/inc/hook_admin.inc.php
diff -u phpbrain/inc/hook_admin.inc.php:1.10
phpbrain/inc/hook_admin.inc.php:1.11
--- phpbrain/inc/hook_admin.inc.php:1.10 Sun May 15 12:43:37 2005
+++ phpbrain/inc/hook_admin.inc.php Tue May 9 05:14:07 2006
@@ -1,29 +1,27 @@
<?php
- /**********************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org *
- * This program is part of the GNU project, see http://www.gnu.org/ *
- * *
- * Copyright 2003 Free Software Foundation, Inc. *
- * *
- * Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
- * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * --------------------------------------------
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * at your option) any later version. *
- \**********************************************************************/
- /* $Id: hook_admin.inc.php,v 1.10 2005/05/15 12:43:37 skwashd Exp $ */
+/**************************************************************************\
+* phpGroupWare - KnowledgeBase *
+* http://www.phpgroupware.org *
+* *
+* Copyright (c) 2003-2006 Free Sofware Foundation Inc *
+* Written by Dave Hall skwashd at phpgropware.org *
+* ------------------------------------------------------------------------ *
+* Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/ *
+* but quickly became a full rewrite
*
+* ------------------------------------------------------------------------ *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 2 of the License, or (at your *
+* option) any later version. *
+\**************************************************************************/
+
+ /* $Id: hook_admin.inc.php,v 1.11 2006/05/09 05:14:07 skwashd Exp $ */
{
$file = array
(
'Site Configuration' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname='
. $appname),
- '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()
//$GLOBALS['phpgw']->link('/index.php','menuaction=phpbrain.uikb.index')
+ 'Global Categories' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname=phpbrain')
);
display_section($appname,$file);
}
Index: phpbrain/inc/hook_config.inc.php
diff -u phpbrain/inc/hook_config.inc.php:1.5
phpbrain/inc/hook_config.inc.php:1.6
--- phpbrain/inc/hook_config.inc.php:1.5 Sun May 15 12:43:37 2005
+++ phpbrain/inc/hook_config.inc.php Tue May 9 05:14:07 2006
@@ -1,26 +1,25 @@
<?php
- /**********************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org *
- * This program is part of the GNU project, see http://www.gnu.org/ *
- * *
- * Copyright 2003 Free Software Foundation, Inc. *
- * *
- * Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
- * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * --------------------------------------------
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * at your option) any later version. *
- \**********************************************************************/
- /* $Id: hook_config.inc.php,v 1.5 2005/05/15 12:43:37 skwashd Exp $ */
+/**************************************************************************\
+* phpGroupWare - KnowledgeBase *
+* http://www.phpgroupware.org *
+* *
+* Copyright (c) 2003-2006 Free Sofware Foundation Inc *
+* Written by Dave Hall skwashd at phpgropware.org *
+* ------------------------------------------------------------------------ *
+* Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/ *
+* but quickly became a full rewrite
*
+* ------------------------------------------------------------------------ *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 2 of the License, or (at your *
+* option) any later version. *
+\**************************************************************************/
- /* $Id: hook_config.inc.php,v 1.5 2005/05/15 12:43:37 skwashd Exp $ */
+ /* $Id: hook_config.inc.php,v 1.6 2006/05/09 05:14:07 skwashd Exp $ */
function anon_user($config)
{
- $sbox = createObject('phpgwapi.sbox2');
- return
$sbox->getAccount('newsettings[anon_user]',$config['anon_user'], true);
+ //$sbox = createObject('phpgwapi.sbox2');
+ //return
$sbox->getAccount('newsettings[anon_user]',$config['anon_user'], true);
}
?>
Index: phpbrain/inc/hook_manual.inc.php
diff -u phpbrain/inc/hook_manual.inc.php:1.3
phpbrain/inc/hook_manual.inc.php:1.4
--- phpbrain/inc/hook_manual.inc.php:1.3 Sun May 15 12:43:37 2005
+++ phpbrain/inc/hook_manual.inc.php Tue May 9 05:14:07 2006
@@ -1,20 +1,21 @@
<?php
- /**********************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org *
- * This program is part of the GNU project, see http://www.gnu.org/ *
- * *
- * Copyright 2003 Free Software Foundation, Inc. *
- * *
- * Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
- * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * --------------------------------------------
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * at your option) any later version. *
- \**********************************************************************/
- /* $Id: hook_manual.inc.php,v 1.3 2005/05/15 12:43:37 skwashd Exp $ */
+/**************************************************************************\
+* phpGroupWare - KnowledgeBase *
+* http://www.phpgroupware.org *
+* *
+* Copyright (c) 2003-2006 Free Sofware Foundation Inc *
+* Written by Dave Hall skwashd at phpgropware.org *
+* ------------------------------------------------------------------------ *
+* Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/ *
+* but quickly became a full rewrite
*
+* ------------------------------------------------------------------------ *
+* This program is free software; you can redistribute it and/or modify it *
+* under the terms of the GNU General Public License as published by the *
+* Free Software Foundation; either version 2 of the License, or (at your *
+* option) any later version. *
+\**************************************************************************/
+
+ /* $Id: hook_manual.inc.php,v 1.4 2006/05/09 05:14:07 skwashd Exp $ */
// Only Modify the $file variable.....
$file = Array();
Index: phpbrain/index.php
diff -u phpbrain/index.php:1.3 phpbrain/index.php:1.4
--- phpbrain/index.php:1.3 Sun May 15 12:43:37 2005
+++ phpbrain/index.php Tue May 9 05:14:07 2006
@@ -1,30 +1,29 @@
<?php
- /**********************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org *
- * This program is part of the GNU project, see http://www.gnu.org/ *
- * *
- * Copyright 2003 Free Software Foundation, Inc. *
- * *
- * Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
- * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * --------------------------------------------
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * at your option) any later version. *
- \**********************************************************************/
- /* $Id: index.php,v 1.3 2005/05/15 12:43:37 skwashd Exp $ */
+
/**************************************************************************\
+ * eGroupWare - KnowledgeBase
*
+ * http://www.egroupware.org
*
+ * Written by Dave Hall [skwashd AT phpgroupware.org]
*
+ *
------------------------------------------------------------------------ *
+ * Started off as a port of phpBrain - http://vrotvrot.com/phpBrain/
*
+ * but quickly became a full rewrite.
*
+ *
------------------------------------------------------------------------ *
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by
the *
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+ /* $Id: index.php,v 1.4 2006/05/09 05:14:07 skwashd Exp $ */
- $GLOBALS['phpgw_info']['flags'] = array
- (
+ $phpgw_info = array();
+ $GLOBALS['phpgw_info']['flags'] = array(
'currentapp' => 'phpbrain',
'noheader' => True,
'nonavbar' => True
);
include('../header.inc.php');
- header('Location: ' . $GLOBALS['phpgw']->link('/index.php',
-
array('menuaction' => 'phpbrain.uikb.index')));
- $GLOBALS['phpgw']->common->phpgw_exit();
+ $obj = CreateObject('phpbrain.uikb');
+ $obj->index();
+
+ $GLOBALS['phpgw']->common->phpgw_exit(true);
?>
Index: phpbrain/setup/phpgw_de.lang
diff -u phpbrain/setup/phpgw_de.lang:1.3 phpbrain/setup/phpgw_de.lang:1.4
--- phpbrain/setup/phpgw_de.lang:1.3 Wed Feb 22 06:10:03 2006
+++ phpbrain/setup/phpgw_de.lang Tue May 9 05:14:07 2006
@@ -1,83 +1,188 @@
-$stat_name %1 phpbrain de
-%1 contains %2 items phpbrain de %1 beinhaltet %2 Punkte
-%1 faqs_activated phpbrain de %1 FAQs aktiviert
-%1 faqs_deleted phpbrain de %1 FAQs gelöscht
-%1 matches found phpbrain de %1 Ãbereinstimmungen gefunden
-%1 questions_activated phpbrain de %1 Fragen aktiviert
-%1 questions_deleted phpbrain de %1 Fragen gelöscht
-active_when_checked phpbrain de
-add_answer phpbrain de Antwort hinzufügen
-add_comments phpbrain de Kommentar hinzufügen
-add_question phpbrain de Frage hinzufügen
-add_question (%1 open) phpbrain de Frage hinzufügen (%1 offen)
-allow html admin de HTML Befehle erlauben beim posting
-allow_html phpbrain de HTML tags in Beiträgen erlauben
-already_rated phpbrain de
-anon user admin de Anunymer Benutzer
-anon_user phpbrain de Anonymer Benutzer
+/kb directory does not exist and could not be created, please ask the
adminstrator to check the global configuration phpbrain de Das
Verzeichnis /kb existiert nicht oder konnte nicht erstellt werden. Bitte
kontaktieren Sie den Administrator zur Überprüfung der Konfiguration.
+action phpbrain de Befehl
+actions phpbrain de Befehle
+add articles phpbrain de Artikel hinzufügen
+add link phpbrain de Link hinzufügen
+add question phpbrain de Frage hinzufügen
+added file %1 phpbrain de Datei %1 hinzugefügt
+added link %1 phpbrain de Link %1 hinzugefügt
+added related articles %1 phpbrain de Verwandte Artikel %1
hinzugefügt
+advanced search phpbrain de Erweiterte Suche
+all articles phpbrain de Alle Artikel
answer phpbrain de Antwort
-browse common de Ansehen
-cant_post_must_register phpbrain de Sie müssen ein
registrierter Benutzer sein um Informationen zur Wissensdatenbank hinzuzufügen
-check_before_submit phpbrain de Bitte überprüfen Sie das
diese Information nicht schon in der Wissensdatenbank vorhanden ist, bevor Sie
etwas neues eintragen
-close window phpbrain de Fenster schliessen
+anytime phpbrain de jederzeit
+anywhere in the article phpbrain de Im gesamten Artikel
+article phpbrain de Artikel
+article added to database, you can now attach files or links, or relate to
other articles phpbrain de Der Artikel wurde zur Datenbank
hinzugefügt. Sie können nun Links, Dateien oder verwandte Artikel zu diesem
Artikel hinzufügen.
+article created phpbrain de Artikel wurde erstellt
+article deleted phpbrain de Artikel gelöscht
+article deleted successfully phpbrain de Artikel wurde
erfolgreich gelöscht
+article edited phpbrain de Artikel bearbeitet
+article has been published phpbrain de Artikel wurde
veröffentlicht
+article id phpbrain de Artikel ID
+articles added phpbrain de Artikel hinzugefügt
+articles deleted successfully phpbrain de Artikel erfolgreich
gelöscht
+articles have been published phpbrain de Artikel wurde
veröffentlicht
+articles in %1 phpbrain de Artikel in %1
+articles in %1 and all its subcategories phpbrain de Artikel
in %1 und in allen Unterkategorien
+articles not classified under any category phpbrain de Artikel
welche keiner Kategorie zugeteilt wurden
+ascendent phpbrain de Aufsteigend
+attach file phpbrain de Datei hinzufügen
+attached files phpbrain de Hinzugefügte Dateien
+average rating phpbrain de Durchschnittliche Bewertung
+base directory does not exist, please ask the adminstrator to check the global
configuratio phpbrain de Das Hauptverzeichnis existiert nicht.
Bitte kontaktieren Sie den Administrator damit dieser die Konfiguration
überprüft.
+before submiting a question, please search in the knowledge base first
phpbrain de Bevor Sie eine Frage einreichen, durchsuchen Sie bitte
die Wissensdatenbank zuerst
+by answering this question you will help to get the answer quicker the next
time phpbrain de Durch beantworten diese Frage helfen Sie,
das nächste mal eine schnellere Antwort zu erhalten.
comment phpbrain de Kommentare
+comment and rating have been published phpbrain de Kommentar und
Bewertung wurden veröffentlicht
+comment could not be inserted in the database phpbrain de Der
Kommentar konnte nicht zur Datenbank hinzugefügt werden
+comment has been deleted phpbrain de Kommentar wurde
hinzugefügt
+comment has been published phpbrain de Kommantar wurde
veröffentlicht
+comment has been submited for revision phpbrain de Kommantar wurde
eingereicht zur überprüfung
+comment has been submited for revision and rating will be published
phpbrain de Kommentar wurde eingereicht zur Überprüfung. Ihre
Bewertung wird veröffentlicht
comments phpbrain de Kommentare
-cur_open_qs phpbrain de Zur Zeit offene Fragen
-current_questions phpbrain de momentane Fragen
-edit_answer phpbrain de Antworten bearbeiten
-edit_faq phpbrain de FAQ bearbeiten
-enable common de Aktivieren
-example phpbrain de Beispiel
-excellent common de Sehr gut
-explain_faq_admin phpbrain de
-explain_maintain_answers phpbrain de
-explain_questions_admin phpbrain de
-faq phpbrain de FAQ
-faq_saved phpbrain de FAQ gespeichert
-faqs phpbrain de FAQs
-faqs_and_tutes phpbrain de FAQs und Anleitungen
-improve_by_rate phpbrain de Helfen Sie und die Qualität
der Einträge zu verbesser indem Sie diese beurteilen
-inspire_by_suggestions phpbrain de Wenn Sie ein Beispiel suchen,
sehen Sie sich doch bitte die offenen Fragen an.
-invalid faq request - or something is nqr phpbrain de Fehler:
Nicht gültige FAQ Eingabe
-kb_contains phpbrain de In der Wissensdatenbank befinden sich
-know_contrib phpbrain de Haben Sie eine Lösung für eine offene
Frage? Wenn ja tragen Sie die Antwort bitte hier ein.
-last_mod %1 phpbrain de Zuletzt bearbeitet: %1
-maintain_answers phpbrain de Antworten verwalten
-no comments phpbrain de keine Kommentare
-none found - revise or browse phpbrain de Nichts gefunden -
please revise your seach or browse
-none_pending phpbrain de Keine offenen vorhanden
-none_unanswered phpbrain de keine FAQ unbeantwortet
-not_submit_qs_warn phpbrain de Bitte beachten Sie das Sie hier
keine Fragen plazieren. Fragen sollten in der Sektion Fragen eingetragen
werden. <br> Wenn Sie eine Frage eintragen ohne eine Antwort wird diese Frage
gelöscht.
-num_faqs %1 phpbrain de FAQs(%1)
-num_open %1 phpbrain de offen(%1)
-num_pages %1 phpbrain de Seiten(%1)
-num_tutes %1 phpbrain de Anleitungen(%1)
+configuration phpbrain de Konfiguration
+create a new article to answer the question asked by %1 in %2 phpbrain
de Einen neuen Artikel erstellen um auf die Frage, gestellt von %1 in %2
zu antworten
+created by %1 on %2 phpbrain de Erstellt von %1 in %2
+creation phpbrain de Erstellung
+creation date phpbrain de Erstellungsdatum
+delete article phpbrain de Artikel löschen
+delete selected phpbrain de Ausgewählte löschen
+deleted relation to article %1 phpbrain de Verbindung zu
Artikel %1 gelöscht
+deleted relation to article %1 phpbrain de Verbindung zu Artikel
%1 gelöscht
+descendent phpbrain de Absteigend
+details phpbrain de Details
+e-groupware knowledge base article attached phpbrain de
eGroupWare Wissensdatenbank Artikel angehangen
+e-mail has been sent phpbrain de Email wurde versendet
+edit article phpbrain de Artikel bearbeiten
+enter one or two words describing the issue, or type the article number if you
know it phpbrain de Bitte geben Sie ein oder zwei Worte ein welche
Ihre Frage beschreiben, oder geben Sie die Artikel Nummer ein wenn Sie diese
Wissen
+error deleting article from database phpbrain de Es ist ein
Fehler beim löschen des Artikel in der Datenbank aufgetreten
+error deleting link phpbrain de Fehler beim löschen des Link
+error downloading file phpbrain de Fehler beim runterladen der
Datei
+error locating files directory phpbrain de Der Datei Ordner konnte
nicht gefunden werden
+error moving file to directory phpbrain de Beim verschieben der
Datein in den Ordner ist ein Fehler aufgetreten
+error publishing comment phpbrain de Es ist ein Fehler beim
veröffentlichen des Kommentars aufgetreten
+error retrieving article phpbrain de Fehler beim empfangen
des Artikel
+error trying to delete comment phpbrain de Es ist ein Fehler beim
löschen des Kommentars
+error trying to delete question phpbrain de Es ist ein
Fehler beim löschen der Frage
+error trying to edit article phpbrain de Es ist ein Fehler beim
versuch diesen Artikel zu bearbeiten
+error trying to publish article phpbrain de Fehler beim
veröffentlichen des Artikels
+error: file doesn't exist in the database phpbrain de Fehler:
Diese Datein existiert nicht in der Datenbank
+excellent phpbrain de Sehr gut
+failure trying to delete the file phpbrain de Es sit ein
Fehler aufgetreten beim Versuch den Artikel zu löschen
+file could be deleted from server but not from database phpbrain
de Datei konnte auf dem Server gelöscht werden, jedoch nicht in der
Datenbank
+file has been successfully uploaded phpbrain de Datei wurde
erfolgreich hochgeladen
+file was already missing from server, and was deleted from the database
phpbrain de Die Datei ist auf dem Server nicht mehr vorhanden und
wurde in der Datenbank gelöscht
+file was deleted successfully phpbrain de Datein wurde
erfolgreich gelöscht
+file wasn't in server and it couldn't be deleted from the database
phpbrain de Die Datei war weder auf dem Server noch in der
Datenbank vorhanden und konnte nicht gelöscht werden
+find results phpbrain de Finde Ergebnisse
+global categories phpbrain de Globale Kategorien
+have to be approved first common de Muß zuerst überprüft werden
+history phpbrain de Historie
+if you can't find answers to your problem in the knowledge base, describe it
below phpbrain de Falls Sie keine Antwort zu Ihrem problem
finden in der Wissensdatenbank, beschreiben Sie es bitte unten.
+if you wish, you can comment this article here phpbrain de Sie
können diesen Artikel hier kommentieren
+in %1 phpbrain de in %1
+in the text phpbrain de im Text
+in the title phpbrain de im Titel
+in the topic phpbrain de im Thema
+include subcategories phpbrain de inklusive Unterkategorien
+keywords phpbrain de Schlüsselworte
+knowledge base article #%1 phpbrain de Wissensdatenbank
Artikel %1
+knowledge base configuration common de Wissensdatenbank konfiguration
+last modification by %1 on %2 phpbrain de Zuletzt bearbeitet von
%1 am %2
+latest phpbrain de Zuletzt
+latest comments phpbrain de Letzte Kommentare
+leave empty to automatically generate an id phpbrain de um
automatisch eine ID zu erstellen geben Sie nichts ein
+link could not be added phpbrain de Der Link konnte nicht
hinzugefügt werden
+link deleted successfully phpbrain de Link erfolgreich
gelöscht
+link has been added phpbrain de Link wurde hinzugefügt
+links phpbrain de Links
+links & files phpbrain de Links und Dateien
+mail article phpbrain de Artikel per Mail versenden
+main view phpbrain de Gesamtübersicht
+maintain articles phpbrain de Artikel verwalten
+maintain questions phpbrain de Fragen verwalten
+maximum number of comments to show: phpbrain de Maximale Anzahl
von Artikeln welche angezeigt werden soll
+maximum number of most popular articles, latest articles and unanswered
questions to show in the main view: phpbrain de Maximale Anzahl
der meist gelesenen Artikel, der letzten Artikel und der offenen Fragen welche
in der Übersicht angezeigt werden sollen
+modification date phpbrain de Änderungs Datum
+most viewed phpbrain de Meist gelesen
+new article phpbrain de Neuer Artikel
+nobody has rated this article so far phpbrain de Dieser Artikel
wurde noch nicht bewertet
+nothing was uploaded! phpbrain de Es wurde nichts hochgeladen!
+number of results per page phpbrain de Anzehl Treffer
+ocurrences phpbrain de Auftreten
+or browse the categories phpbrain de Oder die Kategorien
durchsuchen
+order results by phpbrain de Ergebnisse sortieren nach
+outstanding published questions phpbrain de Ausstehende
veröffentlichte Fragen
+past %1 months phpbrain de letzte %1 Monate
+past year phpbrain de letztes Jahr
+people have rated this article phpbrain de Dieser Artikel wurde
bewerted von folgenden Personen mit
phpbrain common de Wissensdatenbank
-phpbrain config admin de Wissensdatenbank konfiguration
-phpbrain_config phpbrain de Wissensdatenbank konfiguration
-poor common de Schlecht
-preview phpbrain de Vorschau
-question phpbrain de Frage
-rating phpbrain de Beurteilung
-rating %1 phpbrain de Beurteilung %1
-register common de Registrieren
-related_url phpbrain de Zugehörige URL
-reset phpbrain de zurücksetzen
-return_to_admin phpbrain de Zurück zur Administration
-return_to_cats %1 phpbrain de Zurück zur Kategorie: %1
-return_to_index phpbrain de Zurück zum Index
-return_to_search %1 phpbrain de Zurück zur Suche: %1
-score %1 phpbrain de Bewertung %1
-section_maint_faqs phpbrain de Nicht freigegebene FAQs
bearbeiten
-section_maintain_questions phpbrain de Fragen Verwalten
-show phpbrain de zeigen
-submitted_by phpbrain de Eingereicht von
-text common de Text
-thanks_4_rating phpbrain de Vielen Dank für Ihre Bewertung
-tutorial phpbrain de Anleitung
-tutorials phpbrain de Anleitungen
-up phpbrain de hoch
+please rate the pertinence and quality of this article phpbrain de
Bewerten Sie bitte die Angemessenheit und die Qualität dieses Artikels
+please try again phpbrain de Bitte versuchen Sie es erneut
+poor phpbrain de Schlecht
+printer view phpbrain de Drucker freundliche Darstellung
+problem relating articles phpbrain de Fehler beim bewerten
des Artikels
+publication date phpbrain de Erstellungs Datum
+publish phpbrain de Veröffentlichen
+publish articles automatically? common de Artikel automatisch
veröffentlichen
+publish comments automatically? common de Kommentare automatisch
veröffentlichen
+publish questions automatically? common de Fragen automatisch
veröffentlichen
+publish selected phpbrain de Markierte veröffentlichen
+published phpbrain de Veröffentlicht
+question deleted successfully phpbrain de Frage erfolgreich
gelöscht
+questions deleted successfully phpbrain de Fragen erfolgreich
gelöscht
+rating has been submited phpbrain de Ihre Bewertung wurde
veröffentlicht
+rating invalid phpbrain de Bewertung ungültig
+recipient phpbrain de Empfänger
+related articles in the knowledge base phpbrain de In Verbindung
stehende Artikel in der Wissensbasis
+relation with article was removed successfully phpbrain de Verbing
zu diesem Artikel wurde erfolgreich gelöscht
+removed file %1 phpbrain de Datei %1 gelöscht
+removed link %1 phpbrain de Link %1 gelöscht
+reply-to phpbrain de Antwort an
+search in all the knowledge base phpbrain de In der
kompletten Wissensdatenbank suchen
+search results phpbrain de Suchergebnis
+see more questions phpbrain de Mehr Fragen anzeigen
+see more questions... phpbrain de Mehr Fragen anzeigen...
+select articles phpbrain de Artikel auswählen
+show all comments phpbrain de Alle Kommentare anzeigen
+show articles belonging to: phpbrain de Zeige Artikel welche
gehören zu:
+show messages in category phpbrain de Zeige Nachrichten in
Kategorie
+submit comment phpbrain de Kommentar absenden
+submit comment and rating phpbrain de Kommentar und Bewertung
absenden
+suggested category phpbrain de Vorgeschlagene Kategorie
+summary phpbarin de Summe
+that file already exists phpbrain de Diese Datei existiert
bereits
+the article id must be a number phpbrain de Die Artikel ID
muß eine Zahl sein
+the article is empty phpbrain de Dieser Artikel ist leer
+the file was already missing in the server phpbrain de Die
Datei war auf dem Server nicht vorhanden
+the following errors occurred phpbrain de Die follgenden Fehler
sind aufgetreten
+the mail server returned: phpbrain de Der Mailserver
antwortete:
+the present category and all subcategories under it phpbrain de
Die momentane Kategorie und alle Unterkategorien
+the present category only phpbrain de Nur in der momentanen
Kategorie
+there are no articles phpbrain de Es wurden keine Artikel gefunden
+there are no articles available phpbrain de Es sind keine
Artikel verfügbar
+this article hasn't yet been published in the knowledge base phpbrain
de Dieser Artikel wurde in der Wissensdatenbank noch nicht veröffentlicht
+title phpbrain de Titel
+to create categories, press 'edit categories' in the preferences menu
phpbrain de Um eine Kategorie zu erstellen, klicken Sie "Kategorien
bearbeiten" im Menü Einstellungen
+topic phpbrain de Thema
+unable to add rating to database phpbrain de Es konnte keine
Bewertung in die Datenbank zugefügt werden
+unanswered questions phpbrain de Offene Fragen
+unpublish phpbrain de Veröffentlichung zurücknehmen
+unpublished phpbrain de Nicht veröffentlicht
+user preferences phpbrain de Benutzer Einstellungen
views phpbrain de Besuche
-views %1 phpbrain de Besuche %1
-votes %1 phpbrain de Bewertungen %1
-
+was it easy to find this article using the above search string?
phpbrain de War es einfach, diesen Artikel mit der oben genannten
Suchzeichenkette zu finden?
+when navigating through categories, choose whether the list of articles shown
corresponds only to the present category, or the present category and all
categories under it. phpbrain de Wenn Sie eine Kategorie
auswählen, soll die Liste der Artikel nur die ausgewählte Kategorie zeigen oder
auch alle Unterkategorien?
+with all the words phpbrain de Beinhaltet alle Worte
+with at least one of the words phpbrain de Beinhaltet mindestens
eins der Worte
+with the exact phrase phpbrain de Mit der genauen Phrase
+without the words phpbrain de Beinhaltet keines der Worte
+you are in %1 phpbrain de Sie befinden sich in %1
+you have already qualified this article phpbrain de Sie
haben schon eine Bewertung zu diesem Artikel abgegeben
+you have not the proper permissions to do that phpbrain de Sie
haben keine ausreichenden Rechte
+you must enter a title phpbrain de Sie müssen einen Titel eingeben
+you must enter a topic phpbrain de Sie müssen ein Thema eingeben
+your message could not be sent! phpbrain de Ihre Nachricht
konnte nicht gesendet werden!
+your question will be posted, but only will be published after approval by a
user with publishing rights phpbrain de Ihre Frage wurde
weitegeleitet, Sie wird jedoch zuerst veröffentlicht nachdem ein user mit
administrativen Rechten diese überprüft hat
+your question will be published immediately phpbrain de Ihre
Frage wird schnellstens veröffentlicht
Index: phpbrain/setup/phpgw_en.lang
diff -u phpbrain/setup/phpgw_en.lang:1.13 phpbrain/setup/phpgw_en.lang:1.14
--- phpbrain/setup/phpgw_en.lang:1.13 Tue Apr 29 21:17:54 2003
+++ phpbrain/setup/phpgw_en.lang Tue May 9 05:14:07 2006
@@ -1,80 +1,189 @@
-$stat_name %1 phpbrain en $stat_name %1
-%1 contains %2 items phpbrain en %1 contains %2 items
-%1 faqs_activated phpbrain en %1 FAQs Activated
-%1 faqs_deleted phpbrain en %1 FAQs Deleted
-%1 matches found phpbrain en %1 Matches Found
-%1 questions_activated phpbrain en %1 Questions Activated
-%1 questions_deleted phpbrain en %1 Questions Deleted
-active_when_checked phpbrain en Active when checked
-add_answer phpbrain en Add Answer
-add_comments phpbrain en Add Comments
-add_question phpbrain en Add Question
-add_question (%1 open) phpbrain en Add Question (%1 Open)
-allow html admin en Allow HTML tags in posts
-already_rated phpbrain en You have already rated this item.
Thank you.
-anon user admin en Anonymous User
-answer phpbrain en Answer
-browse common en Browse
-cant_post_must_register phpbrain en You must be a
registered user to be able to add information to the knowledge base
-check_before_submit phpbrain en Please check that this
information is not already in the knowledge base before submitting.
-close window phpbrain en close window
-comment phpbrain en Comments
+/kb directory does not exist and could not be created, please ask the
adminstrator to check the global configuration phpbrain en /kb
directory does not exist and could not be created, please ask the administrator
to check the global configuration
+action phpbrain en Action
+actions phpbrain en Actions
+add articles phpbrain en Add articles
+add link phpbrain en Add link
+add question phpbrain en Add Question
+added file %1 phpbrain en Added file %1
+added link %1 phpbrain en Added link %1
+added related articles %1 phpbrain en Added related articles
%1
+advanced search phpbrain en Advanced Search
+all articles phpbrain en All articles
+answer phpbrain en answer
+anytime phpbrain en anytime
+anywhere in the article phpbrain en Anywhere in the article
+article phpbrain en Article
+article added to database, you can now attach files or links, or relate to
other articles phpbrain en Article added to database, you can
now attach files or links, or relate to other articles
+article created phpbrain en Article created
+article deleted phpbrain en Article deleted
+article deleted successfully phpbrain en Article deleted
successfully
+article edited phpbrain en Article edited
+article has been published phpbrain en Article has been
published
+article id phpbrain en Article ID
+articles added phpbrain en Articles added
+articles deleted successfully phpbrain en Articles deleted
successfully
+articles have been published phpbrain en Articles have been
published
+articles in %1 phpbrain en Articles in %1
+articles in %1 and all its subcategories phpbrain en
Articles in %1 and all its subcategories
+articles not classified under any category phpbrain en
Articles not classified under any category
+ascendent phpbrain en Ascendent
+attach file phpbrain en Attach File
+attached files phpbrain en Attached Files
+average rating phpbrain en Average rating
+base directory does not exist, please ask the adminstrator to check the global
configuratio phpbrain en Base directory does not exist, please
ask the administrator to check the global configuration
+before submiting a question, please search in the knowledge base first
phpbrain en Before submiting a question, please search in the
knowledge base first
+by answering this question you will help to get the answer quicker the next
time phpbrain en By answering this question you will help to
get the answer quicker the next time
+comment phpbrain en comment
+comment and rating have been published phpbrain en Comment and
rating have been published
+comment could not be inserted in the database phpbrain en Comment
could not be inserted in the database
+comment has been deleted phpbrain en Comment has been deleted
+comment has been published phpbrain en Comment has been
published
+comment has been submited for revision phpbrain en Comment has
been submited for revision
+comment has been submited for revision and rating will be published
phpbrain en Comment has been submited for revision and rating will
be published
comments phpbrain en Comments
-current_questions phpbrain en Current Questions
-cur_open_qs phpbrain en Current Open Questions
-edit_answer phpbrain en Edit Answer
-edit_faq phpbrain en Edit FAQ
-enable common en Enable
-example phpbrain en Example
-excellent common en Excellent
-explain_faq_admin phpbrain en Answers to FAQs must be enabled
so users can few them. Select the FAQs you wish to enable. Alternatively you
can select inappropriate responses which you wish to delete.
-explain_maintain_answers phpbrain en Questions submitted by
users must be activated by an admin user. Select those answers that you wish
to activate or alternatively delete
-explain_questions_admin phpbrain en Answers submitted by
users must be activated by an admin user. Select those questions that you wish
to activate or alternatively delete
-faq phpbrain en FAQ
-faqs phpbrain en FAQs
-faqs_and_tutes phpbrain en FAQs and Tutorials
-faq_saved phpbrain en FAQ Saved
-improve_by_rate phpbrain en Help us improve by rating posts
-inspire_by_suggestions phpbrain en If you need inspiration, take a
look at the open questions.
-invalid faq request - or something is nqr phpbrain en ERROR:
Invalid FAQ Request
-kb_contains phpbrain en Knowledge Base Contains
-know_contrib phpbrain en Do you know the answer? If so, answer
it.
-last_mod %1 phpbrain en Last Modified: %1
-maintain_answers phpbrain en Maintain Answers
-no comments phpbrain en No Comments
-none found - revise or browse phpbrain en Nothing found - please
revise your seach or browse
-none_pending phpbrain en None Pending
-none_unanswered phpbrain en No FAQs unanswered
-not_submit_qs_warn phpbrain en Please note that this is not
the place to ask questions. The should be posted on the questions page. If
you enter a question without an answer on this page it will be deleted.
-num_faqs %1 phpbrain en FAQs(%1)
-num_open %1 phpbrain en Open(%1)
-num_pages %1 phpbrain en Pages(%1)
-num_tutes %1 phpbrain en Tutorials(%1)
+configuration phpbrain en Configuration
+create a new article to answer the question asked by %1 in %2 phpbrain
en Create a new article to answer the question asked by %1 in %2
+created by %1 on %2 phpbrain en Created by %1 on %2
+creation phpbrain en creation
+creation date phpbrain en Creation date
+delete article phpbrain en Delete article
+delete selected phpbrain en Delete selected
+deleted relation to article %1 phpbrain en Deleted
relation to article %1
+deleted relation to article %1 phpbrain en Deleted relation to
article %1
+descendent phpbrain en Descendent
+details phpbrain en Details
+e-groupware knowledge base article attached phpbrain en
E-GroupWare Knowledge Base article attached
+e-mail has been sent phpbrain en e-mail has been sent
+edit article phpbrain en Edit article
+enter one or two words describing the issue, or type the article number if you
know it phpbrain en Enter one or two words describing the issue, or
type the article number if you know it
+error deleting article from database phpbrain en Error deleting
article from database
+error deleting link phpbrain en Error deleting link
+error downloading file phpbrain en Error downloading file
+error locating files directory phpbrain en Error locating files
directory
+error moving file to directory phpbrain en Error moving file to
directory
+error publishing comment phpbrain en Error publishing comment
+error retrieving article phpbrain en Error retrieving article
+error trying to delete comment phpbrain en Error trying to delete
comment
+error trying to delete question phpbrain en Error trying to
delete question
+error trying to edit article phpbrain en Error trying to edit
article
+error trying to publish article phpbrain en Error trying to
publish article
+error: file doesn't exist in the database phpbrain en Error:
file doesn't exist in the database
+excellent phpbrain en Excellent
+failure trying to delete the file phpbrain en Failure trying
to delete the file
+file could be deleted from server but not from database phpbrain
en File coud be deleted from server but not from database
+file has been successfully uploaded phpbrain en File has been
successfully uploaded
+file was already missing from server, and was deleted from the database
phpbrain en File was already missing from server, and was deleted
from the database
+file was deleted successfully phpbrain en File was deleted
successfully
+file wasn't in server and it couldn't be deleted from the database
phpbrain en File wasn't in server and it couldn't be deleted from
the database
+find results phpbrain en Find results
+global categories phpbrain en Global Categories
+have to be approved first common en Have to be approved first
+history phpbrain en History
+if you can't find answers to your problem in the knowledge base, describe it
below phpbrain en If you can't find answers to your problem in
the knowledge base, describe it below
+if you wish, you can comment this article here phpbrain en If you
wish, you can comment this article here
+in %1 phpbrain en in %1
+in the text phpbrain en in the text
+in the title phpbrain en in the title
+in the topic phpbrain en in the topic
+include subcategories phpbrain en Include subcategories
+keywords phpbrain en Keywords
+knowledge base article #%1 phpbrain en Knowledge Base article
#%1
+knowledge base configuration common en Knowledge Base configuration
+last modification by %1 on %2 phpbrain en Last modification by %1
on %2
+last modified phpbrain en Last Modified
+latest phpbrain en Latest
+latest comments phpbrain en Latest comments
+leave empty to automatically generate an id phpbrain en Leave
empty to automatically generate an ID
+link could not be added phpbrain en Link could not be added
+link deleted successfully phpbrain en Link deleted
successfully
+link has been added phpbrain en Link has been added
+links phpbrain en Links
+links & files phpbrain en Links & Files
+mail article phpbrain en Mail article
+main view phpbrain en Main View
+maintain articles phpbrain en Maintain Articles
+maintain questions phpbrain en Maintain Questions
+maximum number of comments to show: phpbrain en Maximum number
of comments to show:
+maximum number of most popular articles, latest articles and unanswered
questions to show in the main view: phpbrain en Maximum number
of most popular articles, latest articles and unanswered questions to show in
the main view:
+modification date phpbrain en Modification date
+most viewed phpbrain en Most viewed
+new article phpbrain en New Article
+nobody has rated this article so far phpbrain en Nobody has
rated this article so far
+nothing was uploaded! phpbrain en Nothing was uploaded!
+number of results per page phpbrain en Number of results
+ocurrences phpbrain en Ocurrences
+or browse the categories phpbrain en Or browse the categories
+order results by phpbrain en Order results by
+outstanding published questions phpbrain en Outstanding
published questions
+past %1 months phpbrain en past %1 months
+past year phpbrain en past year
+people have rated this article phpbrain en people have rated this
article
phpbrain common en Knowledge Base
-phpbrain config admin en KnowledgeBase Configuration
-phpbrain_config phpbrain en Knowledge Base Configuration
-poor common en Poor
-preview phpbrain en preview
-question phpbrain en Question
-rating phpbrain en Rating
-rating %1 phpbrain en rating %1
-register common en Register
-related_url phpbrain en Related URL
-reset phpbrain en Reset
-return_to_admin phpbrain en Return to Admin
-return_to_cats %1 phpbrain en Return to Category: %1
-return_to_index phpbrain en Return to Index
-return_to_search %1 phpbrain en Return to Search: %1
-score %1 phpbrain en score %1
-section_maintain_questions phpbrain en Maintain Questions
-section_maint_faqs phpbrain en Maintain Pending FAQs
-show phpbrain en show
-submitted_by phpbrain en Submitted By
-text common en Text
-thanks_4_rating phpbrain en Thank you for rating this item.
-tutorial phpbrain en Tutorial
-tutorials phpbrain en Tutorials
-up phpbrain en up
-views phpbrain en Views
-views %1 phpbrain en views %1
-votes %1 phpbrain en votes %1
+please rate the pertinence and quality of this article phpbrain en
Please rate the pertinence and quality of this article
+please try again phpbrain en Please try again
+poor phpbrain en Poor
+printer view phpbrain en Printer view
+problem relating articles phpbrain en Problem relating
articles
+publication date phpbrain en Publication date
+publish phpbrain en Publish
+publish articles automatically? common en Publish articles
automatically?
+publish comments automatically? common en Publish comments
automatically?
+publish questions automatically? common en Publish questions
automatically
+publish selected phpbrain en Publish selected
+published phpbrain en Published
+question deleted successfully phpbrain en Question deleted
successfully
+questions deleted successfully phpbrain en Questions deleted
successfully
+rating has been submited phpbrain en Rating has been submited
+rating invalid phpbrain en Rating invalid
+recipient phpbrain en Recipient
+related articles in the knowledge base phpbrain en Related
Articles in the Knowledge Base
+relation with article was removed successfully phpbrain en
Relation with article was removes successfully
+removed file %1 phpbrain en Removed file %1
+removed link %1 phpbrain en Removed link %1
+reply-to phpbrain en Reply-to
+search in all the knowledge base phpbrain en Search in all
the Knowledge Base
+search results phpbrain en Search results
+see more questions phpbrain en See more questions
+see more questions... phpbrain en See more questions...
+select articles phpbrain en Select articles
+show all comments phpbrain en Show all comments
+show articles belonging to: phpbrain en Show articles belonging
to:
+show messages in category phpbrain en Show messages in
category
+submit comment phpbrain en Submit comment
+submit comment and rating phpbrain en Submit comment and
rating
+suggested category phpbrain en Suggested category
+summary phpbarin en Summary
+that file already exists phpbrain en That file already exists
+the article id must be a number phpbrain en The article ID
must be a number
+the article is empty phpbrain en The article is empty
+the file was already missing in the server phpbrain en The
file was already missing in the server
+the following errors occurred phpbrain en The following errors
occurred
+the mail server returned: phpbrain en The mail server
returned:
+the present category and all subcategories under it phpbrain en
The present category and all subcategories under it
+the present category only phpbrain en The present category
only
+there are no articles phpbrain en There are no articles
+there are no articles available phpbrain en There are no
articles available
+this article hasn't yet been published in the knowledge base phpbrain
en This article hasn't yet been published in the Knowledge Base
+title phpbrain en Title
+to create categories, press 'edit categories' in the preferences menu
phpbrain en To create categories, press 'Edit Categories' in the
preferences menu
+topic phpbrain en Topic
+unable to add rating to database phpbrain en Unable to add
rating to database
+unanswered questions phpbrain en Unanswered questions
+unpublish phpbrain en Unpublish
+unpublished phpbrain en unpublished
+user preferences phpbrain en User preferences
+views phpbrain en views
+was it easy to find this article using the above search string?
phpbrain en Was it easy to find this article using the above search
string?
+when navigating through categories, choose whether the list of articles shown
corresponds only to the present category, or the present category and all
categories under it. phpbrain en When navigating through
categories, choose whether the list of articles shown corresponds only to the
present category, or the present category and all categories under it.
+with all the words phpbrain en With all the words
+with at least one of the words phpbrain en With at least one of
the words
+with the exact phrase phpbrain en With the exact phrase
+without the words phpbrain en Without the words
+you are in %1 phpbrain en You are in %1
+you have already qualified this article phpbrain en You
have already qualified this article
+you have not the proper permissions to do that phpbrain en You
have not the proper permissions to do that
+you must enter a title phpbrain en You must enter a title
+you must enter a topic phpbrain en You must enter a topic
+your message could not be sent! phpbrain en Your message
could not be sent!
+your question will be posted, but only will be published after approval by a
user with publishing rights phpbrain en Your question will be
posted, but only will be published after approval by a user with publishing
rights
+your question will be published immediately phpbrain en Your
question will be published immediately
Index: phpbrain/setup/phpgw_fr.lang
diff -u phpbrain/setup/phpgw_fr.lang:1.2 phpbrain/setup/phpgw_fr.lang:1.3
--- phpbrain/setup/phpgw_fr.lang:1.2 Wed Feb 22 06:08:24 2006
+++ phpbrain/setup/phpgw_fr.lang Tue May 9 05:14:07 2006
@@ -1,80 +1,271 @@
$stat_name %1 phpbrain fr $stat_name %1
%1 contains %2 items phpbrain fr %1 contient %2 objets
-%1 faqs_activated phpbrain fr %1 FAQs Activées
-%1 faqs_deleted phpbrain fr %1 FAQs Effacées
-%1 matches found phpbrain fr %1 Occurrences Trouvées
-%1 questions_activated phpbrain fr %1 Questions Activées
-%1 questions_deleted phpbrain fr %1 Questions Effacées
-active_when_checked phpbrain fr Actif quand vérifié
-add_answer phpbrain fr Ajouter Une Réponse
+%1 faqs_activated phpbrain fr %1 FAQs Activées
+%1 faqs_deleted phpbrain fr %1 FAQs Effacées
+%1 matches found phpbrain fr %1 Occurrences Trouvées
+%1 questions_activated phpbrain fr %1 Questions Activées
+%1 questions_deleted phpbrain fr %1 Questions Effacées
+/kb directory does not exist and could not be created, please ask the
administrator to check the global configuration phpbrain fr Le
repertoire /kb n'existe pas et ne peut être créé. Demandez à votre
administrateur de vérifier la configuration globale.
+/kb directory does not exist and could not be created, please ask the
adminstrator to check the global configuration phpbrain fr le
répertoire /kb n'existe pas et n'a pas pu être créé, veuillez demander à votre
administrateur qu'il vérifie la configuration globale
+action phpbrain fr Action
+actions phpbrain fr Actions
+active_when_checked phpbrain fr Actif quand vérifié
+add articles phpbrain fr Ajouter un article
+add link phpbrain fr Ajouter un lien
+add question phpbrain fr Ajouter une question
+add_answer phpbrain fr Ajouter Une Réponse
add_comments phpbrain fr Ajouter Des Commentaires
add_question phpbrain fr Ajouter Une Question
add_question (%1 open) phpbrain fr Ajouter Une Question (%1
Ouvert(s))
+added file %1 phpbrain fr Fichier ajouté %1
+added link %1 phpbrain fr Lien ajouté %1
+added related articles %1 phpbrain fr Article lié ajouté
+advanced search phpbrain fr Recherche avancée
+all articles phpbrain fr Tous les articles
allow html admin fr Autoriser les tags HTML dans les messages
-already_rated phpbrain fr Vous avez déjà mis une note à ce
sujet. Merci.
+already_rated phpbrain fr Vous avez déjà mis une note à ce sujet.
Merci.
anon user admin fr Utilisateur anonyme
-answer phpbrain fr Réponse
+answer phpbrain fr Réponse
+anytime phpbrain fr N'importe quand
+anywhere in the article phpbrain fr N'importe où dans
l'article
+article phpbrain fr Article
+article added to database, you can now attach files or links, or relate to
other articles phpbrain fr Article ajouté en base de données,
vous pouvez maintenant attaché des fichiers ou des liens, ou pointer vers
d'autres articles.
+article created phpbrain fr Article créé
+article deleted phpbrain fr Article supprimé
+article deleted successfully phpbrain fr Article supprimé avec
succès
+article edited phpbrain fr Article modifié
+article has been published phpbrain fr L'article a été publié
+article id phpbrain fr Identifiant d'article
+articles added phpbrain fr Articles supprimés
+articles deleted successfully phpbrain fr Articles supprimés avec
succès
+articles have been published phpbrain fr Les articles ont été
publiés
+articles in %1 phpbrain fr Articles dans %1
+articles in %1 and all its subcategories phpbrain fr
Articles dans %1 et toutes ses sous-catégories
+articles not classified under any category phpbrain fr
Articles non classés dans une catégorie
+ascendent phpbrain fr Ascendant
+attach file phpbrain fr Attacher un fichier
+attached files phpbrain fr Fichiers attachés
+average rating phpbrain fr Note moyenne
+base directory does not exist, please ask the adminstrator to check the global
configuratio phpbrain fr Le répertoire de base n'existe pas,
demandez svp à votre administrateur de vérifier la configuration globale
+before submiting a question, please search in the knowledge base first
phpbrain fr Avant de soumettre la question, merci de consulter la
base de connaissances.
browse common fr Naviguer
-cant_post_must_register phpbrain fr Vous devez être un
utilisateur enregistré pour pouvoir ajouter des informations dans la base de
connaissances
-check_before_submit phpbrain fr SVP vérifiez que cette
information n'est pas déjà dans la base de connaissances avant de la
soumettre.
-close window phpbrain fr Fermer la fenêtre
+by answering this question you will help to get the answer quicker the next
time phpbrain fr En répondant à cette question, vous
contribuez à rendre l'accès à la réponse plus rapidement la prochaine fois.
+cant_post_must_register phpbrain fr Vous devez être un
utilisateur enregistré pour pouvoir ajouter des informations dans la base de
connaissances
+check spelling phpbrain fr Vérifier l'orthographe
+check_before_submit phpbrain fr SVP vérifiez que cette
information n'est pas déjà dans la base de connaissances avant de la soumettre.
+close window phpbrain fr Fermer la fenêtre
comment phpbrain fr Commentaire
+comment and rating have been published phpbrain fr Les commentaire
et note ont été publiés
+comment could not be inserted in the database phpbrain fr Le
commentaire ne peut être inséré dans la base.
+comment has been deleted phpbrain fr Le commentaire a été
supprimé
+comment has been published phpbrain fr Le commentaire a été
publié
+comment has been submited for revision phpbrain fr Le commentaire
a été soumis à relecture
+comment has been submited for revision and rating will be published
phpbrain fr Le commentaire a été soumis à la relecture et la note
sera publiée.
comments phpbrain fr Commentaires
-current_questions phpbrain fr Questions actuelles
+configuration phpbrain fr Configuration
+confirm phpbrain fr Confirmer
+correct the errors and press confirm phpbrain fr Corrigez les
erreurs et pressez Confirmer
+create a new article to answer the question asked by %1 in %2 phpbrain
fr Créez un nouvel article pour répondre à la question posée par %1 dans %2
+created by %1 on %2 phpbrain fr Créé par %1 le %2
+creation phpbrain fr création
+creation date phpbrain fr Date de création
cur_open_qs phpbrain fr Questions actuellement ouvertes
-edit_answer phpbrain fr Modifier la réponse
+current_questions phpbrain fr Questions actuelles
+date phpbrain fr Date
+delete article phpbrain fr Supprimer l'article
+delete selected phpbrain fr Supprimer la sélection
+deleted relation to article %1 phpbrain fr Relation avec
article %1 supprimée
+deleted relation to article %1 phpbrain fr Relation avec article
%1 supprimée
+descendent phpbrain fr Descendant
+details phpbrain fr Détails
+e-mail has been sent phpbrain fr l'e-mail a été envoyé
+edit article phpbrain fr Editer l'article
+edit_answer phpbrain fr Modifier la réponse
edit_faq phpbrain fr Modifier la FAQ
enable common fr Activer
+enter one or two words describing the issue, or type the article number if you
know it phpbrain fr Entrez un ou deux mots décrivant le problème,
ou tapez le numéro d'article si vous le connaissez
+error deleting article from database phpbrain fr Erreur lors de
la suppression de l'article en base
+error deleting link phpbrain fr Erreur lors de la suppression
du lien
+error downloading file phpbrain fr Erreur lors du téléchargement
du fichier
+error locating files directory phpbrain fr Erreur lors de la
tentative d'accès au répertoire
+error moving file to directory phpbrain fr Erreur lors du
déplacement du fichier vers le répertoire
+error publishing comment phpbrain fr Erreur lors de la
publication du commentaire
+error retrieving article phpbrain fr Erreur lors de la
récuperation de l'article
+error trying to delete comment phpbrain fr Erreur en essayant de
supprimer le commentaire
+error trying to delete question phpbrain fr Erreur en
essayant de supprimer la question
+error trying to edit article phpbrain fr Erreur en essayant
d'éditer l'article
+error trying to publish article phpbrain fr Erreur en
essayant de publier l'article
+error: file doesn't exist in the database phpbrain fr Erreur:
le fichier n'existe pas dans la base de données
example phpbrain fr Exemple
-excellent common fr Excellent
-explain_faq_admin phpbrain fr Les réponses aux FAQs doivent
être activées pour que les utilisateurs puissent les voir. Choisissez les
FAQs que vous voulez activer. Sinon, vous pouvez choisir les réponses
inappropriées que vous voudriez effacer.
-explain_maintain_answers phpbrain fr Les questions soumises
par les utilisateurs doivent être activées par un utilisateur avec les droits
d'administrateur. Choisissez les réponses que vous voulez activer ou
éventuellement effacer.
-explain_questions_admin phpbrain fr Les réponses soumises
pares utilisateurs doivent être activées par un utilisateur avec les droits
d'administrateur. Choisissez les questions que vous voulez activer ou
éventuellement effacer.
+excellent phpbrain fr Excellent
+explain_faq_admin phpbrain fr Les réponses aux FAQs doivent
être activées pour que les utilisateurs puissent les voir. Choisissez les FAQs
que vous voulez activer. Sinon, vous pouvez choisir les réponses inappropriées
que vous voudriez effacer.
+explain_maintain_answers phpbrain fr Les questions soumises
par les utilisateurs doivent être activées par un utilisateur avec les droits
d'administrateur. Choisissez les réponses que vous voulez activer ou
éventuellement effacer.
+explain_questions_admin phpbrain fr Les réponses soumises
pares utilisateurs doivent être activées par un utilisateur avec les droits
d'administrateur. Choisissez les questions que vous voulez activer ou
éventuellement effacer.
+failure trying to delete the file phpbrain fr Echec lors de
la tentative de suppression du fichier
faq phpbrain fr FAQ
+faq_saved phpbrain fr FAQ Enregistrée
faqs phpbrain fr FAQs
faqs_and_tutes phpbrain fr FAQs et Tutoriels
-faq_saved phpbrain fr FAQ Enregistrée
-improve_by_rate phpbrain fr Aidez-nous à améliorer en
mettant des notes aux posts
+file coud be deleted from server but not from database phpbrain fr
Le fichier peut-être supprimé du serveur mais pas de la base de données
+file could be deleted from server but not from database phpbrain
fr Le fichier a pu être effacé du serveur mais pas de la base de données
+file has been successfully uploaded phpbrain fr Le fichier a
été enregistré sur le serveur avec succès
+file was already missing from server, and was deleted from the database
phpbrain fr Le fichier n'était plus sur le serveur et a été
supprimé de la base de données
+file was deleted successfully phpbrain fr Le fichier a été
supprimé avec succès
+file wasn't in server and it couldn't be deleted from the database
phpbrain fr Le fichier n'était pas sur le serveur et n'a pu être
supprimé de la base.
+find results phpbrain fr Chercher les résultats
+global categories phpbrain fr Catégories globales
+have to be approved first common fr Doivent être approuvés d'abord
+history phpbrain fr Historique
+if you can't find answers to your problem in the knowledge base, describe it
below phpbrain fr Si vous ne pouvez pas trouvez de réponses à
vos problème dans la base de connaissances, décrivez le ci-dessous
+if you wish, you can comment this article here phpbrain fr Si vous
le souhaitez vous pouvez commenter cet article ici
+improve_by_rate phpbrain fr Aidez-nous à améliorer en
mettant des notes aux posts
+in %1 phpbrain fr dans %1
+in the text phpbrain fr dans le texte
+in the title phpbrain fr dans le titre
+in the topic phpbrain fr dans le sujet
+include subcategories phpbrain fr Inclure les sous-catégories
inspire_by_suggestions phpbrain fr Si vous avez besoin
d'inspiration, allez jetter un oeil aux questions ouvertes.
-invalid faq request - or something is nqr phpbrain fr ERREUR:
requête FAQ invalide
+invalid faq request - or something is nqr phpbrain fr ERREUR:
requête FAQ invalide
kb_contains phpbrain fr La base de connaissances contient
-know_contrib phpbrain fr Connaissez-vous la réponse? Si oui,
répondez.
-last_mod %1 phpbrain fr Dernière modification: %1
-maintain_answers phpbrain fr Maintenir les réponses
+keywords phpbrain fr Mots-clés
+know_contrib phpbrain fr Connaissez-vous la réponse? Si oui,
répondez.
+knowledge base article #%1 phpbrain fr Base de connaissance
article n°%1
+knowledge base configuration common fr Configuration de la Base de
connaissance
+last modification by %1 on %2 phpbrain fr Dernière modification
par %1 le %2
+last_mod %1 phpbrain fr Dernière modification: %1
+latest phpbrain fr Les derniers en date
+latest comments phpbrain fr Derniers commentaires
+leave empty to automatically generate an id phpbrain fr Laisser
vide pour générer automatiquement un ID
+link could not be added phpbrain fr Le lien ne peut être
ajouté
+link deleted successfully phpbrain fr Lien supprimé avec
succès
+link has been added phpbrain fr Le lien a été ajouté
+links phpbrain fr Liens
+links & files phpbrain fr Liens & Fichiers
+mail article phpbrain fr Envoyer l'article par email
+main view phpbrain fr Vue principale
+maintain articles phpbrain fr Maintenir les articles
+maintain questions phpbrain fr Maintenir les réponses
+maintain_answers phpbrain fr Maintenir les réponses
+maximum number of comments to show: phpbrain fr Nombre maximum
de commentaires à montrer
+maximum number of most popular articles, latest articles and unanswered
questions to show in the main view: phpbrain fr Nombre maximum
d'articles les plus populaires, les plus récents et de questions sans réponses
dans la vue principale:
+modification date phpbrain fr Date de modification
+most viewed phpbrain fr Les plus consultés
+new article phpbrain fr Nouvel article
no comments phpbrain fr Pas de commentaires
-none found - revise or browse phpbrain fr Aucune occurrence
trouvée - SVP vérifiez votre recherche ou naviguez
+nobody has rated this article so far phpbrain fr Personne n'a
noté cet article à ce jour
+none phpbrain fr Aucun
+none found - revise or browse phpbrain fr Aucune occurrence
trouvée - SVP vérifiez votre recherche ou naviguez
none_pending phpbrain fr Aucune en attente
-none_unanswered phpbrain fr Aucune FAQ non répondue
-not_submit_qs_warn phpbrain fr SVP notez que ceci n'est pas
l'endroit pour poser des questions. Ceci devrait être posté dans la page des
questions. Si vous entrez une question sans une réponse dans cette page elle
sera effacée.
+none_unanswered phpbrain fr Aucune FAQ non répondue
+not_submit_qs_warn phpbrain fr SVP notez que ceci n'est pas
l'endroit pour poser des questions. Ceci devrait être posté dans la page des
questions. Si vous entrez une question sans une réponse dans cette page elle
sera effacée.
+nothing was uploaded! phpbrain fr Rien n'a été enregistré sur le
serveur!
num_faqs %1 phpbrain fr FAQs(%1)
num_open %1 phpbrain fr Ouverte(s)(%1)
num_pages %1 phpbrain fr Pages(%1)
num_tutes %1 phpbrain fr Tutoriels(%1)
+number of results phpbrain fr Nombre de résultats
+number of results per page phpbrain fr Nombre de résultats
+ocurrences phpbrain fr Occurences
+or browse the categories phpbrain fr Où consulter les
catégories
+order results by phpbrain fr Trier les résultats par
+outstanding published questions phpbrain fr Questions
éditées en suspens
+past %1 months phpbrain fr des derniers %1 mois
+past year phpbrain fr de l'année dernière
+people have rated this article phpbrain fr personnes ont noté cet
article
phpbrain common fr Base de connaissances
phpbrain config admin fr Configuration de la base de
connaissances
phpbrain_config phpbrain fr Configuration de base de la
base de connaissances
-poor common fr Pauvre
-preview phpbrain fr prévisualisation
+please rate the pertinence and quality of this article phpbrain fr
Merci de noter la pertinence et la qualité de cet article
+please try again phpbrain fr Merci d'essayer à nouveau
+poor phpbrain fr Pauvre
+preview phpbrain fr prévisualisation
+printer view phpbrain fr Affichage optimisé pour l'impression
+problem relating articles phpbrain fr Problèmes liés à
l'article
+publication date phpbrain fr Date de publication
+publish phpbrain fr Publier
+publish articles automatically? common fr Publier les articles
automatiquement ?
+publish comments automatically? common fr Publier les
commentaires automatiquement ?
+publish questions automatically common fr Publier les questions
automatiquement
+publish questions automatically? common fr Publier les questions
automatiquement
+publish selected phpbrain fr Publier
+published phpbrain fr Publié
question phpbrain fr Question
+question deleted successfully phpbrain fr Question supprimée avec
succès
+questions deleted successfully phpbrain fr Questions supprimées
avec succès
rating phpbrain fr Notation
rating %1 phpbrain fr Notation %1
+rating has been submited phpbrain fr La note a été
enregistrée
+rating invalid phpbrain fr La note est invalide
+recipient phpbrain fr Destinataire
register common fr Enregistrer
-related_url phpbrain fr URL liée
-reset phpbrain fr Réinitialiser
-return_to_admin phpbrain fr Retourner à l'administration
-return_to_cats %1 phpbrain fr Retourner à la catégorie: %1
-return_to_index phpbrain fr Retourner à l'index
-return_to_search %1 phpbrain fr Retourner à la recherche: %1
+related articles in the knowledge base phpbrain fr Articles liés
dans la base de connaissances
+related_url phpbrain fr URL liée
+relation with article was removed successfully phpbrain fr La
relation avec l'article a été supprimée avec succès
+relation with article was removes successfully phpbrain fr La
relation avec l'article a été supprimé avec succès
+removed file %1 phpbrain fr Fichier supprimé %1
+removed link %1 phpbrain fr Lien supprimé %1
+reply-to phpbrain fr Répondre à
+reset phpbrain fr Réinitialiser
+return_to_admin phpbrain fr Retourner à l'administration
+return_to_cats %1 phpbrain fr Retourner à la catégorie: %1
+return_to_index phpbrain fr Retourner à l'index
+return_to_search %1 phpbrain fr Retourner à la recherche: %1
score %1 phpbrain fr score %1
-section_maintain_questions phpbrain fr Maintenir les questions
+search in all the knowledge base phpbrain fr Rechercher dans
toute la base de connaissances
+search results phpbrain fr Résultats de la recherche
section_maint_faqs phpbrain fr Maintenir les FAQs en attente
+section_maintain_questions phpbrain fr Maintenir les questions
+see more questions phpbrain fr Voir d'autres questions
+see more questions... phpbrain fr Voir plus de questions...
+select articles phpbrain fr Sélectionner les articles
show phpbrain fr Montrer
+show all comments phpbrain fr Afficher l'ensemble des
commentaires
+show articles belonging to: phpbrain fr Afficher les articles
appartenant à:
+show messages in category phpbrain fr Afficher les articles
dans la catégorie
+submit comment phpbrain fr Soumettre un commentaire
+submit comment and rating phpbrain fr Soumettre un
commentaire et une note
submitted_by phpbrain fr Soumis par
+suggested category phpbrain fr Catégorie suggérée
+summary phpbarin fr Sommaire
text common fr Texte
-thanks_4_rating phpbrain fr Merci d'avoir mis une note Ã
cet objet.
+thanks_4_rating phpbrain fr Merci d'avoir mis une note à
cet objet.
+that file already exists phpbrain fr Ce fichier existe déjà
+the article doesn't have spell errors phpbrain fr Cet article n'a
aucune faute d'orthographe
+the article id must be a number phpbrain fr L'ID d'article
doit être un nombre
+the article is empty phpbrain fr Cet article est vide
+the file was already missing in the server phpbrain fr Le
fichier était déjà absent du serveur
+the following errors occurred phpbrain fr Les erreurs suivantes
ont été commises
+the present category and all subcategories under it phpbrain fr
La catégorie actuelle et l'ensemble de ses sous-catégories
+the present category only phpbrain fr La catégorie actuelle
uniquement
+there are no articles phpbrain fr Il n'y a pas d'articles
+there are no articles available phpbrain fr Aucun article
disponible
+this article hasn't yet been published in the knowledge base phpbrain
fr Cet article n'a pas encore été publie dans la base des connaissances
+title phpbrain fr Titre
+to create categories, press 'edit categories' in the preferences menu
phpbrain fr Pour crééer des catégories, presser "Editer les
catégories" dans le menu des préférences
+topic phpbrain fr Sujet
tutorial phpbrain fr Tutoriel
tutorials phpbrain fr Tutoriels
+unable to add rating to database phpbrain fr Impossible
d'ajouter la note dans la base
+unanswered questions phpbrain fr Questions sans réponses
+unpublished phpbrain fr non publié
up phpbrain fr Haut
+upload phpbrain fr télécharger un fichier sur le serveur
+user phpbrain fr Utilisateur
+user preferences phpbrain fr Préférences utilisateurs
views phpbrain fr Vues
views %1 phpbrain fr Vues %1
votes %1 phpbrain fr Votes %1
+was it easy to find this article using the above search string?
phpbrain fr Etait-ce facile de trouver cet article en utilisant la
chaîne de recherche ci-dessus ?
+when navigating through categories, choose whether the list of articles shown
corresponds only to the present category, or the present category and all
categories under it. phpbrain fr En naviguant à travers les
catégories, choisissez si la liste d'articles doit uniquement correspondre à la
catégorie actuelle, ou a la catégorie actuelle et à l'ensemble de ses
sous-catégories.
+with all the words phpbrain fr Avec tous ces mots
+with at least one of the words phpbrain fr Avec au moins un de ces
mots
+with the exact phrase phpbrain fr Avec la phrase exacte
+without the words phpbrain fr Sans ces mots
+you are in %1 phpbrain fr Vous êtes dans %1
+you have already qualified this article phpbrain fr Vous
avez déjà noté cet article
+you have not the proper permissions to do that phpbrain fr Vous
n'avez pas les droits suffisants pour cela
+you must enter a title phpbrain fr Vous devez entrer un titre
+you must enter a topic phpbrain fr Vous devez entrer un sujet
+your question will be posted, but only will be published after approval by a
user with publishing rights phpbrain fr Votre question sera
postée, mais sera publiée seulement après approbation par un compte possédant
les droits de publication
+your question will be posted, but only will be published after aproval of a
system administrator phpbrain fr Votre question a été
enregistrée, mais ne sera publiée qu'après approbation de l'administrateur
système
+your question will be published immediately phpbrain fr Votre
question sera publiée immédiatement
Index: phpbrain/setup/phpgw_sv.lang
diff -u phpbrain/setup/phpgw_sv.lang:1.3 phpbrain/setup/phpgw_sv.lang:1.4
--- phpbrain/setup/phpgw_sv.lang:1.3 Mon Nov 3 23:46:44 2003
+++ phpbrain/setup/phpgw_sv.lang Tue May 9 05:14:07 2006
@@ -1,80 +1,189 @@
-$stat_name %1 phpbrain sv $stat_name %1
-%1 contains %2 items phpbrain sv %1 innehåller %2 st
-%1 faqs_activated phpbrain sv %1 FAQs Aktiverad
-%1 faqs_deleted phpbrain sv %1 FAQs Raderad
-%1 matches found phpbrain sv %1 resultat funna
-%1 questions_activated phpbrain sv %1 Frågor aktiverade
-%1 questions_deleted phpbrain sv %1 Frågor raderade
-active_when_checked phpbrain sv Aktiv när den är markerad
-add_answer phpbrain sv Lägg till svar
-add_comments phpbrain sv Lägg till kommentar
-add_question phpbrain sv Lägg till fråga
-add_question (%1 open) phpbrain sv Lägg till fråga (%1 Öppna)
-allow html admin sv Tillåt HTML i poster
-already_rated phpbrain sv Du har redan betygsatt denna, Tack.
-anon user admin sv Anonym användare
-answer phpbrain sv Svar
-browse common sv Bläddra
-cant_post_must_register phpbrain sv Du måste vara
registrerad användare för att kunna lägga till information i kunskapsbasen
-check_before_submit phpbrain sv Var snäll och se efter att
denna information inte redan finns i kunskapsbasen innan du lägger till den.
-close window phpbrain sv stäng fönster
-comment phpbrain sv Kommentarer
+/kb directory does not exist and could not be created, please ask the
adminstrator to check the global configuration phpbrain sv /kb
katalogen existerar inte och kunde inte skapas, vänligen be administratören att
kontrollera den globala konfigurationen
+action phpbrain sv Åtgärd
+actions phpbrain sv Åtgärder
+add articles phpbrain sv Skapa artikel
+add link phpbrain sv Lägg till länk
+add question phpbrain sv Ställ fråga
+added file %1 phpbrain sv Fil %1 tillagd
+added link %1 phpbrain sv Länk %1 tillagd
+added related articles %1 phpbrain sv Relaterade artiklar %1
tillagda
+advanced search phpbrain sv Avancerad sökning
+all articles phpbrain sv Samtliga artiklar
+answer phpbrain sv Svara
+anytime phpbrain sv När som helst
+anywhere in the article phpbrain sv Var som helst i artikeln
+article phpbrain sv Artikel
+article added to database, you can now attach files or links, or relate to
other articles phpbrain sv Artikeln har lagts till i
databasen, du kan nu bifoga filer eller länkar, eller relatera till andra
artiklar
+article created phpbrain sv Artikeln skapad
+article deleted phpbrain sv Artikeln raderad
+article deleted successfully phpbrain sv Artikeln raderad
+article edited phpbrain sv Artikeln ändrad
+article has been published phpbrain sv Artikeln har publicerats
+article id phpbrain sv Artíkel ID
+articles added phpbrain sv Artiklar skapade
+articles deleted successfully phpbrain sv Artikeln raderad
+articles have been published phpbrain sv Artiklarna publicerade
+articles in %1 phpbrain sv Artiklar i %1
+articles in %1 and all its subcategories phpbrain sv
Artiklar i %1 och alla dess underkategorier
+articles not classified under any category phpbrain sv
Okategoriserade artiklar
+ascendent phpbrain sv Överordnad
+attach file phpbrain sv Bifoga fil
+attached files phpbrain sv Bifoga filer
+average rating phpbrain sv Genomsnittligt omdömme
+base directory does not exist, please ask the adminstrator to check the global
configuratio phpbrain sv Baskatalogen existerar inte. Vänligen
be administratören kontrollera den globala konfigurationen
+before submiting a question, please search in the knowledge base first
phpbrain sv Innan du skriver en fråga, vänligen sök i
kunskapsdatabasen först. Kanske är den redan besvarad?
+by answering this question you will help to get the answer quicker the next
time phpbrain sv Genom att svara på denna fråga hjälper du
kunskapsdatabasen att växa. Det i sin tur gör att det blir lättare att hitta
svar på frågor i fortsättningen.
+comment phpbrain sv kommentera
+comment and rating have been published phpbrain sv Kommentarer och
omdömme har publicerats
+comment could not be inserted in the database phpbrain sv
Kommentaren kunde inte läggas till i kunskapsdatabasen
+comment has been deleted phpbrain sv Kommentaren raderad
+comment has been published phpbrain sv Kommentaren har
publicerats
+comment has been submited for revision phpbrain sv Kommentaren har
skickats för godkännande
+comment has been submited for revision and rating will be published
phpbrain sv Kommentaren har skickats för godkännande och omdömme
kommer att publiceras
comments phpbrain sv Kommentarer
-cur_open_qs phpbrain sv Nuvarande öppna frågor
-current_questions phpbrain sv Nuvarande frågor
-edit_answer phpbrain sv Ändra svar
-edit_faq phpbrain sv Ändra FAQ
-enable common sv Aktivera
-example phpbrain sv Exempel
-excellent common sv Utmärkt
-explain_faq_admin phpbrain sv Svar till FAQ:s måste aktiveras
så användare kan se dem. Välj de FAQ:s du vill aktivera. Alternativit kan du
välja opassande svar som du vill radera.
-explain_maintain_answers phpbrain sv Frågor som skapats av
användare måste aktiveras av en admin-användare. Välj dessa frågor som du vill
aktivera eller alterntivt radera.
-explain_questions_admin phpbrain sv Svar skapade av
användare måste aktiveras av en admin-användare. Välj dessa svar du vill
aktivera eller alternativt radera.
-faq phpbrain sv FAQ
-faq_saved phpbrain sv FAQ sparad
-faqs phpbrain sv FAQ:s
-faqs_and_tutes phpbrain sv FAQ:s och handledningar
-improve_by_rate phpbrain sv Hjälp oss att förbättra genom
att betygssätta postningar
-inspire_by_suggestions phpbrain sv Om du behöver inspiration ta en
titt på de öppna frågorna.
-invalid faq request - or something is nqr phpbrain sv FEL:
Ogilitig FAQ förfrågan
-kb_contains phpbrain sv Kunskapsbanken innehåller
-know_contrib phpbrain sv Vet du svaret? I så fall, svara på det.
-last_mod %1 phpbrain sv Senast ändrad: %1
-maintain_answers phpbrain sv Underhåll Svar
-no comments phpbrain sv Inga kommentarer
-none found - revise or browse phpbrain sv Inget hittat - kolla
upp din sökning eller bläddring
-none_pending phpbrain sv Inga i kö
-none_unanswered phpbrain sv Inga FAQ:s obesvarade
-not_submit_qs_warn phpbrain sv Lägg märke till att detta är
inte platsen att ställa frågor på. De ska postas på frågesidan. Om du lägger
till en fråga utan svar på denna sida raderas den.
-num_faqs %1 phpbrain sv FAQ:s(%1)
-num_open %1 phpbrain sv Öppna(%1)
-num_pages %1 phpbrain sv Sidor(%1)
-num_tutes %1 phpbrain sv Handledningar(%1)
-phpbrain common sv Kunskapsbas
-phpbrain config admin sv Kunskapsbas konfiguration
-phpbrain_config phpbrain sv Kunskapsbas konfiguration
-poor common sv Dålig
-preview phpbrain sv förhandsgranska
-question phpbrain sv Fråga
-rating phpbrain sv Betyg
-rating %1 phpbrain sv betyg %1
-register common sv Registrera
-related_url phpbrain sv URL-länk
-reset phpbrain sv Återställ
-return_to_admin phpbrain sv Återvänd till Admin
-return_to_cats %1 phpbrain sv Återvänd till Kategori: %1
-return_to_index phpbrain sv Återvänd till Index
-return_to_search %1 phpbrain sv Återvänd till Sök: %1
-score %1 phpbrain sv poäng %1
-section_maint_faqs phpbrain sv Hantera köade FAQ:s
-section_maintain_questions phpbrain sv Hantera frågor
-show phpbrain sv visa
-submitted_by phpbrain sv Inskickad av
-text common sv Text
-thanks_4_rating phpbrain sv Tack för att du betygssatte
denna.
-tutorial phpbrain sv Handledning
-tutorials phpbrain sv Handledningar
-up phpbrain sv upp
+configuration phpbrain sv Alternativ
+create a new article to answer the question asked by %1 in %2 phpbrain
sv Skapa ny artikel för att besvara fråga ställd av %1 i %2
+created by %1 on %2 phpbrain sv Skapad av %1 i %2
+creation phpbrain sv Skapande
+creation date phpbrain sv Skapad den
+delete article phpbrain sv Radera artikel
+delete selected phpbrain sv Radera valt
+deleted relation to article %1 phpbrain sv Relation till
%1 borttagen
+deleted relation to article %1 phpbrain sv Radera relation till
artikel i %1
+descendent phpbrain sv Underordnad
+details phpbrain sv Detaljer
+e-groupware knowledge base article attached phpbrain sv
E-GroupWare Kunskapsdatabas-artikel bifogad
+e-mail has been sent phpbrain sv E-post har skickats
+edit article phpbrain sv Redigera artikel
+enter one or two words describing the issue, or type the article number if you
know it phpbrain sv Ange ett eller två ord som kan beskriva
problemet, eller ange artikelnummer om du känner till det
+error deleting article from database phpbrain sv Artikelradering
misslyckades
+error deleting link phpbrain sv Länkradering misslyckades
+error downloading file phpbrain sv Nedladdning misslyckades
+error locating files directory phpbrain sv Hittade inte filen i
katalogen
+error moving file to directory phpbrain sv Flytt av fil
misslyckades
+error publishing comment phpbrain sv Publicering av
kommentar misslyckades
+error retrieving article phpbrain sv Kan inte hämta artilke
+error trying to delete comment phpbrain sv Fel uppstod vid
radering av kommentar
+error trying to delete question phpbrain sv Fel uppstod vid
radering av fråga
+error trying to edit article phpbrain sv Fel uppstod vid
redigering av artikel
+error trying to publish article phpbrain sv Fel uppstod vid
publicering av artikel
+error: file doesn't exist in the database phpbrain sv FEL:
Filen finns inte i databasen
+excellent phpbrain sv Utmärkt
+failure trying to delete the file phpbrain sv Fel uppstod vid
radering av filen
+file could be deleted from server but not from database phpbrain
sv Filen kunde raderas från servern men inte i databasen
+file has been successfully uploaded phpbrain sv Uppladdning av
fil lyckades
+file was already missing from server, and was deleted from the database
phpbrain sv Filen saknades redan på servern och togs bort ur
databasen
+file was deleted successfully phpbrain sv Filraderingen lyckades
+file wasn't in server and it couldn't be deleted from the database
phpbrain sv Filen fanns inte på servern och kunde inte tas bort ur
databasen
+find results phpbrain sv Hitta resultat
+global categories phpbrain sv Globala kategorier
+have to be approved first common sv Måste godkännas först
+history phpbrain sv Historik
+if you can't find answers to your problem in the knowledge base, describe it
below phpbrain sv Om du inte kan hitta svaret i
kunskapsdatabasen, vänligen beskriv problemet här nedan
+if you wish, you can comment this article here phpbrain sv Om du
vill, kan du kommentera artikeln här
+in %1 phpbrain sv i %1
+in the text phpbrain sv I texten
+in the title phpbrain sv I titeln
+in the topic phpbrain sv I ämnet
+include subcategories phpbrain sv Inkludera underkategorier
+keywords phpbrain sv Nyckelord
+knowledge base article #%1 phpbrain sv Kunskapsdatabasens
artikel #%1
+knowledge base configuration common sv Kunskapsdatabaskonfiguration
+last modification by %1 on %2 phpbrain sv Senaste ändring av %1
på %2
+last modified phpbrain sv Senast ändrad
+latest phpbrain sv Senaste
+latest comments phpbrain sv Senaste kommentarer
+leave empty to automatically generate an id phpbrain sv Lämna
tomt för att automatiskt generera ett ID
+link could not be added phpbrain sv Kunde inte lägga till
länk
+link deleted successfully phpbrain sv Länkradering lyckades
+link has been added phpbrain sv Länken har lagts till
+links phpbrain sv Länkar
+links & files phpbrain sv Länkar och filer
+mail article phpbrain sv E-posta artikel
+main view phpbrain sv Huvudvy
+maintain articles phpbrain sv Underhåll artiklar
+maintain questions phpbrain sv Underhåll frågor
+maximum number of comments to show: phpbrain sv Maximalt antal
kommentarer som visas
+maximum number of most popular articles, latest articles and unanswered
questions to show in the main view: phpbrain sv Antal av de mest
populära artiklarna, senaste artiklarna och obesvarade frågor som skall visas i
huvudvyn:
+modification date phpbrain sv Ändrad den
+most viewed phpbrain sv Mest populära
+new article phpbrain sv Ny artikel
+nobody has rated this article so far phpbrain sv Ingen har
betygsatt denna artikel ännu
+nothing was uploaded! phpbrain sv Inget laddades upp
+number of results per page phpbrain sv Antal resultat
+ocurrences phpbrain sv Förekommer
+or browse the categories phpbrain sv Eller leta bland
kategorierna
+order results by phpbrain sv Sortera resultat efter
+outstanding published questions phpbrain sv Olösta
publicerade frågor
+past %1 months phpbrain sv Senaste %1 månaderna
+past year phpbrain sv Senaste året
+people have rated this article phpbrain sv användare har betygsatt
denna artikel
+phpbrain common sv Kunskapdatabas
+please rate the pertinence and quality of this article phpbrain sv
Vänligen betygsätt relevans och kvalitet på denna artikel
+please try again phpbrain sv Vänligen försök igen
+poor phpbrain sv Dåligt
+printer view phpbrain sv Printervy
+problem relating articles phpbrain sv Problem med att
relatera artiklar
+publication date phpbrain sv Publiceringsdatum
+publish phpbrain sv Publicera
+publish articles automatically? common sv Publicera artiklar
automatiskt?
+publish comments automatically? common sv Publicera kommentarer
automatiskt?
+publish questions automatically? common sv Publicera frågor
automatiskt?
+publish selected phpbrain sv Publicera valda
+published phpbrain sv Publicerad
+question deleted successfully phpbrain sv Fråga raderad
+questions deleted successfully phpbrain sv Frågor raderade
+rating has been submited phpbrain sv Omdömmet har skickats
+rating invalid phpbrain sv Ogiltigt omdömme
+recipient phpbrain sv Mottagare
+related articles in the knowledge base phpbrain sv Relaterade
artiklar i kunskapsdatabasen
+relation with article was removed successfully phpbrain sv
Relation med artikel togs bort
+removed file %1 phpbrain sv Tog bort filen %1
+removed link %1 phpbrain sv Tog bort länken %1
+reply-to phpbrain sv Svara-till
+search in all the knowledge base phpbrain sv Sök i hela
kunskapdatabasen
+search results phpbrain sv Sökresultat
+see more questions phpbrain sv Se fler frågor
+see more questions... phpbrain sv Se fler frågor...
+select articles phpbrain sv Välj artiklar
+show all comments phpbrain sv Visa alla kommentarer
+show articles belonging to: phpbrain sv Visa artiklar som
tillhöt:
+show messages in category phpbrain sv Visa meddelanden i
kategorin
+submit comment phpbrain sv Skicka kommentar
+submit comment and rating phpbrain sv Skicka kommentar och
omdömme
+suggested category phpbrain sv Föreslagen kategori
+summary phpbarin sv Summering
+that file already exists phpbrain sv Den filen existerar
redan
+the article id must be a number phpbrain sv ArtikelID måste
vara ett nummer
+the article is empty phpbrain sv Artikeln är tom
+the file was already missing in the server phpbrain sv Filen
saknades redan på servern
+the following errors occurred phpbrain sv Följande fel uppstod
+the mail server returned: phpbrain sv E-post servern svarade:
+the present category and all subcategories under it phpbrain sv
Aktuell kategori och samtliga underkategorier
+the present category only phpbrain sv Atuell kategori enbart
+there are no articles phpbrain sv Det finns inga artiklar
+there are no articles available phpbrain sv Det finns inga
artiklar tillgängliga
+this article hasn't yet been published in the knowledge base phpbrain
sv Denna artikel har inte publicerats i kunskapsdatabasen ännu
+title phpbrain sv Titel
+to create categories, press 'edit categories' in the preferences menu
phpbrain sv För att skapa kategorier, klicka på 'Redigera
kategorier' i prefereser-menyn
+topic phpbrain sv Ämne
+unable to add rating to database phpbrain sv Kunde inte
lägga till omdömmet i databasen
+unanswered questions phpbrain sv Obesvarade frågor
+unpublish phpbrain sv Publisera inte
+unpublished phpbrain sv Opublicerad
+user preferences phpbrain sv Användar alternativ
views phpbrain sv Vyer
-views %1 phpbrain sv visar %1
-votes %1 phpbrain sv röster %1
+was it easy to find this article using the above search string?
phpbrain sv Var det enkelt att hitta denna artikel med det
sökbegrepp du använde?
+when navigating through categories, choose whether the list of articles shown
corresponds only to the present category, or the present category and all
categories under it. phpbrain sv När du navigerar genom
kategorierna, avgör om listan med artiklar enbart korresponderar med aktuell
kategori eller med aktuell kategori och samtliga av dess underkategorier.
+with all the words phpbrain sv Med samtliga ord
+with at least one of the words phpbrain sv Med minst ett av orden
+with the exact phrase phpbrain sv Med den exakta frasen
+without the words phpbrain sv Utan dessa ord
+you are in %1 phpbrain sv Du är i %1
+you have already qualified this article phpbrain sv Du har
redan godkänt denna artikel
+you have not the proper permissions to do that phpbrain sv Du har
inte behörighet att göra det
+you must enter a title phpbrain sv Du måste ange en titel
+you must enter a topic phpbrain sv Du måste ange ett ämne
+your message could not be sent! phpbrain sv Meddelandet
kunde inte skickas
+your question will be posted, but only will be published after approval by a
user with publishing rights phpbrain sv Din fråga kommer att
skickas, men kommer bara att publiceras när någon med behörighet att publicera
väljer att göra det.
+your question will be published immediately phpbrain sv Din
fråga kommer att publiceras omedelbart
Index: phpbrain/setup/setup.inc.php
diff -u phpbrain/setup/setup.inc.php:1.5 phpbrain/setup/setup.inc.php:1.6
--- phpbrain/setup/setup.inc.php:1.5 Sat Mar 11 23:20:48 2006
+++ phpbrain/setup/setup.inc.php Tue May 9 05:14:07 2006
@@ -1,58 +1,54 @@
<?php
- /**********************************************************************\
- * phpGroupWare - KnowledgeBase
*
- * http://www.phpgroupware.org *
- * This program is part of the GNU project, see http://www.gnu.org/ *
- * *
- * Copyright 2003 Free Software Foundation, Inc. *
- * *
- * Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
- * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * --------------------------------------------
*
- * This program is Free Software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * at your option) any later version. *
- \**********************************************************************/
- /* $Id: setup.inc.php,v 1.5 2006/03/11 23:20:48 skwashd Exp $ */
+
/**************************************************************************\
+ * eGroupWare - PHPBrain
*
+ * http://www.egroupware.org
*
+ * --------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by
the *
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+
+ /* $Id: setup.inc.php,v 1.6 2006/05/09 05:14:07 skwashd Exp $ */
/* Basic information about this app */
$setup_info['phpbrain']['name'] = 'phpbrain';
$setup_info['phpbrain']['title'] = 'Knowledge Base';
- $setup_info['phpbrain']['version'] = '0.9.14.001';
+ $setup_info['phpbrain']['version'] = '0.9.17.505';
$setup_info['phpbrain']['app_order'] = 25;
$setup_info['phpbrain']['enable'] = 1;
- $setup_info['phpbrain']['app_group'] = 'other';
$setup_info['phpbrain']['author'] = 'Dave Hall';
- $setup_info['phpbrain']['note'] = 'A knowledge base for storing and
searching for FAQs and Tutorials';
+ $setup_info['phpbrain']['note'] = 'Knowledge Base repository';
$setup_info['phpbrain']['license'] = 'GPL';
- $setup_info['phpbrain']['description'] =
- 'Searchable Knowledge Base.';
+ $setup_info['phpbrain']['description'] = 'Searchable Knowledge Base.';
$setup_info['phpbrain']['maintainer'] = 'Dave Hall';
- $setup_info['phpbrain']['maintainer_email'] = 'address@hidden';
+ $setup_info['phpbrain']['maintainer_email'] = 'skwashd at
phpgroupware.org';
/* The hooks this app includes, needed for hooks registration */
$setup_info['phpbrain']['hooks'][] = 'about';
$setup_info['phpbrain']['hooks'][] = 'admin';
- //$setup_info['phpbrain']['hooks'][] = 'add_def_pref';
+ $setup_info['phpbrain']['hooks'][] = 'add_def_pref';
$setup_info['phpbrain']['hooks'][] = 'config';
- //$setup_info['phpbrain']['hooks'][] = 'config_validate';
- //$setup_info['phpbrain']['hooks'][] = 'home';
- $setup_info['phpbrain']['hooks'][] = 'manual';
- //$setup_info['phpbrain']['hooks'][] = 'addaccount';
- //$setup_info['phpbrain']['hooks'][] = 'editaccount';
- //$setup_info['phpbrain']['hooks'][] = 'deleteaccount';
- //$setup_info['phpbrain']['hooks'][] = 'notifywindow';
- //$setup_info['phpbrain']['hooks'][] = 'preferences';
-
- $setup_info['phpbrain']['tables'][] = 'phpgw_kb_faq';
+ $setup_info['phpbrain']['hooks'][] = 'preferences';
+ $setup_info['phpbrain']['hooks'][] = 'settings';
+ $setup_info['phpbrain']['hooks'][] = 'sidebox_menu';
+ $setup_info['phpbrain']['hooks'][] = 'deleteaccount';
+
+ $setup_info['phpbrain']['tables'][] = 'phpgw_kb_articles';
$setup_info['phpbrain']['tables'][] = 'phpgw_kb_comment';
$setup_info['phpbrain']['tables'][] = 'phpgw_kb_questions';
+ $setup_info['phpbrain']['tables'][] = 'phpgw_kb_ratings';
+ $setup_info['phpbrain']['tables'][] = 'phpgw_kb_related_art';
+ $setup_info['phpbrain']['tables'][] = 'phpgw_kb_search';
+ $setup_info['phpbrain']['tables'][] = 'phpgw_kb_files';
+ $setup_info['phpbrain']['tables'][] = 'phpgw_kb_urls';
/* Dependencies for this app to work */
$setup_info['phpbrain']['depends'][] = array(
- 'appname' => 'phpgwapi',
- 'versions' => Array('0.9.16', '0.9.17', '0.9.18')
+ 'appname' => 'phpgwapi',
+ 'versions' => Array('0.9.17', '0.9.18')
);
-?>
+
+
+
Index: phpbrain/setup/tables_baseline.inc.php
diff -u phpbrain/setup/tables_baseline.inc.php:1.2
phpbrain/setup/tables_baseline.inc.php:1.3
--- phpbrain/setup/tables_baseline.inc.php:1.2 Sun May 15 12:43:37 2005
+++ phpbrain/setup/tables_baseline.inc.php Tue May 9 05:14:07 2006
@@ -1,7 +1,7 @@
<?php
/**************************************************************************\
- * phpGroupWare - Setup *
- * http://www.phpgroupware.org *
+ * eGroupWare - Setup *
+ * http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@@ -9,7 +9,7 @@
* option) any later version. *
\**************************************************************************/
- /* $Id: tables_baseline.inc.php,v 1.2 2005/05/15 12:43:37 skwashd Exp $ */
+ /* $Id: tables_baseline.inc.php,v 1.3 2006/05/09 05:14:07 skwashd Exp $ */
$phpgw_baseline = array(
@@ -31,8 +31,37 @@
),
'pk' => array('faq_id'),
'fk' => array(),
- 'ix' => array('cat_id','published','is_faq'),
- 'uc' => array(),
- 'ft' => array('title','text','keywords') //not yet
implemeneted
+ 'ix' => array(
+ array('title','options'=>array('mysql'=>255)),
+
array('text','options'=>array('mysql'=>'FULLTEXT')),
+ 'cat_id',
+ 'published',
+
array('keywords','options'=>array('mysql'=>255)),
+ 'is_faq'),
+ 'uc' => array()
+ ),
+ 'phpgw_kb_comment' => array(
+ 'fd' => array(
+ 'comment_id' => array('type' =>
'auto','nullable' => False),
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => False,'default' => '0'),
+ 'comment' => array('type' => 'text','nullable'
=> False),
+ 'entered' => array('type' => 'int','precision'
=> '4','nullable' => True,'default' => '0'),
+ 'faq_id' => array('type' => 'int','precision'
=> '4','nullable' => False,'default' => '0')
+ ),
+ 'pk' => array('comment_id'),
+ 'fk' => array(),
+ 'ix' => array('faq_id'),
+ 'uc' => array()
+ ),
+ 'phpgw_kb_questions' => array(
+ 'fd' => array(
+ 'question_id' => array('type' =>
'auto','nullable' => False),
+ 'question' => array('type' => 'text','nullable'
=> False),
+ 'pending' => array('type' => 'int','precision'
=> '2','nullable' => False,'default' => '1')
+ ),
+ 'pk' => array('question_id'),
+ 'fk' => array(),
+ 'ix' => array('pending'),
+ 'uc' => array()
)
);
Index: phpbrain/setup/tables_current.inc.php
diff -u phpbrain/setup/tables_current.inc.php:1.2
phpbrain/setup/tables_current.inc.php:1.3
--- phpbrain/setup/tables_current.inc.php:1.2 Sun May 15 12:43:37 2005
+++ phpbrain/setup/tables_current.inc.php Tue May 9 05:14:07 2006
@@ -1,7 +1,7 @@
<?php
/**************************************************************************\
- * phpGroupWare - Setup *
- * http://www.phpgroupware.org *
+ * eGroupWare - Setup *
+ * http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@@ -9,54 +9,115 @@
* option) any later version. *
\**************************************************************************/
- /* $Id: tables_current.inc.php,v 1.2 2005/05/15 12:43:37 skwashd Exp $ */
+ /* $Id: tables_current.inc.php,v 1.3 2006/05/09 05:14:07 skwashd Exp $ */
$phpgw_baseline = array(
- 'phpgw_kb_faq' => array(
+ 'phpgw_kb_articles' => array(
'fd' => array(
- 'faq_id' => array('type' => 'auto','nullable'
=> False),
- 'title' => array('type' => 'text','nullable' =>
False),
+ 'art_id' => array('type' => 'auto','nullable'
=> False),
+ 'q_id' => array('type' => 'int','precision' =>
'8','nullable' => False),
+ 'title' => array('type' =>
'varchar','precision' => '255','nullable' => False),
+ 'topic' => array('type' =>
'varchar','precision' => '255','nullable' => False),
'text' => array('type' => 'text','nullable' =>
False),
'cat_id' => array('type' => 'int','precision'
=> '4','nullable' => False,'default' => '0'),
'published' => array('type' =>
'int','precision' => '2','nullable' => False,'default' => '0'),
- 'keywords' => array('type' => 'text','nullable'
=> False),
'user_id' => array('type' => 'int','precision'
=> '4','nullable' => False,'default' => '0'),
'views' => array('type' => 'int','precision' =>
'4','nullable' => False,'default' => '0'),
- 'modified' => array('type' => 'int','precision'
=> '4','nullable' => True),
- 'is_faq' => array('type' => 'int','precision'
=> '2','nullable' => False,'default' => '1'),
- 'url' => array('type' => 'varchar','precision'
=> '128','nullable' => False),
- 'votes' => array('type' => 'int','precision' =>
'4','nullable' => False,'default' => '0'),
- 'total' => array('type' => 'int','precision' =>
'4','nullable' => False,'default' => '0')
- ),
- 'pk' => array('faq_id'),
- 'fk' => array(),
- 'ix' => array('cat_id','published','is_faq'),
- 'uc' => array(),
- 'ft' => array('title','text','keywords') //not yet
implemeneted
+ 'created' => array('type' => 'int','precision'
=> '4'),
+ 'modified' => array('type' => 'int','precision'
=> '4'),
+ 'modified_user_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'votes_1' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'votes_2' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'votes_3' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'votes_4' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'votes_5' => array('type' => 'int','precision'
=> '4','nullable' => False)
+ ),
+ 'pk' => array('art_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
),
'phpgw_kb_comment' => array(
'fd' => array(
'comment_id' => array('type' =>
'auto','nullable' => False),
- 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => False,'default' => '0'),
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
'comment' => array('type' => 'text','nullable'
=> False),
- 'entered' => array('type' => 'int','precision'
=> '4','nullable' => True,'default' => '0'),
- 'faq_id' => array('type' => 'int','precision'
=> '4','nullable' => False,'default' => '0')
+ 'entered' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'art_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'published' => array('type' =>
'int','precision' => '2','nullable' => False)
),
'pk' => array('comment_id'),
'fk' => array(),
- 'ix' => array('faq_id'),
+ 'ix' => array('art_id'),
'uc' => array()
),
'phpgw_kb_questions' => array(
'fd' => array(
'question_id' => array('type' =>
'auto','nullable' => False),
- 'question' => array('type' => 'text','nullable'
=> False),
- 'pending' => array('type' => 'int','precision'
=> '2','nullable' => False,'default' => '1')
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'summary' => array('type' => 'text','nullable'
=> False),
+ 'details' => array('type' => 'text','nullable'
=> False),
+ 'cat_id' => array('type' => 'int','precision'
=> '4','nullable' => False,'default' => '0'),
+ 'creation' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'published' => array('type' =>
'int','precision' => '2','nullable' => False)
),
'pk' => array('question_id'),
'fk' => array(),
- 'ix' => array('pending'),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_kb_ratings' => array(
+ 'fd' => array(
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'art_id' => array('type' => 'int','precision'
=> '4','nullable' => False)
+ ),
+ 'pk' => array('user_id','art_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_kb_related_art' => array(
+ 'fd' => array(
+ 'art_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'related_art_id' => array('type' =>
'int','precision' => '4','nullable' => False)
+ ),
+ 'pk' => array('art_id','related_art_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_kb_search' => array(
+ 'fd' => array(
+ 'keyword' => array('type' =>
'varchar','precision' => '30','nullable' => False),
+ 'art_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'score' => array('type' => 'int','precision' =>
'8','nullable' => False)
+ ),
+ 'pk' => array('keyword','art_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_kb_files' => array(
+ 'fd' => array(
+ 'art_id' => array('type' => 'int','precision'
=> '4'),
+ 'art_file' => array('type' =>
'varchar','precision' => '255'),
+ 'art_file_comments' => array('type' =>
'varchar','precision' => '255'),
+ ),
+ 'pk' => array('art_id','art_file'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_kb_urls' => array(
+ 'fd' => array(
+ 'art_id' => array('type' => 'int','precision'
=> '4'),
+ 'art_url' => array('type' =>
'varchar','precision' => '255'),
+ 'art_url_title' => array('type' =>
'varchar','precision' => '255')
+ ),
+ 'pk' => array('art_id','art_url'),
+ 'fk' => array(),
+ 'ix' => array(),
'uc' => array()
)
);
Index: phpbrain/templates/idots/images/navbar.png
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpbrain ./index.php inc/class.bokb.inc.php inc...,
Dave Hall <=