<div id="primary_header">
	<h1><?php print $this->translate('Groupware Preferences')?></h1>

</div>

<div id="primary_content">
	<div id="primary_content_inner">
		<div id="Flash" class="flash_notice"></div>

		<form id="settingsForm" method="post" action="<?php echo $this->moduleBaseUrl ?>/settings/groupwaresave">

			<input type="hidden" name="save" value="1" />


			<table class="settings">
		        <tr>
					<td class="label"><?php print $this->translate('Groupware Zone'); ?></td>
					<td>
						<div class="styled-select">
						        <span class="arrow"></span>
						<select style="width:130px" name="fields[GroupwareZone]">
							<?php $w4m70Yt0hYUduM2r2lrrIuY0bgKG4A3vvftl4NbzCWfW = ((Zend_Registry::get('w4m70Yt0hYUduM2r2lrrIuY0bgKG4A3vvftl4NbzCWfW') & LICENSE_FEATURE_BASIC_GROUPWARE) != 0); $dgz = $this->groupDefault['GroupwareZone']; ?>
							<option value="System"<?php echo ($w4m70Yt0hYUduM2r2lrrIuY0bgKG4A3vvftl4NbzCWfW?($dgz=='System'?' selected':''):' disabled="disabled"') ?>>System Wide</option>
							<option value="Domain"<?php echo ($w4m70Yt0hYUduM2r2lrrIuY0bgKG4A3vvftl4NbzCWfW?($dgz=='Domain'?' selected':''):' disabled="disabled"') ?>>Domain Wide</option>
							<option value="Off"<?php echo ((!$w4m70Yt0hYUduM2r2lrrIuY0bgKG4A3vvftl4NbzCWfW || ($dgz!='Domain' && $dgz!='System') )?' selected':'') ?>>Off</option>
						</select>
						</div>
					<small><?php print $this->translate('Set the Address book and Calendar sharing to <strong>Off</strong>, or <strong>System</strong> to allow sharing with users on all domains on the server, or <strong>Domain</strong> to only allow sharing to users on the same domain.')?> <?php print $this->translate('(This setting has a global effect on the system.)')?></small></td>
				</tr>
				
				<tr>
					<td class="label"><?php print $this->translate('Shared Addressbook'); ?></td>
					<td>
						<input name="fields[SharedAbook]" type='hidden' value='0'/>
						<input name="fields[SharedAbook]" type="checkbox" value="1" class="iphoneStyle" <?php echo ($this->groupDefault['SharedAbook']) ? 'checked' : '' ?> />
						
					<small><?php print $this->translate('Allows Address book sharing based on the Groupware Zone.')?></small></td>
				</tr>
				
			</table>
			
			<div class="divider"></div>
			
			<table class="settings">

					<!--
					<tr id="groupware_domains_row" style="display:hidden">
						<td class="label"><?php print $this->translate('Groupware Domains')?></td>
						<td>
							<table id="user_div">
								<tr>
									<td><label class="label"><?php print $this->translate('Domain')?></label></td>
									<td><label class="label"><?php print $this->translate('Enabled')?></label></td>
								</tr>
								<tr id="new_user_div" style="display:none">
									<td>
										<input id="new_user" style='padding: 2px; width:95%' id='new_username' value="Domain Name" type="text"/>
									</td>
									<td colspan="7">
										<input id='groupware_enabled' type="checkbox" checked="true"/>
									</td>
								</tr>
								<?php echo $this->domains; ?>
							</table>
						<small><?php print $this->translate('This list is all the domains for which groupware has been enabled if per-domain mode is selected.')?></small></td>
						</td>
					</tr>
					<tr id="groupware_control_row">
						<td></td>
						<td colspan="6">
							<div name="add" id="back_button" style="float:left;"><a href="#"><span><img Title="Add User" src="<?php echo $this->siteBaseUrl ?>images/icons/folder_add_trans.gif"/></span></a></div>
							<div name="remove" id="back_button" style="float:left;"><a href="#"><span><img Title="Remove User" src="<?php echo $this->siteBaseUrl ?>images/icons/folder_remove_trans.gif"/></span></a></div>
						</td>
					</tr>
					-->

			</table>

		</div>
	</form>
	<div id="back_button" name="save">
		<a href="#">
			<span class="stronglastword"><?php echo $this->translate('Save Settings') ?></span>
		</a>
	</div>
</div>

<script type="text/javascript">
$( function()
{

	$('.iphoneStyle', '#Groupware_Settings').each( function() { $(this).iphoneStyle() });
	$('.stronglastword', '#Groupware_Settings').each( function() { $(this).stronglastword() });

	$('#back_button a', '#Groupware_Settings').bind("click", function() 
	{ 

		return $('#settingsForm', '#Groupware_Settings').submit()

	})

	// bind to the form's submit event and cancel legacy submit 
	$('#settingsForm', '#Groupware_Settings').submit(function() 
	{

	    $.php($("#settingsForm", '#Groupware_Settings').attr("action"),$("#settingsForm", '#Groupware_Settings').serializeArray());
	    return false; 

	});

});
</script>
