<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_default
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="entry-edit">
    <?php echo $this->getFormHtml() ?>

    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Maintainers") ?></h4>
    </div>
    <fieldset id="maintainers_fieldset" class="grid">
        <legend><?php echo $this->__("Maintainers") ?></legend>
        <table class="data" cellspacing="0">
            <thead>
                <tr class="headings">
                    <th><?php echo $this->__("Level") ?></th>
                    <th><?php echo $this->__("Name") ?></th>
                    <th><?php echo $this->__("User") ?></th>
                    <th><?php echo $this->__("Email") ?></th>
                    <th><?php echo $this->__("Status") ?></th>
                    <th><?php echo $this->__("Action") ?></th>
                </tr>
                <tr id="maintainers_template" style="display:none">
<?php function showMaintainersTemplate($self, $_i=0) { ?>
                    <td style="margin-bottom:5px;">
                        <select name="maintainers[role][]" style="width:70px">
                        <?php foreach ($self->getMaintainerRoles() as $_value=>$_label): ?>
                            <option value="<?php echo $_value ?>" <?php echo $self->getSelected('maintainers/role/'.$_i, $_value) ?>><?php echo $_label ?></option>
                        <?php endforeach ?>
                        </select>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:160px;" name="maintainers[name][]" value="<?php echo $self->getValue('maintainers/name/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:140px;" name="maintainers[handle][]" value="<?php echo $self->getValue('maintainers/handle/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:160px;" name="maintainers[email][]" value="<?php echo $self->getValue('maintainers/email/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <select name="maintainers[active][]" style="width:70px">
                            <option value="1" <?php echo $self->getSelected('maintainers/active/'.$_i, 1) ?>><?php echo $self->__("Active") ?></option>
                            <option value="0" <?php echo $self->getSelected('maintainers/active/'.$_i, 0) ?>><?php echo $self->__("Inactive") ?></option>
                        </select>
                    </td><td style="margin-bottom:5px;">
                        <?php echo $self->getRemoveRowButtonHtml('tr') ?>
                    </td>
<?php } ?>
<?php showMaintainersTemplate($this) ?>
                </tr>
            </thead>
            <tbody id="maintainers_container">
            <?php if ($this->getData('maintainers/role')): ?>
            <?php foreach ($this->getData('maintainers/role') as $_i=>$_dbField): ?>
                <?php if (0===$_i) continue; ?>
                <tr>
<?php showMaintainersTemplate($this, $_i) ?>
                </tr>
            <?php endforeach ?>
            <?php endif ?>
            </tbody>
            <tfoot>
                <tr>
                    <td class="a-right" colspan="6"><?php echo $this->getAddRowButtonHtml('maintainers_container', 'maintainers_template', $this->__('Add Maintainer')) ?></td>
                </tr>
            </tfoot>
        </table>
    </fieldset>
</div>
