commit c3282e6d209520241f286fc8fc1764de04e4b2fa
parent ff9b2e4bc96d0a0f73e8a76fe2cc800b8c24ca8b
Author: dankert <devnull@localhost>
Date: Tue, 15 Feb 2011 21:36:33 +0100
Schnellsuche soll JSON-Dokument zurückgeben, außerdem auch in der Administration suchen.
Diffstat:
2 files changed, 52 insertions(+), 30 deletions(-)
diff --git a/action/SearchAction.class.php b/action/SearchAction.class.php
@@ -186,42 +186,64 @@ class SearchAction extends Action
$text = $this->getRequestVar('search');
- $o = new Object();
- if ( Object::available( intval($text) ) )
- $listObjectIds[] = intval( $text );
-
- if ( $conf['search']['quicksearch']['search_name'] )
- {
- $o = new Object();
- $listObjectIds += $o->getObjectIdsByName( $text );
- }
-
- if ( $conf['search']['quicksearch']['search_description'] )
+ $project = Session::getProject();
+ if ( is_object($project) && $project->projectid == -1 )
{
- $o = new Object();
- $listObjectIds += $o->getObjectIdsByDescription( $text );
+ $resultList = array();
+
+ $user = User::loadWithName($text);
+ if ( is_object($user) )
+ {
+ $userResult = array( 'url' => Html::url('template','',$templateid),
+ 'type' => 'user',
+ 'name' => $user->name,
+ 'desc' => lang('NO_DESCRIPTION_AVAILABLE'),
+ 'lastchange_date' => 0 );
+ }
+ $resultList[] = $userResult;
+
+ $this->setTemplateVar( 'result',$resultList );
}
-
- if ( $conf['search']['quicksearch']['search_filename'] )
+ else
{
$o = new Object();
- $listObjectIds += $o->getObjectIdsByFilename( $text );
+ if ( Object::available( intval($text) ) )
+ $listObjectIds[] = intval( $text );
+
+ if ( $conf['search']['quicksearch']['search_name'] )
+ {
+ $o = new Object();
+ $listObjectIds += $o->getObjectIdsByName( $text );
+ }
- $f = new File();
- $listObjectIds += $f->getObjectIdsByExtension( $text );
- }
-
- // Inhalte durchsuchen
- if ( $conf['search']['quicksearch']['search_content'] )
- {
- $e = new Value();
- $listObjectIds += $e->getObjectIdsByValue( $text );
+ if ( $conf['search']['quicksearch']['search_description'] )
+ {
+ $o = new Object();
+ $listObjectIds += $o->getObjectIdsByDescription( $text );
+ }
- $template = new Template();
- $listTemplateIds += $template->getTemplateIdsByValue( $text );
+ if ( $conf['search']['quicksearch']['search_filename'] )
+ {
+ $o = new Object();
+ $listObjectIds += $o->getObjectIdsByFilename( $text );
+
+ $f = new File();
+ $listObjectIds += $f->getObjectIdsByExtension( $text );
+ }
+
+ // Inhalte durchsuchen
+ if ( $conf['search']['quicksearch']['search_content'] )
+ {
+ $e = new Value();
+ $listObjectIds += $e->getObjectIdsByValue( $text );
+
+ $template = new Template();
+ $listTemplateIds += $template->getTemplateIdsByValue( $text );
+ }
+
+ $this->explainResult( $listObjectIds, $listTemplateIds );
}
- $this->explainResult( $listObjectIds, $listTemplateIds );
}
diff --git a/action/SearchAction.ini.php b/action/SearchAction.ini.php
@@ -3,8 +3,8 @@
goto=prop
[quicksearch]
-menu=search
-goto=result
+async=true
+;goto=result
[result]
menu=search