diff --git a/plugins/dynamix.vm.manager/VMMachines.page b/plugins/dynamix.vm.manager/VMMachines.page index 0423cf439..8ac915f5e 100644 --- a/plugins/dynamix.vm.manager/VMMachines.page +++ b/plugins/dynamix.vm.manager/VMMachines.page @@ -163,12 +163,6 @@ function resetSorting() { $('input[type=button]').prop('disabled',true); $.post('/plugins/dynamix.vm.manager/include/UserPrefs.php',{reset:true},function(){loadlist();}); } -var sortableHelper = function(e,i){ - i.children().each(function(){ - $(this).width($(this).width()); - }); - return i; -}; function changemedia(uuid,dev,bus,file) { if (file === "--select") getisoimage(uuid,dev,bus,file) ; if (file === "--eject") ajaxVMDispatch({action:"change-media", uuid:uuid , cdrom:"" , dev:dev , bus:bus , file:file}, "loadlist"); @@ -218,24 +212,41 @@ function dialogStyle() { $('.ui-dialog-content').css({'padding-top':'15px','vertical-align':'bottom'}); $('.ui-button-text').css({'padding':'0px 5px'}); } - -function loadlist() { - timers.vm = setTimeout(function(){$('div.spinner.fixed').show('slow');},500); - $.get('/plugins/dynamix.vm.manager/include/VMMachines.php',{show:$.cookie('vmshow')},function(d) { - clearTimeout(timers.vm); - var data = d.split(/\0/); - $('#kvm_list').html(data[0]).sortable({helper:sortableHelper,items:'tr.sortable',cursor:'move',axis:'y',containment:'parent',delay:100,opacity:0.5,zIndex:9999, +var sortableHelper = function(e,ui){ + ui.children().each(function(){$(this).width($(this).width());}); + return ui; +}; +function LockButton() { + if ($.cookie('lockbutton') == null) { + $.cookie('lockbutton','lockbutton'); + + $('div.nav-item.LockButton').find('a').prop('title',"_(Lock sortable items)_"); + $('div.nav-item.LockButton').find('b').removeClass('icon-u-lock red-text').addClass('icon-u-lock-open green-text'); + + $('div.nav-item.LockButton').find('span').text("_(Lock sortable items)_"); + $('#kvm_list').sortable({helper:sortableHelper,items:'tr.sortable',cursor:'move',axis:'y',containment:'parent',delay:100,opacity:0.5,zIndex:9999,forcePlaceholderSize:true, update:function(e,ui){ - $('#kvm_list').find('tr.sortable').each(function(){ - var parent = $(this).attr('parent-id'); - var child = $('tr[child-id="'+parent+'"]'); - child.detach().insertAfter($(this)); - }); var row = $('#kvm_list').find('tr:first'); var names = ''; var index = ''; row.parent().children().find('td.vm-name').each(function(){names+=$(this).find('a').text()+';';index+=$(this).parent().parent().children().index($(this).parent())+';';}); $.post('/plugins/dynamix.vm.manager/include/UserPrefs.php',{names:names,index:index}); }}); + } else { + $.removeCookie('lockbutton'); + + $('div.nav-item.LockButton').find('a').prop('title',"_(Unlock sortable items)_"); + $('div.nav-item.LockButton').find('b').removeClass('icon-u-lock-open green-text').addClass('icon-u-lock red-text'); + + $('div.nav-item.LockButton').find('span').text("_(Unlock sortable items)_"); + $('#kvm_list').sortable('destroy'); + } +} +function loadlist() { + timers.vm = setTimeout(function(){$('div.spinner.fixed').show('slow');},500); + $.get('/plugins/dynamix.vm.manager/include/VMMachines.php',{show:$.cookie('vmshow')},function(d) { + clearTimeout(timers.vm); + var data = d.split(/\0/); + $('#kvm_list').html(data[0]); $('head').append(' diff --git a/plugins/dynamix/include/DefaultPageLayout.php b/plugins/dynamix/include/DefaultPageLayout.php index 2475f4423..5fa8c87ea 100644 --- a/plugins/dynamix/include/DefaultPageLayout.php +++ b/plugins/dynamix/include/DefaultPageLayout.php @@ -609,7 +609,7 @@ foreach ($tasks as $button) { unset($tasks); echo ""; echo "