<?php 
error_reporting(0);
if(!$userlogined==true){exit("<script type=\"text/javascript\">location.href='".cd_webpath."user/login.php?login_referer=".cd_webpath."user/".rewrite_url('space.php?do=valbum')."';</script>");}
?>
  <div class="user"> 
   <div class="user_center"> 
<?php include_once('source/space_menu.php');?> 
<?php if($view==""){ ?>
<script type="text/javascript">
function changeImg(){
var imgSrc = $("#imgObj");
var src = imgSrc.attr("src");
imgSrc.attr("src",chgUrl(src));
}
function chgUrl(url){
var timestamp = (new Date()).valueOf();
if((url.indexOf("&")>=0)){
url = "source/ajax.php?ac=seccode&rand=" + timest
}else{
url = "source/ajax.php?ac=seccode&rand=" + timest
}
return url;
}
</script> 
    <div class="user_main"> 
     <div class="uMain_content"> 
      <div class="main_nav"> 
       <ul> 
        <li class="concert"> <a href="<?php echo rewrite_url('space.php?do=valbum&view=list');?>">已审专辑</a> </li> 
        <li class="find"> <a href="<?php echo rewrite_url('space.php?do=valbum&view=passed');?>">待审专辑</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=valbum');?>">创建专辑</a> 
       </div> 
      </div> 
      <div class="main"> 
       <div id="tooltip" class="refresh"> 
       </div> 
      </div> 
      <div class="minHeight500"> 
       <div class="profile"> 
        <div class="title"> <div class="name">制作视频专辑</div> </div> 
        <form name="form"> 
         <ul id="specialAddMain"> 
          <li> 
           <div class="name">专辑名称：</div> 
           <div class="input"> <input type="text" style="width: 190px;" class="input_normal" name="rspecialName" id="rspecialName" maxlength="100" /> </div> 
           <div class="input_msg" id="mspecialName">作为专辑名称请您认真填写，合理的名称审核才会通过。</div> </li> 
          <li> 
           <div class="name">所属歌手：</div> 
           <div class="input"> <input type="text" style="width: 90px;" class="input_normal" name="rSingerID" id="rSingerID" maxlength="100" /> </div> 
           <div class="input_msg"></div>
           <div class="input_msg" id="mSingerID">请输入专辑所属歌手。</div> </li> 
          <li> 
           <div class="name">发行公司：</div> 
           <div class="input"> <input type="text" style="width: 125px;" class="input_normal" name="rGongSi" id="rGongSi" maxlength="50" /> </div> 
           <div class="input_msg" id="mGongSi">专辑的发行公司，请正确选择。</div> </li> 
          <li> 
           <div class="name">所属分类：</div> 
           <div class="input"> <select class="select_normal" name="rclassId" id="rclassId" disabled> <option value="0">选择所属分类</option> 
<?php
$valbumclasssql="select CD_ID,CD_Name from " . tname('valbumclass') . " where CD_FatherID=0 and CD_IsHide=0 order by CD_TheOrder asc";
$result=$db->query($valbumclasssql);
//$classnum=$db->num_rows($result);
if($result) {
	while($valbumclass=$db->fetch_array($result)) {
			echo "<option value='" . $valbumclass['CD_ID'] . "' >&nbsp;|—" . $valbumclass['CD_Name'] . "</option>";
echo Get_Fclass_select($valbumclass['CD_ID'],'valbumclass');				
}
}
?></select> </div> 
           <div class="input_msg"> <span class="button2-main"><span><button type="button" onclick="pop.up('请选择一个分类', 'selectclass/index.php?ac=valbum', '960px', '550px', '110px');">选择分类</button></span></span> </div>
		   <div class="input_msg" id="mclassId">专辑的所属分类，请正确选择。</div> </li> 
          <li> 
           <div class="name">所属语言：</div> 
           <div class="input"> <select style="width: 110px;" class="select_normal" name="rYuYan" id="rYuYan"> <option value="">选择所属语言</option> <option value="国语">国语</option> <option value="粤语">粤语</option> <option value="闽语">闽语</option> <option value="英语">英语</option> <option value="日语">日语</option> <option value="韩语">韩语</option> <option value="其它">其它</option> </select> </div> 
           <div class="input_msg" id="mYuYan">专辑的所属语言，请正确选择。</div> </li> 
          <li> 
           <div class="name">设置封面：</div> 
           <div class="input"> <input type="text" style="width: 320px;" class="input_normal" name="rPic" id="rPic" /> </div> 
           <div class="input_msg"><span class="button2-main"><span><button type="button" onclick="pop.up('上传封面', '<?php echo cd_webpath;?>include/upload/?ac=valbum&f=form.rPic', '406px', '180px', '140px');">本地上传</button></span></span></div>
           <div class="input_msg" id="mPic"></div> </li> 
          <li class="note"> 
           <div class="name">专辑简介：</div> 
           <div class="input"> <textarea name="rIntro" id="rIntro"></textarea> </div> </li> 
          <li> 
           <div class="name"></div> 
           <div class="input"> <span class="button-main"><span><button type="button" id="specialNewAdd">上传保存</button></span></span> </div> </li> 
         </ul> 
        </form> 
       </div> 
      </div> 
     </div> 
    </div>  
<?php }elseif($view=="passed"){ ?>
    <div class="user_main"> 
     <div class="uMain_content"> 
      <div class="main_nav"> 
       <ul> 
        <li class="concert"> <a href="<?php echo rewrite_url('space.php?do=valbum&view=list');?>">已审专辑</a> </li> 
        <li class="find"> <a class="on" href="<?php echo rewrite_url('space.php?do=valbum&view=passed');?>">待审专辑</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=valbum');?>">创建专辑</a> 
       </div> 
      </div> 
      <div class="big_list"> 
       <ul> 
        <li><a href="<?php echo rewrite_url('space.php?do=valbum&view=passed');?>"<?php if($day=="") {echo ' class="current"';}?>>全部类型</a></li>
<?php
if($day){$valbumclass=$db->getrow('select * from ' . tname('valbumclass') . " where CD_ID='" . $day . "'");}
$valbumclasssql1="select CD_ID,CD_Name from " . tname('valbumclass') . " where CD_FatherID=0 and CD_IsHide=0";
$results=$db->query($valbumclasssql1);
if($results) {
		while($valbumclass1=$db->fetch_array($results)) {
			if($valbumclass["CD_FatherID"]=="0"){$FatherID=$valbumclass["CD_ID"];}else{$FatherID=$valbumclass["CD_FatherID"];}
				if($valbumclass1['CD_ID']==$FatherID){
						echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=passed&day='.$valbumclass1['CD_ID'].'')."' class=\"current\">" . $valbumclass1['CD_Name'] . "</a></li>";
				} else {
						echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=passed&day='.$valbumclass1['CD_ID'].'')."'>" . $valbumclass1['CD_Name'] . "</a></li>";
				}
		}
}
?>
      </div> 
<?php
if($day){
if($valbumclass["CD_TieID"]!=999999){
echo'<div class="small_list">';
$valbumclasssql2="select CD_ID,CD_Name from " . tname('valbumclass') . " where CD_ID in (".$valbumclass["CD_TieID"].") and CD_IsHide=0";
$results=$db->query($valbumclasssql2);
if($results) {
	while($valbumclass2=$db->fetch_array($results)) {
		if($valbumclass2['CD_ID']==$day){
			echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=passed&day='.$valbumclass2['CD_ID'].'')."' class=\"current\">" . $valbumclass2['CD_Name'] . "</a></li>";
		}else{
			echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=passed&day='.$valbumclass2['CD_ID'].'')."'>" . $valbumclass2['CD_Name'] . "</a></li>";
		}
	}
}
echo'</div>';
}
}
?>
      <div id="imageList" class="minHeight500"> 
       <div class="image_praise"> 
<?php
global $db;
$a=0;
if($day) {
if(cd_zclass=="1"){
	if($valbumclass["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($valbumclass["CD_ID"].','.$valbumclass['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$valbumclass["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$valbumclass["CD_ID"]."'";
		}
}
$valbumsql="select * from " . tname('valbum') . " where CD_Passed=1$fidsql and CD_User='" . $CcTvAi_com_username . "' order by CD_AddTime desc";
$Arr=getuserpage($valbumsql, 20); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<div class="nothing">暂无待审专辑。</div>';
} else {
		if($result) {
				echo '<div class="image_praise">';
				echo '<ul>';
				while($valbum=$db->fetch_array($result)) {
						echo '<li>';
						echo '<div class="pic">';
						echo '<a href="' . LinkUrl("valbum", $valbum['CD_ClassID'], 1, $valbum['CD_ID']) . '" target="_blank"><img class="avatar" src="' . LinkPicUrl($valbum['CD_Pic'],'valbum') . '" title="' . $valbum['CD_Name'] . '" height="160" width="160" onerror="this.src=\'' . cd_webpath . 'user/static/images/nopic.jpg\'"/></a>';
						echo '</div>';
						echo '<div class="option">';
						echo '<label style="color:#FA7A19;" class="set" sid="' . $valbum['CD_ID'] . '">设置</label>';
						echo '<label style="cursor:pointer;">' . getlen("len", "6", $valbum['CD_Name']) . '</label>';
						echo '<label style="color:#FF0000;" class="delete" did="' . $valbum['CD_ID'] . '">删除</label>';
						echo '</div>';
						echo '</li>';
				}
				echo '</ul>';
				echo '</div>';
		}
}
?>
         </ul>
        </div> 
<?php if($num>0){?>
       <div class="page"> 
        <div class="pages"> 
<?php echo $Arr[0]; ?><input type="text" maxlength="5" onkeydown="function c(event,val){e = event ? event :(window.event ? window.event : null);if(e.keyCode==13){val = parseInt(val);val=isNaN(val)||(val<=0)?1:val;window.location.href='<?php echo cd_webpath; ?>user/space.php?do=valbum&view=passed&day=<?php echo $day; ?>&pages='+val+'';return false;}else{return true;}};if(!c(event,this.value))return false;" title="输入页码，按回车快速跳转"/>
        </div> 
       </div> 
<?php } ?>
      </div> 
     </div> 
    </div> 
<?php }elseif($view=="list"){ ?>
    <div class="user_main"> 
     <div class="uMain_content"> 
      <div class="main_nav"> 
       <ul> 
        <li class="concert"> <a class="on" href="<?php echo rewrite_url('space.php?do=valbum&view=list');?>">已审专辑</a> </li> 
        <li class="find"> <a href="<?php echo rewrite_url('space.php?do=valbum&view=passed');?>">待审专辑</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=valbum');?>">创建专辑</a> 
       </div> 
      </div> 
      <div class="big_list"> 
       <ul> 
        <li><a href="<?php echo rewrite_url('space.php?do=valbum&view=list');?>"<?php if($day=="") {echo ' class="current"';}?>>全部类型</a></li>
<?php
if($day){$valbumclass=$db->getrow('select * from ' . tname('valbumclass') . " where CD_ID='" . $day . "'");}
$valbumclasssql1="select CD_ID,CD_Name from " . tname('valbumclass') . " where CD_FatherID=0 and CD_IsHide=0";
$results=$db->query($valbumclasssql1);
if($results) {
		while($valbumclass1=$db->fetch_array($results)) {
			if($valbumclass["CD_FatherID"]=="0"){$FatherID=$valbumclass["CD_ID"];}else{$FatherID=$valbumclass["CD_FatherID"];}
				if($valbumclass1['CD_ID']==$FatherID){
						echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=list&day='.$valbumclass1['CD_ID'].'')."' class=\"current\">" . $valbumclass1['CD_Name'] . "</a></li>";
				} else {
						echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=list&day='.$valbumclass1['CD_ID'].'')."'>" . $valbumclass1['CD_Name'] . "</a></li>";
				}
		}
}
?>
      </div> 
<?php
if($day){
if($valbumclass["CD_TieID"]!=999999){
echo'<div class="small_list"><ul>';
$valbumclasssql2="select CD_ID,CD_Name from " . tname('valbumclass') . " where CD_ID in (".$valbumclass["CD_TieID"].") and CD_IsHide=0";
$results=$db->query($valbumclasssql2);
if($results) {
	while($valbumclass2=$db->fetch_array($results)) {
		if($valbumclass2['CD_ID']==$day){
			echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=list&day='.$valbumclass2['CD_ID'].'')."' class=\"current\">" . $valbumclass2['CD_Name'] . "</a></li>";
		}else{
			echo "<li><a href='" . rewrite_url('space.php?do=valbum&view=list&day='.$valbumclass2['CD_ID'].'')."'>" . $valbumclass2['CD_Name'] . "</a></li>";
		}
	}
}
echo'</div>';
}
}
?>
      <div id="imageList" class="minHeight500"> 
       <div class="image_praise"> 
<?php
global $db;
$a=0;
if($day) {
if(cd_zclass=="1"){
	if($valbumclass["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($valbumclass["CD_ID"].','.$valbumclass['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$valbumclass["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$valbumclass["CD_ID"]."'";
		}
}
$valbumsql="select * from " . tname('valbum') . " where CD_Passed=0$fidsql and CD_User='" . $CcTvAi_com_username . "' order by CD_AddTime desc";
$Arr=getuserpage($valbumsql, 20); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<div class="nothing">暂无已审专辑。</div>';
} else {
		if($result) {
				echo '<div class="image_praise">';
				echo '<ul>';
				while($valbum=$db->fetch_array($result)) {
						echo '<li>';
						echo '<div class="pic">';
						echo '<a href="' . LinkUrl("valbum", $valbum['CD_ClassID'], 1, $valbum['CD_ID']) . '" target="_blank"><img class="avatar" src="' . LinkPicUrl($valbum['CD_Pic'],'valbum') . '" title="' . $valbum['CD_Name'] . '" height="160" width="160" onerror="this.src=\'' . cd_webpath . 'user/static/images/nopic.jpg\'"/></a>';
						echo '</div>';
						echo '<div class="option">';
						echo '<label style="color:#FA7A19;" class="set" sid="' . $valbum['CD_ID'] . '">设置</label>';
						echo '<label style="cursor:pointer;">' . getlen("len", "6", $valbum['CD_Name']) . '</label>';
						//echo '<label style="color:#FF0000;" class="delete" did="'.$row['CD_ID'].'">删除</label>';
						echo '</div>';
						echo '</li>';
				}
				echo '</ul>';
				echo '</div>';
		}
}
?>
         </ul>
        </div> 
<?php if($num>0){?>
       <div class="page"> 
        <div class="pages"> 
<?php echo $Arr[0]; ?><input type="text" maxlength="5" onkeydown="function c(event,val){e = event ? event :(window.event ? window.event : null);if(e.keyCode==13){val = parseInt(val);val=isNaN(val)||(val<=0)?1:val;window.location.href='<?php echo cd_webpath; ?>user/space.php?do=valbum&view=list&day=<?php echo SafeRequest("day","get"); ?>&pages='+val+'';return false;}else{return true;}};if(!c(event,this.value))return false;" title="输入页码，按回车快速跳转"/>
        </div> 
       </div> 
<?php } ?>
      </div> 
     </div> 
    </div> 
<?php }elseif($view=="song"){ $specialid = SafeRequest("id","get");?>
    <div class="user_main"> 
     <div class="uMain_content"> 
      <div class="main_nav"> 
       <ul> 
        <li class="concert"> <a href="<?php echo rewrite_url('space.php?do=valbum&view=list');?>">已审专辑</a> </li> 
        <li class="find"> <a href="<?php echo rewrite_url('space.php?do=valbum&view=passed');?>">待审专辑</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=valbum');?>">创建专辑</a> 
       </div> 
      </div> 
      <div class="main"> 
       <div id="tooltip" class="refresh"> 
       </div> 
      </div> 
      <div class="minHeight500"> 
       <div class="profile"> 
<?php
if($row=$db->getrow("select * from ".tname('valbum')." where CD_ID=".$specialid)){
if($row['CD_User']==$CcTvAi_com_username){
?>
        <div class="title"><div class="name"><?php echo $row['CD_Name']; ?></div></div>
        <form name="form" method="post" action="<?php echo cd_webpath?>user/do.php?p=valbum&a=doSong">
         <input type="hidden" name="specialid" value="<?php echo $specialid; ?>" />
         <table cellspacing="0" cellpadding="0" width="100%">
           <tr align="center">
            <td height="35"><font color="red">您上传且未加入任何专辑的视频</font></td>
            <td><b>Shift键可多选</b></td>
            <td>已加入该专辑的歌曲</td>
           </tr>
           <tr align="center">
           <td width="44%"><select name="joinlist[]" id="joinlist" style="width:320px;height:350px" multiple="multiple" size="1">
<?php
$sqls="select * from " . tname('video') . " where CD_User='" . $CcTvAi_com_username . "' and CD_Deleted=0 and CD_SpecialID=0 order by CD_AddTime desc";
$results=$db->query($sqls);
if($results) {
		while($rows=$db->fetch_array($results)) {
				echo "<option value=\"" . $rows['CD_ID'] . "\">" . $rows['CD_Name'] . "</option>";
		}
}
?>
</select></td>
            <td width="12%">
            <span class="button-main" style="margin-left:14px;"><span><input type="submit" name="join" value="<=加入" onclick="return join_list();"></span></span><br><br>
            <span class="button-main" style="margin-left:14px;"><span><input type="submit" name="del" value="删除=>" onclick="return del_list();"></span></span>
            </td>
            <td width="44%"><select name="dellist[]" id="dellist" style="width:320px;height:350px" multiple="multiple" size="1">
<?php
$sqlss="select * from " . tname('video') . " where CD_SpecialID=" . $specialid . " and CD_Deleted=0 order by CD_AddTime desc";
$resultss=$db->query($sqlss);
if($resultss) {
		while($rowss=$db->fetch_array($resultss)) {
				echo "<option value=\"" . $rowss['CD_ID'] . "\">" . $rowss['CD_Name'] . "</option>";
		}
}
?>
</select></td>
           </tr>
         </table> 
        </form> 
<?php
}else{
echo "<div class=\"nothing\">对不起，您不能设置别人的专辑。</div>";
}
}else{
echo "<div class=\"nothing\">抱歉，该专辑不存在或已被删除。</div>";
}
?>
       </div> 
      </div> 
     </div> 
    </div> 
<?php }?>
   </div> 
  </div> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/jquery/jquery.min.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/core.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/card.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/dialog.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/jquery/jquery.plugins.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/js/common.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/js/valbum.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/layer/lib.js"></script> 
<?php if($view==""){ ?>
  <script type="text/javascript">
listenMsg.start();
nav.init();
nav.userMenu();
specialLib.shareAddInit();
var pop = {
up: function(text, url, width, height, top) {
$.layer({
type: 2,
maxmin: true,
title: text,
iframe: {
src: url
},
area: [width, height],
offset: [top, '50%'],
shade: [0]
});
}
}
  </script> 
<?php }elseif($view=="list"){ ?>
  <script type="text/javascript">listenMsg.start();nav.init();nav.userMenu();specialLib.passDelInit();specialLib.songSetInit();</script>
<?php }elseif($view=="passed"){ ?>
  <script type="text/javascript">listenMsg.start();nav.init();nav.userMenu();specialLib.passDelInit();specialLib.songSetInit();</script>
<?php }elseif($view=="song"){ ?>
  <script type="text/javascript">
listenMsg.start();
nav.init();
nav.userMenu();
function join_list(){
if(document.form.joinlist.value==""){
$.tipMessage('请选择要加入专辑的视频！', 1, 1000);
document.form.joinlist.focus();
return false;
}
}
function del_list(){
if(document.form.dellist.value==""){
$.tipMessage('请选择要删除的专辑视频！', 1, 1000);
document.form.dellist.focus();
return false;
}
}
  </script>
<?php }?>
<?php include_once('source/space_footer.php');?> 
  </body>
</html>