protected function RenderContent()
    {
        ?>
			<form method="POST" id="frmMain">
			<?php 
        $tbs = new TabContainer("tbs");
        $tbs->TabPages[] = new TabPage("tabInformation", "Information", null, null, null, function () {
            ?>
				<table style="width: 100%;">
					<tr>
						<td style="width: 100px;">Title: </td>
						<td><input name="organization_Title" type="text" value="<?php 
            echo $this->CurrentObject->Title;
            ?>
" /></td>
					</tr>
				</table>
				<?php 
        });
        $tbs->TabPages[] = new TabPage("tabUsers", "Users", null, null, null, function () {
        });
        $tbs->CurrentTab = $tbs->TabPages[0];
        $tbs->Render();
        ?>
				<div class="Buttons">
					<input class="Button Default" type="submit" value="Save Changes" />
					<a class="Button" href="<?php 
        echo System::ExpandRelativePath("~/organizations");
        ?>
">Discard Changes</a>
				</div>
			</form>
			<?php 
    }
    protected function RenderContent()
    {
        ?>
			<form method="POST" id="frmMain">
			<?php 
        $tbs = new TabContainer("tbs");
        $tbs->TabPages[] = new TabPage("tabInformation", "Information", null, null, null, function () {
            ?>
				<div class="FormView" style="width: 100%;">
					<div class="Field">
						<label for="txtTitle" style="width: 100px;">Title:</label>
						<input id="txtTitle" name="datacenter_Title" type="text" value="<?php 
            echo $this->CurrentObject->Title;
            ?>
" />
					</div>
					<div class="Field">
						<label for="txtDescription" style="vertical-align: top;">Description:</label>
						<textarea id="txtDescription" name="datacenter_Description" style="width: 100%;" rows="5"><?php 
            echo $this->CurrentObject->Description;
            ?>
</textarea>
					</div>
					<div class="Field">
						<label for="txtHostName">Hostname:</label>
						<input id="txtHostName" name="datacenter_HostName" type="text" value="<?php 
            echo $this->CurrentObject->HostName;
            ?>
" />
					</div>
				</div>
				<?php 
        });
        $tbs->SelectedTab = $tbs->TabPages[0];
        $tbs->Render();
        ?>
				<div class="Buttons">
					<input type="submit" class="Button Default" value="Save Changes" />
					<a class="Button" href="<?php 
        echo System::ExpandRelativePath("~/data-centers");
        ?>
">Discard Changes</a>
				</div>
			</form>
			<?php 
    }
    protected function RenderContent()
    {
        ?>
		<form method="POST">
		<?php 
        $tc = new TabContainer();
        $tc->TabPages[] = new TabPage("tabGeneralInformation", "General Information", null, null, null, function () {
            ?>
				<div class="FormView">
					<div class="Field">
						<label for="txtModuleTitle">Title:</label>
						<input id="txtModuleTitle" name="module_Title" type="text" value="<?php 
            echo $this->Module->Title;
            ?>
" />
					</div>
					<div class="Field">
						<label for="txtModuleDescription" style="vertical-align: top;">Description: </label>
						<textarea id="txtModuleDescription" name="module_Description" style="width: 100%;" rows="5"><?php 
            echo $this->Module->Description;
            ?>
</textarea>
					</div>
				</div>
				<?php 
        });
        $tc->TabPages[] = new TabPage("tabApplicationMenuItems", "Application Menu Items", null, null, null, function () {
            $lv = new ListView();
            $lv->Columns = array(new ListViewColumn("chTitle", "Title"), new ListViewColumn("chDescription", "Description"), new ListViewColumn("chTarget", "Target"));
            $menuitems = $this->Module->GetMainMenuItems();
            foreach ($menuitems as $menuitem) {
                $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("chTitle", $menuitem->Title), new ListViewItemColumn("chDescription", $menuitem->Description), new ListViewItemColumn("chTarget", $menuitem->TargetURL)));
            }
            $lv->Render();
        });
        $tc->TabPages[] = new TabPage("tabModulePages", "Module Pages", null, null, null, function () {
            $lv = new ListView();
            $lv->Columns = array(new ListViewColumn("chURL", "URL"));
            $pages = $this->Module->GetPages();
            foreach ($pages as $modulePage) {
                $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("chURL", "<a href=\"" . System::ExpandRelativePath("~/modules/modify/" . $this->Module->ID . "/pages/" . $modulePage->ID) . "\">" . $modulePage->URL . "</a>", $modulePage->URL)));
            }
            $lv->Render();
        });
        $tc->Render();
        ?>
			<div class="Buttons" style="text-align: right;">
				<input class="Button Default" type="submit" value="Save Changes" />
				<a class="Button" href="<?php 
        echo System::ExpandRelativePath("~/modules");
        ?>
">Discard Changes</a>
			</div>
		</form>
		<?php 
    }
    protected function RenderContent()
    {
        if ($this->CurrentObject != null) {
            ?>
			<form method="POST">
			<?php 
            $tbs = new TabContainer("tbsObject");
            //								ID						title			imageurl	targeturl	script	contentfunc
            $tbs->TabPages[] = new TabPage("tabGeneralInformation", "General Information", null, null, null, function () {
                ?>
					<div class="FormView">
						<div class="Field">
							<label for="txtObjectName">Object <u>n</u>ame:</label>
							<input type="text" name="object_Name" id="txtObjectName" accesskey="n" value="<?php 
                echo $this->CurrentObject->Name;
                ?>
" />
						</div>
						<div class="Field">
							<label for="cboModuleID">Parent <u>m</u>odule:</label>
							<select id="cboModuleID" name="object_ModuleID" accesskey="m">
							</select>
						</div>
						<div class="Field">
							<label for="cboParentObjectID">Parent <u>o</u>bject:</label>
							<select id="cboParentObjectID" name="object_ParentObjectID" accesskey="o">
							</select>
						</div>
					</div>
					<?php 
            });
            $tbs->TabPages[] = new TabPage("tabStaticProperties", "Static Properties", null, null, null, function () {
                ?>
					<table class="ListView" style="width: 100%;">
						<tr id="Property_Header">
							<th style="width: 32px;"><a href="#" onclick="AddPropertyBelow('Header');" title="Add Below">[+]</a></th>
							<th style="width: 256px;">Property</th>
							<th style="width: 128px;">Data Type</th>
							<th>Default Value</th>
						</tr>
						<?php 
                $properties = $this->CurrentObject->GetProperties();
                foreach ($properties as $property) {
                    ?>
								<tr id="StaticProperty_<?php 
                    echo $property->ID;
                    ?>
">
									<td style="width: 32px;"><a href="#" onclick="AddStaticPropertyBelow('<?php 
                    echo $property->ID;
                    ?>
');" title="Add Below">[+]</a></td>
									<td><?php 
                    echo $property->Name;
                    ?>
</td>
									<td><?php 
                    echo $property->DataType == null ? "(undefined)" : "<a href=\"" . System::ExpandRelativePath("~/datatype/modify/" . $property->DataType->ID) . "\">" . $property->DataType->Name . "</a>";
                    ?>
</td>
									<td>
									<?php 
                    if ($property->DataType == null || $property->DataType->ColumnRendererCodeBlob == null) {
                        ?>
										<input style="width: 100%;" type="text" id="txtStaticProperty_<?php 
                        echo $property->ID;
                        ?>
" name="StaticProperty_<?php 
                        echo $property->ID;
                        ?>
" value="<?php 
                        echo $property->DefaultValue;
                        ?>
" />
										<?php 
                    } else {
                        call_user_func($property->DataType->ColumnRendererCodeBlob, $property->Value);
                    }
                    ?>
									</td>
								</tr>
								<?php 
                }
                ?>
					</table>
					<?php 
            });
            $tbs->TabPages[] = new TabPage("tabInstanceProperties", "Instance Properties", null, null, null, function () {
                ?>
					<script type="text/javascript">
					function AddInstancePropertyBelow(id)
					{
						var hdnNewPropertyCount = document.getElementById("hdnNewPropertyCount");
						hdnNewPropertyCount.value = parseInt(hdnNewPropertyCount.value) + 1;
						
						var parentRow = document.getElementById("InstanceProperty_" + id);
						var table = parentRow.parentElement;
						
						var tr = table.insertRow(parentRow.sectionRowIndex + 1);
						
						var tdAdd = tr.insertCell(-1);
						tdAdd.innerHTML = "<a href=\"#\" onclick=\"AddInstancePropertyBelow('');\" title=\"Add Below\">[+]</a>";
						
						var tdProperty = tr.insertCell(-1);
						tdProperty.innerHTML = "<input type=\"text\" name=\"InstanceProperty_" + hdnNewPropertyCount.value + "_Name\" />";
						
						var tdDataType = tr.insertCell(-1);
						tdDataType.innerHTML = "<input type=\"text\" name=\"InstanceProperty_" + hdnNewPropertyCount.value + "_DataTypeID\" />";
						
						var tdDefaultValue = tr.insertCell(-1);
						tdDefaultValue.innerHTML = "<input type=\"text\" name=\"InstanceProperty_" + hdnNewPropertyCount.value + "_DefaultValue\" />";
					}
					</script>
					<input type="hidden" id="hdnNewPropertyCount" name="InstanceProperty_NewPropertyCount" value="0" />
					<table class="ListView" style="width: 100%;">
						<tr id="InstanceProperty_Header">
							<th style="width: 32px;"><a href="#" onclick="AddInstancePropertyBelow('Header'); return false;" title="Add Below">[+]</a></th>
							<th style="width: 256px;">Property</th>
							<th style="width: 128px;">Data Type</th>
							<th>Default Value</th>
						</tr>
						<?php 
                $properties = $this->CurrentObject->GetInstanceProperties();
                foreach ($properties as $property) {
                    ?>
								<tr id="InstanceProperty_<?php 
                    echo $property->ID;
                    ?>
">
									<td style="width: 32px;"><a href="#" onclick="AddInstancePropertyBelow('<?php 
                    echo $property->ID;
                    ?>
'); return false;" title="Add Below">[+]</a></td>
									<td><?php 
                    echo $property->Name;
                    ?>
</td>
									<td><?php 
                    echo $property->DataType == null ? "(undefined)" : "<a href=\"" . System::ExpandRelativePath("~/datatype/modify/" . $property->DataType->ID) . "\">" . $property->DataType->Name . "</a>";
                    ?>
</td>
									<td>
									<?php 
                    $property->RenderColumn();
                    ?>
									</td>
								</tr>
								<?php 
                }
                ?>
					</table>
					<?php 
            });
            $tbs->TabPages[] = new TabPage("tabStaticMethods", "Static Methods", null, null, null, function () {
                ?>
					<table class="ListView" style="width: 100%;">
						<tr id="StaticMethod_Header">
							<th style="width: 32px;"><a href="#" onclick="AddStaticMethodBelow('Header');" title="Add Below">[+]</a></th>
							<th style="width: 256px;">Method</th>
							<th>Description</th>
							<th style="width: 128px;">Return Data Type</th>
						</tr>
						<?php 
                $methods = $this->CurrentObject->GetMethods();
                foreach ($methods as $method) {
                    ?>
								<tr id="StaticMethod_<?php 
                    echo $method->ID;
                    ?>
">
									<td style="width: 32px;"><a href="#" onclick="AddStaticMethodBelow('<?php 
                    echo $method->ID;
                    ?>
');" title="Add Below">[+]</a></td>
									<td><a href="<?php 
                    echo System::ExpandRelativePath("~/tenant/modify/" . $this->CurrentTenant->URL . "/objects/" . $this->CurrentObject->ID . "/methods/static/" . $method->ID);
                    ?>
"><?php 
                    echo $method->Name;
                    ?>
</a></td>
									<td><?php 
                    echo $method->Description;
                    ?>
</td>
									<td><?php 
                    /* echo($method->DataType == null ? "(undefined)" : "<a href=\"#\">" . $method->DataType->Name . "</a>"); */
                    ?>
</td>
								</tr>
								<?php 
                }
                ?>
					</table>
					<?php 
            });
            $tbs->TabPages[] = new TabPage("tabInstances", "Instances", null, "~/tenant/modify/" . $this->CurrentTenant->URL . "/objects/" . $this->CurrentObject->ID . "/instances", null, function () {
                $listview = new ListView("lvInstances");
                $listview->Width = "100%";
                $properties = $this->CurrentObject->GetInstanceProperties();
                foreach ($properties as $property) {
                    if ($property->ColumnVisible) {
                        $listview->Columns[] = new ListViewColumn("P" . $property->ID, $property->Name);
                    }
                }
                $instances = $this->CurrentObject->GetInstances();
                foreach ($instances as $instance) {
                    $cols = array();
                    foreach ($properties as $property) {
                        if ($property->ColumnVisible) {
                            $cols[] = new ListViewItemColumn("P" . $property->ID, "", "", function ($vals) {
                                $inst = $vals[0];
                                $prop = $vals[1];
                                $prop->RenderColumn($inst->GetPropertyValue($prop));
                            }, array($instance, $property));
                        }
                    }
                    $lvi = new ListViewItem($cols);
                    $listview->Items[] = $lvi;
                }
                $listview->Render();
            });
            $tbs->SelectedTab = $tbs->TabPages[0];
            $tbs->Render();
            ?>
			
					<div class="Buttons">
						<input type="submit" class="Button Default" value="Save Changes" />
						<a class="Button" href="<?php 
            echo System::ExpandRelativePath("~/tenant/modify/" . $this->CurrentTenant->URL);
            ?>
">Discard Changes</a>
					</div>
				</form>
				<?php 
        }
    }
    protected function RenderContent()
    {
        ?>
			<style type="text/css">
			.CodeMirror
			{
				border: dotted 1px #AAAAAA;
				line-height: 18px;
			}
			.CodeMirror .CodeMirror-linenumbers
			{
				width: 48px;
			}
			</style>
			<script type="text/javascript">
			// TODO: make this work with AJAX
			
			var CodeMirrorDefaultParameters = 
			{
				lineNumbers: true,
				matchBrackets: true,
				mode: "text/x-php",
				indentUnit: 4,
				indentWithTabs: true
			};
			
			function InitializeCodeMirror(id)
			{
				var txt = document.getElementById(id);
				if (txt.CodeMirrorInitialized) return;
				
				var edt = CodeMirror.fromTextArea(txt, CodeMirrorDefaultParameters);
				txt.CodeMirrorInitialized = true;
			}
			function tbs_OnClientTabChanged()
			{
				switch (tbs.GetSelectedTabID())
				{
					case "tabEncoder":
					{
						InitializeCodeMirror("txtEncoderCodeBlob");
						break;
					}
					case "tabDecoder":
					{
						InitializeCodeMirror("txtDecoderCodeBlob");
						break;
					}
					case "tabColumnRenderer":
					{
						InitializeCodeMirror("txtColumnRendererCodeBlob");
						break;
					}
					case "tabEditorRenderer":
					{
						InitializeCodeMirror("txtEditorRendererCodeBlob");
						break;
					}
				}
			}
			</script>
			<form method="POST">
				<?php 
        if ($this->CurrentDataType != null) {
            echo "<input type=\"hidden\" name=\"datatype_ID\" value=\"" . $this->CurrentDataType->ID . "\" />";
        }
        $tbs = new TabContainer("tbs");
        $tbs->OnClientTabChanged = "tbs_OnClientTabChanged();";
        $tbs->TabPages[] = new TabPage("tabGeneral", "General Information", null, null, null, function () {
            $fv = new FormView("fv");
            $fv->Width = "100%";
            $fv->Items[] = new FormViewItemText("txtDataTypeName", "datatype_Name", "Name", $this->CurrentDataType->Name);
            $fv->Items[0]->Required = true;
            $fv->Items[] = new FormViewItemMemo("txtDataTypeDescription", "datatype_Description", "Description", $this->CurrentDataType->Description);
            $fv->Render();
        });
        $tbs->TabPages[] = new TabPage("tabEncoder", "Encoder", null, null, null, function () {
            $ds = new Disclosure();
            $ds->Title = "Code";
            $ds->BeginContent();
            ?>
						<textarea id="txtEncoderCodeBlob" name="datatype_EncoderCodeBlob" style="width: 100%;" rows="20"><?php 
            echo $this->CurrentDataType->EncoderCodeBlob;
            ?>
</textarea>
						<?php 
            $ds->EndContent();
            /*
            $ds = new Disclosure();
            $ds->Title = "Preview";
            $ds->BeginContent();
            
            ?>
            <div class="FormView">
            	<div class="Field">
            		<label id="lblEncoderCodeBlobValue" for="txtEncoderCodeBlobValue">Value</label>
            		<input type="text" onchange="__EncoderCodeBlob_RefreshResult();" />
            	</div>
            	<div class="Field">
            		<label id="lblEncoderCodeBlobResult" for="txtEncoderCodeBlobResult">Result</label>
            		<span id="txtEncoderCodeBlobResult">&nbsp;</span>
            	</div>
            </div>
            <?php
            
            $ds->EndContent();
            */
        });
        $tbs->TabPages[] = new TabPage("tabDecoder", "Decoder", null, null, null, function () {
            $ds = new Disclosure();
            $ds->Title = "Code";
            $ds->BeginContent();
            ?>
						<textarea id="txtDecoderCodeBlob" name="datatype_DecoderCodeBlob" style="width: 100%;" rows="20"><?php 
            echo $this->CurrentDataType->DecoderCodeBlob;
            ?>
</textarea>
						<?php 
            $ds->EndContent();
        });
        $tbs->TabPages[] = new TabPage("tabColumnRenderer", "Column Renderer", null, null, null, function () {
            $ds = new Disclosure();
            $ds->Title = "Code";
            $ds->BeginContent();
            ?>
						<textarea id="txtColumnRendererCodeBlob" name="datatype_ColumnRendererCodeBlob" style="width: 100%;" rows="20"><?php 
            echo $this->CurrentDataType->ColumnRendererCodeBlob;
            ?>
</textarea>
						<?php 
            $ds->EndContent();
            $ds = new Disclosure();
            $ds->Title = "Preview";
            $ds->BeginContent();
            $ds->EndContent();
        });
        $tbs->TabPages[] = new TabPage("tabEditorRenderer", "Editor Renderer", null, null, null, function () {
            $ds = new Disclosure();
            $ds->Title = "Code";
            $ds->BeginContent();
            ?>
						<textarea id="txtEditorRendererCodeBlob" name="datatype_EditorRendererCodeBlob" style="width: 100%;" rows="20"><?php 
            echo $this->CurrentDataType->EditorRendererCodeBlob;
            ?>
</textarea>
						<?php 
            $ds->EndContent();
            $ds = new Disclosure();
            $ds->Title = "Preview";
            $ds->BeginContent();
            $ds->EndContent();
        });
        $tbs->SelectedTab = $tbs->TabPages[0];
        $tbs->Render();
        ?>
				<div class="Buttons">
					<input class="Button Default" type="submit" value="Save Changes" />
					<a class="Button" href="<?php 
        echo System::ExpandRelativePath("~/data-types");
        ?>
">Cancel</a>
				</div>
			</form>
			<?php 
    }
    protected function RenderContent()
    {
        ?>
			<form method="POST" id="frmMain">
			<?php 
        $tbs = new TabContainer("tbs");
        $tbs->TabPages[] = new TabPage("tabInformation", "Information", null, null, null, function () {
            ?>
				<div class="FormView">
					<div class="Field">
						<label for="txtLoginID">Login ID</label>
						<input id="txtLoginID" name="user_LoginID" type="text" value="<?php 
            echo $this->CurrentObject->UserName;
            ?>
" />
						<span class="HelpText">The name used to log this user into the system</span>
					</div>
					<div class="Field">
						<label for="txtDisplayName">Display name</label>
						<input id="txtDisplayName" name="user_DisplayName" type="text" value="<?php 
            echo $this->CurrentObject->DisplayName;
            ?>
" />
						<span class="HelpText">The friendly name for this user</span>
					</div>
					<div class="Field">
						<label for="chkAccountLocked">Lock account</label>
						<input id="chkAccountLocked" name="user_AccountLocked" type="checkbox"<?php 
            echo $this->CurrentObject->AccountLocked ? " checked=\"checked\"" : "";
            ?>
 />
						<span class="HelpText">Check if this user should be prohibited from logging in</span>
					</div>
					<div class="Field">
						<label for="chkForcePasswordChange">Require password reset on next logon</label>
						<input id="chkForcePasswordChange" name="user_ForcePasswordChange" type="checkbox"<?php 
            echo $this->CurrentObject->ForcePasswordChange ? " checked=\"checked\"" : "";
            ?>
 />
						<span class="HelpText">Check if this user must change their password the next time they log in</span>
					</div>
				</div>
				<?php 
        });
        $tbs->TabPages[] = new TabPage("tabPrivileges", "Privileges", null, null, null, function () {
            $lv = new ListView();
            $lv->EnableRowCheckBoxes = true;
            $lv->Columns = array(new ListViewColumn("lvcPrivilege", "Privilege"));
            $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcPrivilege", "Administrator")));
            $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcPrivilege", "Moderator")));
            $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcPrivilege", "User")));
            $lv->Render();
        });
        $tbs->SelectedTab = $tbs->TabPages[0];
        $tbs->Render();
        ?>
				<div class="Buttons">
					<input class="Button Default" type="submit" value="Save Changes" />
					<a class="Button" href="<?php 
        echo System::ExpandRelativePath("~/users");
        ?>
">Discard Changes</a>
				</div>
			</form>
			<?php 
    }
    protected function RenderContent()
    {
        ?>
			<form method="POST" onsubmit="return form_OnSubmit();">
				<?php 
        $tbs = new TabContainer("tbsTabs");
        $tbs->TabPages[] = new TabPage("tabGeneralInformation", "General Information", null, null, null, function () {
            $fv = new FormView();
            $fv->Items[] = new FormViewItemText("txtTenantURL", "tenant_URL", "Name", $this->Tenant->URL);
            $fvTenantTypes = array();
            $tenanttypes = TenantType::Get();
            foreach ($tenanttypes as $tenanttype) {
                $fvTenantType = new FormViewItemChoiceValue($tenanttype->Title, $tenanttype->ID);
                $fvTenantType->Selected = $this->Tenant != null && $this->Tenant->Type != null && $tenanttype->ID == $this->Tenant->Type->ID;
                $fvTenantTypes[] = $fvTenantType;
            }
            $fv->Items[] = new FormViewItemChoice("cboTenantType", "tenant_TypeID", "Type", null, $fvTenantTypes);
            $fv->Items[] = new FormViewItemBoolean("chkStatus", "tenant_Status", "Status", $this->Tenant->Status == TenantStatus::Enabled);
            $fvDataCenters = array();
            $datacenters = DataCenter::Get();
            foreach ($datacenters as $datacenter) {
                $fvDataCenter = new FormViewItemChoiceValue($datacenter->Title, $datacenter->ID);
                $fvDataCenter->Selected = $this->Tenant != null && $this->Tenant->DataCenters->Contains($datacenter);
                $fvDataCenters[] = $fvDataCenter;
            }
            $fv->Items[] = new FormViewItemChoice("cboDataCenter", "tenant_DataCenterIDs", "Data centers", null, $fvDataCenters, true);
            $fvPaymentPlans = array();
            $paymentplans = PaymentPlan::Get();
            foreach ($paymentplans as $paymentplan) {
                $fvPaymentPlan = new FormViewItemChoiceValue($paymentplan->Title, $paymentplan->ID);
                $fvPaymentPlan->Selected = $this->Tenant != null && $this->Tenant->PaymentPlan != null && $paymentplan->ID == $this->Tenant->PaymentPlan->ID;
                $fvPaymentPlans[] = $fvPaymentPlan;
            }
            $fv->Items[] = new FormViewItemChoice("cboPaymentPlan", "tenant_PaymentPlanID", "Payment plan", null, $fvPaymentPlans);
            $fv->Items[] = new FormViewItemDateTime("txtActivationDate", "tenant_BeginTimestamp", "Activation date", $this->Tenant != null ? $this->Tenant->BeginTimestamp : null, true);
            $fv->Items[] = new FormViewItemDateTime("txtTerminationDate", "tenant_EndTimestamp", "Termination date", $this->Tenant != null ? $this->Tenant->EndTimestamp : null, true);
            $fv->Items[] = new FormViewItemMemo("txtDescription", "tenant_Description", "Description", $this->Tenant->Description);
            $fv->Render();
        });
        $path = System::GetVirtualPath();
        if ($path[1] != "clone") {
            $tbs->TabPages[] = new TabPage("tabCustomProperties", "Custom Properties", null, null, null, function () {
                $lv = new ListView();
                $lv->Width = "100%";
                $lv->EnableAddRemoveRows = true;
                $lv->Columns = array(new ListViewColumn("lvcProperty", "Property"), new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcValue", "Value"));
                $properties = $this->Tenant->GetProperties();
                foreach ($properties as $property) {
                    $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcProperty", $property->Name), new ListViewItemColumn("lvcDescription", $property->Description), new ListViewItemColumn("lvcValue", null, null, function ($property) {
                        $property->DataType->RenderEditor($this->Tenant->GetPropertyValue($property), "Property_" . $property->ID);
                    }, $property)));
                }
                $lv->Render();
            });
            $tbs->TabPages[] = new TabPage("tabEnabledModules", "Enabled Modules", null, null, null, function () {
                $lv = new ListView();
                $lv->Width = "100%";
                $lv->EnableRowCheckBoxes = true;
                $lv->Columns = array(new ListViewColumn("lvcModule", "Module"), new ListViewColumn("lvcDescription", "Description"));
                $modules = Module::Get(null);
                foreach ($modules as $module) {
                    $item = new ListViewItem(array(new ListViewItemColumn("lvcModule", "<a href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $this->Tenant->URL . "/modules/" . $module->ID . "\">" . $module->Title . "</a>", $module->Title)), new ListViewItemColumn("lvcDescription", $module->Description)));
                    $item->Checked = $this->Tenant->HasModule($module);
                    $lv->Items[] = $item;
                }
                $lv->Render();
            });
            $tbs->TabPages[] = new TabPage("tabGlobalObjects", "Global Objects", null, null, null, function () {
                $lv = new ListView();
                $lv->Width = "100%";
                $lv->EnableAddRemoveRows = true;
                $lv->Columns = array(new ListViewColumn("lvcObject", "Object"), new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcInstances", "Instances"));
                $objects = TenantObject::Get(null, $this->Tenant);
                foreach ($objects as $object) {
                    $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcObject", $object->Name), new ListViewItemColumn("lvcDescription", $object->Description), new ListViewItemColumn("lvcInstances", "<a href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $this->Tenant->URL . "/objects/" . $object->ID . "/instances") . "\">" . $object->CountInstances() . "</a>")));
                }
                $lv->Render();
            });
        }
        $tbs->SelectedTab = $tbs->TabPages[0];
        $tbs->Render();
        ?>
				<div class="Buttons">
					<input class="Button Default" type="submit" value="Save Changes" />
					<a class="Button" onclick="return nav('/tenant');" href="<?php 
        echo System::ExpandRelativePath("~/tenant");
        ?>
">Cancel</a>
				</div>
			</form>
			<script type="text/javascript">
			var TenantManagementPageMode =
			{
				"Create": 1,
				"Modify": 2
			}
			<?php 
        if ($this->Mode == TenantManagementPageMode::Create) {
            echo "var Mode = TenantManagementPageMode.Create;";
        } else {
            if ($this->Mode == TenantManagementPageMode::Modify) {
                echo "var Mode = TenantManagementPageMode.Modify;";
            }
        }
        ?>
			function form_OnSubmit()
			{
				if (Mode == TenantManagementPageMode.Create)
				{
					var xhr = new XMLHttpRequest();
					var tenantName = document.getElementById('txtTenantURL').value;
					
					xhr.open("GET", "/API/Tenant.php?action=exists&q=" + tenantName, false);
					xhr.send(null);
					
					var obj = JSON.parse(xhr.responseText);
					if (obj.result == "success" && obj.exists)
					{
						Notification.Show("Tenant '" + tenantName + "' already exists", "Please specify a unique tenant name", "Error");
						return false;
					}
				}
				
				Notification.Show("Changes were saved successfully", "Taking you back to the Tenant Management page", "Success");
				return true;
			}
			</script>
			<?php 
    }