Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión 70

Selector de usuarios en grupos

Ver diferencias:

controlies/www/users/index.html
<!-- Libreria JGrid -->
<link rel="stylesheet" type="text/css" media="screen" href="js/jquery/jdgrid/css/ui.jqgrid.css" />
<script src="js/jquery/jdgrid/grid.locale-sp.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/src/grid.common.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/src/grid.formedit.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/src/grid.custom.js" type="text/javascript"></script>
<!-- Libreria Multiselect -->
<link rel="stylesheet" type="text/css" href="js/multiselect/jquery.multiselect.css" />
<script language="javascript" src="js/multiselect/jquery.multiselect.min.js"></script>
<script language="javascript" src="js/multiselect/jquery.multiselect.es.js"></script>
<script language="javascript">
$(function() {
$("#dialog-confirm").dialog({ autoOpen: false });
controlies/www/main.html
<script language="javascript" src="js/jquery/jquery-1.5.min.js"></script>
<script language="javascript" src="js/jquery/jquery-ui-1.8.9.custom.min.js"></script>
<script language="javascript" src="js/jquery/jquery.dropdown.js"></script>
<!-- Libreria Multiselect -->
<link rel="stylesheet" type="text/css" href="js/multiselect/jquery.multiselect.css" />
<script language="javascript" src="js/multiselect/jquery.multiselect.min.js"></script>
<script language="javascript" src="js/multiselect/jquery.multiselect.es.js"></script>
<!-- Libreria JGrid -->
<link rel="stylesheet" type="text/css" media="screen" href="js/jquery/jdgrid/css/ui.jqgrid.css" />
......
<ul>
<li><a href="javascript:loadModule('users')">Usuarios</a></li>
<li><a href="javascript:loadModule('groups','')">Grupos</a></li>
<li><a href="#">Departamentos</a></li>
<li class="empty">Máquinas</li>
<!--<li class="empty">Máquinas</li>-->
<li><a href="javascript:loadModule('ltsp')">Servidores LTSP</a></li>
<li><a href="javascript:loadModule('workstation')">WorkStations</a></li>
<li><a href="javascript:loadModule('thinclients')">Clientes Ligeros</a></li>
<li><a href="javascript:loadModule('portatilpro')">Portátiles Profesores</a></li>
<li><a href="javascript:loadModule('thinclients')">Clientes Ligeros</a></li>
<li><a href="javascript:loadForm('show','Parametros DHCP')">Parámetros DHCP</a></li>
</ul>
</li>
<li><a href="#" class="dir">Sincronización</a>
<!-- <li><a href="#" class="dir">Sincronización</a>
<ul>
<li><a href="#">Importación Rayuela</a></li>
</ul>
......
<li><a href="#">LTSP</a></li>
<li><a href="#">Portátiles</a></li>
</ul>
</li>
</li>-->
<li><a href="javascript:logout();">Salir</a></li>
</ul>
controlies/www/js/multiselect2/css/ui.multiselect.css
/* Multiselect
----------------------------------*/
.ui-multiselect { border: solid 1px; font-size: 0.8em; }
.ui-multiselect ul { -moz-user-select: none; }
.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
.ui-multiselect ul.selected li { }
.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
.ui-multiselect ul.available li { padding-left: 10px; }
.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
.ui-multiselect .ui-state-hover { border: none; }
.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
.ui-multiselect .add-all { float: right; padding: 7px;}
.ui-multiselect .remove-all { float: right; padding: 7px;}
.ui-multiselect .search { float: left; padding: 4px;}
.ui-multiselect .count { float: left; padding: 7px;}
.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; }
controlies/www/js/multiselect2/locale/ui-multiselect-en.js
/**
* Localization strings for the UI Multiselect widget
*
* @locale en, en-US
*/
$.extend($.ui.multiselect.locale, {
addAll:'Add all',
removeAll:'Remove all',
itemsCount:'items selected'
});
controlies/www/js/multiselect2/locale/ui-multiselect-es.js
/**
* Localization strings for the UI Multiselect widget
*
* @locale es, es-ES
*/
$.extend($.ui.multiselect.locale, {
addAll:'Agregar todos',
removeAll:'Remover todos',
itemsCount:'Objetos seleccionados'
});
controlies/www/js/multiselect2/locale/ui-multiselect-fr.js
/**
* Localization strings for the UI Multiselect widget
*
* @locale fr, fr-FR, fr-CA
*/
$.extend($.ui.multiselect.locale, {
addAll:'Ajouter tout',
removeAll:'Supprimer tout',
itemsCount:'items sélectionnés'
});
controlies/www/js/multiselect2/locale/ui-multiselect-de.js
/**
* Localization strings for the UI Multiselect widget
*
* @locale de, de-DE, de-AT, de-CH
*/
$.extend($.ui.multiselect.locale, {
addAll:'Alle hinzufügen',
removeAll:'Alle entfernen',
itemsCount:'Einträge ausgewählt'
});
controlies/www/js/multiselect2/plugins/localisation/jquery.localisation.js
/* http://keith-wood.name/localisation.html
Localisation assistance for jQuery v1.0.4.
Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
Please attribute the author if you use it. */
(function($) { // Hide scope, no $ conflict
/* Load applicable localisation package(s) for one or more jQuery packages.
Assumes that the localisations are named <base>-<lang>.js
and loads them in order from least to most specific.
For example, $.localise('mypackage');
with the browser set to 'en-US' would attempt to load
mypackage-en.js and mypackage-en-US.js.
Also accepts an array of package names to process.
Optionally specify whether or not to include the base file,
the desired language, and/or the timeout period, e.g.
$.localise(['mypackage1', 'yourpackage'],
{loadBase: true; language: 'en-AU', timeout: 300});
@param packages (string or string[]) names of package(s) to load
@param settings omit for the current browser language or
(string) code for the language to load (aa[-AA]) or
(object} options for the call with
language (string) the code for the language
loadBase (boolean) true to also load the base package or false (default) to not
path (string or string[2]) the paths to the JavaScript,
either as both or [base, localisations]
timeout (number) the time period in milliseconds (default 500)
@param loadBase (boolean, optional) true to also load the base package or false (default) to not -
omit this if settings is an object
@param path (string or string[2], optional) the paths to the JavaScript,
either as both or [base, localisations] -
omit this if settings is an object
@param timeout (number, optional) the time period in milliseconds (default 500) -
omit this if settings is an object */
$.localise = function(packages, settings, loadBase, path, timeout) {
if (typeof settings != 'object' && typeof settings != 'string') {
timeout = path;
path = loadBase;
loadBase = settings;
settings = '';
}
if (typeof loadBase != 'boolean') {
timeout = path;
path = loadBase;
loadBase = false;
}
if (typeof path != 'string' && !isArray(path)) {
timeout = path;
path = ['', ''];
}
var saveSettings = {async: $.ajaxSettings.async, timeout: $.ajaxSettings.timeout};
settings = (typeof settings != 'string' ? settings || {} :
{language: settings, loadBase: loadBase, path: path, timeout: timeout});
var paths = (!settings.path ? ['', ''] :
(isArray(settings.path) ? settings.path : [settings.path, settings.path]));
$.ajaxSetup({async: false, timeout: (settings.timeout || 500)});
var localiseOne = function(package, lang) {
if (settings.loadBase) {
$.getScript(paths[0] + package + '.js');
}
if (lang.length >= 2) {
$.getScript(paths[1] + package + '-' + lang.substring(0, 2) + '.js');
}
if (lang.length >= 5) {
$.getScript(paths[1] + package + '-' + lang.substring(0, 5) + '.js');
}
};
var lang = normaliseLang(settings.language || $.localise.defaultLanguage);
packages = (isArray(packages) ? packages : [packages]);
for (i = 0; i < packages.length; i++) {
localiseOne(packages[i], lang);
}
$.ajaxSetup(saveSettings);
};
// Localise it!
$.localize = $.localise;
/* Retrieve the default language set for the browser. */
$.localise.defaultLanguage = normaliseLang(navigator.language /* Mozilla */ ||
navigator.userLanguage /* IE */);
/* Ensure language code is in the format aa-AA. */
function normaliseLang(lang) {
lang = lang.replace(/_/, '-').toLowerCase();
if (lang.length > 3) {
lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();
}
return lang;
}
/* Determine whether an object is an array. */
function isArray(a) {
return (a && a.constructor == Array);
}
})(jQuery);
controlies/www/js/multiselect2/plugins/localisation/jquery.localisation-min.js
/* http://keith-wood.name/localisation.html
Localisation assistance for jQuery v1.0.4.
Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
Please attribute the author if you use it. */
(function($){$.localise=function(c,d,e,f,g){if(typeof d!='object'&&typeof d!='string'){g=f;f=e;e=d;d=''}if(typeof e!='boolean'){g=f;f=e;e=false}if(typeof f!='string'&&!isArray(f)){g=f;f=['','']}var h={async:$.ajaxSettings.async,timeout:$.ajaxSettings.timeout};d=(typeof d!='string'?d||{}:{language:d,loadBase:e,path:f,timeout:g});var j=(!d.path?['','']:(isArray(d.path)?d.path:[d.path,d.path]));$.ajaxSetup({async:false,timeout:(d.timeout||500)});var k=function(a,b){if(d.loadBase){$.getScript(j[0]+a+'.js')}if(b.length>=2){$.getScript(j[1]+a+'-'+b.substring(0,2)+'.js')}if(b.length>=5){$.getScript(j[1]+a+'-'+b.substring(0,5)+'.js')}};var l=normaliseLang(d.language||$.localise.defaultLanguage);c=(isArray(c)?c:[c]);for(i=0;i<c.length;i++){k(c[i],l)}$.ajaxSetup(h)};$.localize=$.localise;$.localise.defaultLanguage=normaliseLang(navigator.language||navigator.userLanguage);function normaliseLang(a){a=a.replace(/_/,'-').toLowerCase();if(a.length>3){a=a.substring(0,3)+a.substring(3).toUpperCase()}return a}function isArray(a){return(a&&a.constructor==Array)}})(jQuery);
controlies/www/js/multiselect2/plugins/localisation/jquery.localisation-pack.js
/* http://keith-wood.name/localisation.html
Localisation assistance for jQuery v1.0.4.
Written by Keith Wood (kbwood{at}iinet.com.au) June 2007.
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
Please attribute the author if you use it. */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.m=7(c,d,e,f,g){4(8 d!=\'E\'&&8 d!=\'r\'){g=f;f=e;e=d;d=\'\'}4(8 e!=\'F\'){g=f;f=e;e=x}4(8 f!=\'r\'&&!n(f)){g=f;f=[\'\',\'\']}o h={s:$.y.s,9:$.y.9};d=(8 d!=\'r\'?d||{}:{t:d,z:e,6:f,9:g});o j=(!d.6?[\'\',\'\']:(n(d.6)?d.6:[d.6,d.6]));$.A({s:x,9:(d.9||G)});o k=7(a,b){4(d.z){$.u(j[0]+a+\'.v\')}4(b.p>=2){$.u(j[1]+a+\'-\'+b.q(0,2)+\'.v\')}4(b.p>=5){$.u(j[1]+a+\'-\'+b.q(0,5)+\'.v\')}};o l=w(d.t||$.m.B);c=(n(c)?c:[c]);H(i=0;i<c.p;i++){k(c[i],l)}$.A(h)};$.I=$.m;$.m.B=w(C.t||C.J);7 w(a){a=a.K(/L/,\'-\').M();4(a.p>3){a=a.q(0,3)+a.q(3).N()}D a}7 n(a){D(a&&a.O==P)}})(Q);',53,53,'||||if||path|function|typeof|timeout|||||||||||||localise|isArray|var|length|substring|string|async|language|getScript|js|normaliseLang|false|ajaxSettings|loadBase|ajaxSetup|defaultLanguage|navigator|return|object|boolean|500|for|localize|userLanguage|replace|_|toLowerCase|toUpperCase|constructor|Array|jQuery'.split('|'),0,{}))
controlies/www/js/multiselect2/plugins/scrollTo/changes.txt
1.4.1
[Feature]
- The target can be 'max' to scroll to the end while keeping it elegant.
[Enhancement]
- Default duration is 0 for jquery +1.3. Means sync animation
- The plugin works on all major browsers, on compat & quirks modes, including iframes.
- In addition to window/document, if html or body are received, the plugin will choose the right one.
[Fix]
- The Regex accepts floating numbers, Thanks Ramin
- Using jQuery.nodeName where neccessary so that this works on xml+xhtml
- The max() internal function wasn't completely accurrate, now it is 98% (except for IE on quirks mode and it's not too noticeable).
1.4
[Fix]
- Fixed the problem when scrolling the window to absolute positioned elements on Safari.
- Fixed the problem on Opera 9.5 when scrolling the window. That it always scrolls to 0.
[Feature]
- Added the settings object as 2nd argument to the onAfter callback.
- The 3rd argument of scrollTo can be just a function and it's used as the onAfter.
- Added full support for iframes (even max scroll calculation).
- Instead of $.scrollTo, $(window).scrollTo() and $(document).scrollTo() can be used.
- Added $().scrollable() that returns the real element to scroll, f.e: $(window).scrollable() == [body|html], works for iframes.
[Enhancement]
- Cleaned the code a bit, specially the comments
1.3.3
[Change]
- Changed the licensing from GPL to GPL+MIT.
1.3.2
[Enhancement]
- Small improvements to make the code shorter.
[Change]
- Removed the last argument received by onAfter as it was the same as the 'this' but jqueryfied.
1.3.1
[Feature]
- Exposed $.scrollTo.window() to get the element that needs to be animated, to scroll the window.
- Added option 'over'.
[Enhancement]
- Made the code as short as possible.
[Change]
- Changed the arguments received by onAfter
1.3
[Enhancement]
- Added semicolon to the start, for safe file concatenation
- Added a limit check, values below 0 or over the maximum are fixed.
- Now it should work faster, only one of html or body go through all the processing, instead of both for all browsers.
[Fix]
- Fixed the behavior for Opera, which seemed to react to both changes on <html> and <body>.
- The border is also reduced, when 'margin' is set to true.
[Change]
- The option speed has been renamed to duration.
[Feature]
- The duration can be specified with a number as 2nd argument, and the rest of the settings as the third ( like $().animate )
- Remade the demo
1.2.4
[Enhancement]
- The target can be in the form of { top:x, left:y } allowing different position for each axis.
[Feature]
- The option 'offset' has been added, to scroll behind or past the target. Can be a number(both axes) or { top:x, left:y }.
1.2.3
[Feature]
- Exposed the defaults.
[Enhancement]
- Made the callback functions receive more parameters.
1.2.2
[Fix]
- Fixed a bug, I didn't have to add the scrolled amount if it was body or html.
1.2
[Change]
- The option 'onafter' is now called 'onAfter'.
[Feature]
- Two axes can be scrolled together, this is set with the option 'axis'.
- In case 2 axes are chosen, the scrolling can be queued: one scrolls, and then the other.
- There's an intermediary event, 'onAfterFirst' called in case the axes are queued, after the first ends.
- If the option 'margin' is set to true, the plugin will take in account, the margin of the target(no use if target is a value).
controlies/www/js/multiselect2/plugins/scrollTo/jquery.scrollTo.js
/**
* jQuery.ScrollTo
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/9/2009
*
* @projectDescription Easy element scrolling using jQuery.
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
*
* @author Ariel Flesler
* @version 1.4.1
*
* @id jQuery.scrollTo
* @id jQuery.fn.scrollTo
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
* The different options for target are:
* - A number position (will be applied to all axes).
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
* - A jQuery/DOM element ( logically, child of the element to scroll )
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
* @option {Number} duration The OVERALL length of the animation.
* @option {String} easing The easing method for the animation.
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
* @option {Function} onAfter Function to be called after the scrolling ends.
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* @desc Scroll to a fixed position
* @example $('div').scrollTo( 340 );
*
* @desc Scroll relatively to the actual position
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
*
* @dec Scroll using a selector (relative to the scrolled element)
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
*
* @ Scroll to a DOM element (same for jQuery object)
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
* alert('scrolled!!');
* }});
*
* @desc Scroll on both axes, to different values
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
*/
;(function( $ ){
var $scrollTo = $.scrollTo = function( target, duration, settings ){
$(window).scrollTo( target, duration, settings );
};
$scrollTo.defaults = {
axis:'xy',
duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1
};
// Returns the element that needs to be animated to scroll the window.
// Kept for backwards compatibility (specially for localScroll & serialScroll)
$scrollTo.window = function( scope ){
return $(window).scrollable();
};
// Hack, hack, hack... stay away!
// Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
$.fn.scrollable = function(){
return this.map(function(){
var elem = this,
isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
if( !isWin )
return elem;
var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
return $.browser.safari || doc.compatMode == 'BackCompat' ?
doc.body :
doc.documentElement;
});
};
$.fn.scrollTo = function( target, duration, settings ){
if( typeof duration == 'object' ){
settings = duration;
duration = 0;
}
if( typeof settings == 'function' )
settings = { onAfter:settings };
if( target == 'max' )
target = 9e9;
settings = $.extend( {}, $scrollTo.defaults, settings );
// Speed is still recognized for backwards compatibility
duration = duration || settings.speed || settings.duration;
// Make sure the settings are given right
settings.queue = settings.queue && settings.axis.length > 1;
if( settings.queue )
// Let's keep the overall duration
duration /= 2;
settings.offset = both( settings.offset );
settings.over = both( settings.over );
return this.scrollable().each(function(){
var elem = this,
$elem = $(elem),
targ = target, toff, attr = {},
win = $elem.is('html,body');
switch( typeof targ ){
// A number will pass the regex
case 'number':
case 'string':
if( /^([+-]=)?\d+(\.\d+)?(px)?$/.test(targ) ){
targ = both( targ );
// We are done
break;
}
// Relative selector, no break!
targ = $(targ,this);
case 'object':
// DOMElement / jQuery
if( targ.is || targ.style )
// Get the real position of the target
toff = (targ = $(targ)).offset();
}
$.each( settings.axis.split(''), function( i, axis ){
var Pos = axis == 'x' ? 'Left' : 'Top',
pos = Pos.toLowerCase(),
key = 'scroll' + Pos,
old = elem[key],
Dim = axis == 'x' ? 'Width' : 'Height';
if( toff ){// jQuery / DOMElement
attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
// If it's a dom element, reduce the margin
if( settings.margin ){
attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
}
attr[key] += settings.offset[pos] || 0;
if( settings.over[pos] )
// Scroll to a fraction of its width/height
attr[key] += targ[Dim.toLowerCase()]() * settings.over[pos];
}else
attr[key] = targ[pos];
// Number or 'number'
if( /^\d+$/.test(attr[key]) )
// Check the limits
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max(Dim) );
// Queueing axes
if( !i && settings.queue ){
// Don't waste time animating, if there's no need.
if( old != attr[key] )
// Intermediate animation
animate( settings.onAfterFirst );
// Don't animate this axis again in the next iteration.
delete attr[key];
}
});
animate( settings.onAfter );
function animate( callback ){
$elem.animate( attr, duration, settings.easing, callback && function(){
callback.call(this, target, settings);
});
};
// Max scrolling position, works on quirks mode
// It only fails (not too badly) on IE, quirks mode.
function max( Dim ){
var scroll = 'scroll'+Dim;
if( !win )
return elem[scroll];
var size = 'client' + Dim,
html = elem.ownerDocument.documentElement,
body = elem.ownerDocument.body;
return Math.max( html[scroll], body[scroll] )
- Math.min( html[size] , body[size] );
};
}).end();
};
function both( val ){
return typeof val == 'object' ? val : { top:val, left:val };
};
})( jQuery );
controlies/www/js/multiselect2/plugins/scrollTo/README.txt
jQuery.ScrollTo 1.4
* Apart from the target and duration, the plugin can receive a hash of settings. Documentation and examples are included in the source file.
* If you are interested in animated "same-page-scrolling" using anchors(<a href="#some_id">...), check http://jquery.com/plugins/project/LocalScroll
* The target can be specified as:
* A Number/String specifying a position using px or just the number.
* A string selector that will be relative, to the element that is going to be scrolled, and must match at least one child.
* A DOM element, logically child of the element to scroll.
* A hash { top:x, left:y }, x and y can be any kind of number/string like described above.
* The plugin supports relative animations
* 'em' and '%' are not supported as part of the target, because they won't work with jQuery.fn.animate.
* The plugin might fail to scroll an element, to an inner node that is nested in more scrollable elements. This seems like an odd situation anyway.
* Both axes ( x, y -> left, top ) can be scrolled, you can send 'x', 'y', 'xy' or 'yx' as 'axis' inside the settings.
* If 2 axis are scrolled, there's an option to queue the animations, so that the second will start once the first ended ('xy' and 'yx' will have different effects)
* The option 'margin' can be setted to true, then the margin of the target element, will be taken into account and will be deducted.
* 'margin' will only be valid, if the target is a selector, a DOM element, or a jQuery Object.
* The option 'offset' allows to scroll less or more than the actual target by a defined amount of pixels. Can be a number(both axes) or { top:x, left:y }.
* The option 'over' lets you add or deduct a fraction of the element's height and width from the final position. so over:0.5 will scroll to the middle of the object. can be specified with {top:x, left:y}
* Don't forget the callback event is now called 'onAfter', and if queuing is activated, then 'onAfterFirst' can be used.
* If the first axis to be scrolled, is already positioned, that animation will be skipped, to avoid a delay in the animation.
* The call to the plugin can be made in 2 different ways: $().scrollTo( target, duration, settings ) or $().scrollTo( target, settings ). Where one of the settings is 'duration'.
* If you find any bug, or you have any advice, don't hesitate to open a ticket/request at http://jquery.com/plugins/project/ScrollTo .
controlies/www/js/multiselect2/plugins/scrollTo/jquery.scrollTo-min.js
/**
* jQuery.ScrollTo - Easy element scrolling using jQuery.
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/9/2009
* @author Ariel Flesler
* @version 1.4.1
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/
;(function($){var m=$.scrollTo=function(b,h,f){$(window).scrollTo(b,h,f)};m.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};m.window=function(b){return $(window).scrollable()};$.fn.scrollable=function(){return this.map(function(){var b=this,h=!b.nodeName||$.inArray(b.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!h)return b;var f=(b.contentWindow||b).document||b.ownerDocument||b;return $.browser.safari||f.compatMode=='BackCompat'?f.body:f.documentElement})};$.fn.scrollTo=function(l,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};if(l=='max')l=9e9;a=$.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=$(k),d=l,p,g={},q=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(d)){d=n(d);break}d=$(d,this);case'object':if(d.is||d.style)p=(d=$(d)).offset()}$.each(a.axis.split(''),function(b,h){var f=h=='x'?'Left':'Top',i=f.toLowerCase(),c='scroll'+f,r=k[c],s=h=='x'?'Width':'Height';if(p){g[c]=p[i]+(q?0:r-o.offset()[i]);if(a.margin){g[c]-=parseInt(d.css('margin'+f))||0;g[c]-=parseInt(d.css('border'+f+'Width'))||0}g[c]+=a.offset[i]||0;if(a.over[i])g[c]+=d[s.toLowerCase()]()*a.over[i]}else g[c]=d[i];if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],u(s));if(!b&&a.queue){if(r!=g[c])t(a.onAfterFirst);delete g[c]}});t(a.onAfter);function t(b){o.animate(g,j,a.easing,b&&function(){b.call(this,l,a)})};function u(b){var h='scroll'+b;if(!q)return k[h];var f='client'+b,i=k.ownerDocument.documentElement,c=k.ownerDocument.body;return Math.max(i[h],c[h])-Math.min(i[f],c[f])}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);
controlies/www/js/multiselect2/ui.multiselect.js
/*
* jQuery UI Multiselect
*
* Authors:
* Michael Aufreiter (quasipartikel.at)
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://www.quasipartikel.at/multiselect/
*
*
* Depends:
* ui.core.js
* ui.sortable.js
*
* Optional:
* localization (http://plugins.jquery.com/project/localisation)
* scrollTo (http://plugins.jquery.com/project/ScrollTo)
*
* Todo:
* Make batch actions faster
* Implement dynamic insertion through remote calls
*/
(function($) {
$.widget("ui.multiselect", {
options: {
sortable: true,
searchable: true,
animated: 'fast',
show: 'slideDown',
hide: 'slideUp',
dividerLocation: 0.6,
nodeComparator: function(node1,node2) {
var text1 = node1.text(),
text2 = node2.text();
return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
}
},
_create: function() {
this.element.hide();
this.id = this.element.attr("id");
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
this.count = 0; // number of currently selected options
this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container);
this.availableContainer = $('<div class="available"></div>').appendTo(this.container);
this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer);
this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer);
this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
var that = this;
// set dimensions
this.container.width(this.element.width()+1);
this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
// fix list height to match <option> depending on their individual header's heights
this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
if ( !this.options.animated ) {
this.options.show = 'show';
this.options.hide = 'hide';
}
// init lists
this._populateLists(this.element.find('option'));
// make selection sortable
if (this.options.sortable) {
this.selectedList.sortable({
placeholder: 'ui-state-highlight',
axis: 'y',
update: function(event, ui) {
// apply the new sort order to the original selectbox
that.selectedList.find('li').each(function() {
if ($(this).data('optionLink'))
$(this).data('optionLink').remove().appendTo(that.element);
});
},
receive: function(event, ui) {
ui.item.data('optionLink').attr('selected', true);
// increment count
that.count += 1;
that._updateCount();
// workaround, because there's no way to reference
// the new element, see http://dev.jqueryui.com/ticket/4303
that.selectedList.children('.ui-draggable').each(function() {
$(this).removeClass('ui-draggable');
$(this).data('optionLink', ui.item.data('optionLink'));
$(this).data('idx', ui.item.data('idx'));
that._applyItemState($(this), true);
});
// workaround according to http://dev.jqueryui.com/ticket/4088
setTimeout(function() { ui.item.remove(); }, 1);
}
});
}
// set up livesearch
if (this.options.searchable) {
this._registerSearchEvents(this.availableContainer.find('input.search'));
} else {
$('.search').hide();
}
// batch actions
this.container.find(".remove-all").click(function() {
that._populateLists(that.element.find('option').removeAttr('selected'));
return false;
});
this.container.find(".add-all").click(function() {
that._populateLists(that.element.find('option').attr('selected', 'selected'));
return false;
});
},
destroy: function() {
this.element.show();
this.container.remove();
$.Widget.prototype.destroy.apply(this, arguments);
},
_populateLists: function(options) {
this.selectedList.children('.ui-element').remove();
this.availableList.children('.ui-element').remove();
this.count = 0;
var that = this;
var items = $(options.map(function(i) {
var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show();
if (this.selected) that.count += 1;
that._applyItemState(item, this.selected);
item.data('idx', i);
return item[0];
}));
// update count
this._updateCount();
},
_updateCount: function() {
this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
},
_getOptionNode: function(option) {
option = $(option);
var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
node.data('optionLink', option);
return node;
},
// clones an item with associated data
// didn't find a smarter away around this
_cloneWithData: function(clonee) {
var clone = clonee.clone();
clone.data('optionLink', clonee.data('optionLink'));
clone.data('idx', clonee.data('idx'));
return clone;
},
_setSelected: function(item, selected) {
item.data('optionLink').attr('selected', selected);
if (selected) {
var selectedItem = this._cloneWithData(item);
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);
this._applyItemState(selectedItem, true);
return selectedItem;
} else {
// look for successor based on initial option index
var items = this.availableList.find('li'), comparator = this.options.nodeComparator;
var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i]));
// TODO: test needed for dynamic list populating
if ( direction ) {
while (i>=0 && i<items.length) {
direction > 0 ? i++ : i--;
if ( direction != comparator(item, $(items[i])) ) {
// going up, go back one item down, otherwise leave as is
succ = items[direction > 0 ? i : i+1];
break;
}
}
} else {
succ = items[i];
}
var availableItem = this._cloneWithData(item);
succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList);
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
availableItem.hide()[this.options.show](this.options.animated);
this._applyItemState(availableItem, false);
return availableItem;
}
},
_applyItemState: function(item, selected) {
if (selected) {
if (this.options.sortable)
item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon');
else
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
this._registerRemoveEvents(item.find('a.action'));
} else {
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
this._registerAddEvents(item.find('a.action'));
}
this._registerHoverEvents(item);
},
// taken from John Resig's liveUpdate script
_filter: function(list) {
var input = $(this);
var rows = list.children('li'),
cache = rows.map(function(){
return $(this).text().toLowerCase();
});
var term = $.trim(input.val().toLowerCase()), scores = [];
if (!term) {
rows.show();
} else {
rows.hide();
cache.each(function(i) {
if (this.indexOf(term)>-1) { scores.push(i); }
});
$.each(scores, function() {
$(rows[this]).show();
});
}
},
_registerHoverEvents: function(elements) {
elements.removeClass('ui-state-hover');
elements.mouseover(function() {
$(this).addClass('ui-state-hover');
});
elements.mouseout(function() {
$(this).removeClass('ui-state-hover');
});
},
_registerAddEvents: function(elements) {
var that = this;
elements.click(function() {
var item = that._setSelected($(this).parent(), true);
that.count += 1;
that._updateCount();
return false;
});
// make draggable
if (this.options.sortable) {
elements.each(function() {
$(this).parent().draggable({
connectToSortable: that.selectedList,
helper: function() {
var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
selectedItem.width($(this).width());
return selectedItem;
},
appendTo: that.container,
containment: that.container,
revert: 'invalid'
});
});
}
},
_registerRemoveEvents: function(elements) {
var that = this;
elements.click(function() {
that._setSelected($(this).parent(), false);
that.count -= 1;
that._updateCount();
return false;
});
},
_registerSearchEvents: function(input) {
var that = this;
input.focus(function() {
$(this).addClass('ui-state-active');
})
.blur(function() {
$(this).removeClass('ui-state-active');
})
.keypress(function(e) {
if (e.keyCode == 13)
return false;
})
.keyup(function() {
that._filter.apply(this, [that.availableList]);
});
}
});
$.extend($.ui.multiselect, {
locale: {
addAll:'Add all',
removeAll:'Remove all',
itemsCount:'items selected'
}
});
})(jQuery);
controlies/www/groups/form.html
<form id="form_data" onSubmit="return send();">
<input type="hidden" id="action" name="action"/>
<p><span id="typeTag">Tipo Grupo</span><br>
<select type="text" id="type" name="type">
<select id="type" name="type">
<option value="none">Seleccione...</option>
<option value="school_department">Departamento</option>
<option value="school_classroom">Curso</option>
</select>
</p>
<p><span id="nameTag">Nombre </span><br><input type="text" id="name" name="name"/></p>
<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>
</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>&nbsp;&nbsp;<button type="button" id="cancelButton" style="width:100px;">Cancelar</button></div>
</form>
controlies/www/groups/index.html
<!-- Libreria JGrid -->
<link rel="stylesheet" type="text/css" media="screen" href="js/jquery/jdgrid/css/ui.jqgrid.css" />
<script src="js/jquery/jdgrid/grid.locale-sp.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/src/grid.common.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/src/grid.formedit.js" type="text/javascript"></script>
<script src="js/jquery/jdgrid/src/grid.custom.js" type="text/javascript"></script>
<!-- Libreria Multiselect -->
<link type="text/css" href="js/multiselect2/css/ui.multiselect.css" rel="stylesheet" />
<script type="text/javascript" src="js/multiselect2/plugins/localisation/jquery.localisation-min.js"></script>
<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>
<script language="javascript">
$(function() {
......
$("#dialog-form").html("");
$("#dialog-form").load("groups/form.html", function() {
$.localise('ui-multiselect', {language: 'es', path: 'locale/'});
$("#users").multiselect();
getAllGroups();
getAllUsers();
/*
$("#form_data #action").val("modify");
$("#form_data #user").attr("readonly","true");
$("#form_data #user").css("background-color","#DDD");
......
var dep = Array(result.response['groups']['departments']);
$("#form_data #type").replaceWith(textType+"<input type='hidden' id='type' name='type' value='"+result.response['type']+"'/>");
$("#form_data #name").val(result.response['name']);
$("#form_data #nif").val(result.response['nif']);
$("#form_data #user").val(result.response['user']);
$("#form_data #surname").val(result.response['surname']);
$.each(result.response['groups']['departments'], function(i, l){
$('#form_data input:checkbox[value='+l+']').attr('checked', true);
});
$.each(result.response['groups']['classrooms'], function(i, l){
$('#form_data input:checkbox[value='+l+']').attr('checked', true);
});
});
$("#form_data #name").val(result.response['name']);
}); */
});
x = ($(window).width()-300)/2;
x = ($(window).width()-500)/2;
y = ($(window).height()-500)/2;
$("#dialog-form").dialog({
resizable: false,
modal: true,
width: 300,
width: 500,
title: "Modificar Grupo"
}).dialog('option', 'position', [x, y]);
}
......
}
}).dialog('open');
}
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>");
}); */
});
}
</script>
<div id="tabla_clientes">
controlies/MainLoop.py
u = Users(l,"","","","",request.args['user'][0],"","","","")
response = u.getUserData()
return json.dumps({"response" : response})
elif request.args['action'][0] == "getAllUsers":
u = Users(l,"","")
response = u.getAllUsers()
return json.dumps(response)
elif request.args['action'][0] == "delete":
u = Users(l,"","","","",request.args['user'][0],"","","","")
response = u.delete()
controlies/Plugins/Users.py
return "/home/profesor/"
else:
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 }

Exportar a: Unified diff