<script type="text/javascript">

function validateModuleSelected()
{
    if($("module").value == 0){
        
        return false; 
    }
    
    location.href='index.php?fuse=admin&view=AddEditGeneralGroup&module='+$("module").value+'&group='+ document.groupForm.groupId.value;

}

</script>
<form name="groupForm" method="post" action="index.php?fuse=admin&action=SaveGeneralGroup" />
    <input type="hidden" name="groupId" value="{groupId}" />
    <table>
        <!-- BEGIN DYNAMIC BLOCK: notice -->
        <tr>
            <td colspan="2">
                <div class="yellowbox"><h2>[l]Notice[/l]:</h2>[l]In order to delete an access group you have to assign its members to another group.[/l]<br />[l]The "Customer" and "Super Admin" groups can't be deleted.[/l]</div>
            </td>
        </tr>
        <!-- END DYNAMIC BLOCK: notice -->
        <tr>
            <td align="right" class="formlabel" width="1%">[l]Name[/l]:</td>
            <td class="formfield">
                <input type="text" name="groupName" value="{groupName}" style="width:300px" />
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" class="formlabel" width="1%">[l]Description[/l]:</td>
            <td class="formfield">
                <textarea name="groupDescription" style="width:300px;" rows="2">{groupDescription}</textarea>
            </td>
        </tr>
        <!-- BEGIN DYNAMIC BLOCK: staffMembers -->
        <tr>
            <td align="right" valign="top" class="formlabel" width="1%">[l]Staff members[/l]:</td>
            <td class="formfield">
                <ul>
                    <!-- BEGIN DYNAMIC BLOCK: rowstaff -->
                    <li>{STAFFNAME}</li>
                    <!-- END DYNAMIC BLOCK: rowstaff -->
                </ul>
                <!-- BEGIN DYNAMIC BLOCK: noStaff -->
                [l]There are no staff members belonging to this group.[/l]
                <!-- END DYNAMIC BLOCK: noStaff -->
            </td>
        </tr>
        <!-- END DYNAMIC BLOCK: staffMembers -->
    </table>
    <!-- BEGIN DYNAMIC BLOCK: permissionsSection -->
    <table width="100%" border="0" cellspacing="0" style="margin-top:10px">
        <tr>
            <td colspan="2">{groupPermissionsTitle}</td>
        </tr>
        <tr valign="top">
            <td width="300" class="formfield" >
                <table cellpadding="4" cellspacing="1" width="100%">
                  <tbody>
                    <tr valign="top">
                      <td align="right" nowrap="nowrap" width="75">[l]Module[/l]:</td>
                      <td width="100%">
                        <select name="module" id="module" onchange= "validateModuleSelected();">
                             <option value="0">-- [l]SELECT MODULE[/l] --</option>
                        <!-- BEGIN DYNAMIC BLOCK: modulespackage -->
                            <option {SELECTED} value="{MODULENAME}" >{MODULENAMETRANSLATION}&nbsp;&nbsp;</option>
                        <!-- END DYNAMIC BLOCK: modulespackage -->
                        </select>
                      </td>            
                    </tr>
                  </tbody>
                </table>
            </td>
            <td valign="top" class="formfield" >
                <table>
                    <tr valign="top">
                        <td>
                            <!-- BEGIN DYNAMIC BLOCK: permissionsGroup -->
                            <div id="div_{PERMISSIONNAME}_main" style="{DIVDISPLAY}margin-left:20px" >
                                <div id="div_{PERMISSIONNAME}" style="clear:left;padding-bottom:12px" > 
                                    <input type="checkbox" name="permissions[]" value="{PERMISSIONNAME}" id="{PERMISSIONNAME}" onclick = "changeCheckBox(this, 'div_{PERMISSIONNAME}', 'div_{PERMISSIONNAME}_main')" {DISABLED} align=left  style="float:left;margin:0" {CHECKED} />
                                    <div style="margin-left:20px" > {PERMISSION} {INFOMESSAGE} </div>    
                                </div>
                                {CHILDREN}
                            </div>        
                            <!-- END DYNAMIC BLOCK: permissionsGroup -->
                            <!-- BEGIN DYNAMIC BLOCK: noPermissions -->
                            <div id="div_none_main" style="margin-left:20px" >
                                <div id="div_none" style="clear:left;padding-bottom:12px" > 
                                    <div style="margin-left:20px" > [l]There are no permission available for this group.[/l]</div>    
                                </div>
                            </div>        
                            <!-- END DYNAMIC BLOCK: noPermissions -->
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>    
    <!-- END DYNAMIC BLOCK: permissionsSection -->
    <table>
        <tr>
            <td colspan="2" style="padding-top:10px">
                <input type="submit" value="[l]Save[/l]" class="button_medium" />&nbsp;&nbsp;
                <!-- BEGIN DYNAMIC BLOCK: deleteButton -->
                <input type="submit" value="[l]Delete[/l]" onclick="this.form.action='index.php?fuse=admin&action=DeleteGeneralGroup'" class="button_medium" />
                <!-- END DYNAMIC BLOCK: deleteButton -->
            </td>
        </tr>
    </table>
</form>
