A Qcodo based CMS/ecommerce framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
5.4 KiB

13 years ago
  1. <?php
  2. /**
  3. * This is a quick-and-dirty draft QPanel object to do Create, Edit, and Delete functionality
  4. * of the Page class. It uses the code-generated
  5. * PageMetaControl class, which has meta-methods to help with
  6. * easily creating/defining controls to modify the fields of a Page columns.
  7. *
  8. * Any display customizations and presentation-tier logic can be implemented
  9. * here by overriding existing or implementing new methods, properties and variables.
  10. *
  11. * NOTE: This file is overwritten on any code regenerations. If you want to make
  12. * permanent changes, it is STRONGLY RECOMMENDED to move both page_edit.php AND
  13. * page_edit.tpl.php out of this Form Drafts directory.
  14. *
  15. * @package Quasi
  16. * @subpackage Drafts
  17. */
  18. class PageEditPanel extends QPanel {
  19. // Local instance of the PageMetaControl
  20. protected $mctPage;
  21. // Controls for Page's Data Fields
  22. public $lblId;
  23. public $lblCreationDate;
  24. public $lblLastModification;
  25. public $txtName;
  26. public $txtTitle;
  27. public $txtUri;
  28. public $chkHasHeader;
  29. public $chkHasLeftColumn;
  30. public $chkHasRightColumn;
  31. public $chkHasFooter;
  32. public $lstPublicPermissions;
  33. public $lstUserPermissions;
  34. public $lstGroupPermissions;
  35. public $lstType;
  36. public $lstDocType;
  37. public $lstStatus;
  38. // Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References
  39. public $lstContentBlocks;
  40. public $lstContentCategories;
  41. public $lstHtmlMetaTags;
  42. public $lstJavaScripts;
  43. public $lstStyleSheets;
  44. public $lstUsergroups;
  45. // Other Controls
  46. public $btnSave;
  47. public $btnDelete;
  48. public $btnCancel;
  49. // Callback
  50. protected $strClosePanelMethod;
  51. public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
  52. // Call the Parent
  53. try {
  54. parent::__construct($objParentObject, $strControlId);
  55. } catch (QCallerException $objExc) {
  56. $objExc->IncrementOffset();
  57. throw $objExc;
  58. }
  59. // Setup Callback and Template
  60. $this->strTemplate = 'PageEditPanel.tpl.php';
  61. $this->strClosePanelMethod = $strClosePanelMethod;
  62. // Construct the PageMetaControl
  63. // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
  64. $this->mctPage = PageMetaControl::Create($this, $intId);
  65. // Call MetaControl's methods to create qcontrols based on Page's data fields
  66. $this->lblId = $this->mctPage->lblId_Create();
  67. $this->lblCreationDate = $this->mctPage->lblCreationDate_Create();
  68. $this->lblLastModification = $this->mctPage->lblLastModification_Create();
  69. $this->txtName = $this->mctPage->txtName_Create();
  70. $this->txtTitle = $this->mctPage->txtTitle_Create();
  71. $this->txtUri = $this->mctPage->txtUri_Create();
  72. $this->chkHasHeader = $this->mctPage->chkHasHeader_Create();
  73. $this->chkHasLeftColumn = $this->mctPage->chkHasLeftColumn_Create();
  74. $this->chkHasRightColumn = $this->mctPage->chkHasRightColumn_Create();
  75. $this->chkHasFooter = $this->mctPage->chkHasFooter_Create();
  76. $this->lstPublicPermissions = $this->mctPage->lstPublicPermissions_Create();
  77. $this->lstUserPermissions = $this->mctPage->lstUserPermissions_Create();
  78. $this->lstGroupPermissions = $this->mctPage->lstGroupPermissions_Create();
  79. $this->lstType = $this->mctPage->lstType_Create();
  80. $this->lstDocType = $this->mctPage->lstDocType_Create();
  81. $this->lstStatus = $this->mctPage->lstStatus_Create();
  82. $this->lstContentBlocks = $this->mctPage->lstContentBlocks_Create();
  83. $this->lstContentCategories = $this->mctPage->lstContentCategories_Create();
  84. $this->lstHtmlMetaTags = $this->mctPage->lstHtmlMetaTags_Create();
  85. $this->lstJavaScripts = $this->mctPage->lstJavaScripts_Create();
  86. $this->lstStyleSheets = $this->mctPage->lstStyleSheets_Create();
  87. $this->lstUsergroups = $this->mctPage->lstUsergroups_Create();
  88. // Create Buttons and Actions on this Form
  89. $this->btnSave = new QButton($this);
  90. $this->btnSave->Text = QApplication::Translate('Save');
  91. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  92. $this->btnSave->CausesValidation = $this;
  93. $this->btnCancel = new QButton($this);
  94. $this->btnCancel->Text = QApplication::Translate('Cancel');
  95. $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
  96. $this->btnDelete = new QButton($this);
  97. $this->btnDelete->Text = QApplication::Translate('Delete');
  98. $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('Page') . '?'));
  99. $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
  100. $this->btnDelete->Visible = $this->mctPage->EditMode;
  101. }
  102. // Control AjaxAction Event Handlers
  103. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  104. // Delegate "Save" processing to the PageMetaControl
  105. $this->mctPage->SavePage();
  106. $this->CloseSelf(true);
  107. }
  108. public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
  109. // Delegate "Delete" processing to the PageMetaControl
  110. $this->mctPage->DeletePage();
  111. $this->CloseSelf(true);
  112. }
  113. public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
  114. $this->CloseSelf(false);
  115. }
  116. // Close Myself and Call ClosePanelMethod Callback
  117. protected function CloseSelf($blnChangesMade) {
  118. $strMethod = $this->strClosePanelMethod;
  119. $this->objForm->$strMethod($blnChangesMade);
  120. }
  121. }
  122. ?>