begin modifying ajax/getcontacttags
This commit is contained in:
parent
db71e63467
commit
6d49b0622d
2 changed files with 40 additions and 34 deletions
|
@ -150,6 +150,11 @@ jQuery(document).ready(function() {
|
||||||
$.ui.autocomplete.filter(
|
$.ui.autocomplete.filter(
|
||||||
availableTags, extractLast(request.term)
|
availableTags, extractLast(request.term)
|
||||||
)
|
)
|
||||||
|
/*
|
||||||
|
$.getJSON( "search.php", {
|
||||||
|
term: extractLast( request.term )
|
||||||
|
}, response );
|
||||||
|
*/
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,46 +1,47 @@
|
||||||
<?php
|
<?php
|
||||||
/***************************************************************************
|
/**
|
||||||
Copyright (C) 2004 - 2006 Scuttle project
|
* Return a json file with list of tags according to current user
|
||||||
http://sourceforge.net/projects/scuttle/
|
* and sorted by popularity.
|
||||||
http://scuttle.org/
|
*
|
||||||
|
* The following GET parameters are accepted:
|
||||||
|
* @param string $beginsWith The tag name shall start with that string.
|
||||||
|
* No default.
|
||||||
|
* @param integer $limit Number of tags to return. Defaults to 1000
|
||||||
|
*
|
||||||
|
* Part of SemanticScuttle - your social bookmark manager.
|
||||||
|
*
|
||||||
|
* PHP version 5.
|
||||||
|
*
|
||||||
|
* @category Bookmarking
|
||||||
|
* @package SemanticScuttle
|
||||||
|
* @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net>
|
||||||
|
* @author Christian Weiske <cweiske@cweiske.de>
|
||||||
|
* @author Eric Dane <ericdane@users.sourceforge.net>
|
||||||
|
* @license GPL http://www.gnu.org/licenses/gpl.html
|
||||||
|
* @link http://sourceforge.net/projects/semanticscuttle
|
||||||
|
*/
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/* Return a json file with list of tags according to current user and sort by popularity*/
|
|
||||||
$httpContentType = 'application/json';
|
$httpContentType = 'application/json';
|
||||||
require_once '../www-header.php';
|
require_once '../www-header.php';
|
||||||
|
|
||||||
/* Service creation: only useful services are created */
|
$limit = 30;
|
||||||
$b2tservice =SemanticScuttle_Service_Factory::get('Bookmark2Tag');
|
$beginsWith = null;
|
||||||
$bookmarkservice =SemanticScuttle_Service_Factory::get('Tag');
|
$currentUserId = $userservice->getCurrentUserId();
|
||||||
|
|
||||||
$listTags = $b2tservice->getContactTags(
|
if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
|
||||||
$userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId()
|
$limit = (int)$_GET['limit'];
|
||||||
|
}
|
||||||
|
if (isset($_GET['beginsWith']) && strlen(trim($_GET['beginsWith']))) {
|
||||||
|
$beginsWith = trim($_GET['beginsWith']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$listTags = SemanticScuttle_Service_Factory::get('Bookmark2Tag')->getContactTags(
|
||||||
|
$currentUserId, $limit, $currentUserId, $beginsWith
|
||||||
);
|
);
|
||||||
$tags = array();
|
$tags = array();
|
||||||
foreach($listTags as $t) {
|
foreach ($listTags as $t) {
|
||||||
$tags[] = array(
|
$tags[] = $t['tag'];
|
||||||
'caption' => $t['tag'],
|
|
||||||
'value' => $t['tag'],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($tags);
|
echo json_encode($tags);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue