make tidy-js (#683)
This commit is contained in:
parent
6a72659c95
commit
d18840122f
File diff suppressed because it is too large
Load Diff
|
@ -5,15 +5,17 @@
|
|||
*/
|
||||
function displayNotification(id) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{'notification':id},
|
||||
dataType:'html',
|
||||
success:function(data){
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
'notification': id
|
||||
},
|
||||
dataType: 'html',
|
||||
success: function(data) {
|
||||
$('#data').html(data);
|
||||
},
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
$('#data').html('<h3>Request failed</h3> Error code: '+xhr.status+', '+thrownError);
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#data').html('<h3>Request failed</h3> Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -25,15 +27,17 @@ function displayNotification(id) {
|
|||
*/
|
||||
function displayNotificationDone(id) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{'notificationDone':id},
|
||||
dataType:'html',
|
||||
success:function(data){
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
'notificationDone': id
|
||||
},
|
||||
dataType: 'html',
|
||||
success: function(data) {
|
||||
$('#data').html(data);
|
||||
},
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
$('#data').html('<h3>Request failed</h3> Error code: '+xhr.status+', '+thrownError);
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#data').html('<h3>Request failed</h3> Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -45,16 +49,18 @@ function displayNotificationDone(id) {
|
|||
*/
|
||||
function del(id) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{'delete':id},
|
||||
dataType:'html',
|
||||
success:function(data){
|
||||
$('#data').html(data);
|
||||
$('#uid'+id).remove();
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
'delete': id
|
||||
},
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
$('#data').html('<h3>Request failed</h3> Error code: '+xhr.status+', '+thrownError);
|
||||
dataType: 'html',
|
||||
success: function(data) {
|
||||
$('#data').html(data);
|
||||
$('#uid' + id).remove();
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#data').html('<h3>Request failed</h3> Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -66,15 +72,17 @@ function del(id) {
|
|||
*/
|
||||
function purge(id) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{'purge':id},
|
||||
dataType:'html',
|
||||
success:function(data){
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
'purge': id
|
||||
},
|
||||
dataType: 'html',
|
||||
success: function(data) {
|
||||
$('#data').html(data);
|
||||
},
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
$('#data').html('<h3>Request failed</h3> Error code: '+xhr.status+', '+thrownError);
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#data').html('<h3>Request failed</h3> Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -84,7 +92,9 @@ function purge(id) {
|
|||
function newNotif() {
|
||||
var data = $("#newNotif").html();
|
||||
$('#data').html(data);
|
||||
$("#data input#date").datepicker({'dateFormat':'yy-mm-dd'});
|
||||
$("#data input#date").datepicker({
|
||||
'dateFormat': 'yy-mm-dd'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -101,28 +111,48 @@ function sendNewNotif() {
|
|||
var xml = $("textarea#xml").val();
|
||||
|
||||
// Reset CSS
|
||||
$("input#uid").css('border-width','0');
|
||||
$("input#date").css('border-width','0');
|
||||
$("input#ref").css('border-width','0');
|
||||
$("textarea#xml").css('border-width','0');
|
||||
$("input#uid").css('border-width', '0');
|
||||
$("input#date").css('border-width', '0');
|
||||
$("input#ref").css('border-width', '0');
|
||||
$("textarea#xml").css('border-width', '0');
|
||||
|
||||
// Check data
|
||||
if(!uid){$("input#uid").css('border-color','red').css('border-width','2px').focus();return false;}
|
||||
if(!date){$("input#date").css('border-color','red').css('border-width','2px').focus();return false;}
|
||||
if(!ref){$("input#ref").css('border-color','red').css('border-width','2px').focus();return false;}
|
||||
if(!xml){$("textarea#xml").css('border-color','red').css('border-width','2px').focus();return false;}
|
||||
|
||||
if (!uid) {
|
||||
$("input#uid").css('border-color', 'red').css('border-width', '2px').focus();
|
||||
return false;
|
||||
}
|
||||
if (!date) {
|
||||
$("input#date").css('border-color', 'red').css('border-width', '2px').focus();
|
||||
return false;
|
||||
}
|
||||
if (!ref) {
|
||||
$("input#ref").css('border-color', 'red').css('border-width', '2px').focus();
|
||||
return false;
|
||||
}
|
||||
if (!xml) {
|
||||
$("textarea#xml").css('border-color', 'red').css('border-width', '2px').focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send AJAX request
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{'newNotif':{'uid':uid,'date':date,'ref':ref,'condition':condition,'xml':xml}},
|
||||
dataType:'html',
|
||||
success:function(data){
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
'newNotif': {
|
||||
'uid': uid,
|
||||
'date': date,
|
||||
'ref': ref,
|
||||
'condition': condition,
|
||||
'xml': xml
|
||||
}
|
||||
},
|
||||
dataType: 'html',
|
||||
success: function(data) {
|
||||
$('#data').html(data);
|
||||
},
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
$('#data').html('<h3>Request failed</h3> Error code: '+xhr.status+', '+thrownError);
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#data').html('<h3>Request failed</h3> Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,31 +1,35 @@
|
|||
function displaySession(id) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{'session':id},
|
||||
dataType:'html',
|
||||
success:function(data){
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
'session': id
|
||||
},
|
||||
dataType: 'html',
|
||||
success: function(data) {
|
||||
$('#data').html(data);
|
||||
},
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
$('#data').html('<h3>Request failed</h3> Error code: '+xhr.status+', '+thrownError);
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#data').html('<h3>Request failed</h3> Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
function del(id) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{'delete':id},
|
||||
dataType:'html',
|
||||
success:function(data){
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
'delete': id
|
||||
},
|
||||
dataType: 'html',
|
||||
success: function(data) {
|
||||
$('#data').html(data);
|
||||
// Delete session from tree
|
||||
$('#uid'+id).remove();
|
||||
$('#ip'+id).remove();
|
||||
$('#uid' + id).remove();
|
||||
$('#ip' + id).remove();
|
||||
},
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
$('#data').html('<h3>Request failed</h3> Error code: '+xhr.status+', '+thrownError);
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
$('#data').html('<h3>Request failed</h3> Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -41,11 +41,10 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
$.fn.simpleTree = function(opt){
|
||||
return this.each(function(){
|
||||
$.fn.simpleTree = function(opt) {
|
||||
return this.each(function() {
|
||||
var TREE = this;
|
||||
var ROOT = $('.root',this);
|
||||
var ROOT = $('.root', this);
|
||||
var mousePressed = false;
|
||||
var mouseMoved = false;
|
||||
var dragMoveType = false;
|
||||
|
@ -55,475 +54,490 @@ $.fn.simpleTree = function(opt){
|
|||
var ajaxCache = Array();
|
||||
|
||||
TREE.option = {
|
||||
drag: true,
|
||||
animate: false,
|
||||
autoclose: false,
|
||||
speed: 'fast',
|
||||
afterAjax: false,
|
||||
afterMove: false,
|
||||
afterClick: false,
|
||||
afterDblClick: false,
|
||||
drag: true,
|
||||
animate: false,
|
||||
autoclose: false,
|
||||
speed: 'fast',
|
||||
afterAjax: false,
|
||||
afterMove: false,
|
||||
afterClick: false,
|
||||
afterDblClick: false,
|
||||
// added by Erik Dohmen (2BinBusiness.nl) to make context menu cliks available
|
||||
afterContextMenu: false,
|
||||
docToFolderConvert: false,
|
||||
useClickToToggle: false,
|
||||
afterCloseNearby: false,
|
||||
afterNewNode: false,
|
||||
afterSetTrigger: false
|
||||
afterContextMenu: false,
|
||||
docToFolderConvert: false,
|
||||
useClickToToggle: false,
|
||||
afterCloseNearby: false,
|
||||
afterNewNode: false,
|
||||
afterSetTrigger: false
|
||||
};
|
||||
TREE.option = $.extend(TREE.option,opt);
|
||||
$.extend(this, {getSelected: function(){
|
||||
return $('span.active', this).parent();
|
||||
}});
|
||||
TREE.closeNearby = function(obj)
|
||||
{
|
||||
$(obj).siblings().filter('.folder-open, .folder-open-last').each(function(){
|
||||
var childUl = $('>ul',this);
|
||||
TREE.option = $.extend(TREE.option, opt);
|
||||
$.extend(this, {
|
||||
getSelected: function() {
|
||||
return $('span.active', this).parent();
|
||||
}
|
||||
});
|
||||
TREE.closeNearby = function(obj) {
|
||||
$(obj).siblings().filter('.folder-open, .folder-open-last').each(function() {
|
||||
var childUl = $('>ul', this);
|
||||
var className = this.className;
|
||||
this.className = className.replace('open','close');
|
||||
if(TREE.option.animate)
|
||||
{
|
||||
childUl.animate({height:"toggle"},TREE.option.speed);
|
||||
}else{
|
||||
this.className = className.replace('open', 'close');
|
||||
if (TREE.option.animate) {
|
||||
childUl.animate({
|
||||
height: "toggle"
|
||||
},
|
||||
TREE.option.speed);
|
||||
} else {
|
||||
childUl.hide();
|
||||
}
|
||||
if(typeof TREE.option.afterCloseNearby == 'function')
|
||||
{
|
||||
TREE.option.afterCloseNearby($(this).parent());
|
||||
if (typeof TREE.option.afterCloseNearby == 'function') {
|
||||
TREE.option.afterCloseNearby($(this).parent());
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
TREE.nodeToggle = function(obj)
|
||||
{
|
||||
var childUl = $('>ul',obj);
|
||||
if(obj.className.match('open')){
|
||||
obj.className = obj.className.replace('open','close');
|
||||
if(TREE.option.animate)
|
||||
{
|
||||
childUl.animate({height:"toggle"},TREE.option.speed);
|
||||
}else{
|
||||
TREE.nodeToggle = function(obj) {
|
||||
var childUl = $('>ul', obj);
|
||||
if (obj.className.match('open')) {
|
||||
obj.className = obj.className.replace('open', 'close');
|
||||
if (TREE.option.animate) {
|
||||
childUl.animate({
|
||||
height: "toggle"
|
||||
},
|
||||
TREE.option.speed);
|
||||
} else {
|
||||
childUl.hide();
|
||||
}
|
||||
}else{
|
||||
obj.className = obj.className.replace('close','open');
|
||||
if(TREE.option.animate)
|
||||
{
|
||||
childUl.animate({height:"toggle"},TREE.option.speed, function(){
|
||||
if(TREE.option.autoclose)TREE.closeNearby(obj);
|
||||
if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
|
||||
} else {
|
||||
obj.className = obj.className.replace('close', 'open');
|
||||
if (TREE.option.animate) {
|
||||
childUl.animate({
|
||||
height: "toggle"
|
||||
},
|
||||
TREE.option.speed, function() {
|
||||
if (TREE.option.autoclose) TREE.closeNearby(obj);
|
||||
if (childUl.is('.ajax')) TREE.setAjaxNodes(childUl, obj.id);
|
||||
});
|
||||
}else{
|
||||
} else {
|
||||
childUl.show();
|
||||
if(TREE.option.autoclose)TREE.closeNearby(obj);
|
||||
if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
|
||||
if (TREE.option.autoclose) TREE.closeNearby(obj);
|
||||
if (childUl.is('.ajax')) TREE.setAjaxNodes(childUl, obj.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
TREE.setAjaxNodes = function(node, parentId, callback)
|
||||
{
|
||||
if($.inArray(parentId,ajaxCache) == -1){
|
||||
ajaxCache[ajaxCache.length]=parentId;
|
||||
TREE.setAjaxNodes = function(node, parentId, callback) {
|
||||
if ($.inArray(parentId, ajaxCache) == -1) {
|
||||
ajaxCache[ajaxCache.length] = parentId;
|
||||
var url = $.trim($('>li', node).text());
|
||||
if(url && url.indexOf('url:'))
|
||||
{
|
||||
url=$.trim(url.replace(/.*\{url:(.*)\}/i ,'$1'));
|
||||
var js='';
|
||||
var call='';
|
||||
if(url.indexOf(',js:')){
|
||||
call=url.match(/.*,call:(.*)/i);
|
||||
if(call==null){call='';}else{call=call[1].replace(/,call.*$/,'');}
|
||||
js=url.match(/.*,js:(.*)/i);
|
||||
if(js==null){js='';}else{js=js[1].replace(/,call.*$/,'');}
|
||||
url=$.trim(url.replace(/,(?:js|call):.*/i ,''));
|
||||
if (url && url.indexOf('url:')) {
|
||||
url = $.trim(url.replace(/.*\{url:(.*)\}/i, '$1'));
|
||||
var js = '';
|
||||
var call = '';
|
||||
if (url.indexOf(',js:')) {
|
||||
call = url.match(/.*,call:(.*)/i);
|
||||
if (call == null) {
|
||||
call = '';
|
||||
} else {
|
||||
call = call[1].replace(/,call.*$/, '');
|
||||
}
|
||||
js = url.match(/.*,js:(.*)/i);
|
||||
if (js == null) {
|
||||
js = '';
|
||||
} else {
|
||||
js = js[1].replace(/,call.*$/, '');
|
||||
}
|
||||
url = $.trim(url.replace(/,(?:js|call):.*/i, ''));
|
||||
}
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
contentType:'html',
|
||||
cache:false,
|
||||
success: function(response){
|
||||
contentType: 'html',
|
||||
cache: false,
|
||||
success: function(response) {
|
||||
node.removeAttr('class');
|
||||
if(response.length>0){
|
||||
if (response.length > 0) {
|
||||
node.html(response);
|
||||
$.extend(node,{url:url});
|
||||
TREE.setTreeNodes(node, true);
|
||||
$.extend(node, {
|
||||
url: url
|
||||
});
|
||||
TREE.setTreeNodes(node, true);
|
||||
} else {
|
||||
$("li.line",node).remove();
|
||||
$("li.doc-last",node).remove();
|
||||
$("li.line", node).remove();
|
||||
$("li.doc-last", node).remove();
|
||||
}
|
||||
if(typeof TREE.option.afterAjax == 'function')
|
||||
{
|
||||
if (typeof TREE.option.afterAjax == 'function') {
|
||||
TREE.option.afterAjax(node);
|
||||
}
|
||||
if(typeof callback == 'function')
|
||||
{
|
||||
if (typeof callback == 'function') {
|
||||
callback(node);
|
||||
}
|
||||
if(js.length){if(!js.match(/\(/))js+='()';$('>span',node.parent()).click(function(){eval(js)});}
|
||||
if(call.length){if(!call.match(/\(/))call+='()';eval(call);}
|
||||
if (js.length) {
|
||||
if (!js.match(/\(/)) js += '()';
|
||||
$('>span', node.parent()).click(function() {
|
||||
eval(js)
|
||||
});
|
||||
}
|
||||
if (call.length) {
|
||||
if (!call.match(/\(/)) call += '()';
|
||||
eval(call);
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError){
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
TREE.closeNearby(node);
|
||||
alert('Failed to get remote datas. Error code: '+xhr.status+', '+thrownError);
|
||||
alert('Failed to get remote datas. Error code: ' + xhr.status + ', ' + thrownError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
TREE.setTreeNodes = function(obj, useParent){
|
||||
obj = useParent? obj.parent():obj;
|
||||
$('li>span', obj).addClass('text')
|
||||
.bind('selectstart', function() {
|
||||
TREE.setTreeNodes = function(obj, useParent) {
|
||||
obj = useParent ? obj.parent() : obj;
|
||||
$('li>span', obj).addClass('text').bind('selectstart', function() {
|
||||
return false;
|
||||
}).click(function(){
|
||||
}).click(function() {
|
||||
// Remove all active classes and add the text class
|
||||
$('.active',TREE).toggleClass('active').addClass('text');
|
||||
if(this.className.match('text'))
|
||||
{
|
||||
this.className=this.className.replace('text','active');
|
||||
$('.active', TREE).toggleClass('active').addClass('text');
|
||||
if (this.className.match('text')) {
|
||||
this.className = this.className.replace('text', 'active');
|
||||
}
|
||||
if(TREE.option.useClickToToggle)
|
||||
{
|
||||
if (TREE.option.useClickToToggle) {
|
||||
TREE.nodeToggle($(this).parent().get(0));
|
||||
}
|
||||
if(typeof TREE.option.afterClick == 'function')
|
||||
{
|
||||
if (typeof TREE.option.afterClick == 'function') {
|
||||
TREE.option.afterClick($(this).parent());
|
||||
}
|
||||
return false;
|
||||
}).dblclick(function(){
|
||||
}).dblclick(function() {
|
||||
mousePressed = false;
|
||||
if(!TREE.option.useClickToToggle)
|
||||
{
|
||||
if (!TREE.option.useClickToToggle) {
|
||||
TREE.nodeToggle($(this).parent().get(0));
|
||||
}
|
||||
if(typeof TREE.option.afterDblClick == 'function')
|
||||
{
|
||||
if (typeof TREE.option.afterDblClick == 'function') {
|
||||
TREE.option.afterDblClick($(this).parent());
|
||||
}
|
||||
return false;
|
||||
// added by Erik Dohmen (2BinBusiness.nl) to make context menu actions
|
||||
// available
|
||||
}).bind("contextmenu",function(){
|
||||
$('.active',TREE).toggleClass('active').addClass('text');
|
||||
if(this.className.match('text'))
|
||||
{
|
||||
this.className=this.className.replace('text','active');
|
||||
}).bind("contextmenu", function() {
|
||||
$('.active', TREE).toggleClass('active').addClass('text');
|
||||
if (this.className.match('text')) {
|
||||
this.className = this.className.replace('text', 'active');
|
||||
}
|
||||
if(typeof TREE.option.afterContextMenu == 'function')
|
||||
{
|
||||
if (typeof TREE.option.afterContextMenu == 'function') {
|
||||
TREE.option.afterContextMenu($(this).parent());
|
||||
}
|
||||
return false;
|
||||
}).mousedown(function(event){
|
||||
}).mousedown(function(event) {
|
||||
mousePressed = true;
|
||||
cloneNode = $(this).parent().clone();
|
||||
var LI = $(this).parent();
|
||||
if(TREE.option.drag)
|
||||
{
|
||||
if (TREE.option.drag) {
|
||||
$('>ul', cloneNode).hide();
|
||||
$('body').append('<div id="drag_container"><ul></ul></div>');
|
||||
$('#drag_container').hide().css({opacity:'0.8'});
|
||||
$('#drag_container').hide().css({
|
||||
opacity: '0.8'
|
||||
});
|
||||
$('#drag_container >ul').append(cloneNode);
|
||||
$("<img>").attr({id : "tree_plus",src : imagepath+"tree/plus.gif"}).css({width: "7px",display: "block",position: "absolute",left : "5px",top: "5px", display:'none'}).appendTo("body");
|
||||
$(document).bind("mousemove", {LI:LI}, TREE.dragStart).bind("mouseup",TREE.dragEnd);
|
||||
$("<img>").attr({
|
||||
id: "tree_plus",
|
||||
src: imagepath + "tree/plus.gif"
|
||||
}).css({
|
||||
width: "7px",
|
||||
display: "block",
|
||||
position: "absolute",
|
||||
left: "5px",
|
||||
top: "5px",
|
||||
display: 'none'
|
||||
}).appendTo("body");
|
||||
$(document).bind("mousemove", {
|
||||
LI: LI
|
||||
},
|
||||
TREE.dragStart).bind("mouseup", TREE.dragEnd);
|
||||
}
|
||||
return false;
|
||||
}).mouseup(function(){
|
||||
if(mousePressed && mouseMoved && dragNode_source)
|
||||
{
|
||||
}).mouseup(function() {
|
||||
if (mousePressed && mouseMoved && dragNode_source) {
|
||||
TREE.moveNodeToFolder($(this).parent());
|
||||
}
|
||||
TREE.eventDestroy();
|
||||
});
|
||||
$('li', obj).each(function(i){
|
||||
$('li', obj).each(function(i) {
|
||||
var className = this.className;
|
||||
var open = false;
|
||||
var cloneNode=false;
|
||||
var cloneNode = false;
|
||||
var LI = this;
|
||||
var childNode = $('>ul',this);
|
||||
if(childNode.size()>0){
|
||||
var childNode = $('>ul', this);
|
||||
if (childNode.size() > 0) {
|
||||
var setClassName = 'folder-';
|
||||
if(className && className.indexOf('hidden')>=0){
|
||||
setClassName=setClassName+'hidden';
|
||||
}else if(className && className.indexOf('open')>=0){
|
||||
setClassName=setClassName+'open';
|
||||
open=true;
|
||||
}else{
|
||||
setClassName=setClassName+'close';
|
||||
if (className && className.indexOf('hidden') >= 0) {
|
||||
setClassName = setClassName + 'hidden';
|
||||
} else if (className && className.indexOf('open') >= 0) {
|
||||
setClassName = setClassName + 'open';
|
||||
open = true;
|
||||
} else {
|
||||
setClassName = setClassName + 'close';
|
||||
}
|
||||
this.className = setClassName + ($(this).is(':last-child')? '-last':'');
|
||||
this.className = setClassName + ($(this).is(':last-child') ? '-last' : '');
|
||||
|
||||
if(!open || className.indexOf('ajax')>=0)childNode.hide();
|
||||
if (!open || className.indexOf('ajax') >= 0) childNode.hide();
|
||||
|
||||
TREE.setTrigger(this);
|
||||
}else{
|
||||
} else {
|
||||
var setClassName = 'doc';
|
||||
this.className = setClassName + ($(this).is(':last-child')? '-last':'');
|
||||
this.className = setClassName + ($(this).is(':last-child') ? '-last' : '');
|
||||
}
|
||||
}).before('<li class="line"> </li>')
|
||||
.filter(':last-child').after('<li class="line-last"></li>');
|
||||
}).before('<li class="line"> </li>').filter(':last-child').after('<li class="line-last"></li>');
|
||||
TREE.setEventLine($('.line, .line-last', obj));
|
||||
};
|
||||
TREE.setTrigger = function(node){
|
||||
$('>span',node).before('<img class="trigger" src="'+imagepath+'tree/spacer.gif" border=0>');
|
||||
TREE.setTrigger = function(node) {
|
||||
$('>span', node).before('<img class="trigger" src="' + imagepath + 'tree/spacer.gif" border=0>');
|
||||
var trigger = $('>.trigger', node);
|
||||
trigger.click(function(event){
|
||||
trigger.click(function(event) {
|
||||
TREE.nodeToggle(node);
|
||||
});
|
||||
trigger.css('float','left');
|
||||
if(typeof TREE.option.afterSetTrigger == 'function')
|
||||
{
|
||||
trigger.css('float', 'left');
|
||||
if (typeof TREE.option.afterSetTrigger == 'function') {
|
||||
TREE.option.afterSetTrigger(node);
|
||||
}
|
||||
};
|
||||
TREE.dragStart = function(event){
|
||||
TREE.dragStart = function(event) {
|
||||
var LI = $(event.data.LI);
|
||||
if(mousePressed)
|
||||
{
|
||||
if (mousePressed) {
|
||||
mouseMoved = true;
|
||||
if(dragDropTimer) clearTimeout(dragDropTimer);
|
||||
if($('#drag_container:not(:visible)')){
|
||||
if (dragDropTimer) clearTimeout(dragDropTimer);
|
||||
if ($('#drag_container:not(:visible)')) {
|
||||
$('#drag_container').show();
|
||||
LI.prev('.line').hide();
|
||||
dragNode_source = LI;
|
||||
}
|
||||
$('#drag_container').css({position:'absolute', "left" : (event.pageX + 5), "top": (event.pageY + 15) });
|
||||
if(LI.is(':visible'))LI.hide();
|
||||
$('#drag_container').css({
|
||||
position: 'absolute',
|
||||
"left": (event.pageX + 5),
|
||||
"top": (event.pageY + 15)
|
||||
});
|
||||
if (LI.is(':visible')) LI.hide();
|
||||
var temp_move = false;
|
||||
if(event.target.tagName.toLowerCase()=='span' && $.inArray(event.target.className, Array('text','active','trigger'))!= -1)
|
||||
{
|
||||
if (event.target.tagName.toLowerCase() == 'span' && $.inArray(event.target.className, Array('text', 'active', 'trigger')) != -1) {
|
||||
var parent = event.target.parentNode;
|
||||
var offs = $(parent).offset({scroll:false});
|
||||
var screenScroll = {x : (offs.left - 3),y : event.pageY - offs.top};
|
||||
var offs = $(parent).offset({
|
||||
scroll: false
|
||||
});
|
||||
var screenScroll = {
|
||||
x: (offs.left - 3),
|
||||
y: event.pageY - offs.top
|
||||
};
|
||||
var isrc = $("#tree_plus").attr('src');
|
||||
var ajaxChildSize = $('>ul.ajax',parent).size();
|
||||
var ajaxChild = $('>ul.ajax',parent);
|
||||
var ajaxChildSize = $('>ul.ajax', parent).size();
|
||||
var ajaxChild = $('>ul.ajax', parent);
|
||||
screenScroll.x += 19;
|
||||
screenScroll.y = event.pageY - screenScroll.y + 5;
|
||||
|
||||
if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize==0)
|
||||
{
|
||||
if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src',imagepath+'tree/plus.gif');
|
||||
$("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
|
||||
dragDropTimer = setTimeout(function(){
|
||||
parent.className = parent.className.replace('close','open');
|
||||
$('>ul',parent).show();
|
||||
}, 700);
|
||||
}else if(parent.className.indexOf('folder')>=0 && ajaxChildSize==0){
|
||||
if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src',imagepath+'tree/plus.gif');
|
||||
$("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
|
||||
}else if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize>0)
|
||||
{
|
||||
if (parent.className.indexOf('folder-close') >= 0 && ajaxChildSize == 0) {
|
||||
if (isrc.indexOf('minus') != -1) $("#tree_plus").attr('src', imagepath + 'tree/plus.gif');
|
||||
$("#tree_plus").css({
|
||||
"left": screenScroll.x,
|
||||
"top": screenScroll.y
|
||||
}).show();
|
||||
dragDropTimer = setTimeout(function() {
|
||||
parent.className = parent.className.replace('close', 'open');
|
||||
$('>ul', parent).show();
|
||||
},
|
||||
700);
|
||||
} else if (parent.className.indexOf('folder') >= 0 && ajaxChildSize == 0) {
|
||||
if (isrc.indexOf('minus') != -1) $("#tree_plus").attr('src', imagepath + 'tree/plus.gif');
|
||||
$("#tree_plus").css({
|
||||
"left": screenScroll.x,
|
||||
"top": screenScroll.y
|
||||
}).show();
|
||||
} else if (parent.className.indexOf('folder-close') >= 0 && ajaxChildSize > 0) {
|
||||
mouseMoved = false;
|
||||
$("#tree_plus").attr('src',imagepath+'tree/minus.gif');
|
||||
$("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
|
||||
$("#tree_plus").attr('src', imagepath + 'tree/minus.gif');
|
||||
$("#tree_plus").css({
|
||||
"left": screenScroll.x,
|
||||
"top": screenScroll.y
|
||||
}).show();
|
||||
|
||||
$('>ul',parent).show();
|
||||
$('>ul', parent).show();
|
||||
/*
|
||||
Thanks for the idea of Erik Dohmen
|
||||
*/
|
||||
TREE.setAjaxNodes(ajaxChild,parent.id, function(){
|
||||
parent.className = parent.className.replace('close','open');
|
||||
TREE.setAjaxNodes(ajaxChild, parent.id, function() {
|
||||
parent.className = parent.className.replace('close', 'open');
|
||||
mouseMoved = true;
|
||||
$("#tree_plus").attr('src',imagepath+'tree/plus.gif');
|
||||
$("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
|
||||
$("#tree_plus").attr('src', imagepath + 'tree/plus.gif');
|
||||
$("#tree_plus").css({
|
||||
"left": screenScroll.x,
|
||||
"top": screenScroll.y
|
||||
}).show();
|
||||
});
|
||||
|
||||
}else{
|
||||
if(TREE.option.docToFolderConvert)
|
||||
{
|
||||
$("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
|
||||
}else{
|
||||
} else {
|
||||
if (TREE.option.docToFolderConvert) {
|
||||
$("#tree_plus").css({
|
||||
"left": screenScroll.x,
|
||||
"top": screenScroll.y
|
||||
}).show();
|
||||
} else {
|
||||
$("#tree_plus").hide();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$("#tree_plus").hide();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
TREE.dragEnd = function(){
|
||||
if(dragDropTimer) clearTimeout(dragDropTimer);
|
||||
TREE.dragEnd = function() {
|
||||
if (dragDropTimer) clearTimeout(dragDropTimer);
|
||||
TREE.eventDestroy();
|
||||
};
|
||||
TREE.setEventLine = function(obj){
|
||||
obj.mouseover(function(){
|
||||
if(this.className.indexOf('over')<0 && mousePressed && mouseMoved)
|
||||
{
|
||||
this.className = this.className.replace('line','line-over');
|
||||
TREE.setEventLine = function(obj) {
|
||||
obj.mouseover(function() {
|
||||
if (this.className.indexOf('over') < 0 && mousePressed && mouseMoved) {
|
||||
this.className = this.className.replace('line', 'line-over');
|
||||
}
|
||||
}).mouseout(function(){
|
||||
if(this.className.indexOf('over')>=0)
|
||||
{
|
||||
this.className = this.className.replace('-over','');
|
||||
}).mouseout(function() {
|
||||
if (this.className.indexOf('over') >= 0) {
|
||||
this.className = this.className.replace('-over', '');
|
||||
}
|
||||
}).mouseup(function(){
|
||||
if(mousePressed && dragNode_source && mouseMoved)
|
||||
{
|
||||
}).mouseup(function() {
|
||||
if (mousePressed && dragNode_source && mouseMoved) {
|
||||
dragNode_destination = $(this).parents('li:first');
|
||||
TREE.moveNodeToLine(this);
|
||||
TREE.eventDestroy();
|
||||
}
|
||||
});
|
||||
};
|
||||
TREE.checkNodeIsLast = function(node)
|
||||
{
|
||||
if(node.className.indexOf('last')>=0)
|
||||
{
|
||||
TREE.checkNodeIsLast = function(node) {
|
||||
if (node.className.indexOf('last') >= 0) {
|
||||
var prev_source = dragNode_source.prev().prev();
|
||||
if(prev_source.size()>0)
|
||||
{
|
||||
prev_source[0].className+='-last';
|
||||
if (prev_source.size() > 0) {
|
||||
prev_source[0].className += '-last';
|
||||
}
|
||||
node.className = node.className.replace('-last','');
|
||||
node.className = node.className.replace('-last', '');
|
||||
}
|
||||
};
|
||||
TREE.checkLineIsLast = function(line)
|
||||
{
|
||||
if(line.className.indexOf('last')>=0)
|
||||
{
|
||||
TREE.checkLineIsLast = function(line) {
|
||||
if (line.className.indexOf('last') >= 0) {
|
||||
var prev = $(line).prev();
|
||||
if(prev.size()>0)
|
||||
{
|
||||
prev[0].className = prev[0].className.replace('-last','');
|
||||
if (prev.size() > 0) {
|
||||
prev[0].className = prev[0].className.replace('-last', '');
|
||||
}
|
||||
dragNode_source[0].className+='-last';
|
||||
dragNode_source[0].className += '-last';
|
||||
}
|
||||
};
|
||||
TREE.eventDestroy = function()
|
||||
{
|
||||
TREE.eventDestroy = function() {
|
||||
// added by Erik Dohmen (2BinBusiness.nl), the unbind mousemove TREE.dragStart action
|
||||
// like this other mousemove actions binded through other actions ain't removed (use it myself
|
||||
// to determine location for context menu)
|
||||
$(document).unbind('mousemove',TREE.dragStart).unbind('mouseup').unbind('mousedown');
|
||||
$(document).unbind('mousemove', TREE.dragStart).unbind('mouseup').unbind('mousedown');
|
||||
$('#drag_container, #tree_plus').remove();
|
||||
if(dragNode_source)
|
||||
{
|
||||
if (dragNode_source) {
|
||||
$(dragNode_source).show().prev('.line').show();
|
||||
}
|
||||
dragNode_destination = dragNode_source = mousePressed = mouseMoved = false;
|
||||
//ajaxCache = Array();
|
||||
};
|
||||
TREE.convertToFolder = function(node){
|
||||
node[0].className = node[0].className.replace('doc','folder-open');
|
||||
TREE.convertToFolder = function(node) {
|
||||
node[0].className = node[0].className.replace('doc', 'folder-open');
|
||||
node.append('<ul><li class="line-last"></li></ul>');
|
||||
TREE.setTrigger(node[0]);
|
||||
TREE.setEventLine($('.line, .line-last', node));
|
||||
};
|
||||
TREE.convertToDoc = function(node){
|
||||
TREE.convertToDoc = function(node) {
|
||||
$('>ul', node).remove();
|
||||
$('img', node).remove();
|
||||
node[0].className = node[0].className.replace(/folder-(open|close)/gi , 'doc');
|
||||
node[0].className = node[0].className.replace(/folder-(open|close)/gi, 'doc');
|
||||
};
|
||||
TREE.moveNodeToFolder = function(node)
|
||||
{
|
||||
TREE.moveNodeToFolder = function(node) {
|
||||
// Open node if it's closed
|
||||
if(node[0].className.match('close')){TREE.nodeToggle(node[0]);}
|
||||
if(!TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1)
|
||||
{
|
||||
if (node[0].className.match('close')) {
|
||||
TREE.nodeToggle(node[0]);
|
||||
}
|
||||
if (!TREE.option.docToFolderConvert && node[0].className.indexOf('doc') != -1) {
|
||||
return true;
|
||||
}else if(TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1){
|
||||
} else if (TREE.option.docToFolderConvert && node[0].className.indexOf('doc') != -1) {
|
||||
TREE.convertToFolder(node);
|
||||
}
|
||||
TREE.checkNodeIsLast(dragNode_source[0]);
|
||||
var lastLine = $('>ul >.line-last', node);
|
||||
if(lastLine.size()>0)
|
||||
{
|
||||
if (lastLine.size() > 0) {
|
||||
TREE.moveNodeToLine(lastLine[0]);
|
||||
}
|
||||
};
|
||||
TREE.moveNodeToLine = function(node){
|
||||
TREE.moveNodeToLine = function(node) {
|
||||
TREE.checkNodeIsLast(dragNode_source[0]);
|
||||
TREE.checkLineIsLast(node);
|
||||
var parent = $(dragNode_source).parents('li:first');
|
||||
var line = $(dragNode_source).prev('.line');
|
||||
$(node).before(dragNode_source);
|
||||
$(dragNode_source).before(line);
|
||||
node.className = node.className.replace('-over','');
|
||||
node.className = node.className.replace('-over', '');
|
||||
var nodeSize = $('>ul >li', parent).not('.line, .line-last').filter(':visible').size();
|
||||
if(TREE.option.docToFolderConvert && nodeSize==0)
|
||||
{
|
||||
if (TREE.option.docToFolderConvert && nodeSize == 0) {
|
||||
TREE.convertToDoc(parent);
|
||||
}else if(nodeSize==0)
|
||||
{
|
||||
parent[0].className=parent[0].className.replace('open','close');
|
||||
$('>ul',parent).hide();
|
||||
} else if (nodeSize == 0) {
|
||||
parent[0].className = parent[0].className.replace('open', 'close');
|
||||
$('>ul', parent).hide();
|
||||
}
|
||||
|
||||
// added by Erik Dohmen (2BinBusiness.nl) select node
|
||||
if($('span:first',dragNode_source).attr('class')=='text')
|
||||
{
|
||||
$('.active',TREE).toggleClass('active').addClass('text');
|
||||
$('span:first',dragNode_source).toggleClass('text').addClass('active');
|
||||
if ($('span:first', dragNode_source).attr('class') == 'text') {
|
||||
$('.active', TREE).toggleClass('active').addClass('text');
|
||||
$('span:first', dragNode_source).toggleClass('text').addClass('active');
|
||||
}
|
||||
|
||||
if(typeof(TREE.option.afterMove) == 'function')
|
||||
{
|
||||
if (typeof(TREE.option.afterMove) == 'function') {
|
||||
var pos = $(dragNode_source).prevAll(':not(.line)').size();
|
||||
TREE.option.afterMove($(node).parents('li:first'), $(dragNode_source), pos);
|
||||
}
|
||||
};
|
||||
|
||||
TREE.addNode = function(id, text, callback)
|
||||
{
|
||||
TREE.newNodeIn(TREE.getSelected(),id,text,callback);
|
||||
TREE.addNode = function(id, text, callback) {
|
||||
TREE.newNodeIn(TREE.getSelected(), id, text, callback);
|
||||
};
|
||||
TREE.newNodeIn = function(node, id, text, callback)
|
||||
{
|
||||
var temp_node = $('<li><ul><li id="'+id+'"><span>'+text+'</span></li></ul></li>');
|
||||
TREE.setTreeNodes(temp_node,false);
|
||||
TREE.newNodeIn = function(node, id, text, callback) {
|
||||
var temp_node = $('<li><ul><li id="' + id + '"><span>' + text + '</span></li></ul></li>');
|
||||
TREE.setTreeNodes(temp_node, false);
|
||||
destination = node;
|
||||
dragNode_source = $('.doc-last',temp_node);
|
||||
dragNode_source = $('.doc-last', temp_node);
|
||||
TREE.moveNodeToFolder(destination);
|
||||
temp_node.remove();
|
||||
if(typeof TREE.option.afterNewNode == 'function')
|
||||
{
|
||||
if (typeof TREE.option.afterNewNode == 'function') {
|
||||
TREE.option.afterNewNode(node);
|
||||
}
|
||||
if(typeof(callback) == 'function')
|
||||
{
|
||||
if (typeof(callback) == 'function') {
|
||||
callback(dragNode_destination, dragNode_source);
|
||||
}
|
||||
};
|
||||
TREE.newNodeAfter = function(id, text, callback)
|
||||
{
|
||||
TREE.newNodeIn(TREE.getSelected().parent().parent(),id,text,callback);
|
||||
TREE.newNodeAfter = function(id, text, callback) {
|
||||
TREE.newNodeIn(TREE.getSelected().parent().parent(), id, text, callback);
|
||||
};
|
||||
TREE.newAjaxNodeIn = function(node,id,text,url,callback)
|
||||
{
|
||||
var temp_node = $('<li><ul><li id="'+id+'"><span>'+text+'</span><ul class="ajax"><li id="new">.{url:'+url+'}</li></ul></li></ul></li>');
|
||||
TREE.setTreeNodes(temp_node,false);
|
||||
TREE.newAjaxNodeIn = function(node, id, text, url, callback) {
|
||||
var temp_node = $('<li><ul><li id="' + id + '"><span>' + text + '</span><ul class="ajax"><li id="new">.{url:' + url + '}</li></ul></li></ul></li>');
|
||||
TREE.setTreeNodes(temp_node, false);
|
||||
destination = node;
|
||||
dragNode_source = $('.folder-close-last',temp_node);
|
||||
dragNode_source = $('.folder-close-last', temp_node);
|
||||
TREE.moveNodeToFolder(destination);
|
||||
temp_node.remove();
|
||||
if(typeof TREE.option.afterNewNode == 'function')
|
||||
{
|
||||
if (typeof TREE.option.afterNewNode == 'function') {
|
||||
TREE.option.afterNewNode(node);
|
||||
}
|
||||
if(typeof(callback) == 'function')
|
||||
{
|
||||
if (typeof(callback) == 'function') {
|
||||
callback(dragNode_destination, dragNode_source);
|
||||
}
|
||||
};
|
||||
TREE.delNode = function(callback)
|
||||
{
|
||||
TREE.delNode = function(callback) {
|
||||
dragNode_source = TREE.getSelected();
|
||||
TREE.checkNodeIsLast(dragNode_source[0]);
|
||||
dragNode_source.prev().remove();
|
||||
dragNode_source.remove();
|
||||
if(typeof(callback) == 'function')
|
||||
{
|
||||
if (typeof(callback) == 'function') {
|
||||
callback(dragNode_destination);
|
||||
}
|
||||
};
|
||||
|
||||
TREE.init = function(obj)
|
||||
{
|
||||
TREE.init = function(obj) {
|
||||
TREE.setTreeNodes(obj, false);
|
||||
};
|
||||
TREE.init(ROOT);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
// Adapt some class to fit Bootstrap theme
|
||||
$("div.message-positive").addClass("alert-success");
|
||||
|
@ -9,4 +8,3 @@ $(document).ready(function(){
|
|||
$("table.info").addClass("table");
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/* Watch login and logout events */
|
||||
|
||||
navigator.id.watch({
|
||||
loggedInUser: null,
|
||||
onlogin: function(assertion) {
|
||||
// POST assertion
|
||||
$('form.BrowserID').append('<input type="hidden" name="browserIdAssertion" value="'+assertion+'" />').submit();
|
||||
},
|
||||
onlogout: function() {
|
||||
// Do nothing
|
||||
}
|
||||
loggedInUser: null,
|
||||
onlogin: function(assertion) {
|
||||
// POST assertion
|
||||
$('form.BrowserID').append('<input type="hidden" name="browserIdAssertion" value="' + assertion + '" />').submit();
|
||||
},
|
||||
onlogout: function() {
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
// Manage auto login
|
||||
if (browserIdAutoLogin.match('1')) {
|
||||
|
@ -7,7 +7,7 @@ $(document).ready(function(){
|
|||
|
||||
// Intercept submit the first time
|
||||
var intercepted = 0;
|
||||
$("form.BrowserID").submit(function( event ) {
|
||||
$("form.BrowserID").submit(function(event) {
|
||||
if (!intercepted) {
|
||||
event.preventDefault();
|
||||
intercepted = 1;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
navigator.id.logout();
|
||||
});
|
||||
|
|
|
@ -12,20 +12,32 @@
|
|||
*/
|
||||
|
||||
/* Set autocomplete real value */
|
||||
if(autocomplete.match('1')){autocomplete='on';}
|
||||
if(autocomplete.match('0')){autocomplete='off';}
|
||||
if (autocomplete.match('1')) {
|
||||
autocomplete = 'on';
|
||||
}
|
||||
if (autocomplete.match('0')) {
|
||||
autocomplete = 'off';
|
||||
}
|
||||
|
||||
/* Set newwindow value (default is false) */
|
||||
if(newwindow.match('1')){newwindow=true;}else{newwindow=false;}
|
||||
if (newwindow.match('1')) {
|
||||
newwindow = true;
|
||||
} else {
|
||||
newwindow = false;
|
||||
}
|
||||
|
||||
/* Set antiframe value (default is true) */
|
||||
if(antiframe.match('0')){antiframe=false;}else{antiframe=true;}
|
||||
if (antiframe.match('0')) {
|
||||
antiframe = false;
|
||||
} else {
|
||||
antiframe = true;
|
||||
}
|
||||
|
||||
/* jQuery */
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
/* AntiFrame script */
|
||||
if(antiframe && top!=self){
|
||||
if (antiframe && top != self) {
|
||||
top.location.href = location.href;
|
||||
}
|
||||
|
||||
|
@ -36,7 +48,9 @@ $(document).ready(function(){
|
|||
opacity: 0.5,
|
||||
revert: true,
|
||||
items: "> div.category",
|
||||
update: function(){ getOrder(); }
|
||||
update: function() {
|
||||
getOrder();
|
||||
}
|
||||
});
|
||||
|
||||
restoreOrder();
|
||||
|
@ -45,32 +59,42 @@ $(document).ready(function(){
|
|||
$("div.message").fadeIn('slow');
|
||||
|
||||
/* Set timezone */
|
||||
$("input[name=timezone]").val( -(new Date().getTimezoneOffset()/60) );
|
||||
$("input[name=timezone]").val(-(new Date().getTimezoneOffset() / 60));
|
||||
|
||||
/* Menu tabs */
|
||||
var menuTabs = $("#menu").tabs({active:0});
|
||||
var menuIndex = $('#menu a[href="#'+displaytab+'"]').parent().index();
|
||||
if (menuIndex<0){menuIndex=0;}
|
||||
menuTabs.tabs("option","active",menuIndex);
|
||||
var menuTabs = $("#menu").tabs({
|
||||
active: 0
|
||||
});
|
||||
var menuIndex = $('#menu a[href="#' + displaytab + '"]').parent().index();
|
||||
if (menuIndex < 0) {
|
||||
menuIndex = 0;
|
||||
}
|
||||
menuTabs.tabs("option", "active", menuIndex);
|
||||
|
||||
/* Authentication choice tabs */
|
||||
var authMenuTabs = $("#authMenu").tabs({active:0});
|
||||
var authMenuTabs = $("#authMenu").tabs({
|
||||
active: 0
|
||||
});
|
||||
// TODO: cookie
|
||||
//$("#authMenu").tabs({cookie: {name: 'lemonldapauthchoice'}});
|
||||
if(choicetab){
|
||||
var authMenuIndex = $('#authMenu a[href="#'+choicetab+'"]').parent().index();
|
||||
authMenuTabs.tabs("option","active",authMenuIndex);
|
||||
if (choicetab) {
|
||||
var authMenuIndex = $('#authMenu a[href="#' + choicetab + '"]').parent().index();
|
||||
authMenuTabs.tabs("option", "active", authMenuIndex);
|
||||
}
|
||||
|
||||
/* Focus on first visible input */
|
||||
$("input[type!=hidden]:first").focus();
|
||||
if(login){ $("input[type=password]:first").focus(); }
|
||||
if (login) {
|
||||
$("input[type=password]:first").focus();
|
||||
}
|
||||
|
||||
/* Password autocompletion */
|
||||
$("input[type='password']").attr("autocomplete",autocomplete);
|
||||
$("input[type='password']").attr("autocomplete", autocomplete);
|
||||
|
||||
/* Open links in new windows */
|
||||
if(newwindow){ $('#appslist a').attr("target", "_blank"); }
|
||||
if (newwindow) {
|
||||
$('#appslist a').attr("target", "_blank");
|
||||
}
|
||||
|
||||
/* Complete removeOther link */
|
||||
if ($("p.removeOther").length) {
|
||||
|
@ -79,12 +103,12 @@ $(document).ready(function(){
|
|||
|
||||
var back_url = "";
|
||||
if (action.indexOf("?") != -1) {
|
||||
back_url = action.substring(0,action.indexOf("?")) + "?";
|
||||
back_url = action.substring(0, action.indexOf("?")) + "?";
|
||||
} else {
|
||||
back_url = action + "?";
|
||||
}
|
||||
|
||||
$("form.login input[type=hidden]").each(function(index){
|
||||
$("form.login input[type=hidden]").each(function(index) {
|
||||
back_url = back_url + "&" + $(this).attr("name") + "=" + $(this).val();
|
||||
});
|
||||
|
||||
|
@ -92,7 +116,7 @@ $(document).ready(function(){
|
|||
|
||||
link = link + "&method=" + method + "&url=" + $.base64Encode(back_url);
|
||||
|
||||
$("p.removeOther a").attr("href",link);
|
||||
$("p.removeOther a").attr("href", link);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -104,10 +128,12 @@ var setSelector = "#appslist";
|
|||
function getOrder() {
|
||||
// save custom order to persistent session
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:scriptname,
|
||||
data:{storeAppsListOrder:$(setSelector).sortable("toArray").join()},
|
||||
dataType:'json'
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
storeAppsListOrder: $(setSelector).sortable("toArray").join()
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -127,7 +153,7 @@ function restoreOrder() {
|
|||
|
||||
// make array from current order
|
||||
var rebuild = new Array();
|
||||
for ( var v=0, len=items.length; v<len; v++ ){
|
||||
for (var v = 0, len = items.length; v < len; v++) {
|
||||
rebuild[items[v]] = items[v];
|
||||
}
|
||||
|
||||
|
@ -142,10 +168,10 @@ function restoreOrder() {
|
|||
var item = rebuild[itemID];
|
||||
|
||||
// select the item according to current order
|
||||
var child = $(setSelector+".ui-sortable").children("#" + item);
|
||||
var child = $(setSelector + ".ui-sortable").children("#" + item);
|
||||
|
||||
// select the item according to the saved order
|
||||
var savedOrd = $(setSelector+".ui-sortable").children("#" + itemID);
|
||||
var savedOrd = $(setSelector + ".ui-sortable").children("#" + itemID);
|
||||
|
||||
// remove all the items
|
||||
child.remove();
|
||||
|
@ -155,7 +181,7 @@ function restoreOrder() {
|
|||
// class is applied to all ul elements and we
|
||||
// only want the very first! You can modify this
|
||||
// to support multiple lists - not tested!
|
||||
$(setSelector+".ui-sortable").filter(":first").append(savedOrd);
|
||||
$(setSelector + ".ui-sortable").filter(":first").append(savedOrd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,29 +191,32 @@ function restoreOrder() {
|
|||
* @param option Option name
|
||||
* @return true if option is set, false else
|
||||
*/
|
||||
function isHiddenFormValueSet(option){
|
||||
if($('#lmhidden_'+option).length){
|
||||
function isHiddenFormValueSet(option) {
|
||||
if ($('#lmhidden_' + option).length) {
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function ping() {
|
||||
$.ajax({type:"POST",
|
||||
url:scriptname,
|
||||
data:{ping:1},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(!data.auth){
|
||||
location.reload(true);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: scriptname,
|
||||
data: {
|
||||
ping: 1
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
if (!data.auth) {
|
||||
location.reload(true);
|
||||
}
|
||||
else {
|
||||
setTimeout('ping();', 60000);
|
||||
}
|
||||
}
|
||||
else{
|
||||
setTimeout('ping();',60000);
|
||||
}
|
||||
}/*,
|
||||
/*,
|
||||
error:function(xhr, ajaxOptions, thrownError){
|
||||
alert('Request failed Error code: '+xhr.status+', '+thrownError);
|
||||
}*/
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user