Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/modules/topMusic/admin/editSong.php
<?php
/************************************************************************/
/* Top Music: Administration Module                                     */
/* ================================                                     */
/*                                                                      */
/* Copyright (c) 2004 by SergiDs.com                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); }
$aid = trim($aid);
$result = mysql_query("select radminsuper from ".$prefix."_authors where aid='$aid'");
list($radminsuper) = mysql_fetch_row($result);
if ($radminsuper==1) {
	//require_once("lib/com/sergids/topmusic/view/GenericAdminView.php");
?>
<script language="javascript" type="text/javascript">
function unlinkRelated(id){
	form=document.getElementById('songEditForm');
	form.unlink.value=id;
	if(confirm('Unlinking this song the form changes will be lost.'))
		form.submit();
}
function linkRelated(){
	var form=document.getElementById('songEditForm');
	var related=document.getElementById('related')[document.getElementById('related').selectedIndex].value;
	form.link.value=related;
	if(confirm('Linking this song will also submit the form changes.'))
		form.submit();
}
</script>
	<table cellspacing="0" cellpadding="0" border="0">
	<form name="songEditForm" id="songEditForm" method="post" action="admin.php?op=topmusic&action=editSong&idartist=<?=$_GET['idartist']?>&idalbum=<?=$_GET['idalbum']?>&idsong=<?=$_GET['idsong']?>" enctype="multipart/form-data">
	<?php if($message!=""){ ?>
	<tr>
	<td colspan="2"><font color="red"><?=$message?></font></td>
	</tr>
	<?php } ?>
	<tr>
	<td><?=_TOPMUSIC_ARTIST?>:</td><td>
	<?php
	
	$genericView=new GenericAdminView();
	$genericView->printSelect("artist",$artistList,$_GET['idartist'],"loadSelect('album','artist','album','albumDiv',true);");
	?>
	</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td><?=_TOPMUSIC_ALBUM?>:</td><td>
	<div id="albumDiv" style="display: inline"><?php
	$genericView->printSelect("album",$albumList,$_GET['idalbum']);?>
	</div></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td><?=_TOPMUSIC_TITLE?>:</td><td><input type="text" name="title" value="<?=$song->getTitle()?>"></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td><?=_TOPMUSIC_NUMBER?>:</td><td><input type="text" name="number" value="<?=$song->getNumber()?>"></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td><?=_TOPMUSIC_GENRE?>:</td><td>
	<?php
	$genericView=new GenericAdminView();
	$genericView->printSelect("genre",$genreList,$song->getGenreid(),"");
	?>
	</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<?php
	if(count($songFields)>0){ 
		foreach($songFields as $field){?>
		<tr>
			<td valign="top"><strong><i><?=$field->description?></i></strong>:</td><td> <?=GenericAdminView::printCustomField($field)?> </td>
		</tr>
		<tr>
			<td colspan="2">&nbsp;</td>
		</tr>
	<?	}
	}?>
	<tr>
	<td valign="top"><?=_TOPMUSIC_TRACK?>:</td><td><input type="text" name="track" value="<?=$song->getTrack()?>">&nbsp;<a href="#top" onClick="javascript:url=document.songEditForm.track.value;if(url.substring(0,4)!='http'){url='modules/<?=_TOPMUSIC_MODULENAME?>/tracks/'+url}window.open(url,'CheckTrackURL','width=500,height=400,toolbar=no, scrollbars=yes,titlebar=no, statusbar=no')"><?=_TOPMUSIC_CHECK?></a><img src="modules/topMusic/images/question.gif" hspace="4" align="middle" title="<?=_TOPMUSIC_HELPTRACK?>"></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td valign="top" algin="left"><?=_TOPMUSIC_VIEWS?>:</td><td><input type="text" name="views" size="5" value="<?=$song->getCount()?>"></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td valign="top"><?=_TOPMUSIC_LYRICS?>:</td><td><textarea name="lyrics" cols="70" rows="15"><?=$song->getLyrics()?></textarea></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td valign="top"><strong><?=_TOPMUSIC_RELATED_SONGS?></strong>:</td>
	<td></td>
	</tr>
	<tr><td></td>
		<td>
		<table>
			<?php
			if(count($relatedList)>0){
				foreach($relatedList as $rel){
					echo "<tr>";
					echo "	<td><a href=\"admin.php?op=topmusic&action=editSong&idartist=".$rel->getIdartist()."&idalbum=&idalbum=".$rel->getIdalbum()."&idsong=".$rel->getId()."\">".$rel->getTitle()."</a></td>
							<td><input type=\"button\" name=\"deleteRelated\" value=\""._TOPMUSIC_UNLINK."\" onClick=\"unlinkRelated(".$rel->getId().")\"></td>";
					echo "</tr>";
				}
			}?>
		</table>
		</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td></td>
		<td>1. Select an artist: <?php
	//Initial status
	$albumList[0]="...";
	$songList[0]="...";
	$genericView=new GenericAdminView();
	$genericView->printSelect("artist_rel",$artistList,"","loadSelect('album','artist_rel','album_rel','albumSelectDiv',false,'related','songSelectDiv')");?>
	<br>2. Select an album:<div id="albumSelectDiv" style="display: inline"><?php
	$genericView->printSelect("album_rel",$albumList_related,"","loadSelect('song','album_rel','related','songSelectDiv',true);");?>
	</div><br>3. Select a song:<div id="songSelectDiv" style="display: inline"><?php
	$genericView->printSelect("related",$songList,"","");?>
	&nbsp;</div><input type="button" name="addRelated" value="<?=_TOPMUSIC_LINK?>" onClick="javascript:linkRelated()"></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
	<td>&nbsp;</td>
	<td>
		<input type="hidden" name="unlink">
		<input type="hidden" name="link" id="link" value="...">
		<input type="submit" name="submit1" value="<?=_TOPMUSIC_SAVE?>">
	</td>
	</tr>
	</form>
	</table>
	<?php
} else {
	OpenTable();
    echo "Access Denied";
    CloseTable();
}
?>
Return current item: Top Music module