Revisión 72
Añadido por Manu Mora Gordillo hace alrededor de 14 años
controlies/Plugins/Users.py | ||
---|---|---|
return "/home/alumnos/"
|
||
|
||
def getAllUsers(self):
|
||
result = self.ldap.search("ou=Group","(|(groupType=school_department)(groupType=school_class))",["cn","groupType"])
|
||
|
||
departments = []
|
||
classrooms = []
|
||
for g in result:
|
||
if g[0][1]["groupType"][0] == "school_department":
|
||
departments.append(g[0][1]["cn"][0])
|
||
elif g[0][1]["groupType"][0] == "school_class":
|
||
classrooms.append(g[0][1]["cn"][0])
|
||
|
||
departments.sort()
|
||
classrooms.sort()
|
||
return { "departments":departments, "classrooms":classrooms }
|
||
result = self.ldap.search("ou=People","uid=*",["uid","cn"])
|
||
|
||
rows = []
|
||
for u in result:
|
||
rows.append({ 'value':u[0][1]['uid'][0] , 'caption':u[0][1]['cn'][0] });
|
||
|
||
return rows
|
controlies/www/js/fcbkcomplete/style.css | ||
---|---|---|
/* TextboxList sample CSS */
|
||
ul.holder { margin: 0; border: 1px solid #999; overflow: hidden; height: auto !important; height: 1%; padding: 4px 5px 0; }
|
||
*:first-child+html ul.holder { padding-bottom: 2px; } * html ul.holder { padding-bottom: 2px; } /* ie7 and below */
|
||
ul.holder li { float: left; list-style-type: none; margin: 0 5px 4px 0; }
|
||
ul.holder li.bit-box, ul.holder li.bit-input input { font: 11px "Lucida Grande", "Verdana"; }
|
||
ul.holder li.bit-box { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; border: 1px solid #CAD8F3; background: #DEE7F8; padding: 1px 5px 2px; }
|
||
ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
|
||
ul.holder li.bit-input input { width: 150px; margin: 0; border: none; outline: 0; padding: 3px 0 2px; } /* no left/right padding here please */
|
||
ul.holder li.bit-input input.smallinput { width: 20px; }
|
||
|
||
/* Facebook demo CSS */
|
||
form, #add { border: 1px solid #999; width: 550px; margin: 50px; padding: 20px 30px 10px; }
|
||
form ol li { list-style-type: none; }
|
||
form ol { font: 11px "Lucida Grande", "Verdana"; margin: 0; padding: 0; }
|
||
form ol li.input-text { margin-bottom: 10px; list-style-type: none; padding-bottom: 10px; }
|
||
form ol li.input-text label { font-weight: bold; cursor: pointer; display: block; font-size: 13px; margin-bottom: 10px; }
|
||
form ol li.input-text input { width: 500px; padding: 5px 5px 6px; font: 11px "Lucida Grande", "Verdana"; border: 1px solid #999; }
|
||
form ul.holder { width: 500px; }
|
||
form ul { margin: 0 !important }
|
||
#facebook-list ul.holder li.bit-box, #apple-list ul.holder li.bit-box { padding-right: 15px; position: relative; }
|
||
#apple-list ul.holder li.bit-input { margin: 0; }
|
||
#apple-list ul.holder li.bit-input input.smallinput { width: 5px; }
|
||
ul.holder li.bit-hover { background: #BBCEF1; border: 1px solid #6D95E0; }
|
||
ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
|
||
ul.holder li.bit-box a.closebutton { position: absolute; right: 4px; top: 5px; display: block; width: 7px; height: 7px; font-size: 1px; background: url('close.gif'); }
|
||
ul.holder li.bit-box a.closebutton:hover { background-position: 7px; }
|
||
ul.holder li.bit-box-focus a.closebutton, ul.holder li.bit-box-focus a.closebutton:hover { background-position: bottom; }
|
||
|
||
/* Autocompleter */
|
||
|
||
#facebook-auto { display: none; position: absolute; width: 512px; background: #eee; }
|
||
#facebook-auto .default { padding: 5px 7px; border: 1px solid #ccc; border-width: 0 1px 1px; }
|
||
#facebook-auto ul { display: none; margin: 0; padding: 0; overflow: auto; }
|
||
#facebook-auto ul li { padding: 5px 12px; z-index: 1000; cursor: pointer; margin: 0; list-style-type: none; border: 1px solid #ccc; border-width: 0 1px 1px; font: 11px "Lucida Grande", "Verdana"; }
|
||
#facebook-auto ul li em { font-weight: bold; font-style: normal; background: #ccc; }
|
||
#facebook-auto ul li.auto-focus { background: #4173CC; color: #fff; }
|
||
#facebook-auto ul li.auto-focus em { background: none; }
|
||
|
||
#demo ul.holder li.bit-input input { padding: 2px 0 1px; border: 1px solid #999; }
|
||
#add a { color: #666; }
|
||
#add-test { width: 100px; padding: 2px; }
|
||
#button_container { margin-left: 70px; margin-bottom: 30px;}
|
||
.hidden { display:none;}
|
||
controlies/www/js/fcbkcomplete/fetched.php | ||
---|---|---|
[{"caption":"Manuel Mujica Lainez","value":4},{"caption":"Gustavo Nielsen","value":3},{"caption":"Silvina Ocampo","value":3},{"caption":"Victoria Ocampo", "value":3},{"caption":"Hector German Oesterheld", "value":3},{"caption":"Olga Orozco", "value":3},{"caption":"Juan L. Ortiz", "value":3},{"caption":"Alicia Partnoy", "value":3},{"caption":"Roberto Payro", "value":3},{"caption":"Ricardo Piglia", "value":3},{"caption":"Felipe Pigna", "value":3},{"caption":"Alejandra Pizarnik", "value":3},{"caption":"Antonio Porchia", "value":3},{"caption":"Juan Carlos Portantiero", "value":3},{"caption":"Manuel Puig", "value":3},{"caption":"Andres Rivera", "value":3},{"caption":"Mario Rodriguez Cobos", "value":3},{"caption":"Arturo Andres Roig", "value":3},{"caption":"Ricardo Rojas", "value":3}]
|
||
controlies/www/js/fcbkcomplete/fcbkcomplete.js | ||
---|---|---|
/*
|
||
FCBKcomplete 1.09
|
||
- Jquery version required: 1.2.x, 1.3.x
|
||
|
||
Changelog:
|
||
- 1.09 IE crash fixed
|
||
|
||
- 1.08 some minor bug fixed
|
||
|
||
- 1.07 case sensetive added
|
||
applied filter to non ajax items
|
||
filter algorithm changed
|
||
cache for ajax request added
|
||
up/down with auto scrolling
|
||
minor code fixes
|
||
|
||
- 1.06 auto heigth fix
|
||
event bind on main element for better user frendly experience
|
||
filter for items
|
||
up/down keys supported from now
|
||
|
||
- 1.05 bindEvents function fixed thanks to idgnarn
|
||
|
||
- 1.04 IE7 <em> tag replace fixed
|
||
|
||
- 1.03 IE7 & IE6 crash fixed
|
||
IE7 css fixed
|
||
|
||
- 1.02 json parsing fixed
|
||
remove element fixed
|
||
|
||
- 1.01 some bugs fixed
|
||
|
||
- 1.0 migration from prototype
|
||
*/
|
||
|
||
/* Coded by: emposha <admin@emposha.com> */
|
||
/* Copyright: Emposha.com <http://www.emposha.com/> - Distributed under MIT - Keep this message! */
|
||
/*
|
||
* elem - input element id or object
|
||
* list - preadded elements
|
||
* complete - autocomplete div id or object
|
||
* ajax - object with two parametrs a) url to fetch json object b) use cache
|
||
* height - maximum number of element shown before scroll will apear
|
||
* filter - object with two parametrs a)case sensitive b) show/hide filtered items
|
||
* newel - show typed text like a element
|
||
*/
|
||
|
||
jQuery.facebooklist = function(elem, list, complete, ajax, height, filter, newel){
|
||
|
||
var addHiddenInput = function(value){
|
||
var input = document.createElement('input');
|
||
$(input).attr({
|
||
'type': 'hidden',
|
||
'name': (elem.attr('id') + '[]'),
|
||
'id': (elem.attr('id') + '[]'),
|
||
'value': value
|
||
});
|
||
return input;
|
||
}
|
||
|
||
var getChar = function(e){
|
||
if (window.event) {
|
||
keynum = e.keyCode;
|
||
}
|
||
else
|
||
if (e.which) {
|
||
keynum = e.which;
|
||
}
|
||
if (keynum == 8)
|
||
return '';
|
||
|
||
return String.fromCharCode(keynum);
|
||
}
|
||
|
||
var addItem = function(item, preadded){
|
||
var title = item.text();
|
||
var value = (item.attr('rel') && item.attr('rel') != -1 ? item.attr('rel') : title);
|
||
var li = document.createElement('li');
|
||
var txt = document.createTextNode(title);
|
||
var aclose = document.createElement('a');
|
||
var input = addHiddenInput(value);
|
||
$(li).attr({
|
||
'class': 'bit-box'
|
||
});
|
||
$(li).prepend(txt);
|
||
$(aclose).attr({
|
||
'class': 'closebutton',
|
||
'href': '#'
|
||
});
|
||
li.appendChild(aclose);
|
||
li.appendChild(input);
|
||
holder.appendChild(li);
|
||
$(aclose).click(function(){
|
||
$(this).parent('li').fadeOut('fast', function(){
|
||
$(this).remove();
|
||
});
|
||
return false;
|
||
});
|
||
if (!preadded) {
|
||
holder.removeChild(document.getElementById('annoninput'));
|
||
addInput();
|
||
}
|
||
feed.hide();
|
||
}
|
||
|
||
var defaultFilter = function(input){
|
||
if (filter.userfilter) {
|
||
var flag;
|
||
feed.children('li:not([fckb])').removeClass('hidden');
|
||
$.each(feed.children('li:not([fckb])'), function(i, val){
|
||
var item = $(val);
|
||
if (filter.casesensetive) {
|
||
flag = item.text().indexOf(input);
|
||
item.html(item.text().replace(input, '<em>' + input + '</em>'));
|
||
}
|
||
else {
|
||
flag = item.text().toLowerCase().indexOf(input.toLowerCase());
|
||
item.html(item.text().replace(input, '<em>' + input + '</em>'));
|
||
}
|
||
if (flag == -1) {
|
||
item.addClass('hidden');
|
||
}
|
||
else {
|
||
counter++;
|
||
}
|
||
});
|
||
}
|
||
else {
|
||
counter += feed.children('li:not([fckb])').length;
|
||
}
|
||
if (counter > height) {
|
||
feed.css({
|
||
'height': (height * 24) + 'px',
|
||
'overflow': 'auto'
|
||
});
|
||
}
|
||
else {
|
||
feed.css('height', 'auto');
|
||
}
|
||
}
|
||
|
||
var feedFilter = function(item, caption, input){
|
||
if (filter.userfilter) {
|
||
if (filter.casesensetive) {
|
||
if (caption.indexOf(input) != -1) {
|
||
item.html(caption.replace(input, '<em>' + input + '</em>'));
|
||
return true;
|
||
}
|
||
}
|
||
else {
|
||
if (caption.toLowerCase().indexOf(input) != -1) {
|
||
item.html(caption.replace(input, '<em>' + input + '</em>'));
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
item.html(caption.replace(input, '<em>' + input + '</em>'));
|
||
return true;
|
||
}
|
||
}
|
||
|
||
var addItemFeed = function(data, input){
|
||
feed.children('li[fckb=2]').remove();
|
||
$.each(data, function(i, val){
|
||
if (val.caption) {
|
||
var li = document.createElement('li');
|
||
$(li).attr({
|
||
'rel': val.value,
|
||
'fckb': '2'
|
||
});
|
||
if (feedFilter($(li), val.caption, input)) {
|
||
feed.append(li);
|
||
counter++;
|
||
}
|
||
}
|
||
});
|
||
defaultFilter(input);
|
||
}
|
||
|
||
var addTextItemFeed = function(value){
|
||
if (newel) {
|
||
feed.children('li[fckb=1]').remove();
|
||
var li = document.createElement('li');
|
||
$(li).attr({
|
||
'rel': value,
|
||
'fckb': '1'
|
||
});
|
||
$(li).html(value);
|
||
feed.prepend(li);
|
||
counter++;
|
||
}
|
||
}
|
||
|
||
var removeFeedEvent = function () {
|
||
feed.children('li').unbind('mouseover');
|
||
feed.children('li').unbind('mouseout');
|
||
feed.mousemove(function () {
|
||
bindFeedEvent();
|
||
feed.unbind('mousemove');
|
||
})
|
||
}
|
||
|
||
var bindFeedEvent = function () {
|
||
feed.children('li').mouseover(function(){
|
||
feed.children('li').removeClass("auto-focus");
|
||
$(this).addClass("auto-focus");
|
||
nowFocusOn = $(this);
|
||
});
|
||
feed.children('li').mouseout( function(){
|
||
$(this).removeClass("auto-focus");
|
||
nowFocusOn = null;
|
||
});
|
||
}
|
||
|
||
var bindEvents = function(){
|
||
var maininput = $('.maininput');
|
||
bindFeedEvent();
|
||
feed.children('li').unbind('click');
|
||
feed.children('li').click(function(){
|
||
addItem($(this));
|
||
complete.hide();
|
||
});
|
||
maininput.unbind('keydown');
|
||
maininput.keydown(function(event){
|
||
if (event.keyCode == 13 && nowFocusOn != null) {
|
||
addItem($(nowFocusOn));
|
||
complete.hide();
|
||
event.preventDefault();
|
||
}
|
||
if (event.keyCode == 40) {
|
||
removeFeedEvent();
|
||
if (typeof(nowFocusOn) == 'undefined' || nowFocusOn.length == 0) {
|
||
nowFocusOn = $(feed.children('li:visible:first'));
|
||
feed.get(0).scrollTop = 0;
|
||
}
|
||
else {
|
||
nowFocusOn.removeClass("auto-focus");
|
||
nowFocusOn = nowFocusOn.nextAll('li:visible:first');
|
||
var prev = parseInt(nowFocusOn.prevAll('li:visible').length,10);
|
||
var next = parseInt(nowFocusOn.nextAll('li:visible').length,10);
|
||
if ((prev > Math.round(height /2) || next <= Math.round(height /2)) && typeof(nowFocusOn.get(0)) != 'undefined') {
|
||
feed.get(0).scrollTop = parseInt(nowFocusOn.get(0).scrollHeight,10) * (prev - Math.round(height /2));
|
||
}
|
||
}
|
||
feed.children('li').removeClass("auto-focus");
|
||
nowFocusOn.addClass("auto-focus");
|
||
}
|
||
if (event.keyCode == 38) {
|
||
removeFeedEvent();
|
||
if (typeof(nowFocusOn) == 'undefined' || nowFocusOn.length == 0) {
|
||
nowFocusOn = $(feed.children('li:visible:last'));
|
||
feed.get(0).scrollTop = parseInt(nowFocusOn.get(0).scrollHeight,10) * (parseInt(feed.children('li:visible').length,10) - Math.round(height /2));
|
||
}
|
||
else {
|
||
nowFocusOn.removeClass("auto-focus");
|
||
nowFocusOn = nowFocusOn.prevAll('li:visible:first');
|
||
var prev = parseInt(nowFocusOn.prevAll('li:visible').length,10);
|
||
var next = parseInt(nowFocusOn.nextAll('li:visible').length,10);
|
||
if ((next > Math.round(height /2) || prev <= Math.round(height /2)) && typeof(nowFocusOn.get(0)) != 'undefined') {
|
||
feed.get(0).scrollTop = parseInt(nowFocusOn.get(0).scrollHeight,10) * (prev - Math.round(height /2));
|
||
}
|
||
}
|
||
feed.children('li').removeClass("auto-focus");
|
||
nowFocusOn.addClass("auto-focus");
|
||
}
|
||
});
|
||
}
|
||
|
||
var addInput = function(){
|
||
var li = document.createElement('li');
|
||
var input = document.createElement('input');
|
||
$(li).attr({
|
||
'class': 'bit-input',
|
||
'id': 'annoninput'
|
||
});
|
||
$(input).attr({
|
||
'type': 'text',
|
||
'class': 'maininput'
|
||
});
|
||
li.appendChild(input);
|
||
holder.appendChild(li);
|
||
$(input).focus(function(){
|
||
complete.fadeIn('fast');
|
||
});
|
||
$(holder).click(function(){
|
||
$(input).focus();
|
||
if (feed.length && $(input).val().length) {
|
||
feed.show();
|
||
}
|
||
else {
|
||
feed.children('li[fckb=2]').remove();
|
||
feed.children('li').addClass('hidden');
|
||
feed.css('height','0px');
|
||
$('.default').show();
|
||
}
|
||
});
|
||
$(input).keyup(function(event){
|
||
if (event.keyCode != 40 && event.keyCode != 38) {
|
||
counter = 0;
|
||
var etext = $(input).val();
|
||
addTextItemFeed(etext);
|
||
if (ajax.url) {
|
||
if (ajax.cache && cache.length > 0) {
|
||
addItemFeed(cache, etext);
|
||
bindEvents();
|
||
}
|
||
else {
|
||
$.post(ajax.url + '?action=getAllUsers&tag=' + etext, null, function(data){
|
||
addItemFeed(data, etext);
|
||
cache = data;
|
||
bindEvents();
|
||
}, "json");
|
||
}
|
||
}
|
||
else {
|
||
bindEvents();
|
||
}
|
||
$('.default').hide();
|
||
feed.show();
|
||
}
|
||
});
|
||
}
|
||
|
||
if (typeof(elem) != 'object') {
|
||
elem = $(elem);
|
||
}
|
||
if (typeof(list) != 'object') {
|
||
list = $(list);
|
||
}
|
||
if (typeof(complete) != 'object') {
|
||
complete = $(complete);
|
||
}
|
||
var feed = $('#feed');
|
||
var cache = {};
|
||
var counter = 0;
|
||
var nowFocusOn;
|
||
var holder = document.createElement('ul');
|
||
elem.css('display', 'none');
|
||
$(holder).attr('class', 'holder');
|
||
|
||
if (list && list.children('li').length) {
|
||
$.each(list.children('li'), function(i, val){
|
||
addItem($(list.children('li')[i]), 1);
|
||
});
|
||
}
|
||
|
||
addInput();
|
||
elem.before(holder);
|
||
|
||
$(document).click(function (event) {
|
||
if ($(event.target).attr('class') != 'holder' && $(event.target).attr('class') != 'maininput') {
|
||
$('.default').hide();
|
||
$(feed).hide();
|
||
}
|
||
});
|
||
}
|
||
controlies/www/js/fcbkcomplete/index.html | ||
---|---|---|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
<head>
|
||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||
<title>FCBKcomplete Demo</title>
|
||
|
||
<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Test Stylesheet" charset="utf-8" />
|
||
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="fcbkcomplete.min.js" type="text/javascript" charset="utf-8"></script>
|
||
</head>
|
||
|
||
<body id="test">
|
||
|
||
<input type="text" value="" id="facebook-demo" />
|
||
<ul id="preadded" style="display:none"></ul>
|
||
<div id="facebook-auto">
|
||
<div class="default">Escribe el nombre de la persona a buscar</div>
|
||
<ul id="feed"></ul>
|
||
</div>
|
||
|
||
<script language="JavaScript">
|
||
$(document).ready(function() {
|
||
$.facebooklist('#facebook-demo', '#preadded', '#facebook-auto',{url:'fetched.php',cache:1}, 10, {userfilter:1,casesensetive:0});
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|
||
controlies/www/js/fcbkcomplete/fcbkcomplete.min.js | ||
---|---|---|
/*
|
||
FCBKcomplete 1.09
|
||
- Jquery version required: 1.2.x, 1.3.x
|
||
|
||
Changelog:
|
||
- 1.09 IE crash fixed
|
||
|
||
- 1.08 some minor bug fixed
|
||
|
||
- 1.07 case sensetive added
|
||
applied filter to non ajax items
|
||
filter algorithm changed
|
||
cache for ajax request added
|
||
up/down with auto scrolling
|
||
minor code fixes
|
||
|
||
- 1.06 auto heigth fix
|
||
event bind on main element for better user frendly experience
|
||
filter for items
|
||
up/down keys supported from now
|
||
|
||
- 1.05 bindEvents function fixed thanks to idgnarn
|
||
|
||
- 1.04 IE7 <em> tag replace fixed
|
||
|
||
- 1.03 IE7 & IE6 crash fixed
|
||
IE7 css fixed
|
||
|
||
- 1.02 json parsing fixed
|
||
remove element fixed
|
||
|
||
- 1.01 some bugs fixed
|
||
|
||
- 1.0 migration from prototype
|
||
*/
|
||
|
||
/* Coded by: emposha <admin@emposha.com> */
|
||
/* Copyright: Emposha.com <http://www.emposha.com/> - Distributed under MIT - Keep this message! */
|
||
/*
|
||
* elem - input element id or object
|
||
* list - preadded elements
|
||
* complete - autocomplete div id or object
|
||
* ajax - object with two parametrs a) url to fetch json object b) use cache
|
||
* height - maximum number of element shown before scroll will apear
|
||
* filter - object with two parametrs a)case sensitive b) show/hide filtered items
|
||
* newel - show typed text like a element
|
||
*/
|
||
|
||
jQuery.facebooklist=function(elem,list,complete,ajax,height,filter,newel){var addHiddenInput=function(value){var input=document.createElement('input');$(input).attr({'type':'hidden','name':(elem.attr('id')+'[]'),'id':(elem.attr('id')+'[]'),'value':value});return input;}
|
||
var getChar=function(e){if(window.event){keynum=e.keyCode;}
|
||
else
|
||
if(e.which){keynum=e.which;}
|
||
if(keynum==8)
|
||
return'';return String.fromCharCode(keynum);}
|
||
var addItem=function(item,preadded){var title=item.text();var value=(item.attr('rel')&&item.attr('rel')!=-1?item.attr('rel'):title);var li=document.createElement('li');var txt=document.createTextNode(title);var aclose=document.createElement('a');var input=addHiddenInput(value);$(li).attr({'class':'bit-box'});$(li).prepend(txt);$(aclose).attr({'class':'closebutton','href':'#'});li.appendChild(aclose);li.appendChild(input);holder.appendChild(li);$(aclose).click(function(){$(this).parent('li').fadeOut('fast',function(){$(this).remove();});return false;});if(!preadded){holder.removeChild(document.getElementById('annoninput'));addInput();}
|
||
feed.hide();}
|
||
var defaultFilter=function(input){if(filter.userfilter){var flag;feed.children('li:not([fckb])').removeClass('hidden');$.each(feed.children('li:not([fckb])'),function(i,val){var item=$(val);if(filter.casesensetive){flag=item.text().indexOf(input);item.html(item.text().replace(input,'<em>'+input+'</em>'));}
|
||
else{flag=item.text().toLowerCase().indexOf(input.toLowerCase());item.html(item.text().replace(input,'<em>'+input+'</em>'));}
|
||
if(flag==-1){item.addClass('hidden');}
|
||
else{counter++;}});}
|
||
else{counter+=feed.children('li:not([fckb])').length;}
|
||
if(counter>height){feed.css({'height':(height*24)+'px','overflow':'auto'});}
|
||
else{feed.css('height','auto');}}
|
||
var feedFilter=function(item,caption,input){if(filter.userfilter){if(filter.casesensetive){if(caption.indexOf(input)!=-1){item.html(caption.replace(input,'<em>'+input+'</em>'));return true;}}
|
||
else{if(caption.toLowerCase().indexOf(input)!=-1){item.html(caption.replace(input,'<em>'+input+'</em>'));return true;}}}
|
||
else{item.html(caption.replace(input,'<em>'+input+'</em>'));return true;}}
|
||
var addItemFeed=function(data,input){feed.children('li[fckb=2]').remove();$.each(data,function(i,val){if(val.caption){var li=document.createElement('li');$(li).attr({'rel':val.value,'fckb':'2'});if(feedFilter($(li),val.caption,input)){feed.append(li);counter++;}}});defaultFilter(input);}
|
||
var addTextItemFeed=function(value){if(newel){feed.children('li[fckb=1]').remove();var li=document.createElement('li');$(li).attr({'rel':value,'fckb':'1'});$(li).html(value);feed.prepend(li);counter++;}}
|
||
var removeFeedEvent=function(){feed.children('li').unbind('mouseover');feed.children('li').unbind('mouseout');feed.mousemove(function(){bindFeedEvent();feed.unbind('mousemove');})}
|
||
var bindFeedEvent=function(){feed.children('li').mouseover(function(){feed.children('li').removeClass("auto-focus");$(this).addClass("auto-focus");nowFocusOn=$(this);});feed.children('li').mouseout(function(){$(this).removeClass("auto-focus");nowFocusOn=null;});}
|
||
var bindEvents=function(){var maininput=$('.maininput');bindFeedEvent();feed.children('li').unbind('click');feed.children('li').click(function(){addItem($(this));complete.hide();});maininput.unbind('keydown');maininput.keydown(function(event){if(event.keyCode==13&&nowFocusOn!=null){addItem($(nowFocusOn));complete.hide();event.preventDefault();}
|
||
if(event.keyCode==40){removeFeedEvent();if(typeof(nowFocusOn)=='undefined'||nowFocusOn.length==0){nowFocusOn=$(feed.children('li:visible:first'));feed.get(0).scrollTop=0;}
|
||
else{nowFocusOn.removeClass("auto-focus");nowFocusOn=nowFocusOn.nextAll('li:visible:first');var prev=parseInt(nowFocusOn.prevAll('li:visible').length,10);var next=parseInt(nowFocusOn.nextAll('li:visible').length,10);if((prev>Math.round(height/2)||next<=Math.round(height/2))&&typeof(nowFocusOn.get(0))!='undefined'){feed.get(0).scrollTop=parseInt(nowFocusOn.get(0).scrollHeight,10)*(prev-Math.round(height/2));}}
|
||
feed.children('li').removeClass("auto-focus");nowFocusOn.addClass("auto-focus");}
|
||
if(event.keyCode==38){removeFeedEvent();if(typeof(nowFocusOn)=='undefined'||nowFocusOn.length==0){nowFocusOn=$(feed.children('li:visible:last'));feed.get(0).scrollTop=parseInt(nowFocusOn.get(0).scrollHeight,10)*(parseInt(feed.children('li:visible').length,10)-Math.round(height/2));}
|
||
else{nowFocusOn.removeClass("auto-focus");nowFocusOn=nowFocusOn.prevAll('li:visible:first');var prev=parseInt(nowFocusOn.prevAll('li:visible').length,10);var next=parseInt(nowFocusOn.nextAll('li:visible').length,10);if((next>Math.round(height/2)||prev<=Math.round(height/2))&&typeof(nowFocusOn.get(0))!='undefined'){feed.get(0).scrollTop=parseInt(nowFocusOn.get(0).scrollHeight,10)*(prev-Math.round(height/2));}}
|
||
feed.children('li').removeClass("auto-focus");nowFocusOn.addClass("auto-focus");}});}
|
||
var addInput=function(){var li=document.createElement('li');var input=document.createElement('input');$(li).attr({'class':'bit-input','id':'annoninput'});$(input).attr({'type':'text','class':'maininput'});li.appendChild(input);holder.appendChild(li);$(input).focus(function(){complete.fadeIn('fast');});$(holder).click(function(){$(input).focus();if(feed.length&&$(input).val().length){feed.show();}
|
||
else{feed.children('li[fckb=2]').remove();feed.children('li').addClass('hidden');feed.css('height','0px');$('.default').show();}});$(input).keyup(function(event){if(event.keyCode!=40&&event.keyCode!=38){counter=0;var etext=$(input).val();addTextItemFeed(etext);if(ajax.url){if(ajax.cache&&cache.length>0){addItemFeed(cache,etext);bindEvents();}
|
||
else{$.getJSON(ajax.url+'?tag='+etext,null,function(data){addItemFeed(data,etext);cache=data;bindEvents();});}}
|
||
else{bindEvents();}
|
||
$('.default').hide();feed.show();}});}
|
||
if(typeof(elem)!='object'){elem=$(elem);}
|
||
if(typeof(list)!='object'){list=$(list);}
|
||
if(typeof(complete)!='object'){complete=$(complete);}
|
||
var feed=$('#feed');var cache={};var counter=0;var nowFocusOn;var holder=document.createElement('ul');elem.css('display','none');$(holder).attr('class','holder');if(list&&list.children('li').length){$.each(list.children('li'),function(i,val){addItem($(list.children('li')[i]),1);});}
|
||
addInput();elem.before(holder);$(document).click(function(event){if($(event.target).attr('class')!='holder'&&$(event.target).attr('class')!='maininput'){$('.default').hide();$(feed).hide();}});}
|
||
controlies/www/js/fcbkcomplete/json.php | ||
---|---|---|
[{"caption":"Sylvia Molloy","value":5}]
|
||
controlies/www/js/fcbkcomplete/fetched.txt | ||
---|---|---|
[{"caption":"Manuel Mujica Lainez","value":4},{"caption":"Gustavo Nielsen","value":3},{"caption":"Silvina Ocampo","value":3},{"caption":"Victoria Ocampo", "value":3},{"caption":"Hector German Oesterheld", "value":3},{"caption":"Olga Orozco", "value":3},{"caption":"Juan L. Ortiz", "value":3},{"caption":"Alicia Partnoy", "value":3},{"caption":"Roberto Payro", "value":3},{"caption":"Ricardo Piglia", "value":3},{"caption":"Felipe Pigna", "value":3},{"caption":"Alejandra Pizarnik", "value":3},{"caption":"Antonio Porchia", "value":3},{"caption":"Juan Carlos Portantiero", "value":3},{"caption":"Manuel Puig", "value":3},{"caption":"Andres Rivera", "value":3},{"caption":"Mario Rodriguez Cobos", "value":3},{"caption":"Arturo Andres Roig", "value":3},{"caption":"Ricardo Rojas", "value":3}]
|
||
controlies/www/groups/form.html | ||
---|---|---|
</select>
|
||
</p>
|
||
<p><span id="nameTag">Nombre </span><br><input type="text" id="name" name="name"/></p>
|
||
|
||
<input type="text" value="" id="facebook-demo" />
|
||
<ul id="preadded" style="display:none"></ul>
|
||
<div id="facebook-auto">
|
||
<div class="default">Escribe el nombre de la persona a buscar</div>
|
||
<ul id="feed"></ul>
|
||
</div>
|
||
|
||
<p><span id="typeTag">Usuarios</span><br>
|
||
<select id="users" name="users[]" size="15" multiple style="width:480px;">
|
||
<option value="none">Seleccione...</option>
|
||
<option value="school_department">Departamento</option>
|
||
<option value="school_classroom">Curso</option>
|
||
</select>
|
||
<select id="users" name="users[]" size="15" multiple style="width:480px;"></select>
|
||
</p>
|
||
<div id="message" style="text-align:center; font-weight:bold; color:red; padding:3px; "></div>
|
||
<div style="text-align:center;"><button id="saveButton" type="submit" style="width:100px;">Guardar</button> <button type="button" id="cancelButton" style="width:100px;">Cancelar</button></div>
|
controlies/www/groups/index.html | ||
---|---|---|
<script type="text/javascript" src="js/multiselect2/plugins/scrollTo/jquery.scrollTo-min.js"></script>
|
||
<script type="text/javascript" src="js/multiselect2/ui.multiselect.js"></script>
|
||
|
||
<!-- Libreria Facebook -->
|
||
<link rel="stylesheet" href="js/fcbkcomplete/style.css" type="text/css" media="screen" title="Test Stylesheet" charset="utf-8" />
|
||
<script src="js/fcbkcomplete/fcbkcomplete.js" type="text/javascript" charset="utf-8"></script>
|
||
|
||
<script language="javascript">
|
||
$(function() {
|
||
$("#dialog-confirm").dialog({ autoOpen: false });
|
||
... | ... | |
|
||
$("#dialog-form").html("");
|
||
$("#dialog-form").load("groups/form.html", function() {
|
||
|
||
$.localise('ui-multiselect', {language: 'es', path: 'locale/'});
|
||
$("#users").multiselect();
|
||
|
||
getAllUsers();
|
||
$.facebooklist('#facebook-demo', '#preadded', '#facebook-auto',{url:'users',cache:1}, 10, {userfilter:1,casesensetive:0});
|
||
getAllUsers();
|
||
/*
|
||
$("#form_data #action").val("modify");
|
||
$("#form_data #user").attr("readonly","true");
|
||
... | ... | |
function getAllUsers(){
|
||
$.post('users','action=getAllUsers', function(data) {
|
||
var users = $.parseJSON(data);
|
||
|
||
$.each( users.teachers, function(i, l){
|
||
$("#form_data #users").append("<option value='"+l+"'>"+l+"</option>");
|
||
});
|
||
/*$.each( users.students, function(i, l){
|
||
$("#form_data #classrooms").append("<option value='"+l+"'>"+l+"</option>");
|
||
}); */
|
||
});
|
||
|
||
/*$.each( users.users, function(i, l){
|
||
$("#form_data #users").append("<option value='"+l.username+"'>"+l.name+"</option>");
|
||
});*/
|
||
});
|
||
}
|
||
</script>
|
||
|
controlies/MainLoop.py | ||
---|---|---|
session = request.getSession()
|
||
l = ILdapConnection(session)
|
||
connection = l.connect()
|
||
|
||
pagename=request.path[1:].lower()
|
||
|
||
pagename=request.path[1:].lower()
|
||
|
||
if pagename=='':
|
||
request.path='/index.html'
|
||
pagename='index.html'
|
||
... | ... | |
return json.dumps({"response" : response})
|
||
|
||
elif request.args['action'][0] == "getAllUsers":
|
||
u = Users(l,"","")
|
||
u = Users(l,"","","","","","","","","")
|
||
response = u.getAllUsers()
|
||
return json.dumps(response)
|
||
|
Exportar a: Unified diff
Autocompletado