<?php
# ArtRef     -  Referenzliste für Mambo
# Version    :  1.2 b
# by         :  2004  Andreas Duswald
# Homepage   :  www.mamboArt.de
# License    :  GNU GPL Public License
# Based on   :  AkoStaff by Arthur Konze (konze.de)


defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

class HTML_artref {

  function showRef( $option, &$rows, &$clist, &$search, &$pageNav ) {
    global $my, $clist;
?>
    <form action="index2.php" method="post" name="adminForm">
    <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
      <td width="100%" class="sectionname">
        <!--img src="components/com_obrens/images/logo.png"-->
        AÑADIR OBRA
      </td>
      <td nowrap="nowrap"><? echo ADM_ARTREF_zeige; ?></td>
      <td>
        <?php echo $pageNav->writeLimitBox(); ?>
      </td>
      <td><? echo ADM_ARTREF_Suche; ?></td>
      <td>
        <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
      </td>
      <td width="right">
        <?php echo $clist;?>
      </td>
    </tr>
    </table>

    <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
      <tr>
        <th width="20">
          <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
        </th>
        <th class="title" width="25%" nowrap="nowrap"><? echo LIT_TITULO; ?></th>
        <th width="25%" align="left" nowrap="nowrap"><? echo LIT_AUTOR; ?></th>
        <th width="25%" align="left" nowrap="nowrap"><? echo LIT_NOBRA; ?></th>
        <th width="25%" align="left" nowrap="nowrap"><? echo LIT_CATEGORIA; ?></th>
        <th width="10%" nowrap="nowrap"><? echo LIT_PUBLICADO; ?></th>
        <th colspan="2"></th>
      </tr>
<?php
    $k = 0;
    for ($i=0, $n=count( $rows ); $i < $n; $i++) {
      $row = &$rows[$i];
?>
      <tr class="<?php echo "row$k"; ?>">
        <td width="20">
          <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id; ?>" onclick="isChecked(this.checked);" />
        </td>
        <td width="25%">
          <a href="#edit" onclick="return listItemTask('cb<?php echo $i;?>','edit')">
            <?php echo $row->titulo; ?>
          </a>
        </td>
        <td width="25%"><?php echo $row->autor; ?></td>
        <td width="25%"><?php echo $row->id; ?></td>
        <td width="25%"><?php echo $row->category; ?></td>
        <?php
          $task = $row->published ? 'unpublish' : 'publish';
          $img = $row->published ? 'publish_g.png' : 'publish_x.png';
        ?>
        <td width="10%" align="center"><a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $task;?>')"><img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="" /></a></td>
        <td>
        <?php if (($i > 0 || ($i+$pageNav->limitstart > 0)) && $row->catid == @$rows[$i-1]->catid) { ?>
        <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderup')">
        <img src="images/uparrow.png" width="12" height="12" border="0" alt="<? echo ADM_ARTREF_MoveU; ?>">
        </a>
        <?php    } else { echo "&nbsp;"; } ?>
      </td>
      <td>
      <?php    if (($i < $n-1 || $i+$pageNav->limitstart < $pageNav->total-1) && $row->catid == @$rows[$i+1]->catid) { ?>
        <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderdown')">
        <img src="images/downarrow.png" width="12" height="12" border="0" alt="<? echo ADM_ARTREF_MoveD; ?>">
        </a>
        <?php    } else { echo "&nbsp;"; } ?>
      </td>
      <?php    $k = 1 - $k; } ?>
      </tr>
      <tr>
        <th align="center" colspan="9">
          <?php echo $pageNav->writePagesLinks(); ?></th>
      </tr>
      <tr>
        <td align="center" colspan="9">
          <?php echo $pageNav->writePagesCounter(); ?></td>
      </tr>
    </table>
    <input type="hidden" name="option" value="<?php echo $option;?>" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
    </form>
<?php
}


function editRef( $option, &$row, &$clist, &$olist, &$row2) {
?>
<script language="javascript" src="js/dhtml.js"></script>

    <script language="javascript" type="text/javascript">
    function submitbutton(pressbutton) {
      var form = document.adminForm;
      if (pressbutton == 'cancel') {
        submitform( pressbutton );
        return;
      }

      // do field validation
      if (form.titulo.value == ""){
        alert( "<? echo ADM_ARTREF_ERROR_F; ?>" );
      } else if (form.catid.value == "0"){
        alert( "<? echo ADM_ARTREF_ERROR_G; ?>" );
      } else if (form.autor.value == ""){
        alert( "<? echo ADM_ARTREF_ERROR_H; ?>" );
      } else {
        submitform( pressbutton );
      }
    }
    </script>
    
  <table cellpadding="4" cellspacing="0" border="0" width="90%">
    <tr>
        &nbsp;&nbsp;<!--img src="components/com_obrens/images/logo.png"-->
    </tr>
  </table>

  <form action="index2.php" method="post" name="adminForm" id="adminForm">

  <script language="javascript" src="js/dhtml.js"></script>
  <table cellpadding="3" cellspacing="0" border="0" width="90%">
    <tr>
      <td width="" class="tabpadding">&nbsp;</td>
      <td id="tab1" class="offtab" onclick="dhtml.cycleTab(this.id)"><? echo ADM_ARTREF_RefInf; ?></td>
      <!--td id="tab2" class="offtab" onclick="dhtml.cycleTab(this.id)"><? echo ADM_ARTREF_Beschr; ?></td-->
      <td width="90%" class="tabpadding">&nbsp;</td>
    </tr>
  </table>

  <div id="page1" class="pagetext">
    <table cellpadding="4" cellspacing="1" border="0" width="90%" class="adminform">
      <tr>
        <td width="20%" align="right"><? echo LIT_TITULO; ?>:</td>
        <td width="80%">
          <input class="inputbox" type="text" name="titulo" size="50" maxlength="100" value="<?php echo htmlspecialchars( $row->titulo, ENT_QUOTES );?>" />
        </td>
      </tr>
      <tr>
        <td width="20%" align="right"><? echo LIT_AUTOR; ?>:</td>
        <td width="80%">
          <input class="inputbox" type="text" name="autor" size="50" maxlength="100" value="<?php echo htmlspecialchars( $row->autor, ENT_QUOTES );?>" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CATEGORIA; ?>:</td>
        <td>
          <?php echo $clist; ?>
        </td>
      </tr>
      <tr> 
        <td valign="top" align="right"><? echo LIT_ORDENAR; ?>:</td>
		<td>
          <?php echo $olist; ?>
        </td>
      </tr>
	  	
	  	<tr>
        <td colspan=2 width="100%">
          <br><? echo LIT_DETALLES; ?><hr>
        </td>
      </tr>

      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."1"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol1" value=
          <?php if (!$row2->ncol1) 
                   echo LIT_SOPRANO;
                else
                   echo $row2->ncol1; 
          ?>
          " size="30" maxlength="30" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."2"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol2" value=
          <?php if (!$row2->ncol2) 
                   echo LIT_CONTRALTO;
                else
                   echo $row2->ncol2; 
          ?>
          " size="30" maxlength="30" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."3"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol3" value=
          <?php if (!$row2->ncol3) 
                   echo LIT_TENOR;
                else
                   echo $row2->ncol3; 
          ?>
          " size="30" maxlength="30" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."4"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol4" value=
          <?php if (!$row2->ncol4) 
                   echo LIT_BAJO;
                else
                   echo $row2->ncol4; 
          ?>
          " size="30" maxlength="30" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."5"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol5" value="<?php echo $row2->ncol5; ?>" size="30" maxlength="30" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."6"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol6" value="<?php echo $row2->ncol6; ?>" size="30" maxlength="30" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."7"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol7" value="<?php echo $row2->ncol7; ?>" size="30" maxlength="30" />
        </td>
      </tr>
      <tr>
        <td valign="top" align="right"><? echo LIT_CUERDA."8"; ?>:</td>
        <td>
          <input class="inputbox" type="text" name="ncol8" value="<?php echo $row2->ncol8; ?>" size="30" maxlength="30" />
        </td>
      </tr>
    </table>
  </div>
  
  <script language="javascript" type="text/javascript">dhtml.cycleTab('tab1');</script>
    <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
    <input type="hidden" name="option" value="<?php echo $option;?>" />
    <input type="hidden" name="task" value="" />
  </form>


  <script language="JavaScript1.2" defer="defer">
    editor_generate('beschreibung');
  </script>
<?php
  }

function showLanguage($file, $option) {
  $file = stripslashes($file);
  $f=fopen($file,"r");
  $content = fread($f, filesize($file));
  $content = htmlspecialchars($content);
  ?>
  <form action="index2.php?" method="post" name="adminForm" class="adminForm" id="adminForm">
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
     <tr>
       <th colspan="4"><? echo ADM_ARTREF_Pfad; ?>: <?php echo $file; ?></td> </tr>
     <tr>
       <td> <textarea cols="80" rows="20" name="filecontent"><?php echo $content; ?></textarea>
       </td>
     </tr>
     <tr>
       <td class="error"><? echo ADM_ARTREF_ERROR_I; ?></td>
     </tr>
  </table>
  <input type="hidden" name="file" value="<?php echo $file; ?>" />
  <input type="hidden" name="option" value="<?php echo $option; ?>">
  <input type="hidden" name="task" value="">
  <input type="hidden" name="boxchecked" value="0">
  </form>
 <?

}//end function showLanguage
}
?>
