drag & drop for playlisteditor
This commit is contained in:
parent
d097fd47db
commit
c4a05bb3ab
5 changed files with 615 additions and 84 deletions
149
livesupport/modules/htmlUI/var/html/assets/dom-drag.js
Executable file
149
livesupport/modules/htmlUI/var/html/assets/dom-drag.js
Executable file
|
@ -0,0 +1,149 @@
|
||||||
|
/**************************************************
|
||||||
|
* dom-drag.js
|
||||||
|
* 09.25.2001
|
||||||
|
* www.youngpup.net
|
||||||
|
**************************************************
|
||||||
|
* 10.28.2001 - fixed minor bug where events
|
||||||
|
* sometimes fired off the handle, not the root.
|
||||||
|
**************************************************
|
||||||
|
* 05.30.2005 - added a workaround for firefox
|
||||||
|
* activating links when finished dragging.
|
||||||
|
* mmosier@astrolabe.com
|
||||||
|
**************************************************/
|
||||||
|
|
||||||
|
var Drag = {
|
||||||
|
|
||||||
|
obj : null,
|
||||||
|
|
||||||
|
init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
|
||||||
|
{
|
||||||
|
o.onmousedown = Drag.start;
|
||||||
|
|
||||||
|
o.hmode = bSwapHorzRef ? false : true ;
|
||||||
|
o.vmode = bSwapVertRef ? false : true ;
|
||||||
|
|
||||||
|
o.root = oRoot && oRoot != null ? oRoot : o ;
|
||||||
|
|
||||||
|
if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px";
|
||||||
|
if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px";
|
||||||
|
if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
|
||||||
|
if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
|
||||||
|
|
||||||
|
o.minX = typeof minX != 'undefined' ? minX : null;
|
||||||
|
o.minY = typeof minY != 'undefined' ? minY : null;
|
||||||
|
o.maxX = typeof maxX != 'undefined' ? maxX : null;
|
||||||
|
o.maxY = typeof maxY != 'undefined' ? maxY : null;
|
||||||
|
|
||||||
|
o.xMapper = fXMapper ? fXMapper : null;
|
||||||
|
o.yMapper = fYMapper ? fYMapper : null;
|
||||||
|
|
||||||
|
o.root.onDragStart = new Function();
|
||||||
|
o.root.onDragEnd = new Function();
|
||||||
|
o.root.onDrag = new Function();
|
||||||
|
},
|
||||||
|
|
||||||
|
start : function(e)
|
||||||
|
{
|
||||||
|
var o = Drag.obj = this;
|
||||||
|
e = Drag.fixE(e);
|
||||||
|
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
|
||||||
|
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
|
||||||
|
o.root.onDragStart(x, y);
|
||||||
|
|
||||||
|
o.startX = x;
|
||||||
|
o.startY = y;
|
||||||
|
o.lastMouseX = e.clientX;
|
||||||
|
o.lastMouseY = e.clientY;
|
||||||
|
|
||||||
|
if (o.hmode) {
|
||||||
|
if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
|
||||||
|
if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
|
||||||
|
} else {
|
||||||
|
if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
|
||||||
|
if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (o.vmode) {
|
||||||
|
if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
|
||||||
|
if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
|
||||||
|
} else {
|
||||||
|
if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
|
||||||
|
if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.onmousemove = Drag.drag;
|
||||||
|
document.onmouseup = Drag.end;
|
||||||
|
|
||||||
|
if (o.linkDisabled) {
|
||||||
|
var hrefs = o.root.getElementsByTagName("a");
|
||||||
|
for (var i = 0; i < hrefs.length; i++) {
|
||||||
|
hrefs[i].onclick = hrefs[i].prevOnclick;
|
||||||
|
hrefs[i].prevOnclick = null;
|
||||||
|
}
|
||||||
|
o.linkDisabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
drag : function(e)
|
||||||
|
{
|
||||||
|
e = Drag.fixE(e);
|
||||||
|
var o = Drag.obj;
|
||||||
|
|
||||||
|
var ey = e.clientY;
|
||||||
|
var ex = e.clientX;
|
||||||
|
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
|
||||||
|
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
|
||||||
|
var nx, ny;
|
||||||
|
|
||||||
|
if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
|
||||||
|
if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
|
||||||
|
if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
|
||||||
|
if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
|
||||||
|
|
||||||
|
nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
|
||||||
|
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
|
||||||
|
|
||||||
|
if (o.xMapper) nx = o.xMapper(y)
|
||||||
|
else if (o.yMapper) ny = o.yMapper(x)
|
||||||
|
|
||||||
|
Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
|
||||||
|
Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
|
||||||
|
Drag.obj.lastMouseX = ex;
|
||||||
|
Drag.obj.lastMouseY = ey;
|
||||||
|
|
||||||
|
var threshold = 4;
|
||||||
|
if (!o.linkDisabled) {
|
||||||
|
if (Math.abs(nx - o.startX) > threshold || Math.abs(ny - o.startY) > threshold) {
|
||||||
|
var hrefs = o.root.getElementsByTagName("a");
|
||||||
|
for (var i = 0; i < hrefs.length; i++) {
|
||||||
|
hrefs[i].prevOnclick = hrefs[i].onclick;
|
||||||
|
hrefs[i].onclick = function() { return false; };
|
||||||
|
}
|
||||||
|
o.linkDisabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Drag.obj.root.onDrag(nx, ny, Drag.obj.root);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
end : function()
|
||||||
|
{
|
||||||
|
document.onmousemove = null;
|
||||||
|
document.onmouseup = null;
|
||||||
|
Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
|
||||||
|
parseInt(Drag.obj.root.style[Drag.obj.vmode
|
||||||
|
? "top" : "bottom"]), Drag.obj.root);
|
||||||
|
Drag.obj = null;
|
||||||
|
},
|
||||||
|
|
||||||
|
fixE : function(e)
|
||||||
|
{
|
||||||
|
if (typeof e == 'undefined') e = window.event;
|
||||||
|
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
|
||||||
|
if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
};
|
295
livesupport/modules/htmlUI/var/html/assets/draglist.js
Executable file
295
livesupport/modules/htmlUI/var/html/assets/draglist.js
Executable file
|
@ -0,0 +1,295 @@
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// (c) Copyright, DTLink, LLC 1997-2005
|
||||||
|
// http://www.dtlink.com
|
||||||
|
//
|
||||||
|
// DragList - Drag and Drop Ordered Lists
|
||||||
|
//
|
||||||
|
// Javascript Support file for formVista <draglist> fvml tag.
|
||||||
|
//
|
||||||
|
// For more information please see:
|
||||||
|
//
|
||||||
|
// http://www.formvista.com/otherprojects/draglist.html
|
||||||
|
//
|
||||||
|
// For questions or comments please contact us at:
|
||||||
|
//
|
||||||
|
// http://www.formvista.com/contact.html
|
||||||
|
//
|
||||||
|
// LICENSE: This file is governed by the new BSD license. For more information
|
||||||
|
// please see the LICENSE.txt file accompanying this package.
|
||||||
|
//
|
||||||
|
// REVISION HISTORY:
|
||||||
|
//
|
||||||
|
// 2004-11-12 YmL:
|
||||||
|
// . initial revision.
|
||||||
|
//
|
||||||
|
// 2005-05-28 YmL:
|
||||||
|
// . pulled out of formVista, relicensed and packaged as a standalone implementation.
|
||||||
|
//
|
||||||
|
// 2005-06-02 mtmosier:
|
||||||
|
// . added horizontal dragging support.
|
||||||
|
//
|
||||||
|
// ------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor for dragList class
|
||||||
|
*/
|
||||||
|
|
||||||
|
function fv_dragList( name )
|
||||||
|
{
|
||||||
|
|
||||||
|
// name of this dragList. Must match the id of the root DIV tag.
|
||||||
|
|
||||||
|
this.dragListRootId = name;
|
||||||
|
|
||||||
|
// array of item offsets
|
||||||
|
|
||||||
|
this.offsetsX = new Array();
|
||||||
|
this.offsetsY = new Array();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setup the draglist prior to use
|
||||||
|
*
|
||||||
|
* @param string orientation defaults to vert. if set to "horz" renders horizontally.
|
||||||
|
* @param string itemTagName. if null defaults to "div". Can be "span".
|
||||||
|
*/
|
||||||
|
|
||||||
|
fv_dragList.prototype.setup = function( orientation, itemTagName )
|
||||||
|
{
|
||||||
|
|
||||||
|
var horizontal;
|
||||||
|
|
||||||
|
if ( orientation == "horz" )
|
||||||
|
horizontal = true;
|
||||||
|
else
|
||||||
|
horizontal = false;
|
||||||
|
|
||||||
|
this.listRoot = document.getElementById( this.dragListRootId );
|
||||||
|
this.listItems = this.getListItems( itemTagName );
|
||||||
|
|
||||||
|
for (var i = 0; i < this.listItems.length; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( this.listItems[i] == undefined )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( horizontal )
|
||||||
|
{
|
||||||
|
Drag.init(this.listItems[i], null, null, null, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Drag.init(this.listItems[i], null, 0, 0, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------
|
||||||
|
// on drag method
|
||||||
|
|
||||||
|
this.listItems[i].onDrag = function( x, y, thisElem )
|
||||||
|
{
|
||||||
|
|
||||||
|
x = thisElem.offsetLeft;
|
||||||
|
y = thisElem.offsetTop;
|
||||||
|
|
||||||
|
// this is a callback from the dom-drag code. From within this
|
||||||
|
// function "this" does not refer to the fv_draglist function.
|
||||||
|
|
||||||
|
draglist = getDragList( thisElem );
|
||||||
|
|
||||||
|
draglist.recalcOffsets( itemTagName );
|
||||||
|
|
||||||
|
var pos = draglist.getCurrentOffset( thisElem, itemTagName );
|
||||||
|
|
||||||
|
//var listItems = this.getListItems( itemTagName );
|
||||||
|
|
||||||
|
// if bottom edge is below top of lower item.
|
||||||
|
|
||||||
|
var testMoveUp;
|
||||||
|
var testMoveDown;
|
||||||
|
if ( horizontal )
|
||||||
|
{
|
||||||
|
testMoveUp = (x + draglist.getDivWidth(thisElem) > draglist.offsetsX[pos + 1] + draglist.getDivWidth( draglist.listItems[pos + 1] ));
|
||||||
|
testMoveDown = x < draglist.offsetsX[pos - 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testMoveUp = (y + draglist.getDivHeight(thisElem) > draglist.offsetsY[pos + 1] + draglist.getDivHeight( draglist.listItems[pos + 1] ));
|
||||||
|
testMoveDown = y < draglist.offsetsY[pos - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (( pos != draglist.listItems.length - 1) && testMoveUp )
|
||||||
|
{
|
||||||
|
draglist.listRoot.removeChild(thisElem);
|
||||||
|
|
||||||
|
if ( pos + 1 == draglist.listItems.length )
|
||||||
|
{
|
||||||
|
draglist.listRoot.appendChild( thisElem );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
draglist.listRoot.insertBefore(thisElem, draglist.listItems[pos+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
thisElem.style["top"] = "0px";
|
||||||
|
thisElem.style["left"] = "0px";
|
||||||
|
}
|
||||||
|
else if ( pos != 0 && testMoveDown )
|
||||||
|
{
|
||||||
|
draglist.listRoot.removeChild(thisElem);
|
||||||
|
draglist.listRoot.insertBefore(thisElem, draglist.listItems[pos-1]);
|
||||||
|
thisElem.style["top"] = "0px";
|
||||||
|
thisElem.style["left"] = "0px";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
this.listItems[i].onDragEnd = function(x,y,thisElem)
|
||||||
|
{
|
||||||
|
thisElem.style["top"] = "0px";
|
||||||
|
thisElem.style["left"] = "0px";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end of for loop.
|
||||||
|
|
||||||
|
this.recalcOffsets( itemTagName );
|
||||||
|
|
||||||
|
} // end of setup.
|
||||||
|
|
||||||
|
// ----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update the order value fields and submit the form.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fv_dragList.prototype.do_submit = function( formName, dragListRootId )
|
||||||
|
{
|
||||||
|
|
||||||
|
var listOrderItems = this.listRoot.getElementsByTagName("input");
|
||||||
|
|
||||||
|
for (var i = 0; i < listOrderItems.length; i++)
|
||||||
|
{
|
||||||
|
listOrderItems[i].value = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
expr = "document." + formName + ".submit()";
|
||||||
|
|
||||||
|
eval( expr );
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------
|
||||||
|
// "Private" methods.
|
||||||
|
// ----------------------------------------------
|
||||||
|
|
||||||
|
fv_dragList.prototype.recalcOffsets = function( itemTagName )
|
||||||
|
{
|
||||||
|
var listItems = this.getListItems( itemTagName );
|
||||||
|
|
||||||
|
for (var i = 0; i < listItems.length; i++)
|
||||||
|
{
|
||||||
|
this.offsetsX[i] = listItems[i].offsetLeft;
|
||||||
|
this.offsetsY[i] = listItems[i].offsetTop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fv_dragList.prototype.getCurrentOffset = function(elem, itemTagName)
|
||||||
|
{
|
||||||
|
var listItems = this.getListItems( itemTagName );
|
||||||
|
|
||||||
|
for (var i = 0; i < listItems.length; i++)
|
||||||
|
{
|
||||||
|
if (listItems[i] == elem)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fv_dragList.prototype.getDivWidth = function(elem)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (( elem == undefined) || ( elem.offsetWidth == undefined ))
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
|
value = elem.offsetWidth;
|
||||||
|
if (isNaN(value))
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
fv_dragList.prototype.getDivHeight = function(elem)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (( elem == undefined) || ( elem.offsetHeight == undefined ))
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
|
value = elem.offsetHeight;
|
||||||
|
if (isNaN(value))
|
||||||
|
{
|
||||||
|
value = 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return list of draggable items
|
||||||
|
*/
|
||||||
|
|
||||||
|
fv_dragList.prototype.getListItems = function( itemTagName )
|
||||||
|
{
|
||||||
|
if ( itemTagName == undefined )
|
||||||
|
{
|
||||||
|
itemTagName = "div";
|
||||||
|
}
|
||||||
|
|
||||||
|
var listItems = this.listRoot.getElementsByTagName( itemTagName );
|
||||||
|
|
||||||
|
return( listItems );
|
||||||
|
}
|
||||||
|
|
||||||
|
// end of draglist class definition.
|
||||||
|
|
||||||
|
// -------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a new dragList to the list of draglists on this page
|
||||||
|
*
|
||||||
|
* This implementatoin supports multiple managed draglists on
|
||||||
|
* a single page. The index is contained in a global dragListIndex
|
||||||
|
* array that must be declared in the page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function addDragList( draglist )
|
||||||
|
{
|
||||||
|
dragListIndex[ draglist.dragListRootId ] = draglist;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* given a draggable div element, return the draglist it belongs to
|
||||||
|
*
|
||||||
|
* @see fv_draglist.prototype.setup
|
||||||
|
* @todo this should probably be a method inside the draglist class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getDragList( elem )
|
||||||
|
{
|
||||||
|
|
||||||
|
// given a list item return the drag list it belongs to.
|
||||||
|
|
||||||
|
var draglistContainer = elem.parentNode;
|
||||||
|
|
||||||
|
var draglist = dragListIndex[ draglistContainer.id ];
|
||||||
|
|
||||||
|
return( draglist );
|
||||||
|
}
|
||||||
|
|
||||||
|
// END
|
|
@ -226,6 +226,11 @@ switch($_REQUEST['act']){
|
||||||
$uiHandler->PLAYLIST->setReload();
|
$uiHandler->PLAYLIST->setReload();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "PL.reOrder":
|
||||||
|
$uiHandler->PLAYLIST->reOrder($_REQUEST['pl_items']);
|
||||||
|
$uiHandler->PLAYLIST->setReturn();
|
||||||
|
break;
|
||||||
|
|
||||||
case "PL.editMetaData":
|
case "PL.editMetaData":
|
||||||
$uiHandler->PLAYLIST->editMetaData($_REQUEST);
|
$uiHandler->PLAYLIST->editMetaData($_REQUEST);
|
||||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||||
|
@ -268,8 +273,10 @@ switch($_REQUEST['act']){
|
||||||
if ($_REQUEST['is_popup'])
|
if ($_REQUEST['is_popup'])
|
||||||
$uiHandler->redirUrl .= '?popup[]=_reload_parent&popup[]=_close';
|
$uiHandler->redirUrl .= '?popup[]=_reload_parent&popup[]=_close';
|
||||||
}
|
}
|
||||||
if ($uiHandler->alertMsg) $_SESSION['alertMsg'] = $uiHandler->alertMsg;
|
|
||||||
#header('Location: '.$uiHandler->redirUrl);
|
if ($uiHandler->alertMsg) {
|
||||||
|
$_SESSION['alertMsg'] = $uiHandler->alertMsg;
|
||||||
|
}
|
||||||
if (ob_get_contents()) {
|
if (ob_get_contents()) {
|
||||||
$ui_wait = 10;
|
$ui_wait = 10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<!-- start playlist editor -->
|
<div class="container_elements" style="width: 607px;">
|
||||||
<div class="container_elements" style="width: 607px;">
|
|
||||||
|
|
||||||
<div style="width: 574px;">
|
<div style="width: 574px;">
|
||||||
<div style="float: left;"><h1>##Playlist Editor## </h1></div>
|
<div style="float: left;"><h1>##Playlist Editor## </h1></div>
|
||||||
|
@ -11,77 +10,136 @@
|
||||||
<div class="right"> </div>
|
<div class="right"> </div>
|
||||||
<div class="clearer"> </div>
|
<div class="clearer"> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form name="PL" action="{$UI_HANDLER}" method="get">
|
||||||
|
<input type="hidden" name="act" value="PL.reOrder"
|
||||||
|
|
||||||
<div class="container_table" style="width: 594px;">
|
<div class="container_table" style="width: 594px;">
|
||||||
<table style="width: 574px;">
|
<table style="width: 574px;">
|
||||||
<form name="PL">
|
|
||||||
<!-- start repeat after 14 columns -->
|
<!-- start repeat after 14 columns -->
|
||||||
<tr class="blue_head">
|
<tr class="blue_head">
|
||||||
<td style="width: 30px"><input type="checkbox" name="all" onClick="collector_switchAll('PL')"></td>
|
<td style="width: 30px"><input type="checkbox" name="all" onClick="collector_switchAll('PL')"></td>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.forms['PL'].elements['all'].checked = false;
|
document.forms['PL'].elements['all'].checked = false;
|
||||||
</script>
|
</script>
|
||||||
<td style="width: 200px">##Name##</td>
|
<td>##Name##</td>
|
||||||
<td> ##Duration##</td>
|
<td style="width: 50px;">##Duration##</td>
|
||||||
<td style="width: 200px">##Artist##</td>
|
<td style="width: 200px">##Artist##</td>
|
||||||
<td style="width: 30px;">##Type##</td>
|
<td style="width: 35px;">##Type##</td>
|
||||||
<td style="width: 30px; border: 0">##Move##</td>
|
<td style="width: 35px; border: 0">##Move##</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- end repeat after 14 columns -->
|
<!-- end repeat after 14 columns -->
|
||||||
<!-- start item -->
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="draglist_container">
|
||||||
|
|
||||||
{foreach from=$PL->getFlat($PL->activeId) key='pos' item='i'}
|
{foreach from=$PL->getFlat($PL->activeId) key='pos' item='i'}
|
||||||
|
<!-- start item -->
|
||||||
|
<div style="position: relative; left: 0px; top: 0px;">
|
||||||
<!-- {$n++} -->
|
<!-- {$n++} -->
|
||||||
|
|
||||||
|
<table style="width: 574px;">
|
||||||
<!-- fade information -->
|
<!-- fade information -->
|
||||||
<tr onClick="return contextmenu('{$i.attrs.id}', {if $n == 1}'PL.changeFadeIn'{else}'PL.changeTransition'{/if})" style="background-color: #bbb">
|
<tr onClick="return contextmenu('{$i.attrs.id}', {if $n == 1}'PL.changeFadeIn'{else}'PL.changeTransition'{/if})" style="background-color: #bbb">
|
||||||
<td></td>
|
<td style="width: 30px"></td>
|
||||||
<td colspan="5" style="border: 0; cursor: pointer">##Fade## {$i.fadein_ms|string_format:"%d"} ms</td>
|
<td colspan="5" style="border: 0; cursor: pointer">##Fade## {$i.fadein_ms|string_format:"%d"} ms</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!-- end fade information -->
|
||||||
|
|
||||||
|
<!-- clip information -->
|
||||||
<tr class="{cycle values='blue1, blue2'}">
|
<tr class="{cycle values='blue1, blue2'}">
|
||||||
<td><input type="checkbox" class="checkbox" name="{$i.attrs.id}"/></td>
|
<td style="width: 30px"><input type="checkbox" class="checkbox" name="{$i.attrs.id}"/></td>
|
||||||
<td {include file="playlist/actionhandler.tpl"}>{$i.title}</td>
|
<td {include file="playlist/actionhandler.tpl"}>{$i.title}</td>
|
||||||
<td {include file="playlist/actionhandler.tpl"} style="text-align: right">
|
<td style="width: 50px;" {include file="playlist/actionhandler.tpl"} style="text-align: right">
|
||||||
{assign var="_duration" value=$i.duration}{niceTime in=$_duration}
|
{assign var="_duration" value=$i.duration}{niceTime in=$_duration}
|
||||||
</td>
|
</td>
|
||||||
<td {include file="playlist/actionhandler.tpl"}>{$i.creator}</td>
|
<td style="width: 200px" {include file="playlist/actionhandler.tpl"}>{$i.creator}</td>
|
||||||
<td {include file="playlist/actionhandler.tpl"}>
|
<td style="width: 35px" {include file="playlist/actionhandler.tpl"}>
|
||||||
<img src="img/{$i.type}.png" border="0" alt="{$i.type|capitalize}" {include file="sub/mouseover.tpl"} />
|
<img src="img/{$i.type}.png" border="0" alt="{$i.type|capitalize}" {include file="sub/mouseover.tpl"} />
|
||||||
</td>
|
</td>
|
||||||
<td style="border: 0">
|
<td style="width: 35px; border: 0">
|
||||||
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&id={$i.attrs.id}&pos={$pos-1}')"><img src="img/bt_top_xsm.png" alt="##move up##" vspace=1 hspace=1/></a>
|
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&id={$i.attrs.id}&pos={$pos-1}')"><img src="img/bt_top_xsm.png" alt="##move up##" vspace=1 hspace=1/></a>
|
||||||
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&id={$i.attrs.id}&pos={$pos+1}')"><img src="img/bt_bottom_xsm.png" alt="##move down##" vspace=1 hspace=1/></a>
|
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&id={$i.attrs.id}&pos={$pos+1}')"><img src="img/bt_bottom_xsm.png" alt="##move down##" vspace=1 hspace=1/></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!-- end clip information -->
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<input type="hidden" name="pl_items[{$i.attrs.id}]">
|
||||||
|
</div>
|
||||||
|
<!-- end item -->
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table style="width: 574px;">
|
||||||
{if $n}
|
{if $n}
|
||||||
<!-- fade information -->
|
<!-- last item fadeout information -->
|
||||||
<tr onClick="return contextmenu('{$i.attrs.id}', {if $n == 1}'PL.changeFadeIn'{else}'PL.changeFadeOut'{/if})" style="background-color: #bbb">
|
<tr onClick="return contextmenu('{$i.attrs.id}', {if $n == 1}'PL.changeFadeIn'{else}'PL.changeFadeOut'{/if})" style="background-color: #bbb">
|
||||||
<td></td>
|
<td style="width: 30px"></td>
|
||||||
<td colspan="5" style="border: 0; cursor: pointer">##Fade## {$i.fadeout_ms|string_format:"%d"} ms</td>
|
<td style="border: 0; cursor: pointer">##Fade## {$i.fadeout_ms|string_format:"%d"} ms</td>
|
||||||
</tr>
|
</tr>
|
||||||
{else}
|
{else}
|
||||||
|
<!-- empty playlist -->
|
||||||
<tr class="{cycle values='blue1, blue2'}">
|
<tr class="{cycle values='blue1, blue2'}">
|
||||||
<td style="border: 0" colspan="6" align="center">##No Entry##</td>
|
<td style="border: 0" colspan="6" align="center">##No Entry##</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
<!-- end item -->
|
|
||||||
</form>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer" style="width: 569px;">
|
<div class="footer" style="width: 569px;">
|
||||||
<input type="button" class="button_large" onClick="collector_submit('PL', '0&popup[]=PL.changeAllTransitions', '{$UI_BROWSER}', 'chgAllTrans', 400, 150)" value="##Change Fades##" />
|
<input type="button" class="button_large" onClick="collector_submit('PL', '0&popup[]=PL.changeAllTransitions', '{$UI_BROWSER}', 'chgAllTrans', 400, 150)" value="##Change Fades##" />
|
||||||
<input type="button" class="button_large" onClick="collector_submit('PL', 'PL.removeItem')" value="##Remove Selected##" />
|
<input type="button" class="button_large" onClick="collector_submit('PL', 'PL.removeItem')" value="##Remove Selected##" />
|
||||||
<input type="button" class="button_large" onClick="collector_clearAll('PL', 'PL.removeItem')" value="##Clear Playlist##" />
|
<input type="button" class="button_large" onClick="collector_clearAll('PL', 'PL.removeItem')" value="##Clear Playlist##" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container_button">
|
<div class="container_button">
|
||||||
<input type="button" class="button_large" value="##Save Playlist##" onClick="hpopup('{$UI_HANDLER}?act=PL.save')">
|
<input type="button" class="button_large" value="##Save Playlist##" onClick="hpopup('{$UI_HANDLER}?act=PL.save')">
|
||||||
<input type="button" class="button_large" value="##Revert to Saved##" onClick="popup('{$UI_BROWSER}?popup[]=PL.confirmRevert', 'PL.revertChanges', 400, 50)">
|
<input type="button" class="button_large" value="##Revert to Saved##" onClick="popup('{$UI_BROWSER}?popup[]=PL.confirmRevert', 'PL.revertChanges', 400, 50)">
|
||||||
<input type="button" class="button_large" value="##Delete Playlist##" onClick="popup('{$UI_BROWSER}?popup[]=PL.confirmDelete', 'PL.deleteActive', 400, 50)">
|
<input type="button" class="button_large" value="##Delete Playlist##" onClick="popup('{$UI_BROWSER}?popup[]=PL.confirmDelete', 'PL.deleteActive', 400, 50)">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container_button">
|
<div class="container_button">
|
||||||
|
<INPUT TYPE="button" class="button_large" VALUE="##Save Reorder##" onClick="javascript:draglist_manager.do_submit('PL','draglist_container')">
|
||||||
<input type="button" class="button_large" value="##Close Playlist##" onClick="popup('{$UI_BROWSER}?popup[]=PL.confirmRelease', 'PL.confirmRelease', 400, 50)">
|
<input type="button" class="button_large" value="##Close Playlist##" onClick="popup('{$UI_BROWSER}?popup[]=PL.confirmRelease', 'PL.confirmRelease', 400, 50)">
|
||||||
<input type="button" class="button_large" value="##Description##" onClick="location.href='{$UI_BROWSER}?act=PL.editMetaData'">
|
<input type="button" class="button_large" value="##Description##" onClick="location.href='{$UI_BROWSER}?act=PL.editMetaData'">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- end playlist editor -->
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
{assign var="_duration" value=null}
|
{assign var="_duration" value=null}
|
||||||
|
|
||||||
|
<script language="JavaScript" src="assets/dom-drag.js" type="text/javascript"></script>
|
||||||
|
<script language="JavaScript" src="assets/draglist.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script language="JavaScript">
|
||||||
|
|
||||||
|
// a bit ugly. draglist.js assumes the existence of a global
|
||||||
|
// dragListIndex array.
|
||||||
|
|
||||||
|
var dragListIndex = new Array();
|
||||||
|
|
||||||
|
// manager classes.
|
||||||
|
|
||||||
|
draglist_manager = new fv_dragList('draglist_container');
|
||||||
|
|
||||||
|
// queries all top level <divs> under the draglist_container
|
||||||
|
// div and sets up dragging.
|
||||||
|
|
||||||
|
draglist_manager.setup();
|
||||||
|
|
||||||
|
// queries all top level <span>'s under the draglist_container_horz
|
||||||
|
// div and sets up horizontal dragging.
|
||||||
|
|
||||||
|
|
||||||
|
// addes the newly created dragList to the list of draglists on
|
||||||
|
// the page (i.e. we can have more than one on a page)
|
||||||
|
|
||||||
|
addDragList( draglist_manager );
|
||||||
|
|
||||||
|
</script>
|
|
@ -10,6 +10,7 @@ class uiPlaylist
|
||||||
$this->token =& $_SESSION[UI_PLAYLIST_SESSNAME]['token'];
|
$this->token =& $_SESSION[UI_PLAYLIST_SESSNAME]['token'];
|
||||||
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
|
||||||
$this->redirectUrl = UI_BROWSER.'?popup[]=_2PL.simpleManagement&popup[]=_close';
|
$this->redirectUrl = UI_BROWSER.'?popup[]=_2PL.simpleManagement&popup[]=_close';
|
||||||
|
$this->returnUrl = UI_BROWSER.'?act=PL.simpleManagement';
|
||||||
}
|
}
|
||||||
|
|
||||||
function setReload()
|
function setReload()
|
||||||
|
@ -25,6 +26,11 @@ class uiPlaylist
|
||||||
$this->Base->redirUrl = $this->redirectUrl;
|
$this->Base->redirUrl = $this->redirectUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setReturn()
|
||||||
|
{
|
||||||
|
$this->Base->redirUrl = $this->returnUrl;
|
||||||
|
}
|
||||||
|
|
||||||
function getPLArray($id)
|
function getPLArray($id)
|
||||||
{
|
{
|
||||||
return $this->Base->gb->getPlaylistArray($id, $this->Base->sessid);
|
return $this->Base->gb->getPlaylistArray($id, $this->Base->sessid);
|
||||||
|
@ -333,6 +339,22 @@ class uiPlaylist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function reOrder($items)
|
||||||
|
{
|
||||||
|
asort($items); # just to be sure items are in right order
|
||||||
|
$pos = 0;
|
||||||
|
foreach($items as $id=>$v) {
|
||||||
|
$pos++;
|
||||||
|
$r = $this->Base->gb->moveAudioClipInPlaylist($this->token, $id, $pos, $this->Base->sessid);
|
||||||
|
if (PEAR::isError($r)) {
|
||||||
|
if (UI_VERBOSE) print_r($r);
|
||||||
|
$this->Base->_retMsg('Cannot move item');
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
function getCurrElement($id)
|
function getCurrElement($id)
|
||||||
{
|
{
|
||||||
$arr = $this->getFlat($this->activeId);
|
$arr = $this->getFlat($this->activeId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue