Exemple #1
0
 protected function Form_Create()
 {
     parent::Form_Create();
     // "New" is a special keyword
     if (($strToken = trim(strtolower(QApplication::PathInfo(0)))) == 'new') {
         $strToken = null;
     }
     $objPackage = Package::LoadByToken($strToken);
     if (!$objPackage) {
         $objPackage = new Package();
         $this->blnEditMode = false;
         $this->strPageTitle .= 'Create New';
         $this->strHeadline = 'Create a New QPM Package';
     } else {
         if (!$objPackage->IsEditableForPerson(QApplication::$Person)) {
             QApplication::RedirectToLogin();
         }
         $this->blnEditMode = true;
         $this->strPageTitle .= 'Edit Package ' . $objPackage->Token;
         $this->strHeadline = 'Edit Package ' . $objPackage->Token;
     }
     $this->mctPackage = new PackageMetaControl($this, $objPackage);
     $this->txtToken = $this->mctPackage->txtToken_Create();
     $this->txtToken->Required = true;
     $this->lstCategory = $this->mctPackage->lstPackageCategory_Create();
     $this->lstCategory->Required = true;
     // Remove "Issue"
     for ($intIndex = 0; $intIndex < $this->lstCategory->ItemCount; $intIndex++) {
         $objListItem = $this->lstCategory->GetItem($intIndex);
         $objCategory = PackageCategory::Load($objListItem->Value);
         if ($objCategory && $objCategory->Token == 'issues') {
             $this->lstCategory->RemoveItem($intIndex);
             break;
         }
     }
     $this->txtName = $this->mctPackage->txtName_Create();
     $this->txtName->Required = true;
     $this->txtDescription = $this->mctPackage->txtDescription_Create();
     $this->txtDescription->Required = true;
     $this->btnOkay = new QButton($this);
     $this->btnOkay->CausesValidation = true;
     $this->btnOkay->Text = $this->blnEditMode ? 'Update Package' : 'Save New Package';
     $this->btnCancel = new QLinkButton($this);
     $this->btnCancel->Text = 'Cancel';
     $this->btnOkay->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnOkay));
     $this->btnOkay->AddAction(new QClickEvent(), new QAjaxAction('btnOkay_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
     if (!$this->blnEditMode) {
         $this->txtToken->Focus();
     } else {
         $this->txtName->Focus();
     }
 }
Exemple #2
0
 protected function Form_Create()
 {
     parent::Form_Create();
     // Get the Wiki Item and confirm that it exists and that he is authorized to admin
     $this->strSanitizedPath = WikiItem::SanitizeForPath(QApplication::$PathInfo, $this->intWikiItemTypeId);
     $this->objWikiItem = WikiItem::LoadByPathWikiItemTypeId($this->strSanitizedPath, $this->intWikiItemTypeId);
     if (!$this->objWikiItem) {
         QApplication::Redirect('/');
     }
     if (!$this->objWikiItem->IsAdminableForPerson(QApplication::$Person)) {
         QApplication::RedirectToLogin();
     }
     $this->strPageTitle .= $this->objWikiItem->CurrentName;
     $this->lstEditorMinimum = new QListBox($this);
     foreach (PersonType::$NameArray as $intTypeId => $strName) {
         $this->lstEditorMinimum->AddItem($strName, $intTypeId, $intTypeId == $this->objWikiItem->EditorMinimumPersonTypeId);
     }
     $this->lstNavItem = new QListBox($this);
     $this->lstNavItem->AddItem('- Default -', null);
     foreach (QApplication::$NavBarArray as $intIndex => $arrItems) {
         $this->lstNavItem->AddItem($arrItems[0], $intIndex, !is_null($this->objWikiItem->OverrideNavbarIndex) && $this->objWikiItem->OverrideNavbarIndex == $intIndex);
     }
     if (is_null($this->lstNavItem->SelectedValue)) {
         $this->lstNavItem->SelectedIndex = 0;
     }
     $this->lstNavItem->AddAction(new QChangeEvent(), new QAjaxAction('lstNavItem_Change'));
     $this->lstSubNavItem = new QListBox($this);
     $this->lstNavItem_Change(null, null, null);
     $this->btnOkay = new QButton($this);
     $this->btnOkay->CausesValidation = true;
     $this->btnOkay->Text = 'Update';
     $this->btnCancel = new QLinkButton($this);
     $this->btnCancel->Text = 'Cancel';
     $this->btnOkay->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnOkay));
     $this->btnOkay->AddAction(new QClickEvent(), new QAjaxAction('btnOkay_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
 }
Exemple #3
0
 protected function btnNew_Click($strFormId, $strControlId, $strParameter)
 {
     if (!QApplication::$Person) {
         QApplication::RedirectToLogin();
     }
     $this->txtName->Text = null;
     $this->txtDescription->Text = null;
     $this->txtUrl->Text = null;
     $this->dlgBox->Template = dirname(__FILE__) . '/dlgBox_ShowcaseNew.tpl.php';
     $this->dlgBox->ShowDialogBox();
 }
Exemple #4
0
 protected function btnVotes_Click()
 {
     if (!QApplication::$Person) {
         QApplication::RedirectToLogin();
     } else {
         if ($this->objIssue->IsPersonVoted(QApplication::$Person)) {
             $this->objIssue->ClearVote(QApplication::$Person);
             $this->pnlVotes->Refresh();
         } else {
             if ($this->objIssue->PostedByPersonId == QApplication::$Person->Id) {
                 QApplication::DisplayAlert('Sorry!  You cannot vote on bugs and issues you posted yourself.');
             } else {
                 $this->objIssue->SetVote(QApplication::$Person);
                 $this->pnlVotes->Refresh();
             }
         }
     }
 }
Exemple #5
0
 protected function Form_Create()
 {
     parent::Form_Create();
     $objIssue = Issue::Load(QApplication::PathInfo(0));
     if (!$objIssue) {
         $objIssue = new Issue();
         $objIssue->IssuePriorityTypeId = IssuePriorityType::Standard;
         $objIssue->IssueStatusTypeId = IssueStatusType::NewIssue;
         $objIssue->PostedByPerson = QApplication::$Person;
         $this->blnEditMode = false;
         $this->strPageTitle .= 'Create New';
         $this->strHeadline = 'Report a New Bug or Issue';
     } else {
         if (!$objIssue->IsEditableForPerson(QApplication::$Person)) {
             QApplication::RedirectToLogin();
         }
         $this->blnEditMode = true;
         $this->strPageTitle .= 'Edit Issue #' . $objIssue->Id;
         $this->strHeadline = 'Edit Issue #' . $objIssue->Id;
     }
     $this->mctIssue = new IssueMetaControl($this, $objIssue);
     $this->txtTitle = $this->mctIssue->txtTitle_Create();
     $this->txtTitle->Required = true;
     $this->txtExampleCode = $this->mctIssue->txtExampleCode_Create();
     $this->txtExampleTemplate = $this->mctIssue->txtExampleTemplate_Create();
     $this->txtExampleData = $this->mctIssue->txtExampleData_Create();
     $this->txtExpectedOutput = $this->mctIssue->txtExpectedOutput_Create();
     $this->txtActualOutput = $this->mctIssue->txtActualOutput_Create();
     $this->lstPriority = $this->mctIssue->lstIssuePriorityType_Create();
     $this->lstStatus = $this->mctIssue->lstIssueStatusType_Create();
     $this->lstResolution = $this->mctIssue->lstIssueResolutionType_Create();
     $this->txtAssignedTo = new QTextBox($this);
     $this->txtAssignedTo->ReadOnly = true;
     $this->txtDueDate = new QDateTimeTextBox($this);
     $this->calDueDate = new QCalendar($this->txtDueDate, $this->txtDueDate);
     $this->txtDueDate->Text = $this->mctIssue->Issue->DueDate ? $this->mctIssue->Issue->DueDate->__toString() : null;
     $this->dlgAssignedTo = new PersonSelectorDialog($this, 'dlgAssignedTo_Select');
     $this->txtAssignedTo->AddAction(new QClickEvent(), new QShowDialogBox($this->dlgAssignedTo));
     $this->txtAssignedTo->AddAction(new QClickEvent(), new QFocusControlAction($this->dlgAssignedTo->txtMemberSearch));
     $this->lstStatus->AddAction(new QChangeEvent(), new QAjaxAction('RefreshStatuses'));
     foreach (IssueField::LoadArrayByActiveFlag(true, QQ::OrderBy(QQN::IssueField()->OrderNumber)) as $objIssueField) {
         $this->lstField_Setup($objIssueField);
     }
     $this->txtLongDescription = new QTextBox($this);
     $this->txtLongDescription->Visible = !$this->blnEditMode;
     $this->txtLongDescription->Required = !$this->blnEditMode;
     $this->txtLongDescription->TextMode = QTextMode::MultiLine;
     $this->btnOkay = new QButton($this);
     $this->btnOkay->CausesValidation = true;
     $this->btnOkay->Text = $this->blnEditMode ? 'Update Issue' : 'Save New Issue';
     $this->btnCancel = new QLinkButton($this);
     $this->btnCancel->Text = 'Cancel';
     $this->btnOkay->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnOkay));
     $this->btnOkay->AddAction(new QClickEvent(), new QAjaxAction('btnOkay_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
     if ($objIssue->IsAdminableForPerson(QApplication::$Person)) {
         $this->RefreshStatuses();
     } else {
         $this->txtAssignedTo->Visible = false;
         $this->txtDueDate->Visible = false;
         $this->lstStatus->Visible = false;
         $this->lstResolution->Visible = false;
     }
     $this->txtTitle->Focus();
 }
 /**
  * This shouuld be called on the top of any page that requires authentication.
  * This checks to make sure a person is actually logged in on order to view the page.
  * This will redirect to the login page if the user is NOT logged in.
  * @return void
  */
 public static function Authenticate()
 {
     if (!QApplication::$Person) {
         QApplication::RedirectToLogin();
     }
 }
 public function btnNotify_Click()
 {
     if (!QApplication::$Person) {
         QApplication::RedirectToLogin();
     } else {
         if ($this->objTopic) {
             if ($this->objTopic->IsNotifying()) {
                 $this->objTopic->UnassociatePersonAsEmail(QApplication::$Person);
             } else {
                 $this->objTopic->AssociatePersonAsEmail(QApplication::$Person);
             }
             $this->UpdateNotifyButtons();
             foreach ($this->objControlsToRefreshOnUpdateArray as $strControlId => $objControl) {
                 $objControl->Refresh();
             }
         }
     }
 }
Exemple #8
0
 protected function btnEdit_Click()
 {
     if (!QApplication::$Person) {
         QApplication::RedirectToLogin();
     }
     if (!$this->objWikiItem->IsEditableForPerson(QApplication::$Person)) {
         QApplication::DisplayAlert('Unfortunately, your role of "' . QApplication::$Person->Type . '" is not authorized to edit this wiki item.');
         return;
     }
     if (!$this->IsViewingCurrent() || $this->pnlVersions->Visible) {
         $strVersion = '?' . $this->objWikiVersion->VersionNumber;
     } else {
         $strVersion = null;
     }
     QApplication::Redirect('/wiki/edit.php' . $this->objWikiItem->FullPath);
 }