Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/modules/topMusic/admin/addCustomField.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) {
?>
<script language="javascript">
function addField(){
	//comprovar que no hi ha espais
	var form = document.getElementById("fieldForm");
	var error = '';
	if(form.name.value=='')
		error+='Add a name for this field without spaces';
	
	if(error==''){
		form.act.value='add';
		form.submit();
	}else{
		alert(error);
	}
}
</script>
<table border="0" align="center">
  <tr>
    <td scope="col">&nbsp;</th>
    <td scope="col">&nbsp;</th>
    <td scope="col">&nbsp;</th>
  </tr>
  <tr>
    <th scope="col">&nbsp;</th>
    <th scope="col"><?=$_POST['from'].": "._TOPMUSIC_ADD_CUSTOMFIELD?>: <?=$_POST['type']?></th>
    <th scope="col">&nbsp;</th>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
<table width="100%" border="0">
	      <form id="fieldForm" name="fieldForm" action="" method="post">
	      <input type="hidden" name="from" value="<?=$_POST['from']?>">
	      <input type="hidden" name="type" value="<?=$_POST['type']?>">
	      <input type="hidden" name="act" value="">
	      <tr>
	        <td colspan="7">&nbsp;</td>
	      </tr>
<?php
switch($_POST['type']){
	default:
	case "textarea":
	case "text": 
	case "link":?>
      <tr>
        <td><?=_TOPMUSIC_NAME?>:</td>
        <td><input type="text" name="name"></td>
      </tr><tr>
        <td><?=_TOPMUSIC_DESCRIPTION?></td>
        <td><input type="text" name="description"></td>
      </tr>
	<?php break;
	case "select": ?>
		<tr>
        	<td><?=_TOPMUSIC_NAME?>:</td>
        	<td><input type="text" name="name"></td>
      	</tr><tr>
        	<td><?=_TOPMUSIC_DESCRIPTION?></td>
        	<td><input type="text" name="description"></td>
      	</tr><tr>
        	<td><?=_TOPMUSIC_VALUESLIST?></td>
        	<td><input type="text" name="values" size="70" value="<?=_TOPMUSIC_EXAMPLE?>: <?=_TOPMUSIC_VALUE?>1;<?=_TOPMUSIC_VALUE?>2;<?=_TOPMUSIC_VALUE?>3"></td>
      	</tr>
	<?php break;
	case "image": ?>
		<tr>
        	<td><?=_TOPMUSIC_NAME?>:</td>
        	<td><input type="text" name="name"></td>
      	</tr><tr>
        	<td><?=_TOPMUSIC_DESCRIPTION?></td>
        	<td><input type="text" name="description"></td>
      	</tr><tr>
        	<td><?=_TOPMUSIC_FILERELATIVEPATH?></td>
        	<td><input type="text" name="file_path" size="70" value="<?=_TOPMUSIC_EXAMPLE?>: photos/albums"></td>
      	</tr>
      	</tr><tr>
        	<td><?=_TOPMUSIC_THUMBWIDTH?></td>
        	<td><input type="text" name="image_width" value="<?=_TOPMUSIC_EXAMPLE?>: 200"></td>
      	</tr>
	<?php break;
	case "file": ?>
		<tr>
        	<td><?=_TOPMUSIC_NAME?>:</td>
        	<td><input type="text" name="name"></td>
      	</tr><tr>
        	<td><?=_TOPMUSIC_DESCRIPTION?></td>
        	<td><input type="text" name="description"></td>
      	</tr><tr>
        	<td valign="top"><?=_TOPMUSIC_FILEPATH?></td>
        	<td><input type="text" name="file_path" size="70" value="<?=_TOPMUSIC_EXAMPLE?>: photos/albums"><BR><?=_TOPMUSIC_RELATIVETO?> /modules/topMusic/</td>
      	</tr>
      	</tr><tr>
        	<td><?=_TOPMUSIC_FILEICON?></td>
        	<td><input type="text" name="file_icon" value="<?=_TOPMUSIC_EXAMPLE?>: images/pdf.gif"> <?=_TOPMUSIC_RELATIVETO?> /modules/topMusic/</td>
      	</tr>
	<?php break;
}
?>
	<tr>
        <td>&nbsp;</td>
        <td><input type="button" value="<?=_TOPMUSIC_ADD?>" onClick="addField()"></td>
      </tr>
      </form>
    </table>
    </td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<?php
} else {
	OpenTable();
    echo "Access Denied";
    CloseTable();
}
?>
Return current item: Top Music module