pnlTitle = new QPanel($this); $this->pnlTitle->Text = 'AJAX Dashboard'; $this->pnlList = new QPanel($this, 'pnlList'); $this->pnlList->AutoRenderChildren = true; $this->pnlEdit = new QPanel($this, 'pnlEdit'); $this->pnlEdit->AutoRenderChildren = true; $this->pnlEdit->Visible = false; $this->pnlClassNames = new QPanel($this, "classNames"); $this->pnlClassNames->AutoRenderChildren = true; $this->pnlClassNames->Visible = true; // Use the strClassNameArray as magically determined above to aggregate the listbox of classes // Obviously, this should be modified if you want to make a custom dashboard global $strClassNameArray; foreach ($strClassNameArray as $strClassName) { $strMenuLabel = substr( $strClassName, 0 , strpos( $strClassName, "ListPanel" ) ); $pnlClassName = new QPanel($this->pnlClassNames); $pnlClassName->Text = $strMenuLabel; $pnlClassName->CssClass = 'className'; $pnlClassName->ActionParameter = $strClassName; $pnlClassName->AddAction(New QClickEvent(), new QAjaxAction('pnlClassNames_Change')); } $this->objDefaultWaitIcon = new QWaitIcon($this); } /** * This Form_Validate event handler allows you to specify any custom Form Validation rules. * It will also Blink() on all invalid controls, as well as Focus() on the top-most invalid control. */ protected function Form_Validate() { // By default, we report that Custom Validations passed $blnToReturn = true; // Custom Validation Rules // TODO: Be sure to set $blnToReturn to false if any custom validation fails! $blnFocused = false; foreach ($this->GetErrorControls() as $objControl) { // Set Focus to the top-most invalid control if (!$blnFocused) { $objControl->Focus(); $blnFocused = true; } // Blink on ALL invalid controls $objControl->Blink(); } return $blnToReturn; } protected function pnlClassNames_Change($strFormId, $strControlId, $strParameter) { // Get rid of all child controls for list and edit panels $this->pnlList->RemoveChildControls(true); $this->pnlEdit->RemoveChildControls(true); $this->pnlEdit->Visible = false; $this->pnlList->Visible = true; if ($strClassName = $strParameter) { // We've selected a Class Name $objNewPanel = new $strClassName($this->pnlList, 'SetEditPane', 'CloseEditPane'); $this->pnlTitle->Text = $strMenuLabel = substr( $strParameter, 0 , strpos( $strParameter, "ListPanel" ) ); $this->pnlTitle->Text .= ' List'; } else { $this->pnlTitle->Text = 'AJAX Dashboard'; } } public function SetListPane(QPanel $objPanel) { $this->pnlEdit->RemoveChildControls(true); $this->pnlEdit->Visible = false; $this->pnlList->RemoveChildControls(true); $objPanel->SetParentControl($this->pnlList); $this->pnlList->Visible = true; } public function CloseEditPane($blnUpdatesMade) { // Close the Edit Pane $this->pnlEdit->RemoveChildControls(true); $this->pnlEdit->Visible = false; // If updates were made, let's "brute force" the updates to the screen by just refreshing the list pane altogether if ($blnUpdatesMade) $this->pnlList->Refresh(); $this->pnlList->Visible = true; } public function SetEditPane(QPanel $objPanel = null) { $this->pnlList->Visible = false; $this->pnlEdit->RemoveChildControls(true); if ($objPanel) { $objPanel->SetParentControl($this->pnlEdit); $this->pnlEdit->Visible = true; } else { $this->pnlEdit->Visible = false; } } } Dashboard::Run('Dashboard'); ?>