openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 686eb0cc78aec548f54975f0ea845ddf9db5fe49
parent 01f9103e8e06489a3ddc19491414ecb015ec4746
Author: Jan Dankert <devnull@localhost>
Date:   Mon, 22 Oct 2012 23:14:16 +0200

Drag n Drop für Baumelemente.

Diffstat:
themes/default/js/openrat.js | 19++++++++++++++++++-
themes/default/js/plugin/jquery-plugin-orTree.js | 4++--
2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/themes/default/js/openrat.js b/themes/default/js/openrat.js @@ -145,7 +145,7 @@ function refreshWorkbench() else $(dropped).detach().css({top: 0,left: 0}).appendTo(droppedOn).click(); } } ); - + // geht nicht zusammen mit draggable... //$('ul.views').sortable(); @@ -408,6 +408,23 @@ function registerViewEvents( viewEl ) } }); } ); + // Drag n Drop für Inhaltselemente (Dateien,Seiten,Ordner,Verknuepfungen) + $('div.content li.object').draggable( {cursor:'move',revert: 'invalid' }); + $('div.content li.object > div.entry[data-type=\'folder\']').droppable( {accept:'li.object',hoverClass: 'drophover',activeClass: 'dropactive',drop: function(event, ui) { + var dropped = ui.draggable; + var droppedOn = $(this).parent(); + + //alert('Moving '+$(dropped).attr('data-id')+' to folder '+$(droppedOn).attr('data-id') ); + /* + if ( $(dropped).closest('div.frame').attr('id') == $(droppedOn).closest('div.frame').attr('id') ) + $(dropped).css({top: 0,left: 0}); // Nicht auf das eigene Fenster fallen lassen. + else + $(dropped).detach().css({top: 0,left: 0}).appendTo(droppedOn).click(); + */ + //$(dropped).css({top: 0,left: 0}); // Nicht auf das eigene Fenster fallen lassen. + $(dropped).detach().css({top: 0,left: 0}).appendTo(droppedOn).click(); + } } ); + } diff --git a/themes/default/js/plugin/jquery-plugin-orTree.js b/themes/default/js/plugin/jquery-plugin-orTree.js @@ -24,7 +24,7 @@ jQuery.fn.orTree = function( options ) if ( settings.selectable.length==0 || settings.selectable[0]=='' || jQuery.inArray(line.type, settings.selectable)!=-1) { //var img = (line.url!==undefined?'tree_plus':'tree_none'); - $(ul).append( '<li><div class="tree">&nbsp;</div><div class="entry" title="'+ line.description + '"><img src="'+OR_THEMES_EXT_DIR+'default/images/icon_'+line['icon']+'.png" />'+ line.text + '</div></li>' ); + $(ul).append( '<li class="object" data-id="'+line.internalId+'" data-type="'+line.type+'"><div class="tree">&nbsp;</div><div class="entry" data-id="'+line.internalId+'" data-type="'+line.type+'" title="'+ line.description + '"><img src="'+OR_THEMES_EXT_DIR+'default/images/icon_'+line['icon']+'.png" />'+ line.text + '</div></li>' ); var new_li = $(ul).children('li').last(); //$(new_li).children('div').unbind('click'); if ( line.type ) @@ -46,7 +46,7 @@ jQuery.fn.orTree = function( options ) // Den Objekt-Typ und die Objekt-Id für alle Views setzen (die dies zulassen) // Neue Action starten. - $(this).closest('div#content').find('div.entry').removeClass('selected'); + $(this).closest('div.content').find('div.entry').removeClass('selected'); $(this).addClass('selected'); settings.onSelect( $(this).text(), line.action, line.id );