Update : Playlist ajax
Update : Playlist check function Update : Language phrases
This commit is contained in:
parent
6220fab31f
commit
be9d1da53b
7 changed files with 71 additions and 67 deletions
|
@ -612,28 +612,33 @@ if(!empty($mode))
|
|||
*/
|
||||
case 'add_playlist';
|
||||
{
|
||||
$vid = mysql_clean($_POST['vid']);
|
||||
$id = mysql_clean($_POST['id']);
|
||||
$pid = mysql_clean($_POST['pid']);
|
||||
$cbvid->action->add_playlist_item($pid,$vid);
|
||||
updateObjectStats('plist','video',$vid);
|
||||
|
||||
$type = post('objtype');
|
||||
|
||||
if(msg())
|
||||
if($type=='video')
|
||||
{
|
||||
$msg = msg_list();
|
||||
$msg = '<div class="msg">'.$msg[0].'</div>';;
|
||||
$cbvid->action->add_playlist_item($pid,$id );
|
||||
updateObjectStats('plist','video',$id);
|
||||
|
||||
if(msg())
|
||||
{
|
||||
$msg = msg_list();
|
||||
$msg = '<div class="msg">'.$msg[0].'</div>';;
|
||||
}
|
||||
if(error())
|
||||
{
|
||||
$err = error_list();
|
||||
$err = '<div class="error">'.$err[0].'</div>';;
|
||||
}
|
||||
|
||||
$ajax['msg'] = $msg ? $msg : '';
|
||||
$ajax['err'] = $err ? $err : '';
|
||||
|
||||
|
||||
echo json_encode($ajax);
|
||||
}
|
||||
if(error())
|
||||
{
|
||||
$err = error_list();
|
||||
$err = '<div class="error">'.$err[0].'</div>';;
|
||||
}
|
||||
|
||||
$ajax['msg'] = $msg ? $msg : '';
|
||||
$ajax['err'] = $err ? $err : '';
|
||||
|
||||
|
||||
echo json_encode($ajax);
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -641,34 +646,38 @@ if(!empty($mode))
|
|||
|
||||
case 'add_new_playlist';
|
||||
{
|
||||
$vid = mysql_clean($_POST['vid']);
|
||||
|
||||
$params = array('name'=>mysql_clean($_POST['plname']));
|
||||
$pid = $cbvid->action->create_playlist($params);
|
||||
|
||||
if($pid)
|
||||
if(post('objtype')=='video')
|
||||
{
|
||||
$eh->flush();
|
||||
$cbvid->action->add_playlist_item($pid,$vid);
|
||||
$vid = mysql_clean($_POST['id']);
|
||||
|
||||
$params = array('name'=>mysql_clean($_POST['plname']));
|
||||
$pid = $cbvid->action->create_playlist($params);
|
||||
|
||||
if($pid)
|
||||
{
|
||||
$eh->flush();
|
||||
$cbvid->action->add_playlist_item($pid,$vid);
|
||||
}
|
||||
|
||||
if(msg())
|
||||
{
|
||||
$msg = msg_list();
|
||||
$msg = '<div class="msg">'.$msg[0].'</div>';;
|
||||
}
|
||||
if(error())
|
||||
{
|
||||
$err = error_list();
|
||||
$err = '<div class="error">'.$err[0].'</div>';;
|
||||
}
|
||||
|
||||
$ajax['msg'] = $msg ? $msg : '';
|
||||
$ajax['err'] = $err ? $err : '';
|
||||
|
||||
|
||||
echo json_encode($ajax);
|
||||
}
|
||||
|
||||
if(msg())
|
||||
{
|
||||
$msg = msg_list();
|
||||
$msg = '<div class="msg">'.$msg[0].'</div>';;
|
||||
}
|
||||
if(error())
|
||||
{
|
||||
$err = error_list();
|
||||
$err = '<div class="error">'.$err[0].'</div>';;
|
||||
}
|
||||
|
||||
$ajax['msg'] = $msg ? $msg : '';
|
||||
$ajax['err'] = $err ? $err : '';
|
||||
|
||||
|
||||
echo json_encode($ajax);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ class cbactions
|
|||
e(lang("please_login_create_playlist"));
|
||||
elseif(empty($name))
|
||||
e(lang("please_enter_playlist_name"));
|
||||
elseif($this->playlist_exists($name,userid()))
|
||||
elseif($this->playlist_exists($name,userid(),$this->type))
|
||||
e(sprintf(lang("play_list_with_this_name_arlready_exists"),$name));
|
||||
else
|
||||
{
|
||||
|
@ -446,10 +446,13 @@ class cbactions
|
|||
/**
|
||||
* Function used to check weather playlist already exists or not
|
||||
*/
|
||||
function playlist_exists($name,$user)
|
||||
function playlist_exists($name,$user,$type=NULL)
|
||||
{
|
||||
global $db;
|
||||
$count = $db->count(tbl($this->playlist_tbl),"playlist_id"," userid='$user' AND playlist_name='$name'");
|
||||
if($type)
|
||||
$type = $this->type;
|
||||
$count = $db->count(tbl($this->playlist_tbl),"playlist_id"," userid='$user' AND playlist_name='$name' AND playlist_type='".$type."' ");
|
||||
|
||||
if($count)
|
||||
return true;
|
||||
else
|
||||
|
@ -600,6 +603,7 @@ class cbactions
|
|||
{
|
||||
global $db;
|
||||
$result = $db->select(tbl($this->playlist_tbl),"*"," playlist_type='".$this->type."' AND userid='".userid()."'");
|
||||
|
||||
if($db->num_rows>0)
|
||||
return $result;
|
||||
else
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -18,16 +18,6 @@ if(is_installed('editorspick'))
|
|||
|
||||
//i love coding :)
|
||||
|
||||
/**
|
||||
* Custom Top users query. Specially for sauditube.org
|
||||
* SELECT cb_video.userid,cb_video.views,cb_users.*, SUM(cb_video.views) AS total_views FROM cb_video,cb_users
|
||||
* WHERE cb_video.userid = cb_users.userid GROUP BY cb_users.userid
|
||||
|
||||
$result = $db->select(tbl('video,users'),tbl('video.userid,video.views,users.*').", SUM(".tbl('video.views').") AS total_views"
|
||||
,' '.tbl('video.userid').' = '.tbl('users.userid').' GROUP BY '.tbl('users.userid').'',10,' total_views DESC');
|
||||
if($db->num_rows > 0)
|
||||
assign('topusers',$result);
|
||||
*/
|
||||
|
||||
//Displaying The Template
|
||||
template_files('index.html');
|
||||
|
|
|
@ -643,7 +643,7 @@ var loading = loading_img+" Loading...";
|
|||
},'text');
|
||||
}
|
||||
|
||||
function add_playlist(mode,vid,form_id)
|
||||
function add_playlist(mode,vid,form_id,objtype)
|
||||
{
|
||||
$("#playlist_form_result").css("display","block");
|
||||
$("#playlist_form_result").html(loading);
|
||||
|
@ -654,7 +654,8 @@ var loading = loading_img+" Loading...";
|
|||
$.post(page,
|
||||
{
|
||||
mode : 'add_playlist',
|
||||
vid : vid,
|
||||
id : vid,
|
||||
objtype : objtype,
|
||||
pid : $("#playlist_id option:selected").val()
|
||||
},
|
||||
function(data)
|
||||
|
@ -687,7 +688,8 @@ var loading = loading_img+" Loading...";
|
|||
$.post(page,
|
||||
{
|
||||
mode : 'add_new_playlist',
|
||||
vid : vid,
|
||||
id : vid,
|
||||
objtype : objtype,
|
||||
plname : $("#"+form_id+" input:#playlist_name").val()
|
||||
},
|
||||
function(data)
|
||||
|
@ -696,13 +698,13 @@ var loading = loading_img+" Loading...";
|
|||
alert("No data");
|
||||
else
|
||||
{
|
||||
if(data.err != '')
|
||||
if(data.err )
|
||||
{
|
||||
$("#playlist_form_result").css("display","block");
|
||||
$("#playlist_form_result").html(data.err);
|
||||
}
|
||||
|
||||
if(data.msg!='')
|
||||
if(data.msg)
|
||||
{
|
||||
$("#playlist_form_result").css("display","block");
|
||||
$("#playlist_form_result").html(data.msg);
|
||||
|
|
|
@ -8,19 +8,19 @@
|
|||
<form id="add_playlist_form" name="playlist_form" method="post" action="" class="">
|
||||
Please select playlist name from following<br>
|
||||
<select name="playlist_id" id="playlist_id">
|
||||
{section name=plist loop=$playlists}
|
||||
<option value="{$playlists[plist].playlist_id}">{$playlists[plist].playlist_name}</option>
|
||||
{/section}
|
||||
{section name=plist loop=$playlists}
|
||||
<option value="{$playlists[plist].playlist_id}">{$playlists[plist].playlist_name}</option>
|
||||
{/section}
|
||||
</select> or <a href="javascript:void(0)" onClick="$('#add_playlist_form').css('display','none');$('#new_playlist_form').css('display','block')">create new playlist </a><br>
|
||||
|
||||
<input type="button" name="add_to_playlist" value="Add to playlist" class="cb_button" onclick="add_playlist('add','{$params.id}','add_playlist_form')"/>
|
||||
<input type="button" name="add_to_playlist" value="Add to playlist" class="cb_button" onclick="add_playlist('add','{$params.id}','add_playlist_form','{$type}')"/>
|
||||
</form>
|
||||
|
||||
<form id="new_playlist_form" name="new_playlist_form" method="post" action="" class="" style="display:none">
|
||||
<label for="playlist_name">Enter Playlist name</label>
|
||||
<input name="playlist_name" type="text" class="left_text_area" id="playlist_name" value="" size="45" style="width:300px"/> or <a href="javascript:void(0)" onClick="$('#add_playlist_form').css('display','block');$('#new_playlist_form').css('display','none')">Select from list </a><br>
|
||||
<input type="button" name="add_new_playlist" value="Add new playlist" class="cb_button" onclick="add_playlist('new','{$params.id}','new_playlist_form')"/>
|
||||
<input type="button" name="add_new_playlist" value="Add new playlist" class="cb_button" onclick="add_playlist('new','{$params.id}','new_playlist_form','{$type}')"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add To Playlist This {$type} -->
|
||||
<!-- Add To Playlist This {$type} -->
|
|
@ -60,7 +60,6 @@
|
|||
{show_flag_form id=$vdo.videoid type=Video}
|
||||
<div class="action_box" style="display:none" id="video_action_result_cont"></div>
|
||||
{show_playlist_form id=$vdo.videoid type=Video}
|
||||
|
||||
</div>
|
||||
<!-- Action Result Container End-->
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue