コード例 #1
0
    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 
    }
コード例 #2
0
    protected function RenderContent()
    {
        $tenants = Tenant::Get();
        ?>
		<p>There are <?php 
        echo count($tenants);
        ?>
 tenants in total.</p>
		<?php 
        $countActive = 0;
        $countExpired = 0;
        foreach ($tenants as $tenant) {
            if ($tenant->IsExpired()) {
                $countExpired++;
            } else {
                $countActive++;
            }
        }
        $disclosure = new Disclosure();
        $disclosure->Title = "Active Tenants (" . $countActive . ")";
        $disclosure->Expanded = true;
        $disclosure->BeginContent();
        /*
        $lv = new ListView("lvInactive");
        $lv->Columns = array
        (
        	new ListViewColumn("chTenantName", "Tenant Name"),
        	new ListViewColumn("chTenantType", "Tenant Type"),
        	new ListViewColumn("chDataCenters", "Data Centers"),
        	new ListViewColumn("chPaymentPlan", "Payment Plan"),
        	new ListViewColumn("chActivationDate", "Activation Date"),
        	new ListViewColumn("chTerminationDate", "Termination Date"),
        	new ListViewColumn("chDescription", "Description"),
        	new ListViewColumn("chActions", "Actions")
        );
        */
        $lv = new ListView();
        $lv->EnableRowCheckBoxes = true;
        $lv->Width = "100%";
        $lv->Columns = array(new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcTenantType", "Type"), new ListViewColumn("lvcPaymentPlan", "Payment Plan"), new ListViewColumn("lvcDataCenters", "Data Centers"), new ListViewColumn("lvcStartDate", "Start Date"), new ListViewColumn("lvcEndDate", "End Date"));
        foreach ($tenants as $tenant) {
            if ($tenant->IsExpired()) {
                continue;
            }
            $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcDescription", "<div class=\"Title\">" . $tenant->URL . "</div><div class=\"Content\">" . $tenant->Description . "</div>" . "<div class=\"Footer\" style=\"padding: 8px;\">" . "<a class=\"Button Default\" href=\"" . System::ExpandRelativePath("~/tenant/launch/" . $tenant->URL) . "\" target=\"_blank\">Launch</a>" . "<span class=\"Separator\" />" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL) . "\">Modify</a>" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/clone/" . $tenant->URL) . "\">Clone</a>" . "<a class=\"Button\" href=\"" . System::ExpandRelativePath("~/tenant/delete/" . $tenant->URL) . "\">Delete</a>" . "</div>", $tenant->Description . " " . $tenant->URL), new ListViewItemColumn("lvcTenantType", $tenant->Type->Title), new ListViewItemColumn("lvcPaymentPlan", $tenant->PaymentPlan->Title), new ListViewItemColumn("lvcDataCenters", null), new ListViewItemColumn("lvcStartDate", $tenant->BeginTimestamp == null ? "(none)" : $tenant->BeginTimestamp), new ListViewItemColumn("lvcEndDate", $tenant->EndTimestamp == null ? "(none)" : $tenant->EndTimestamp)));
            /*
            ?>
            	<div class="Footer">
            		<a class="Button Default" href="<?php echo(System::ExpandRelativePath("~/tenant/launch/" . $tenant->URL)); ?>" target="_blank">Launch</a>
            		<span class="Separator" />
            		<a class="Button" onclick="return nav('/tenant/modify/<?php echo($tenant->URL); ?>');" href="<?php echo(System::ExpandRelativePath("~/tenant/modify/" . $tenant->URL)); ?>">Modify</a>
            		<a class="Button" href="<?php echo(System::ExpandRelativePath("~/tenant/clone/" . $tenant->URL)); ?>">Clone</a>
            		<a class="Button" href="<?php echo(System::ExpandRelativePath("~/tenant/delete/" . $tenant->URL)); ?>">Delete</a>
            	</div>
            </div>
            <?php
            */
        }
        $lv->Render();
        $disclosure->EndContent();
        $disclosure = new Disclosure();
        $disclosure->Title = "Inactive Tenants (" . $countExpired . ")";
        $disclosure->Expanded = true;
        $disclosure->BeginContent();
        $lv = new ListView();
        $lv->EnableRowCheckBoxes = true;
        $lv->Width = "100%";
        $lv->Columns = array(new ListViewColumn("lvcDescription", "Description"), new ListViewColumn("lvcTenantType", "Type"), new ListViewColumn("lvcPaymentPlan", "Payment Plan"), new ListViewColumn("lvcDataCenters", "Data Centers"), new ListViewColumn("lvcStartDate", "Start Date"), new ListViewColumn("lvcEndDate", "End Date"));
        foreach ($tenants as $tenant) {
            if (!$tenant->IsExpired()) {
                continue;
            }
            $lv->Items[] = new ListViewItem(array(new ListViewItemColumn("lvcDescription", "<div class=\"Title\">" . $tenant->URL . "</div><div class=\"Content\">" . $tenant->Description . "</div>", $tenant->Description . " " . $tenant->URL), new ListViewItemColumn("lvcTenantType", $tenant->Type->Title), new ListViewItemColumn("lvcPaymentPlan", $tenant->PaymentPlan->Title), new ListViewItemColumn("lvcDataCenters", null), new ListViewItemColumn("lvcStartDate", $tenant->BeginTimestamp == null ? "(none)" : $tenant->BeginTimestamp), new ListViewItemColumn("lvcEndDate", $tenant->EndTimestamp == null ? "(none)" : $tenant->EndTimestamp)));
        }
        $lv->Render();
        $disclosure->EndContent();
    }