Search functionality added in filemanager. For the search feature etemplate is used for the interface. The functionality is accessed via the sidebar

and start with a search for all objects that are created since the day before. This is not committed into 1.4. If you think this feature is of 
any help for 1.4 too, let us know.
This commit is contained in:
Klaus Leithoff 2007-07-19 16:13:53 +00:00
parent ab9899f07b
commit 0969f08ee5
12 changed files with 886 additions and 299 deletions

View File

@ -8,10 +8,11 @@
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
require_once(EGW_INCLUDE_ROOT.'/filemanager/inc/class.sofilemanager.inc.php');
/* $Id$ */
class bofilemanager
class bofilemanager extends sofilemanager
{
// used
@ -31,9 +32,32 @@
var $matches;//FIXME matches not defined
var $debug = False;
// Timestamps
//'vfs_created', 'vfs_modified',
var $timestamps=array(
);
/**
* Offset in secconds between user and server-time, it need to be add to a server-time to get the user-time
* or substracted from a user-time to get the server-time
*
* @var int
*/
var $tz_offset_s;
/**
* Current time as timestamp in user-time
*
* @var int
*/
var $now;
function bofilemanager()
{
$this->sofilemanager();
// discarded because of extension
//$this->so =& CreateObject('filemanager.sofilemanager');
//$this->so->db_init();
$this->db_init();
$this->vfs =& CreateObject('phpgwapi.vfs');
error_reporting(4);
@ -93,6 +117,57 @@
'comment' => lang('Comment'),
'version' => lang('Version')
);
if (!is_object($GLOBALS['egw']->datetime))
{
$GLOBALS['egw']->datetime =& CreateObject('phpgwapi.datetime');
}
$this->tz_offset_s = $GLOBALS['egw']->datetime->tz_offset;
$this->now = time() + $this->tz_offset_s; // time() is server-time and we need a user-time
}
/**
* changes the data from the db-format to your work-format
*
* reimplemented to adjust the timezone of the timestamps (adding $this->tz_offset_s to get user-time)
* Please note, we do NOT call the method of the parent so_sql !!!
*
* @param array $data if given works on that array and returns result, else works on internal data-array
* @return array with changed data
*/
function db2data($data=null)
{
if (!is_array($data))
{
$data = &$this->data;
}
foreach($this->timestamps as $name)
{
if (isset($data[$name]) && $data[$name]) $data[$name] += $this->tz_offset_s;
}
return $data;
}
/**
* changes the data from your work-format to the db-format
*
* reimplemented to adjust the timezone of the timestamps (subtraction $this->tz_offset_s to get server-time)
* Please note, we do NOT call the method of the parent so_sql !!!
*
* @param array $data if given works on that array and returns result, else works on internal data-array
* @return array with changed data
*/
function data2db($data=null)
{
if ($intern = !is_array($data))
{
$data = &$this->data;
}
foreach($this->timestamps as $name)
{
if (isset($data[$name]) && $data[$name]) $data[$name] -= $this->tz_offset_s;
}
return $data;
}
###

View File

@ -0,0 +1,59 @@
<?php
/**************************************************************************\
* eGroupWare - Filemanager *
* 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: class.sofilemanager.inc.php 19410 2005-10-14 10:41:15Z ralfbecker $ */
// added for eTemplate
include_once(PHPGW_INCLUDE_ROOT . '/etemplate/inc/class.so_sql.inc.php');
class sofilemanager extends so_sql
{
var $db;
// added for eTemplate
var $maintable='egw_vfs';
function sofilemanager()
{
$this->db = clone($GLOBALS['egw']->db);
$this->so_sql('phpgwapi',$this->maintable);
}
/* Any initializations that need to be done */
function db_init()
{
$this->db->Auto_Free = 0;
}
/* General SQL query */
function db_query($query)
{
return $this->db->query($query);
}
/* Fetch next array for $query_id */
function db_fetch_array($query_id)
{
// $egw->db->Query_ID = $query_id;
$this->db->next_record();
return $this->db->Record;
}
/*
General wrapper for all other db calls
Calls in here are simply returned, so not all will work
*/
function db_call($function, $query_id)
{
// $egw->db->Query_ID = $query_id;
return $this->db->$function();
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,14 @@
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
$file = Array(
array(
'',
'Preferences',
'text' => 'Filemanager Preferences',
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=filemanager')
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=filemanager'),
),
array(
'Search',
'text' => 'Search',
'link' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.uifilemanager.index', 'action'=>'search')),
)
);
display_sidebox($appname,$menu_title,$file);

View File

@ -10,7 +10,7 @@
\**************************************************************************/
/* $Id$ */
/*
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => 'filemanager',
@ -24,4 +24,6 @@
include('../header.inc.php');
ExecMethod('filemanager.uifilemanager.index');
*/
header('Location: ../index.php?menuaction=filemanager.uifilemanager.index');
?>

View File

@ -4,6 +4,9 @@ back to file manager filemanager de Zur
cancel editing %1 without saving filemanager de Bearbeiten abbrechen %1 ohne zu speichern
cannot create directory because it begins or ends in a space filemanager de Kann Verzeichnis nicht anlegen, da der Name mit einem Leerzeichen endet
cannot replace %1 because it is a directory filemanager de Kann %1 nicht ersetzen, da es ein Verzeichnis ist
choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates filemanager de Wenn Sie das bis Datum kleiner als das von Datum wählen, finden Sie alle Einträge, ausser denen, deren Datum im Zeitraum der beiden Daten liegt.
choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date filemanager de Wenn Sie nur ein Datum (von/bis) wählen, finden Sie alle Einträge deren Bezugsdatum älter, bzw. jünger als das jeweilige angegebene Datum ist
clear search filemanager de Suchfelder zurücksetzen
command sucessfully run filemanager de Kommando erfolgreich ausgeführt
comment filemanager de Kommentar
comments cannot contain "%1" filemanager de Kommentare dürfen kein "%1" enthalten
@ -24,6 +27,7 @@ create folder filemanager de Neues Verzeichnis
created filemanager de Erstellt
created %1 filemanager de %1 erstellt
created %1,%2 filemanager de %1,%2 erstellt
created between filemanager de erstellt zwischen
created by filemanager de Erstellt von
created directory %1 filemanager de Verzeichnis %1 erstellt
date filemanager de Datum
@ -45,6 +49,7 @@ fake base dir did not exist, egroupware created a new one. filemanager de Dateim
file filemanager de Datei
file %1 already exists. please edit it or delete it first. filemanager de Datei %1 existiert bereits. Bitte zuerst bearbeiten oder löschen.
file %1 could not be created. filemanager de Datei %1 konnte nicht erstellt werden.
file %1 may be too big. contact your systemadministrator for further info filemanager de Datei %1 ist möglicherweise zu gross. Kontaktieren Sie Ihren Systemadministrator um weitergehende Informationen zu erhalten
file name filemanager de Dateiname
file names cannot contain "%1" filemanager de Dateinamen dürfen kein "%1" enthalten
file names cannot contain \ or / filemanager de Dateinamen dürfen kein \ oder / enthalten
@ -61,10 +66,12 @@ go to your home directory filemanager de Zu Ihrem Heimverzeichnis wechseln
go to: filemanager de Gehe zu:
go up filemanager de einen Ordner nach oben
home filemanager de Home
id filemanager de Id
location filemanager de Pfad
locked filemanager de Gesperrt
mime type filemanager de MIME-Typ
modified filemanager de Verändert
modified between filemanager de verändert zwischen
modified by filemanager de Verändert von
move to filemanager de Verschieben nach
move to: filemanager de Verschieben nach:
@ -87,6 +94,7 @@ save %1, and go back to file listing filemanager de %1 speichern und zur
save all filemanager de Alles speichern
save changes filemanager de Änderungen speichern
saved %1 filemanager de %1 gespeichert
searchstring filemanager de Suchbegriff
show filemanager de Anzeigen
show .. filemanager de Anzeigen ...
show .files filemanager de .Dateien anzeigen
@ -94,6 +102,7 @@ show command line (experimental. dangerous.) filemanager de Kommando anzeigen (E
show help filemanager de Hilfe anzeigen
size filemanager de Größe
sort by: filemanager de Sortieren nach:
start search filemanager de Suche starten
the future filemanager, now for testing purposes only, please send bugreports filemanager de Der neue Dateimanager, jetzt NUR ZUM TESTEN, bitte Fehlermeldungen senden
total files filemanager de Anzahl Dateien
unknown mime-type defaults to text/plain when viewing filemanager de Zum Anzeigen von unbekannte MIME-Typen text/plain verwenden

View File

@ -4,6 +4,9 @@ back to file manager filemanager en Back to file manager
cancel editing %1 without saving filemanager en Cancel editing %1 without saving
cannot create directory because it begins or ends in a space filemanager en Cannot create directory because it begins or ends in a space
cannot replace %1 because it is a directory filemanager en Cannot replace %1 because it is a directory
choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates filemanager en Choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates
choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date filemanager en Choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date
clear search filemanager en clear search
command sucessfully run filemanager en Command sucessfully run
comment filemanager en Comment
comments cannot contain "%1" filemanager en Comments cannot contain "%1"
@ -24,6 +27,7 @@ create folder filemanager en Create Folder
created filemanager en Created
created %1 filemanager en Created %1
created %1,%2 filemanager en Created %1,%2
created between filemanager en created between
created by filemanager en Created by
created directory %1 filemanager en Created directory %1
date filemanager en Date
@ -45,6 +49,7 @@ fake base dir did not exist, egroupware created a new one. filemanager en Fake B
file filemanager en File
file %1 already exists. please edit it or delete it first. filemanager en File %1 already exists. Please edit it or delete it first.
file %1 could not be created. filemanager en File %1 could not be created.
file %1 may be too big. contact your systemadministrator for further info filemanager en File %1 may be too big. Contact your Systemadministrator for further info
file name filemanager en File Name
file names cannot contain "%1" filemanager en File names cannot contain "%1"
file names cannot contain \ or / filemanager en File names cannot contain \ or /
@ -61,10 +66,12 @@ go to your home directory filemanager en Go to your home directory
go to: filemanager en Go to:
go up filemanager en go up
home filemanager en Home
id filemanager en Id
location filemanager en Location
locked filemanager en Locked
mime type filemanager en MIME Type
modified filemanager en Modified
modified between filemanager en modified between
modified by filemanager en Modified by
move to filemanager en Move To
move to: filemanager en Move to:
@ -87,6 +94,7 @@ save %1, and go back to file listing filemanager en Save %1, and go back to file
save all filemanager en Save all
save changes filemanager en Save changes
saved %1 filemanager en Saved %1
searchstring filemanager en searchstring
show filemanager en Show
show .. filemanager en Show ..
show .files filemanager en Show .files
@ -94,6 +102,7 @@ show command line (experimental. dangerous.) filemanager en Show command line (E
show help filemanager en Show help
size filemanager en Size
sort by: filemanager en Sort by:
start search filemanager en start search
the future filemanager, now for testing purposes only, please send bugreports filemanager en The future filemanager, now for TESTING PURPOSES ONLY, please send bugreports
total files filemanager en Total Files
unknown mime-type defaults to text/plain when viewing filemanager en Unknown MIME-type defaults to text/plain when viewing

View File

@ -13,18 +13,18 @@
$setup_info['filemanager']['name'] = 'filemanager';
$setup_info['filemanager']['title'] = 'Filemanager';
$setup_info['filemanager']['version'] = '1.4';
$setup_info['filemanager']['version'] = '1.5';
$setup_info['filemanager']['app_order'] = 6;
$setup_info['filemanager']['enable'] = 1;
$setup_info['filemanager']['tables'] =array('egw_vfs');
/* The hooks this app includes, needed for hooks registration */
$setup_info['filemanager']['hooks'] = array(
'deleteaccount',
'settings',
'sidebox_menu',
'preferences'
);
$setup_info['filemanager']['hooks']['preferences'] = 'filemanager.admin_prefs_sidebox_hooks.all_hooks';
$setup_info['filemanager']['hooks']['deleteaccount'] = 'filemanager.admin_prefs_sidebox_hooks.all_hooks';
$setup_info['filemanager']['hooks'][] = 'settings';
$setup_info['filemanager']['hooks']['sidebox_menu'] = 'filemanager.admin_prefs_sidebox_hooks.all_hooks';
/* Dependencies for this app to work */
$setup_info['filemanager']['depends'][] = array(
'appname' => 'phpgwapi',

View File

@ -11,7 +11,7 @@
.fmButton
{
background-repeat: no-repeat;
background-image:url(../images/buttonbackground.png);
background-image:url(../default/images/buttonbackground.png);
width:28px;
height:28px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,49 +1,49 @@
<?php
/**
* FileManger - WebDAV access
*
* Using the PEAR HTTP/WebDAV/Server class (which need to be installed!)
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package filemanger
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2006 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @version $Id: class.boetemplate.inc.php 21437 2006-04-24 20:42:42Z ralfbecker $
*/
/**
* check if the given user has access
*
* Create a session or if the user has no account return authenticate header and 401 Unauthorized
*
* @param array &$account
* @return int session-id
*/
function check_access(&$account)
{
$account = array(
'login' => $_SERVER['PHP_AUTH_USER'],
'passwd' => $_SERVER['PHP_AUTH_PW'],
'passwd_type' => 'text',
);
if (!($sessionid = $GLOBALS['egw']->session->create($account)))
{
header('WWW-Authenticate: Basic realm="eGroupWare WebDAV"');
header("HTTP/1.1 401 Unauthorized");
header("X-WebDAV-Status: 401 Unauthorized", true);
exit;
}
return $sessionid;
}
$GLOBALS['egw_info']['flags'] = array(
'disable_Template_class' => True,
'noheader' => True,
'currentapp' => 'filemanager',
'autocreate_session_callback' => 'check_access',
);
// if you move this file somewhere else, you need to adapt the path to the header!
include('../header.inc.php');
ExecMethod('phpgwapi.vfs_webdav_server.ServeRequest');
<?php
/**
* FileManger - WebDAV access
*
* Using the PEAR HTTP/WebDAV/Server class (which need to be installed!)
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package filemanger
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2006 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @version $Id: class.boetemplate.inc.php 21437 2006-04-24 20:42:42Z ralfbecker $
*/
/**
* check if the given user has access
*
* Create a session or if the user has no account return authenticate header and 401 Unauthorized
*
* @param array &$account
* @return int session-id
*/
function check_access(&$account)
{
$account = array(
'login' => $_SERVER['PHP_AUTH_USER'],
'passwd' => $_SERVER['PHP_AUTH_PW'],
'passwd_type' => 'text',
);
if (!($sessionid = $GLOBALS['egw']->session->create($account)))
{
header('WWW-Authenticate: Basic realm="eGroupWare WebDAV"');
header("HTTP/1.1 401 Unauthorized");
header("X-WebDAV-Status: 401 Unauthorized", true);
exit;
}
return $sessionid;
}
$GLOBALS['egw_info']['flags'] = array(
'disable_Template_class' => True,
'noheader' => True,
'currentapp' => 'filemanager',
'autocreate_session_callback' => 'check_access',
);
// if you move this file somewhere else, you need to adapt the path to the header!
include('../header.inc.php');
ExecMethod('phpgwapi.vfs_webdav_server.ServeRequest');