Added : Complete Playlist system
|
@ -183,6 +183,49 @@ switch($mode){
|
|||
|
||||
}
|
||||
break;
|
||||
|
||||
case "update_playlist_order":
|
||||
{
|
||||
$pid = mysql_clean(post('playlist_id'));
|
||||
$items = post('playlist_item');
|
||||
$items = array_map('mysql_clean',$items);
|
||||
|
||||
$cbvid->action->update_playlist_order($pid,$items);
|
||||
|
||||
if(error())
|
||||
echo json_encode(array('err'=>error()));
|
||||
else
|
||||
echo json_encode(array('success'=>'yes'));
|
||||
}
|
||||
break;
|
||||
|
||||
case "save_playlist_item_note":
|
||||
{
|
||||
$item_id = mysql_clean(post('item_id'));
|
||||
$text = mysql_clean(post('text'));
|
||||
|
||||
$cbvid->action->save_playlist_item_note($item_id,$text);
|
||||
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error()));
|
||||
} else {
|
||||
echo json_encode(array('msg'=>msg()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case "remove_playlist_item":
|
||||
{
|
||||
$item_id = mysql_clean(post('item_id'));
|
||||
$cbvid->action->delete_playlist_item($item_id);
|
||||
if(error())
|
||||
echo json_encode(array('err'=>error()));
|
||||
else
|
||||
echo json_encode(array('success'=>'ok'));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
exit(json_encode(array('err'=>array(lang('Invalid request')))));
|
||||
|
|
|
@ -1116,4 +1116,7 @@ CREATE TABLE IF NOT EXISTS `{tbl_prefix}slugs` (
|
|||
ALTER TABLE `{tbl_prefix}video_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}user_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}group_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}collection_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}collection_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
|
||||
ALTER TABLE `{tbl_prefix}playlist_items` ADD `order` BIGINT( 10 ) NOT NULL AFTER `playlist_id`;
|
||||
ALTER TABLE `{tbl_prefix}playlist_items` ADD `item_note` MEDIUMTEXT NOT NULL AFTER `item_order`;
|
||||
|
|
|
@ -14,6 +14,10 @@ ALTER TABLE `{tbl_prefix}user_categories` ADD `category_icon` VARCHAR( 100 ) N
|
|||
ALTER TABLE `{tbl_prefix}group_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}collection_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
|
||||
ALTER TABLE `{tbl_prefix}playlist_items` ADD `order` BIGINT( 10 ) NOT NULL AFTER `playlist_id`;
|
||||
ALTER TABLE `{tbl_prefix}playlist_items` ADD `item_note` MEDIUMTEXT NOT NULL AFTER `item_order`;
|
||||
ALTER TABLE `{tbl_prefix}collection_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `{tbl_prefix}photosmeta` (
|
||||
`pmeta_id` bigint(255) NOT NULL AUTO_INCREMENT,
|
||||
`photo_id` bigint(255) NOT NULL,
|
||||
|
|
|
@ -483,12 +483,28 @@ class cbactions
|
|||
function getPlaylistThumb($pid)
|
||||
{
|
||||
$array = array();
|
||||
$array[] = IMAGEURL.'/playlist-default.png';
|
||||
$array[] = IMAGEURL.'/playlist-default.png';
|
||||
$array[] = IMAGEURL.'/playlist-default.png';
|
||||
|
||||
$items = $this->get_playlist_items($pid,NULL,3);
|
||||
|
||||
global $cbvid, $cbaudio;
|
||||
$array = array();
|
||||
|
||||
if($items)
|
||||
foreach($items as $item)
|
||||
{
|
||||
$item['type']=='v';
|
||||
$array[] = GetThumb($item['object_id']);
|
||||
}
|
||||
else
|
||||
return array(TEMPLATEURL.'/images/playlist-default.png');
|
||||
|
||||
$array= array_unique($array);
|
||||
rsort($array);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
function get_playlist_thumb($pid){ return $this->getPlaylistThumb($pid); }
|
||||
|
||||
/**
|
||||
* Function used to check weather playlist already exists or not
|
||||
*/
|
||||
|
@ -541,9 +557,12 @@ class cbactions
|
|||
// e(sprintf(lang('this_already_exist_in_pl'),$this->name));
|
||||
else
|
||||
{
|
||||
$last_order = $this->get_last_order($pid);
|
||||
$this_order = $last_order+1;
|
||||
|
||||
$db->insert(tbl($this->playlist_items_tbl),
|
||||
array("object_id","playlist_id","date_added","playlist_item_type","userid"),
|
||||
array($id,$pid,now(),$this->type,userid()));
|
||||
array("object_id","playlist_id","date_added","playlist_item_type","userid","item_order"),
|
||||
array($id,$pid,now(),$this->type,userid(),$this_order));
|
||||
|
||||
//Update total items in the playlist
|
||||
$db->update(tbl('playlists'),array('total_items','last_update'),
|
||||
|
@ -612,9 +631,15 @@ class cbactions
|
|||
function edit_playlist($params)
|
||||
{
|
||||
global $db;
|
||||
$name = mysql_clean($params['name']);
|
||||
$pdetails = $this->get_playlist($params['pid']);
|
||||
|
||||
|
||||
//$newarray = array_map('mysql_clean',$params);
|
||||
$newarray = $params;
|
||||
extract($newarray);
|
||||
|
||||
//$name = mysql_clean($params['name']);
|
||||
$pdetails = $this->get_playlist($pid);
|
||||
|
||||
if(!$pdetails)
|
||||
e(lang("playlist_not_exist"));
|
||||
elseif(!userid())
|
||||
|
@ -625,9 +650,29 @@ class cbactions
|
|||
e(sprintf(lang("play_list_with_this_name_arlready_exists"),$name));
|
||||
else
|
||||
{
|
||||
$db->update(tbl($this->playlist_tbl),array("playlist_name"),
|
||||
array($name)," playlist_id='".$params['pid']."'");
|
||||
e(lang("play_list_updated"),"m");
|
||||
$fields = array(
|
||||
'playlist_name',
|
||||
'description',
|
||||
'tags',
|
||||
'privacy',
|
||||
'allow_comments',
|
||||
'allow_rating',
|
||||
'date_added'
|
||||
);
|
||||
|
||||
$values = array(
|
||||
$name,
|
||||
$description,
|
||||
$tags,
|
||||
$privacy,
|
||||
$allow_comments,
|
||||
$allow_rating,
|
||||
now()
|
||||
);
|
||||
|
||||
$db->update(tbl($this->playlist_tbl),$fields,
|
||||
$values," playlist_id='".$pid."'");
|
||||
e(lang("play_list_updated"),"m");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -661,18 +706,22 @@ class cbactions
|
|||
$result = $db->select(tbl($this->playlist_tbl),"*"," playlist_type='".$this->type."' AND userid='".userid()."'");
|
||||
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
{
|
||||
return $result;
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to get playlist items
|
||||
*/
|
||||
function get_playlist_items($pid)
|
||||
function get_playlist_items($pid,$order=NULL,$limit=NULL)
|
||||
{
|
||||
global $db;
|
||||
$result = $db->select(tbl($this->playlist_items_tbl),"*","playlist_id='$pid'");
|
||||
if(!$order)
|
||||
$order = " item_order ASC ";
|
||||
$result = $db->select(tbl($this->playlist_items_tbl),"*","playlist_id='$pid'",$limit,$order);
|
||||
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
|
@ -703,6 +752,146 @@ class cbactions
|
|||
return $db->count(tbl($this->playlist_items_tbl),"playlist_item_id"," playlist_item_type='".$this->type."'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get last order number in the playlist for its items
|
||||
*
|
||||
* @param INT pid
|
||||
* @return INT oid
|
||||
*/
|
||||
function get_last_order($pid)
|
||||
{
|
||||
global $db;
|
||||
$result = $db->select(tbl('playlist_items'),'item_order',"playlist_id='$pid' ",1,' item_order DESC ');
|
||||
|
||||
|
||||
if($result)
|
||||
{
|
||||
return $result[0]['item_order'];
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update playist order
|
||||
*
|
||||
* @param INT pid
|
||||
* @param ARRAY playlist_items array
|
||||
* @return BOOLEAN
|
||||
*/
|
||||
function update_playlist_order($pid,$items,$uid=NULL)
|
||||
{
|
||||
global $db;
|
||||
|
||||
if(!$uid) $uid = userid();
|
||||
|
||||
if(!$this->playlist_exists_id($pid,$uid))
|
||||
{
|
||||
e(lang("Playlist does not exists"));
|
||||
return false;
|
||||
}
|
||||
|
||||
$itemsNew = array();
|
||||
$count = 0;
|
||||
foreach($items as $item)
|
||||
{
|
||||
$count++;
|
||||
$itemsNew[$item] = $count;
|
||||
}
|
||||
|
||||
//Setting up the query...
|
||||
$query = "UPDATE ".tbl('playlist_items');
|
||||
$query .= " SET item_order = CASE playlist_item_id ";
|
||||
foreach($itemsNew as $item => $order)
|
||||
{
|
||||
$query .= sprintf("WHEN '%s' THEN '%s' ",$item,$order);
|
||||
$query .= " ";
|
||||
}
|
||||
$query .= " END ";
|
||||
$query .= " WHERE playlist_item_id in(".implode($items,',')
|
||||
.") AND playlist_id='$pid' ";
|
||||
|
||||
$db->Execute($query);
|
||||
|
||||
if(mysql_error()) die ($db->db_query.'<br>'.mysql_error());
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save playlist note...
|
||||
*
|
||||
* @param INT pid
|
||||
* @param STRING text
|
||||
*/
|
||||
function save_playlist_item_note($itemid,$text,$uid=NULL)
|
||||
{
|
||||
global $db;
|
||||
|
||||
if(!$uid)
|
||||
$uid = userid();
|
||||
|
||||
if(!$this->playlist_item_exists($itemid,$uid))
|
||||
e(lang("Playlist item deos not exist"));
|
||||
else{
|
||||
$db->update(tbl('playlist_items'),array('item_note'),array($text)
|
||||
,"playlist_item_id='$itemid' ");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function used to check playlist item exists or not
|
||||
*
|
||||
* @param INT item_id
|
||||
* @param INT playlist_id
|
||||
* @param INT uid
|
||||
*/
|
||||
function playlist_item_exists($item_id,$uid=NULL)
|
||||
{
|
||||
if($uid)
|
||||
{
|
||||
$ucond = " AND userid='$uid' ";
|
||||
}
|
||||
|
||||
global $db;
|
||||
|
||||
$count = $db->count(tbl('playlist_items'),"playlist_item_id","playlist_item_id='$item_id' $ucond ");
|
||||
|
||||
if($count)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* function checks weather paylist exist or not
|
||||
*
|
||||
* @param INT pid
|
||||
* @param INT uid
|
||||
*/
|
||||
|
||||
function playlist_exists_id($pid,$uid=NULL)
|
||||
{
|
||||
if($uid)
|
||||
{
|
||||
$ucond = " AND userid='$uid' ";
|
||||
}
|
||||
|
||||
global $db;
|
||||
$count = $db->count(tbl($this->playlist_tbl),"playlist_id"," playlist_id='$pid' $ucond");
|
||||
|
||||
if($count)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1490,11 +1490,16 @@ class CBvideo extends CBCategory
|
|||
$ptbl = tbl($this->action->playlist_items_tbl);
|
||||
$vtbl = tbl($this->dbtbl['video']);
|
||||
|
||||
$tbls = $ptbl.','.$vtbl;
|
||||
$fields = $ptbl.".*,$vtbl.title,$vtbl.comments_count,$vtbl.views,$vtbl.userid,$vtbl.date_added,
|
||||
$vtbl.file_name,$vtbl.category,$vtbl.description,$vtbl.videokey,$vtbl.tags,$vtbl.videoid,$vtbl.duration";
|
||||
$result = $db->select($tbls,$fields,"playlist_id='$pid' AND ".$vtbl.".videoid=".$ptbl.".object_id");
|
||||
if($db->num_rows>0)
|
||||
|
||||
$result = $db->select(tbl('playlist_items')
|
||||
.' LEFT JOIN '.tbl('video').' ON '
|
||||
.$ptbl.'.object_id'.' = '.tbl('video.videoid')
|
||||
,$fields,$ptbl.'.object_id='.$vtbl.'.videoid AND '.$ptbl
|
||||
.".playlist_id='$pid'",NULL,$ptbl.'.item_order ASC');
|
||||
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
return false;
|
||||
|
|
|
@ -74,7 +74,8 @@ switch($mode)
|
|||
assign('mode','manage_playlist');
|
||||
//Getting List of available playlists
|
||||
$playlists = $cbvid->action->get_playlists();
|
||||
assign('total_playlists',count($playlists));
|
||||
|
||||
assign('total_playlists',$playlists? count($playlists) : 0);
|
||||
assign('playlists',$playlists);
|
||||
|
||||
|
||||
|
@ -86,28 +87,29 @@ switch($mode)
|
|||
|
||||
if(isset($_POST['delete_playlist_item']))
|
||||
{
|
||||
$items = post('check_playlist_items');
|
||||
|
||||
if(count($items)>0)
|
||||
{
|
||||
foreach($items as $item)
|
||||
{
|
||||
$item = mysql_clean($item);
|
||||
$cbvid->action->delete_playlist_item($item);
|
||||
}
|
||||
|
||||
if(!error())
|
||||
{
|
||||
$eh->flush();
|
||||
e(lang("playlist_items_have_been_removed"),"m");
|
||||
}else
|
||||
{
|
||||
$eh->flush();
|
||||
e(lang("playlist_item_doesnt_exist"));
|
||||
}
|
||||
|
||||
}else
|
||||
e(lang("no_item_was_selected_to_delete"));
|
||||
$items = post('check_playlist_items');
|
||||
|
||||
|
||||
if(count($items)>0)
|
||||
{
|
||||
foreach($items as $item)
|
||||
{
|
||||
$item = mysql_clean($item);
|
||||
$cbvid->action->delete_playlist_item($item);
|
||||
}
|
||||
|
||||
if(!error())
|
||||
{
|
||||
$eh->flush();
|
||||
e(lang("playlist_items_have_been_removed"),"m");
|
||||
}else
|
||||
{
|
||||
$eh->flush();
|
||||
e(lang("playlist_item_doesnt_exist"));
|
||||
}
|
||||
|
||||
}else
|
||||
e(lang("no_item_was_selected_to_delete"));
|
||||
}
|
||||
|
||||
assign('mode','edit_playlist');
|
||||
|
@ -115,7 +117,15 @@ switch($mode)
|
|||
|
||||
if(isset($_POST['edit_playlist']))
|
||||
{
|
||||
$params = array('name'=>mysql_clean($_POST['name']),'pid'=>mysql_clean($pid));
|
||||
$params = array(
|
||||
'name'=>($_POST['name']),
|
||||
'description' => (post('description')),
|
||||
'tags' => (post('tags')),
|
||||
'privacy' => (post('privacy')),
|
||||
'allow_comments' => (post('allow_comments')),
|
||||
'allow_rating' => (post('allow_rating')),
|
||||
'pid'=>($pid));
|
||||
|
||||
$cbvid->action->edit_playlist($params);
|
||||
}
|
||||
|
||||
|
@ -133,7 +143,8 @@ switch($mode)
|
|||
assign('playlist',$playlist);
|
||||
//Getting Playlist Item
|
||||
$items = $cbvid->get_playlist_items($pid);
|
||||
assign('items',$items);
|
||||
assign('items',$items );
|
||||
assign('total_items',$items?count($items) : 0);
|
||||
|
||||
}else
|
||||
e(lang('playlist_not_exist'));
|
||||
|
|
35
upload/styles/cbv3/bootstrap/js/bootbox.min.js
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* bootbox.js v2.3.1
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (C) 2011-2012 by Nick Payne <nick@kurai.co.uk>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE
|
||||
*/
|
||||
var bootbox=window.bootbox||function(){function j(b,a){null==a&&(a=k);return"string"==typeof h[a][b]?h[a][b]:a!=l?j(b,l):b}var k="en",l="en",o=!0,g={},f={},h={en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},ru:{OK:"OK",CANCEL:"\u041e\u0442\u043c\u0435\u043d\u0430",
|
||||
CONFIRM:"\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c"}};f.setLocale=function(b){for(var a in h)if(a==b){k=b;return}throw Error("Invalid locale: "+b);};f.addLocale=function(b,a){"undefined"==typeof h[b]&&(h[b]={});for(var c in a)h[b][c]=a[c]};f.setIcons=function(b){g=b;if("object"!==typeof g||null==g)g={}};f.alert=function(){var b="",a=j("OK"),c=null;switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"function"==typeof arguments[1]?c=arguments[1]:a=arguments[1];break;
|
||||
case 3:b=arguments[0];a=arguments[1];c=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}return f.dialog(b,{label:a,icon:g.OK,callback:c},{onEscape:c})};f.confirm=function(){var b="",a=j("CANCEL"),c=j("CONFIRM"),e=null;switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"function"==typeof arguments[1]?e=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];"function"==typeof arguments[2]?e=arguments[2]:c=arguments[2];break;
|
||||
case 4:b=arguments[0];a=arguments[1];c=arguments[2];e=arguments[3];break;default:throw Error("Incorrect number of arguments: expected 1-4");}return f.dialog(b,[{label:a,icon:g.CANCEL,callback:function(){"function"==typeof e&&e(!1)}},{label:c,icon:g.CONFIRM,callback:function(){"function"==typeof e&&e(!0)}}])};f.prompt=function(){var b="",a=j("CANCEL"),c=j("CONFIRM"),e=null;switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"function"==typeof arguments[1]?e=arguments[1]:a=arguments[1];
|
||||
break;case 3:b=arguments[0];a=arguments[1];"function"==typeof arguments[2]?e=arguments[2]:c=arguments[2];break;case 4:b=arguments[0];a=arguments[1];c=arguments[2];e=arguments[3];break;default:throw Error("Incorrect number of arguments: expected 1-4");}var m=$("<form></form>");m.append("<input autocomplete=off type=text />");var h=f.dialog(m,[{label:a,icon:g.CANCEL,callback:function(){"function"==typeof e&&e(null)}},{label:c,icon:g.CONFIRM,callback:function(){"function"==typeof e&&e(m.find("input[type=text]").val())}}],
|
||||
{header:b});h.on("shown",function(){m.find("input[type=text]").focus();m.on("submit",function(a){a.preventDefault();h.find(".btn-primary").click()})});return h};f.modal=function(){var b,a,c,e={onEscape:null,keyboard:!0,backdrop:!0};switch(arguments.length){case 1:b=arguments[0];break;case 2:b=arguments[0];"object"==typeof arguments[1]?c=arguments[1]:a=arguments[1];break;case 3:b=arguments[0];a=arguments[1];c=arguments[2];break;default:throw Error("Incorrect number of arguments: expected 1-3");}e.header=
|
||||
a;c="object"==typeof c?$.extend(e,c):e;return f.dialog(b,[],c)};f.dialog=function(b,a,c){var e=null,f="",h=[],c=c||{};null==a?a=[]:"undefined"==typeof a.length&&(a=[a]);for(var d=a.length;d--;){var g=null,j=null,k="",l=null;if("undefined"==typeof a[d].label&&"undefined"==typeof a[d]["class"]&&"undefined"==typeof a[d].callback){var g=0,p=null,n;for(n in a[d])if(p=n,1<++g)break;1==g&&"function"==typeof a[d][n]&&(a[d].label=p,a[d].callback=a[d][n])}"function"==typeof a[d].callback&&(l=a[d].callback);
|
||||
a[d]["class"]?j=a[d]["class"]:d==a.length-1&&2>=a.length&&(j="btn-primary");g=a[d].label?a[d].label:"Option "+(d+1);a[d].icon&&(k="<i class='"+a[d].icon+"'></i> ");f+="<a data-handler='"+d+"' class='btn "+j+"' href='#'>"+k+""+g+"</a>";h[d]=l}a=["<div class='bootbox modal'>"];if(c.header){d="";if("undefined"==typeof c.headerCloseButton||c.headerCloseButton)d="<a href='#' class='close'>×</a>";a.push("<div class='modal-header'>"+d+"<h3>"+c.header+"</h3></div>")}a.push("<div class='modal-body'></div>");
|
||||
f&&a.push("<div class='modal-footer'>"+f+"</div>");a.push("</div>");var i=$(a.join("\n"));("undefined"===typeof c.animate?o:c.animate)&&i.addClass("fade");$(".modal-body",i).html(b);i.bind("hidden",function(){i.remove()});i.bind("hide",function(){if("escape"==e&&"function"==typeof c.onEscape)c.onEscape()});$(document).bind("keyup.modal",function(a){27==a.which&&(e="escape")});i.bind("shown",function(){$("a.btn-primary:last",i).focus()});i.on("click",".modal-footer a, a.close",function(a){var b=$(this).data("handler"),
|
||||
b=h[b],c=null;"function"==typeof b&&(c=b());!1!==c&&(a.preventDefault(),e="button",i.modal("hide"))});null==c.keyboard&&(c.keyboard="function"==typeof c.onEscape);$("body").append(i);i.modal({backdrop:c.backdrop||!0,keyboard:c.keyboard});return i};f.hideAll=function(){$(".bootbox").modal("hide")};f.animate=function(b){o=b};return f}();
|
After Width: | Height: | Size: 180 B |
After Width: | Height: | Size: 120 B |
After Width: | Height: | Size: 105 B |
After Width: | Height: | Size: 111 B |
After Width: | Height: | Size: 110 B |
After Width: | Height: | Size: 107 B |
After Width: | Height: | Size: 101 B |
After Width: | Height: | Size: 123 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 8.7 KiB |
1320
upload/styles/cbv3/js/bootstrap/jquery-ui-1.8.16.custom.css
vendored
Normal file
6
upload/styles/cbv3/js/bootstrap/jquery.ui.1.8.16.ie.css
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-left, .ui-corner-bottom{ border-radius:0px;}
|
||||
.ui-state-active,.ui-tabs-selected { border-radius:0px;}
|
||||
.ui-tabs-selected { border-radius:0px;}
|
||||
.ui-tabs .ui-tabs-nav li{ filter:none;}
|
||||
.ui-tabs .ui-tabs-nav li a { border-radius:0px; }
|
69
upload/styles/cbv3/js/jquery-ui.js
vendored
Normal file
|
@ -435,4 +435,100 @@ function send_private_message(e) {
|
|||
}
|
||||
obj.button('reset');
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save playlist text
|
||||
* @param item_id INT
|
||||
* @param text STRING
|
||||
*/
|
||||
function save_playlist_item_note(item_id,text)
|
||||
{
|
||||
amplify.request('main',{
|
||||
'mode' : 'save_playlist_item_note',
|
||||
'item_id' : item_id,
|
||||
'text' : text
|
||||
},function(data){
|
||||
if(data.err){
|
||||
displayError(data.err);
|
||||
}else
|
||||
{
|
||||
$('.save-plst-text[data-id='+item_id+']')
|
||||
.button('reset');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function used to remove item from playlist
|
||||
*
|
||||
* @param itemid
|
||||
*/
|
||||
function remove_playlist_item(itemid)
|
||||
{
|
||||
loading('confirm');
|
||||
|
||||
amplify.request('main',{
|
||||
mode : 'remove_playlist_item',
|
||||
item_id : itemid
|
||||
},function(data){
|
||||
|
||||
//Incase there is any..
|
||||
$('#confirm').modal('hide');
|
||||
clear_confirm();
|
||||
|
||||
loading('confirm','hide');
|
||||
|
||||
if(data.err)
|
||||
displayError(data.err);
|
||||
else{
|
||||
$('#'+itemid+'-pitem')
|
||||
.hide('fast')
|
||||
.remove();
|
||||
|
||||
update_manage_playlist_order();
|
||||
update_counter('#playlist_items_count',-1);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update manage playlist order
|
||||
*/
|
||||
function update_manage_playlist_order(){
|
||||
var $length = $('#playlist-manage > li').size();
|
||||
|
||||
if($length>0){
|
||||
for(i=1;i<=$length;i++)
|
||||
{
|
||||
var my = i+1;
|
||||
$('#playlist-manage li:nth-child('+my+') ul .iteration')
|
||||
.text(i+'.');
|
||||
}
|
||||
}else{
|
||||
$('#no-playlist-items-div').show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to make confirmation about any action
|
||||
*/
|
||||
function cb_confirm(title,text,callback)
|
||||
{
|
||||
$('#confirm .modal-header h3').text(title);
|
||||
$('#confirm .modal-body').html(text);
|
||||
$('#confirm-yes').bind('click',callback);
|
||||
$('#confirm').modal('show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears confirm form events and text
|
||||
*/
|
||||
function clear_confirm(){
|
||||
$('#confirm .modal-header h3').text('');
|
||||
$('#confirm .modal-body').html('');
|
||||
$('#confirm-yes').unbind('click');
|
||||
}
|
|
@ -40,6 +40,11 @@
|
|||
<!-- Including ClipBucket Global_header -->
|
||||
{include_header file='global_header'}
|
||||
|
||||
<!-- Including jquery-ui and its custom boostrap UI theme-->
|
||||
<script type="text/javascript" src="{$template_url}/js/jquery-ui.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{$template_url}/js/bootstrap/jquery-ui-1.8.16.custom.css" />
|
||||
|
||||
|
||||
<!-- Including Bootstrap JS
|
||||
NOTE : JQUERY v1.7 or higher is required -->
|
||||
<script type="text/javascript" src="{$template_url}/bootstrap/js/bootstrap.min.js"></script>
|
||||
|
|
|
@ -29,6 +29,22 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Confirm Modal Box -->
|
||||
<div class="modal hide" id="confirm">
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">×</button>
|
||||
<h3>Confirm</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
{loading_pointer place='confirm'}
|
||||
<a href="javascript:void(0)" id="confirm-yes" class="btn btn-primary">Yes</a>
|
||||
<a href="javascript:void(0)" onclick="clear_confirm();" class="btn btn" data-dismiss="modal">No</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<header>
|
||||
<div class="header-top">
|
||||
<div class="logo-container"><a href="{$baseurl}"><img src="{$imageurl}/logo.png" /></a></div>
|
||||
|
|
|
@ -120,6 +120,56 @@
|
|||
$('.cb-tooltip').tooltip();
|
||||
|
||||
|
||||
//Adding sortablities
|
||||
$('#playlist-manage').sortable({
|
||||
handle : '.move',
|
||||
placeholder: "ui-state-highlight",
|
||||
axis: 'y',
|
||||
stop : function(event,ui){
|
||||
|
||||
var formdata =
|
||||
$('#playlist-manage-form')
|
||||
.serialize();
|
||||
|
||||
|
||||
update_manage_playlist_order();
|
||||
|
||||
formdata += '&mode=update_playlist_order';
|
||||
|
||||
amplify.request('main',formdata,function(data){
|
||||
if(data.err)
|
||||
{
|
||||
displayError(data.err);
|
||||
}else
|
||||
{
|
||||
"...";
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$('.save-plst-text').click(function(){
|
||||
|
||||
$(this).button('loading');
|
||||
var item_id = $(this).attr('data-id');
|
||||
var text = $('#'+item_id+'-text').val();
|
||||
|
||||
save_playlist_item_note(item_id,text);
|
||||
})
|
||||
|
||||
|
||||
|
||||
$('.remove_playlist_item').click(function(){
|
||||
var title = $(this).attr('data-confirm-title');
|
||||
var text = $(this).attr('data-confirm-text');
|
||||
var id = $(this).attr('data-id');
|
||||
cb_confirm(title,text,function(){
|
||||
remove_playlist_item(id);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
|
@ -151,6 +151,7 @@
|
|||
|
||||
<!-- Have to edit playlist -->
|
||||
{if $mode=='edit_playlist'}
|
||||
{$pid=$playlist.playlist_id}
|
||||
<div class="account-heading">
|
||||
<h2>{lang code='Manage playlist'}</h2>
|
||||
|
||||
|
@ -238,8 +239,51 @@
|
|||
<hr/>
|
||||
|
||||
|
||||
<h2>Playlist items</h2>
|
||||
<h2>Playlist items (<span id="playlist_items_count">{$total_items}</span>)</h2>
|
||||
<div class="height20"></div>
|
||||
|
||||
{if $items}
|
||||
<form method="post" id="playlist-manage-form" onsubmit="return false;" >
|
||||
<ul class="playlist-manage" id="playlist-manage">
|
||||
<input type="hidden" name="playlist_id" value="{$playlist.playlist_id}"/>
|
||||
{foreach $items as $item}
|
||||
{$itemid = $item.playlist_item_id}
|
||||
<li id="{$itemid}-pitem">
|
||||
<input type="hidden" name="playlist_item[]" value="{$item.playlist_item_id}" />
|
||||
<ul>
|
||||
<li class="iteration">{$item@iteration}.</li>
|
||||
<li class="move"><i class=" icon-align-justify"></i></li>
|
||||
<li class="thumb"><img src="{getThumb vdetails=$item}" /></li>
|
||||
<li class="title">
|
||||
<div class="video-title">
|
||||
<a href="{videoLink vdetails=$item}">{$item.title}</a>
|
||||
</div>
|
||||
|
||||
<input type="text" class="span4" id="{$itemid}-text"
|
||||
value="{$item.item_note}" placeholder="{lang code='Enter note for this item'}"/>
|
||||
<a href="javascript:void(0);" class="btn btn-info save-plst-text"
|
||||
data-loading-text="{lang code='saving..'}"
|
||||
data-id="{$itemid}">{lang code='save'}</a>
|
||||
|
||||
</li>
|
||||
<li class="delete">
|
||||
<a href="javascript:void(0)" data-id="{$itemid}" class="btn remove_playlist_item"
|
||||
data-confirm-title="{lang code='Confirm remove item'}"
|
||||
data-confirm-text="{lang code='Are you sure you want to remove %s from %s'|sprintf:$item.title:$playlist.playlist_name}">
|
||||
<i class="icon-trash"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="alert alert-info {if $total_items>0}display-none{/if}" id="no-playlist-items-div">{lang code='You do not have any items in this playlist, to add videos, goto any video page and click add to and follow the name'}</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -259,3 +259,19 @@ position: absolute;}
|
|||
|
||||
.video-options{right: 5px; bottom: 5px;}
|
||||
.video-options .btn{padding: 0px 2px; line-height: normal}
|
||||
|
||||
.playlist-manage,.playlist-manage ul{ margin: 0px; padding: 0px}
|
||||
|
||||
.playlist-manage > li{list-style: none; padding: 0px; clear: both;
|
||||
margin-bottom: 30px; min-height: 60px}
|
||||
|
||||
.playlist-manage li ul li{margin:0px; float: left; display: inline-block;
|
||||
list-style: none; padding: 0px;margin-right: 10px; min-height: 60px }
|
||||
.playlist-manage .iteration{font-size: 11px; }
|
||||
.playlist-manage .thumb img{width: 70px; height: 50px; border: 1px solid #000;
|
||||
box-shadow: 2px 2px 2px #aaa; margin-right:5px}
|
||||
.playlist-manage .iteration,.playlist-manage .move,.playlist-manage .delete{padding-top: 18px}
|
||||
.playlist-manage .delete{float: right}
|
||||
.playlist-manage .span4{vertical-align:top}
|
||||
.playlist-manage .video-title{font-size: 14px; font-weight:bold; margin-bottom: 5px}
|
||||
.playlist-manage .move{cursor:move}
|