mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
вынос ajax функционала в экшен
This commit is contained in:
parent
17d609f324
commit
f749697c82
|
@ -50,6 +50,11 @@ class ActionAjax extends Action {
|
|||
$this->AddEventPreg('/^preview$/i','/^text$/','EventPreviewText');
|
||||
|
||||
$this->AddEventPreg('/^upload$/i','/^image$/','EventUploadImage');
|
||||
|
||||
$this->AddEventPreg('/^autocompleter$/i','/^tag$/','EventAutocompleterTag');
|
||||
$this->AddEventPreg('/^autocompleter$/i','/^city$/','EventAutocompleterCity');
|
||||
$this->AddEventPreg('/^autocompleter$/i','/^country$/','EventAutocompleterCountry');
|
||||
$this->AddEventPreg('/^autocompleter$/i','/^user$/','EventAutocompleterUser');
|
||||
}
|
||||
|
||||
|
||||
|
@ -714,5 +719,73 @@ class ActionAjax extends Action {
|
|||
$this->Viewer_AssignAjax('sText',$sText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Автоподставновка тегов
|
||||
*
|
||||
*/
|
||||
protected function EventAutocompleterTag() {
|
||||
if (!($sValue=getRequest('value',null,'post'))) {
|
||||
return ;
|
||||
}
|
||||
|
||||
$aItems=array();
|
||||
$aTags=$this->Topic_GetTopicTagsByLike($sValue,10);
|
||||
foreach ($aTags as $oTag) {
|
||||
$aItems[]=$oTag->getText();
|
||||
}
|
||||
$this->Viewer_AssignAjax('aItems',$aItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Автоподставновка городов
|
||||
*
|
||||
*/
|
||||
protected function EventAutocompleterCity() {
|
||||
if (!($sValue=getRequest('value',null,'post'))) {
|
||||
return ;
|
||||
}
|
||||
|
||||
$aItems=array();
|
||||
$aCity=$this->User_GetCityByNameLike($sValue,10);
|
||||
foreach ($aCity as $oCity) {
|
||||
$aItems[]=$oCity->getName();
|
||||
}
|
||||
$this->Viewer_AssignAjax('aItems',$aItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Автоподставновка стран
|
||||
*
|
||||
*/
|
||||
protected function EventAutocompleterCountry() {
|
||||
if (!($sValue=getRequest('value',null,'post'))) {
|
||||
return ;
|
||||
}
|
||||
|
||||
$aItems=array();
|
||||
$aCountry=$this->User_GetCountryByNameLike($sValue,10);
|
||||
foreach ($aCountry as $oCountry) {
|
||||
$aItems[]=$oCountry->getName();
|
||||
}
|
||||
$this->Viewer_AssignAjax('aItems',$aItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Автоподставновка пользователей
|
||||
*
|
||||
*/
|
||||
protected function EventAutocompleterUser() {
|
||||
if (!($sValue=getRequest('value',null,'post'))) {
|
||||
return ;
|
||||
}
|
||||
|
||||
$aItems=array();
|
||||
$aUsers=$this->User_GetUsersByLoginLike($sValue,10);
|
||||
foreach ($aUsers as $oUser) {
|
||||
$aItems[]=$oUser->getLogin();
|
||||
}
|
||||
$this->Viewer_AssignAjax('aItems',$aItems);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -398,6 +398,7 @@ $config['head']['default']['js'] = array(
|
|||
"___path.static.skin___/js/login.js",
|
||||
"___path.static.skin___/js/panel.js",
|
||||
"___path.static.skin___/js/messages.js",
|
||||
"___path.static.skin___/js/Autocompleter.LS.js",
|
||||
"___path.root.engine_lib___/external/MooTools_1.2/plugs/Piechart/moocanvas.js"=>array('browser'=>'IE'),
|
||||
);
|
||||
$config['head']['default']['css'] = array(
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* LiveStreet Engine Social Networking
|
||||
* Copyright © 2008 Mzhelskiy Maxim
|
||||
*
|
||||
*--------------------------------------------------------
|
||||
*
|
||||
* Official site: www.livestreet.ru
|
||||
* Contact e-mail: rus.engine@gmail.com
|
||||
*
|
||||
* GNU General Public License, version 2:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Автоподстановка города
|
||||
*/
|
||||
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.dirname(dirname(dirname(__FILE__))));
|
||||
$sDirRoot=dirname(dirname(dirname(__FILE__)));
|
||||
require_once($sDirRoot."/config/config.ajax.php");
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
if (!$sCity=getRequest('value',null,'post')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($sCity!='') {
|
||||
$aCity=$oEngine->User_GetCityByNameLike($sCity,10);
|
||||
foreach ($aCity as $oCity) {
|
||||
echo('<li>'.$oCity->getName().'</li>');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* LiveStreet Engine Social Networking
|
||||
* Copyright © 2008 Mzhelskiy Maxim
|
||||
*
|
||||
*--------------------------------------------------------
|
||||
*
|
||||
* Official site: www.livestreet.ru
|
||||
* Contact e-mail: rus.engine@gmail.com
|
||||
*
|
||||
* GNU General Public License, version 2:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Автоподстановка города
|
||||
*/
|
||||
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.dirname(dirname(dirname(__FILE__))));
|
||||
$sDirRoot=dirname(dirname(dirname(__FILE__)));
|
||||
require_once($sDirRoot."/config/config.ajax.php");
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
if (!$sCountry=getRequest('value',null,'post')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($sCountry!='') {
|
||||
$aCountry=$oEngine->User_GetCountryByNameLike($sCountry,10);
|
||||
foreach ($aCountry as $oCountry) {
|
||||
echo('<li>'.$oCountry->getName().'</li>');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* LiveStreet Engine Social Networking
|
||||
* Copyright © 2008 Mzhelskiy Maxim
|
||||
*
|
||||
*--------------------------------------------------------
|
||||
*
|
||||
* Official site: www.livestreet.ru
|
||||
* Contact e-mail: rus.engine@gmail.com
|
||||
*
|
||||
* GNU General Public License, version 2:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Автоподстановка тегов
|
||||
*/
|
||||
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.dirname(dirname(dirname(__FILE__))));
|
||||
$sDirRoot=dirname(dirname(dirname(__FILE__)));
|
||||
require_once($sDirRoot."/config/config.ajax.php");
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
if (!$sTag=getRequest('value',null,'post')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($sTag!='') {
|
||||
$aTags=$oEngine->Topic_GetTopicTagsByLike($sTag,10);
|
||||
foreach ($aTags as $oTag) {
|
||||
echo('<li>'.$oTag->getText().'</li>');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* LiveStreet Engine Social Networking
|
||||
* Copyright © 2008 Mzhelskiy Maxim
|
||||
*
|
||||
*--------------------------------------------------------
|
||||
*
|
||||
* Official site: www.livestreet.ru
|
||||
* Contact e-mail: rus.engine@gmail.com
|
||||
*
|
||||
* GNU General Public License, version 2:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Автоподстановка логина юзеров
|
||||
*/
|
||||
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.dirname(dirname(dirname(__FILE__))));
|
||||
$sDirRoot=dirname(dirname(dirname(__FILE__)));
|
||||
require_once($sDirRoot."/config/config.ajax.php");
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
if (!$sUser=getRequest('value',null,'post')) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($sUser!='') {
|
||||
$aUsers=$oEngine->User_GetUsersByLoginLike($sUser,10);
|
||||
foreach ($aUsers as $oUser) {
|
||||
echo('<li>'.$oUser->getLogin().'</li>');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,9 +1,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('blog_admin_user_add'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('topic_tags'), DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('topic_tags'), aRouter['ajax']+'autocompleter/tag/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('topic_tags'), DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('topic_tags'), aRouter['ajax']+'autocompleter/tag/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
document.addEvent('domready', function() {
|
||||
var inputCity = $('profile_city');
|
||||
|
||||
new Autocompleter.Request.HTML(inputCity, DIR_WEB_ROOT+'/include/ajax/cityAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON(inputCity, aRouter['ajax']+'autocompleter/city/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
@ -15,7 +15,7 @@ document.addEvent('domready', function() {
|
|||
|
||||
var inputCountry = $('profile_country');
|
||||
|
||||
new Autocompleter.Request.HTML(inputCountry, DIR_WEB_ROOT+'/include/ajax/countryAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON(inputCountry, aRouter['ajax']+'autocompleter/country/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('talk_users'), DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('talk_users'), aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 1, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('talk_blacklist_add'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('talk_filter_sender'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('talk_speaker_add'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('topic_tags'), DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('topic_tags'), aRouter['ajax']+'autocompleter/tag/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
20
templates/skin/developer/js/Autocompleter.LS.js
Normal file
20
templates/skin/developer/js/Autocompleter.LS.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
Autocompleter.Request.LS = {};
|
||||
|
||||
Autocompleter.Request.LS.JSON = new Class({
|
||||
|
||||
Extends: Autocompleter.Request,
|
||||
|
||||
initialize: function(el, url, options) {
|
||||
this.parent(el, options);
|
||||
this.request = new Request.JSON($merge({
|
||||
'url': url,
|
||||
'link': 'cancel'
|
||||
}, this.options.ajaxOptions)).addEvent('onComplete', this.queryResponse.bind(this));
|
||||
},
|
||||
|
||||
queryResponse: function(response) {
|
||||
this.parent();
|
||||
this.update(response.aItems);
|
||||
}
|
||||
|
||||
});
|
|
@ -17,6 +17,8 @@ $config['head']['default']['js'] = array(
|
|||
"___path.static.skin___/js/other.js",
|
||||
"___path.static.skin___/js/login.js",
|
||||
"___path.static.skin___/js/panel.js",
|
||||
"___path.static.skin___/js/messages.js",
|
||||
"___path.static.skin___/js/Autocompleter.LS.js",
|
||||
);
|
||||
$config['head']['default']['css'] = array(
|
||||
"___path.static.skin___/css/style.css",
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('blog_admin_user_add'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('topic_tags'), DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('topic_tags'), aRouter['ajax']+'autocompleter/tag/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('topic_tags'), DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('topic_tags'), aRouter['ajax']+'autocompleter/tag/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -6,7 +6,7 @@ document.addEvent('domready', function() {
|
|||
|
||||
var inputCity = $('profile_city');
|
||||
|
||||
new Autocompleter.Request.HTML(inputCity, DIR_WEB_ROOT+'/include/ajax/cityAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON(inputCity, aRouter['ajax']+'autocompleter/city/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
@ -16,7 +16,7 @@ document.addEvent('domready', function() {
|
|||
|
||||
var inputCountry = $('profile_country');
|
||||
|
||||
new Autocompleter.Request.HTML(inputCountry, DIR_WEB_ROOT+'/include/ajax/countryAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON(inputCountry, aRouter['ajax']+'autocompleter/country/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('talk_users'), DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('talk_users'), aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 1, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('talk_blacklist_add'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('talk_filter_sender'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML(
|
||||
new Autocompleter.Request.LS.JSON(
|
||||
$('talk_speaker_add'),
|
||||
DIR_WEB_ROOT+'/include/ajax/userAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
aRouter['ajax']+'autocompleter/user/?security_ls_key='+LIVESTREET_SECURITY_KEY,
|
||||
{
|
||||
'indicatorClass': 'autocompleter-loading',
|
||||
'minLength': 1,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new Autocompleter.Request.HTML($('topic_tags'), DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
new Autocompleter.Request.LS.JSON($('topic_tags'), aRouter['ajax']+'autocompleter/tag/?security_ls_key='+LIVESTREET_SECURITY_KEY, {
|
||||
'indicatorClass': 'autocompleter-loading', // class added to the input during request
|
||||
'minLength': 2, // We need at least 1 character
|
||||
'selectMode': 'pick', // Instant completion
|
||||
|
|
20
templates/skin/new/js/Autocompleter.LS.js
Normal file
20
templates/skin/new/js/Autocompleter.LS.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
Autocompleter.Request.LS = {};
|
||||
|
||||
Autocompleter.Request.LS.JSON = new Class({
|
||||
|
||||
Extends: Autocompleter.Request,
|
||||
|
||||
initialize: function(el, url, options) {
|
||||
this.parent(el, options);
|
||||
this.request = new Request.JSON($merge({
|
||||
'url': url,
|
||||
'link': 'cancel'
|
||||
}, this.options.ajaxOptions)).addEvent('onComplete', this.queryResponse.bind(this));
|
||||
},
|
||||
|
||||
queryResponse: function(response) {
|
||||
this.parent();
|
||||
this.update(response.aItems);
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in a new issue